本文整理汇总了C++中CalendarEvent::GetCreatorGUID方法的典型用法代码示例。如果您正苦于以下问题:C++ CalendarEvent::GetCreatorGUID方法的具体用法?C++ CalendarEvent::GetCreatorGUID怎么用?C++ CalendarEvent::GetCreatorGUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CalendarEvent
的用法示例。
在下文中一共展示了CalendarEvent::GetCreatorGUID方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendCalendarEventInviteAlert
void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_ALERT);
data << uint64(calendarEvent.GetEventId());
data << calendarEvent.GetTitle();
data.AppendPackedTime(calendarEvent.GetEventTime());
data << uint32(calendarEvent.GetFlags());
data << uint32(calendarEvent.GetType());
data << int32(calendarEvent.GetDungeonId());
data << uint64(invite.GetInviteId());
Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId());
data << uint64(guild ? guild->GetGUID() : 0);
data << uint8(invite.GetStatus());
data << uint8(invite.GetRank());
data.appendPackGUID(calendarEvent.GetCreatorGUID());
data.appendPackGUID(invite.GetSenderGUID());
if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
{
if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()))
guild->BroadcastPacket(&data);
}
else
if (Player* player = ObjectAccessor::FindPlayer(invite.GetInviteeGUID()))
player->SendDirectMessage(&data);
}
示例2: SendCalendarEventInvite
void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite)
{
CalendarEvent* calendarEvent = GetEvent(invite.GetEventId());
time_t statusTime = invite.GetStatusTime();
bool hasStatusTime = statusTime != 946684800; // 01/01/2000 00:00:00
ObjectGuid invitee = invite.GetInviteeGUID();
Player* player = ObjectAccessor::FindConnectedPlayer(invitee);
uint8 level = player ? player->getLevel() : sCharacterCache->GetCharacterLevelByGuid(invitee);
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (4) + 1);
data << invitee.WriteAsPacked();
data << uint64(invite.GetEventId());
data << uint64(invite.GetInviteId());
data << uint8(level);
data << uint8(invite.GetStatus());
data << uint8(hasStatusTime);
if (hasStatusTime)
data.AppendPackedTime(statusTime);
data << uint8(invite.GetSenderGUID() != invite.GetInviteeGUID()); // false only if the invite is sign-up
if (!calendarEvent) // Pre-invite
{
if (Player* playerSender = ObjectAccessor::FindConnectedPlayer(invite.GetSenderGUID()))
playerSender->SendDirectMessage(&data);
}
else
{
if (calendarEvent->GetCreatorGUID() != invite.GetInviteeGUID()) // correct?
SendPacketToAllEventRelatives(data, *calendarEvent);
}
}
示例3: SendCalendarEvent
void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType)
{
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
return;
CalendarInviteStore const& eventInviteeList = _invites[calendarEvent.GetEventId()];
WorldPacket data(SMSG_CALENDAR_SEND_EVENT, 60 + eventInviteeList.size() * 32);
data << uint8(sendType);
data.appendPackGUID(calendarEvent.GetCreatorGUID());
data << uint64(calendarEvent.GetEventId());
data << calendarEvent.GetTitle();
data << calendarEvent.GetDescription();
data << uint8(calendarEvent.GetType());
data << uint8(CALENDAR_REPEAT_NEVER); // repeatable
data << uint32(CALENDAR_MAX_INVITES);
data << int32(calendarEvent.GetDungeonId());
data << uint32(calendarEvent.GetFlags());
data.AppendPackedTime(calendarEvent.GetEventTime());
data.AppendPackedTime(calendarEvent.GetTimeZoneTime());
Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId());
data << uint64(guild ? guild->GetGUID() : 0);
data << uint32(eventInviteeList.size());
for (CalendarInviteStore::const_iterator itr = eventInviteeList.begin(); itr != eventInviteeList.end(); ++itr)
{
CalendarInvite const* calendarInvite = (*itr);
uint64 inviteeGuid = calendarInvite->GetInviteeGUID();
Player* invitee = ObjectAccessor::FindPlayer(inviteeGuid);
uint8 inviteeLevel = invitee ? invitee->getLevel() : Player::GetLevelFromDB(inviteeGuid);
uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : Player::GetGuildIdFromDB(inviteeGuid);
data.appendPackGUID(inviteeGuid);
data << uint8(inviteeLevel);
data << uint8(calendarInvite->GetStatus());
data << uint8(calendarInvite->GetRank());
data << uint8(calendarEvent.IsGuildEvent() && calendarEvent.GetGuildId() == inviteeGuildId);
data << uint64(calendarInvite->GetInviteId());
data.AppendPackedTime(calendarInvite->GetStatusTime());
data << calendarInvite->GetText();
}
player->SendDirectMessage(&data);
}
示例4: HandleCalendarGetCalendar
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
{
uint64 guid = _player->GetGUID();
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid);
time_t currTime = time(NULL);
WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Average size if no instance
std::vector<CalendarInvite*> invites = sCalendarMgr->GetPlayerInvites(guid);
data << uint32(invites.size());
for (std::vector<CalendarInvite*>::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
{
data << uint64((*itr)->GetEventId());
data << uint64((*itr)->GetInviteId());
data << uint8((*itr)->GetStatus());
data << uint8((*itr)->GetRank());
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent((*itr)->GetEventId()))
{
data << uint8(calendarEvent->IsGuildEvent());
data.appendPackGUID(calendarEvent->GetCreatorGUID());
}
else
{
data << uint8(0);
data.appendPackGUID((*itr)->GetSenderGUID());
}
}
CalendarEventStore playerEvents = sCalendarMgr->GetPlayerEvents(guid);
data << uint32(playerEvents.size());
for (CalendarEventStore::const_iterator itr = playerEvents.begin(); itr != playerEvents.end(); ++itr)
{
CalendarEvent* calendarEvent = *itr;
data << uint64(calendarEvent->GetEventId());
data << calendarEvent->GetTitle();
data << uint32(calendarEvent->GetType());
data.AppendPackedTime(calendarEvent->GetEventTime());
data << uint32(calendarEvent->GetFlags());
data << int32(calendarEvent->GetDungeonId());
Guild* guild = sGuildMgr->GetGuildById(calendarEvent->GetGuildId());
data << uint64(guild ? guild->GetGUID() : 0);
data.appendPackGUID(calendarEvent->GetCreatorGUID());
}
data << uint32(currTime); // server time
data.AppendPackedTime(currTime); // zone time
ByteBuffer dataBuffer;
uint32 boundCounter = 0;
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
Player::BoundInstancesMap boundInstances = _player->GetBoundInstances(Difficulty(i));
for (Player::BoundInstancesMap::const_iterator itr = boundInstances.begin(); itr != boundInstances.end(); ++itr)
{
if (itr->second.perm)
{
InstanceSave const* save = itr->second.save;
dataBuffer << uint32(save->GetMapId());
dataBuffer << uint32(save->GetDifficulty());
dataBuffer << uint32(save->GetResetTime() - currTime);
dataBuffer << uint64(save->GetInstanceId()); // instance save id as unique instance copy id
++boundCounter;
}
}
}
data << uint32(boundCounter);
data.append(dataBuffer);
data << uint32(1135753200); // Constant date, unk (28.12.2005 07:00)
// Reuse variables
boundCounter = 0;
std::set<uint32> sentMaps;
dataBuffer.clear();
ResetTimeByMapDifficultyMap const& resets = sInstanceSaveMgr->GetResetTimeMap();
for (ResetTimeByMapDifficultyMap::const_iterator itr = resets.begin(); itr != resets.end(); ++itr)
{
uint32 mapId = PAIR32_LOPART(itr->first);
if (sentMaps.find(mapId) != sentMaps.end())
continue;
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry || !mapEntry->IsRaid())
continue;
sentMaps.insert(mapId);
dataBuffer << int32(mapId);
dataBuffer << int32(itr->second - currTime);
dataBuffer << int32(0); // Never seen anything else in sniffs - still unknown
++boundCounter;
}
//.........这里部分代码省略.........
示例5: HandleCalendarGetCalendar
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
{
uint64 guid = _player->GetGUID();
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid);
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, 1000); // Impossible to get the correct size without doing a double iteration of some elements
CalendarInviteIdList const& invites = sCalendarMgr->GetPlayerInvites(guid);
data << uint32(invites.size());
for (CalendarInviteIdList::const_iterator it = invites.begin(); it != invites.end(); ++it)
{
CalendarInvite* invite = sCalendarMgr->GetInvite(*it);
CalendarEvent* calendarEvent = invite ? sCalendarMgr->GetEvent(invite->GetEventId()) : NULL;
if (calendarEvent)
{
data << uint64(invite->GetEventId());
data << uint64(invite->GetInviteId());
data << uint8(invite->GetStatus());
data << uint8(invite->GetRank());
data << uint8(calendarEvent->GetGuildId() != 0);
data.appendPackGUID(calendarEvent->GetCreatorGUID());
}
else
{
sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Invite found with id [" UI64FMTD "]", *it);
data << uint64(0) << uint64(0) << uint8(0) << uint8(0);
data.appendPackGUID(0);
}
}
CalendarEventIdList const& events = sCalendarMgr->GetPlayerEvents(guid);
data << uint32(events.size());
for (CalendarEventIdList::const_iterator it = events.begin(); it != events.end(); ++it)
{
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(*it))
{
data << uint64(*it);
data << calendarEvent->GetTitle().c_str();
data << uint32(calendarEvent->GetType());
data << uint32(calendarEvent->GetTime());
data << uint32(calendarEvent->GetFlags());
data << uint32(calendarEvent->GetDungeonId());
data.appendPackGUID(calendarEvent->GetCreatorGUID());
}
else
{
sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Event found with id [" UI64FMTD "]", *it);
data << uint64(0) << uint8(0) << uint32(0)
<< uint32(0) << uint32(0) << uint32(0);
data.appendPackGUID(0);
}
}
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 (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (Player::BoundInstancesMap::const_iterator itr = _player->_boundInstances[i].begin(); itr != _player->_boundInstances[i].end(); ++itr)
if (itr->second.perm)
{
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 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);
if (sentMaps.find(mapId) != sentMaps.end())
continue;
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry || !mapEntry->IsRaid())
continue;
sentMaps.insert(mapId);
//.........这里部分代码省略.........
示例6: SendCalendarEvent
void CalendarMgr::SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType type)
{
if (Player* player = ObjectAccessor::FindPlayer(calendarEvent.GetCreatorGUID()))
player->GetSession()->SendCalendarEvent(calendarEvent, type);
}
示例7: AddAction
void CalendarMgr::AddAction(CalendarAction const& action)
{
switch (action.GetAction())
{
case CALENDAR_ACTION_ADD_EVENT:
{
if (AddEvent(action.Event) && AddInvite(action.Invite))
{
SendCalendarEventInviteAlert(action.Event, action.Invite);
SendCalendarEvent(action.Event, CALENDAR_SENDTYPE_ADD);
}
break;
}
case CALENDAR_ACTION_MODIFY_EVENT:
{
uint64 eventId = action.Event.GetEventId();
CalendarEvent* calendarEvent = CheckPermisions(eventId,
action.GetGUID(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
if (!calendarEvent)
return;
calendarEvent->SetEventId(action.Event.GetEventId());
calendarEvent->SetType(action.Event.GetType());
calendarEvent->SetFlags(action.Event.GetFlags());
calendarEvent->SetTime(action.Event.GetTime());
calendarEvent->SetTimeZoneTime(action.Event.GetTimeZoneTime());
calendarEvent->SetRepeatable(action.Event.GetRepeatable());
calendarEvent->SetDungeonId(action.Event.GetDungeonId());
calendarEvent->SetTitle(action.Event.GetTitle());
calendarEvent->SetDescription(action.Event.GetDescription());
calendarEvent->SetMaxInvites(action.Event.GetMaxInvites());
CalendarinviteIdList const& invites = calendarEvent->GetInviteIdList();
for (CalendarinviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
if (CalendarInvite* invite = GetInvite(*itr))
SendCalendarEventUpdateAlert(invite->GetInvitee(), *calendarEvent, CALENDAR_SENDTYPE_ADD);
break;
}
case CALENDAR_ACTION_COPY_EVENT:
{
CalendarEvent* calendarEvent = CheckPermisions(action.Event.GetEventId(),
action.GetGUID(), action.GetInviteId(), CALENDAR_RANK_OWNER);
if (!calendarEvent)
return;
uint64 eventId = GetFreeEventId();
CalendarEvent newEvent(eventId);
newEvent.SetType(calendarEvent->GetType());
newEvent.SetFlags(calendarEvent->GetFlags());
newEvent.SetTime(action.Event.GetTime());
newEvent.SetTimeZoneTime(calendarEvent->GetTimeZoneTime());
newEvent.SetRepeatable(calendarEvent->GetRepeatable());
newEvent.SetDungeonId(calendarEvent->GetDungeonId());
newEvent.SetTitle(calendarEvent->GetTitle());
newEvent.SetDescription(calendarEvent->GetDescription());
newEvent.SetMaxInvites(calendarEvent->GetMaxInvites());
newEvent.SetCreatorGUID(calendarEvent->GetCreatorGUID());
newEvent.SetGuildId(calendarEvent->GetGuildId());
CalendarinviteIdList const invites = calendarEvent->GetInviteIdList();
for (CalendarinviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
if (CalendarInvite* invite = GetInvite(*itr))
{
uint64 inviteId = GetFreeInviteId();
CalendarInvite newInvite(inviteId);
newInvite.SetEventId(eventId);
newInvite.SetSenderGUID(action.GetGUID());
newInvite.SetInvitee(invite->GetInvitee());
newInvite.SetStatus(invite->GetStatus());
newInvite.SetStatusTime(invite->GetStatusTime());
newInvite.SetText(invite->GetText());
newInvite.SetRank(invite->GetRank());
if (AddInvite(newInvite))
{
SendCalendarEventInviteAlert(newEvent, newInvite);
newEvent.AddInvite(inviteId);
}
}
if (AddEvent(newEvent))
SendCalendarEvent(newEvent, CALENDAR_SENDTYPE_COPY);
break;
}
case CALENDAR_ACTION_REMOVE_EVENT:
{
uint64 eventId = action.Event.GetEventId();
uint32 flags = action.Event.GetFlags();
sLog->outError("CalendarMgr::AddAction:: Flags %u", flags);
// FIXME - Use of Flags here!
CalendarEvent* calendarEvent = CheckPermisions(eventId,
action.GetGUID(), action.GetInviteId(), CALENDAR_RANK_OWNER);
if (!calendarEvent)
return;
//.........这里部分代码省略.........
示例8: HandleCalendarGetCalendar
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
{
uint64 guid = _player->GetGUID();
TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid);
time_t currTime = time(NULL);
uint32 counter = 0;
CalendarInviteStore invites = sCalendarMgr->GetPlayerInvites(guid);
CalendarEventStore playerEvents = sCalendarMgr->GetPlayerEvents(guid);
ResetTimeByMapDifficultyMap const& resets = sInstanceSaveMgr->GetResetTimeMap();
ByteBuffer lockoutInfoBuffer;
ByteBuffer invitesInfoBuffer;
ByteBuffer eventsInfoBuffer;
WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Average size if no instance
size_t resetPos = data.bitwpos();
data.WriteBits(0, 20); // Reset placeholder
data.WriteBits(0, 16); // Holidays -> fuck that shit... Necessary to find out when this should be sent
size_t lockoutPos = data.bitwpos();
data.WriteBits(0, 20); // Lockout placeholder
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
Player::BoundInstancesMap boundInstances = _player->GetBoundInstances(Difficulty(i));
for (Player::BoundInstancesMap::const_iterator itr = boundInstances.begin(); itr != boundInstances.end(); ++itr)
{
if (itr->second.perm)
{
InstanceSave const* save = itr->second.save;
ObjectGuid guid = save->GetInstanceId();
data.WriteBit(guid[6]);
data.WriteBit(guid[7]);
data.WriteBit(guid[2]);
data.WriteBit(guid[1]);
data.WriteBit(guid[5]);
data.WriteBit(guid[4]);
data.WriteBit(guid[0]);
data.WriteBit(guid[3]);
lockoutInfoBuffer << uint32(save->GetDifficulty());
lockoutInfoBuffer.WriteByteSeq(guid[3]);
lockoutInfoBuffer.WriteByteSeq(guid[0]);
lockoutInfoBuffer.WriteByteSeq(guid[1]);
lockoutInfoBuffer.WriteByteSeq(guid[5]);
lockoutInfoBuffer << uint32(save->GetResetTime() - currTime);
lockoutInfoBuffer << uint32(save->GetMapId());
lockoutInfoBuffer.WriteByteSeq(guid[2]);
lockoutInfoBuffer.WriteByteSeq(guid[7]);
lockoutInfoBuffer.WriteByteSeq(guid[6]);
lockoutInfoBuffer.WriteByteSeq(guid[4]);
++counter;
}
}
}
data.WriteBits(invites.size(), 19);
for (CalendarInviteStore::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
{
CalendarEvent* calendarEvent = sCalendarMgr->GetEvent((*itr)->GetEventId());
ObjectGuid guid = (*itr)->GetSenderGUID();
data.WriteBit(guid[1]);
data.WriteBit(guid[2]);
data.WriteBit(guid[6]);
data.WriteBit(guid[7]);
data.WriteBit(guid[3]);
data.WriteBit(guid[0]);
data.WriteBit(guid[4]);
data.WriteBit(guid[5]);
invitesInfoBuffer.WriteByteSeq(guid[2]);
invitesInfoBuffer << uint64((*itr)->GetInviteId());
invitesInfoBuffer << uint8((*itr)->GetStatus());
invitesInfoBuffer.WriteByteSeq(guid[6]);
invitesInfoBuffer.WriteByteSeq(guid[3]);
invitesInfoBuffer.WriteByteSeq(guid[4]);
invitesInfoBuffer.WriteByteSeq(guid[1]);
invitesInfoBuffer.WriteByteSeq(guid[0]);
invitesInfoBuffer << uint64((*itr)->GetEventId());
invitesInfoBuffer.WriteByteSeq(guid[7]);
invitesInfoBuffer.WriteByteSeq(guid[5]);
invitesInfoBuffer << uint8((*itr)->GetRank());
invitesInfoBuffer << uint8((calendarEvent && calendarEvent->IsGuildEvent() && calendarEvent->GetGuildId() == _player->GetGuildId()) ? 1 : 0);
}
data.WriteBits(playerEvents.size(), 19);
for (CalendarEventStore::const_iterator itr = playerEvents.begin(); itr != playerEvents.end(); ++itr)
{
CalendarEvent* calendarEvent = *itr;
Guild* guild = sGuildMgr->GetGuildById(calendarEvent->GetGuildId());
ObjectGuid guildGuid = guild ? guild->GetGUID() : 0;
ObjectGuid creatorGuid = calendarEvent->GetCreatorGUID();
data.WriteBit(creatorGuid[2]);
data.WriteBit(guildGuid[1]);
data.WriteBit(guildGuid[7]);
data.WriteBit(creatorGuid[4]);
data.WriteBit(guildGuid[5]);
data.WriteBit(guildGuid[6]);
//.........这里部分代码省略.........
示例9: HandleCalendarGetCalendar
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
{
uint64 guid = _player->GetGUID();
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid);
time_t currTime = time(NULL);
WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Average size if no instance
CalendarInviteStore invites = sCalendarMgr->GetPlayerInvites(guid);
data << uint32(invites.size());
for (CalendarInviteStore::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
{
data << uint64((*itr)->GetEventId());
data << uint64((*itr)->GetInviteId());
data << uint8((*itr)->GetStatus());
data << uint8((*itr)->GetRank());
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent((*itr)->GetEventId()))
{
data << uint8(calendarEvent->IsGuildEvent());
data.appendPackGUID(calendarEvent->GetCreatorGUID());
}
else
{
data << uint8(0);
data.appendPackGUID((*itr)->GetSenderGUID());
}
}
CalendarEventStore playerEvents = sCalendarMgr->GetPlayerEvents(guid);
data << uint32(playerEvents.size());
for (CalendarEventStore::const_iterator itr = playerEvents.begin(); itr != playerEvents.end(); ++itr)
{
CalendarEvent* calendarEvent = *itr;
data << uint64(calendarEvent->GetEventId());
data << calendarEvent->GetTitle();
data << uint32(calendarEvent->GetType());
data.AppendPackedTime(calendarEvent->GetEventTime());
data << uint32(calendarEvent->GetFlags());
data << int32(calendarEvent->GetDungeonId());
data.appendPackGUID(calendarEvent->GetCreatorGUID());
}
data << uint32(currTime); // server time
data.AppendPackedTime(currTime); // zone time
ByteBuffer dataBuffer;
uint32 boundCounter = 0;
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(_player->GetGUIDLow(), Difficulty(i));
for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
{
if (itr->second.perm)
{
InstanceSave const* save = itr->second.save;
time_t resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
dataBuffer << uint32(save->GetMapId());
dataBuffer << uint32(save->GetDifficulty());
dataBuffer << uint32(resetTime >= currTime ? resetTime-currTime : 0);
dataBuffer << uint64(MAKE_NEW_GUID(save->GetInstanceId(), 0, HIGHGUID_INSTANCE)); // instance save id as unique instance copy id
++boundCounter;
}
}
}
data << uint32(boundCounter);
data.append(dataBuffer);
// pussywizard
uint32 relationTime = sWorld->getIntConfig(CONFIG_INSTANCE_RESET_TIME_RELATIVE_TIMESTAMP) + sWorld->getIntConfig(CONFIG_INSTANCE_RESET_TIME_HOUR) * HOUR; // set point in time (default 29.12.2005) + X hours
data << uint32(relationTime);
// Reuse variables
boundCounter = 0;
std::set<uint32> sentMaps;
dataBuffer.clear();
ResetTimeByMapDifficultyMap const& resets = sInstanceSaveMgr->GetResetTimeMap();
for (ResetTimeByMapDifficultyMap::const_iterator itr = resets.begin(); itr != resets.end(); ++itr)
{
uint32 mapId = PAIR32_LOPART(itr->first);
if (sentMaps.find(mapId) != sentMaps.end())
continue;
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry || !mapEntry->IsRaid())
continue;
sentMaps.insert(mapId);
dataBuffer << int32(mapId);
time_t period = sInstanceSaveMgr->GetExtendedResetTimeFor(mapId, (Difficulty)PAIR32_HIPART(itr->first)) - itr->second;
dataBuffer << int32(period); // pussywizard: reset time period
dataBuffer << int32(0); // pussywizard: reset time offset, needed for other than 7-day periods if not aligned with relationTime
++boundCounter;
}
//.........这里部分代码省略.........