Core/Calendar: Send map raid reset only once

Also some minor changes here and there
This commit is contained in:
Spp
2011-10-18 14:23:08 +02:00
parent bc023c6dfb
commit b5e8a192b1
4 changed files with 45 additions and 40 deletions
+3 -3
View File
@@ -23128,7 +23128,7 @@ void Player::InitRunes()
m_runes->runeState = 0;
m_runes->lastUsedRune = RUNE_BLOOD;
for (uint32 i = 0; i < MAX_RUNES; ++i)
for (uint8 i = 0; i < MAX_RUNES; ++i)
{
SetBaseRune(i, runeSlotTypes[i]); // init base types
SetCurrentRune(i, runeSlotTypes[i]); // init current types
@@ -23137,13 +23137,13 @@ void Player::InitRunes()
m_runes->SetRuneState(i);
}
for (uint32 i = 0; i < NUM_RUNE_TYPES; ++i)
for (uint8 i = 0; i < NUM_RUNE_TYPES; ++i)
SetFloatValue(PLAYER_RUNE_REGEN_1 + i, 0.1f);
}
bool Player::IsBaseRuneSlotsOnCooldown(RuneType runeType) const
{
for (uint32 i = 0; i < MAX_RUNES; ++i)
for (uint8 i = 0; i < MAX_RUNES; ++i)
if (GetBaseRune(i) == runeType && GetRuneCooldown(i) == 0)
return false;
@@ -27,10 +27,12 @@
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GET_CALENDAR"); // empty
uint64 guid = _player->GetGUID();
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid);
time_t cur_time = time(NULL);
time_t cur_time = time_t(time(NULL));
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_CALENDAR [" UI64FMTD "]", guid);
WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 4+4*0+4+4*0+4+4);
data << uint32(0); // invite count
@@ -58,48 +60,52 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket & /*recv_data*/)
}
*/
data << uint32(0); // unk
data << uint32(secsToTimeBitFields(cur_time)); // current time
data << uint32(cur_time); // server time
data << uint32(secsToTimeBitFields(cur_time)); // server time
uint32 counter = 0;
size_t p_counter = data.wpos();
data << uint32(counter); // instance save count
for (int i = 0; i < MAX_DIFFICULTY; ++i)
{
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr)
{
if (itr->second.perm)
{
InstanceSave* save = itr->second.save;
InstanceSave const* save = itr->second.save;
data << uint32(save->GetMapId());
data << uint32(save->GetDifficulty());
data << uint32(save->GetResetTime() - cur_time);
data << uint64(save->GetInstanceId()); // instance save id as unique instance copy id
++counter;
}
}
}
data.put<uint32>(p_counter, counter);
data << uint32(1135753200); // unk (28.12.2005 12:00)
data << uint32(1135753200); // unk (28.12.2005 07:00)
counter = 0;
p_counter = data.wpos();
data << uint32(counter); // raid reset count
std::set<uint32> sentMaps;
ResetTimeByMapDifficultyMap const& resets = sInstanceSaveMgr->GetResetTimeMap();
for (ResetTimeByMapDifficultyMap::const_iterator itr = resets.begin(); itr != resets.end(); ++itr)
{
uint32 mapid = PAIR32_LOPART(itr->first);
MapEntry const* mapEnt = sMapStore.LookupEntry(mapid);
if (!mapEnt || !mapEnt->IsRaid())
uint32 mapId = PAIR32_LOPART(itr->first);
if (sentMaps.find(mapId) != sentMaps.end())
continue;
data << uint32(mapid);
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry || !mapEntry->IsRaid())
continue;
sentMaps.insert(mapId);
data << uint32(mapId);
data << uint32(itr->second - cur_time);
data << uint32(mapEnt->unk_time);
data << uint32(mapEntry->unk_time);
++counter;
}
@@ -126,7 +132,6 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket & /*recv_data*/)
}
*/
sLog->outDebug(LOG_FILTER_NETWORKIO, "Sending calendar");
SendPacket(&data);
}
@@ -384,7 +384,7 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player* player, uint32 spellId, GameO
int32 count = 10;
uint32 itemid = 24538;
// bomb id count
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count, &noSpaceForCount);
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count, &noSpaceForCount);
if (msg != EQUIP_ERR_OK) // convert to possible store amount
count -= noSpaceForCount;