void Player::SendInitialSpells() { uint16 spellCount = 0; PlayerSpellMap::const_iterator itr; for (itr = m_spells.begin(); itr != m_spells.end(); ++itr) { if(itr->second->state == PLAYERSPELL_REMOVED) continue; if(itr->second->active) spellCount +=1; } WorldPacket data(SMSG_INITIAL_SPELLS, (1+2+2+4*m_spells.size())); data << uint8(0); data << uint16(spellCount); for (itr = m_spells.begin(); itr != m_spells.end(); ++itr) { if(itr->second->state == PLAYERSPELL_REMOVED) continue; if(!itr->second->active) continue; data << uint16(itr->first); //data << uint16(itr->second->slotId); data << uint16(0); // it's not slot id } uint16 spellCooldowns = m_spellCooldowns.size(); data << spellCooldowns; for(SpellCooldowns::const_iterator itr=m_spellCooldowns.begin(); itr!=m_spellCooldowns.end(); itr++) { SpellEntry const *sEntry = sSpellStore.LookupEntry(itr->first); if(!sEntry) continue; data << uint16(itr->first); time_t cooldown = 0; time_t curTime = time(NULL); if(itr->second.end > curTime) cooldown = (itr->second.end-curTime)*1000; data << uint16(itr->second.itemid); // cast item id data << uint16(sEntry->Category); // spell category if(sEntry->Category) // may be wrong, but anyway better than nothing... { data << uint32(0); data << uint32(cooldown); } else { data << uint32(cooldown); data << uint32(0); } } GetSession()->SendPacket(&data); sLog.outDetail( "CHARACTER: Sent Initial Spells" ); }