Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. void Player::SendSpellHistory()
  2. {
  3. uint64 curTime = 0;
  4. ACE_OS::gettimeofday().msec(curTime);
  5. uint64 infTime = curTime + infinityCooldownDelayCheck;
  6.  
  7. WorldPacket data(SMSG_SEND_SPELL_HISTORY, (1 + 2 + 4 * m_spells.size() + 2 + m_spellCooldowns.size()*(2 + 2 + 2 + 4 + 4)));
  8. data.WriteBits(m_spellCooldowns.size(), 19);
  9.  
  10. for (auto itr : m_spellCooldowns)
  11. {
  12. data.WriteBit(false); // unk bit, false in sniff
  13. }
  14.  
  15. for (auto itr : m_spellCooldowns)
  16. {
  17. uint32 const spellId = itr.first;
  18. SpellCooldown const& cooldown = itr.second;
  19.  
  20. SpellInfo const* proto = sSpellMgr->GetSpellInfo(spellId);
  21. if (!proto)
  22. continue;
  23.  
  24. uint64 time = cooldown.end > curTime ? (cooldown.end - curTime) : 0;
  25.  
  26. uint64 spellCooldown = proto->Category == 0 ? time : 0;
  27. uint64 categoryCooldown = proto->Category != 0 ? time : 0;
  28.  
  29. if (cooldown.end >= infTime)
  30. {
  31. spellCooldown = 1;
  32. categoryCooldown = 0x80000000;
  33. }
  34.  
  35. data << uint32(spellId);
  36. data << uint32(cooldown.itemid);
  37. data << uint32(proto->Category);
  38. data << uint32(spellCooldown);
  39. data << uint32(categoryCooldown);
  40. }
  41.  
  42. GetSession()->SendPacket(&data);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement