本文整理汇总了C++中Guild::GetGUID方法的典型用法代码示例。如果您正苦于以下问题:C++ Guild::GetGUID方法的具体用法?C++ Guild::GetGUID怎么用?C++ Guild::GetGUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guild
的用法示例。
在下文中一共展示了Guild::GetGUID方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: HandleGuildFinderGetApplications
void WorldSession::HandleGuildFinderGetApplications(WorldPacket& /*recvPacket*/)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_LF_GUILD_GET_APPLICATIONS");
std::list<MembershipRequest> applicatedGuilds = sGuildFinderMgr->GetAllMembershipRequestsForPlayer(GetPlayer()->GetGUIDLow());
uint32 applicationsCount = applicatedGuilds.size();
WorldPacket data(SMSG_LF_GUILD_MEMBERSHIP_LIST_UPDATED);
data << uint32(10 - sGuildFinderMgr->CountRequestsFromPlayer(GetPlayer()->GetGUIDLow())); // Applications count left
data.WriteBits(applicationsCount, 19);
if (applicationsCount > 0)
{
ByteBuffer bufferData;
for (std::list<MembershipRequest>::const_iterator itr = applicatedGuilds.begin(); itr != applicatedGuilds.end(); ++itr)
{
Guild* guild = sGuildMgr->GetGuildById(itr->GetGuildId());
if (!guild)
continue;
LFGuildSettings guildSettings = sGuildFinderMgr->GetGuildSettings(itr->GetGuildId());
MembershipRequest request = *itr;
ObjectGuid guildGuid = ObjectGuid(guild->GetGUID());
data.WriteBits(request.GetComment().size(), 10);
data.WriteBits(guild->GetName().size(), 7);
data.WriteBitSeq<2, 1, 4, 0, 6, 3, 5, 7>(guildGuid);
bufferData << uint32(50397223); // unk Flags
bufferData.WriteByteSeq<1, 5, 6>(guildGuid);
bufferData.WriteString(request.GetComment());
bufferData.WriteByteSeq<0, 2>(guildGuid);
bufferData << uint32(guildSettings.GetClassRoles());
bufferData.WriteByteSeq<4>(guildGuid);
bufferData << uint32(guildSettings.GetAvailability());
bufferData.WriteString(guild->GetName());
bufferData << uint32(time(NULL) - request.GetSubmitTime()); // Time since application (seconds)
bufferData << uint32(guildSettings.GetInterests());
bufferData << uint32(request.GetExpiryTime() - time(NULL)); // Time left to application expiry (seconds)
bufferData.WriteByteSeq<7, 3>(guildGuid);
}
data.FlushBits();
data.append(bufferData);
}
else
{
data.FlushBits();
}
GetPlayer()->SendDirectMessage(&data);
}
示例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: HandleWhoOpcode
//.........这里部分代码省略.........
if (target->GetSession()->GetSecurity() > AccountTypes(gmLevelInWhoList) && !HasPermission(rbac::RBAC_PERM_WHO_SEE_ALL_SEC_LEVELS))
continue;
// do not process players which are not in world
if (!target->IsInWorld())
continue;
// check if target is globally visible for player
if (!target->IsVisibleGloballyFor(_player))
continue;
// check if target's level is in level range
uint8 lvl = target->getLevel();
if (lvl < request.MinLevel || lvl > request.MaxLevel)
continue;
// check if class matches classmask
if (request.ClassFilter >= 0 && !(request.ClassFilter & (1 << target->getClass())))
continue;
// check if race matches racemask
if (request.RaceFilter >= 0 && !(request.RaceFilter & (1 << target->getRace())))
continue;
if (!whoRequest.Areas.empty())
{
if (std::find(whoRequest.Areas.begin(), whoRequest.Areas.end(), target->GetZoneId()) == whoRequest.Areas.end())
continue;
}
std::wstring wTargetName;
if (!Utf8toWStr(target->GetName(), wTargetName))
continue;
wstrToLower(wTargetName);
if (!wPlayerName.empty() && wTargetName.find(wPlayerName) == std::wstring::npos)
continue;
Guild* targetGuild = target->GetGuild();
std::wstring wTargetGuildName;
if (!Utf8toWStr(targetGuild ? targetGuild->GetName() : "", wTargetGuildName))
continue;
wstrToLower(wTargetGuildName);
if (!wGuildName.empty() && wTargetGuildName.find(wGuildName) == std::wstring::npos)
continue;
if (!wWords.empty())
{
std::string aName;
if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(target->GetZoneId()))
aName = areaEntry->AreaName_lang;
bool show = false;
for (size_t i = 0; i < wWords.size(); ++i)
{
if (!wWords[i].empty())
{
if (wTargetName.find(wWords[i]) != std::wstring::npos ||
wTargetGuildName.find(wWords[i]) != std::wstring::npos ||
Utf8FitTo(aName, wWords[i]))
{
show = true;
break;
}
}
}
if (!show)
continue;
}
WorldPackets::Who::WhoEntry whoEntry;
if (!whoEntry.PlayerData.Initialize(target->GetGUID(), target))
continue;
if (targetGuild)
{
whoEntry.GuildGUID = targetGuild->GetGUID();
whoEntry.GuildVirtualRealmAddress = GetVirtualRealmAddress();
whoEntry.GuildName = targetGuild->GetName();
}
whoEntry.AreaID = target->GetZoneId();
whoEntry.IsGM = target->IsGameMaster();
response.Response.Entries.push_back(whoEntry);
// 50 is maximum player count sent to client - can be overridden
// through config, but is unstable
if (response.Response.Entries.size() >= sWorld->getIntConfig(CONFIG_MAX_WHO))
break;
}
SendPacket(response.Write());
}
示例5: HandleGuildFinderBrowse
void WorldSession::HandleGuildFinderBrowse(WorldPacket& recvPacket)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_LF_GUILD_BROWSE");
uint32 classRoles = 0;
uint32 availability = 0;
uint32 guildInterests = 0;
uint32 playerLevel = 0; // Raw player level (1-90), do they use MAX_FINDER_LEVEL when on level 90 ?
recvPacket >> playerLevel >> availability >> classRoles >> guildInterests;
Player* player = GetPlayer();
LFGuildPlayer settings(player->GetGUIDLow(), classRoles, availability, guildInterests, ANY_FINDER_LEVEL);
LFGuildStore guildList = sGuildFinderMgr->GetGuildsMatchingSetting(settings, player->GetTeamId());
uint32 guildCount = guildList.size();
if (guildCount == 0)
{
WorldPacket packet(SMSG_LF_GUILD_BROWSE_UPDATED);
packet.WriteBits(0, 18);
player->SendDirectMessage(&packet);
return;
}
bool returned = false;
if (!(classRoles & GUILDFINDER_ALL_ROLES) || classRoles > GUILDFINDER_ALL_ROLES)
returned = true;
if (!(availability & ALL_WEEK) || availability > ALL_WEEK)
returned = true;
if (!(guildInterests & ALL_INTERESTS) || guildInterests > ALL_INTERESTS)
returned = true;
if (playerLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || playerLevel < 1)
returned = true;
if (returned)
{
WorldPacket packet(SMSG_LF_GUILD_BROWSE_UPDATED);
packet.WriteBits(0, 18);
player->SendDirectMessage(&packet);
return;
}
ByteBuffer bufferData;
WorldPacket data(SMSG_LF_GUILD_BROWSE_UPDATED);
data.WriteBits(guildCount, 18);
for (LFGuildStore::const_iterator itr = guildList.begin(); itr != guildList.end(); ++itr)
{
LFGuildSettings guildSettings = itr->second;
Guild* guild = sGuildMgr->GetGuildById(itr->first);
ObjectGuid guildGUID = ObjectGuid(guild->GetGUID());
data.WriteBit(guildGUID[6]);
data.WriteBit(guildGUID[5]);
data.WriteBit(guildGUID[4]);
data.WriteBit(guildGUID[0]);
data.WriteBit(guildGUID[1]);
data.WriteBits(guildSettings.GetComment().size(), 10);
data.WriteBit(guildGUID[3]);
data.WriteBits(guild->GetName().size(), 7);
data.WriteBit(guildGUID[7]);
data.WriteBit(guildGUID[2]);
bufferData.WriteByteSeq(guildGUID[3]);
bufferData << uint32(guild->GetEmblemInfo().GetStyle());
bufferData << uint8(sGuildFinderMgr->HasRequest(player->GetGUIDLow(), guild->GetGUID()));
bufferData.WriteByteSeq(guildGUID[0]);
bufferData << uint32(guild->GetAchievementMgr().GetAchievementPoints());
bufferData.WriteByteSeq(guildGUID[2]);
bufferData << uint32(guildSettings.GetInterests());
bufferData << int32(guild->GetEmblemInfo().GetBackgroundColor());
bufferData << guild->GetLevel();
bufferData << uint32(guildSettings.GetAvailability());
bufferData << uint32(guildSettings.GetClassRoles());
bufferData.WriteByteSeq(guildGUID[5]);
bufferData << uint32(0); // Unk
if (guild->GetName().size() > 0)
bufferData.append(guild->GetName().c_str(), guild->GetName().size());
bufferData << uint32(0); // Unk
bufferData << uint32(guild->GetEmblemInfo().GetBorderStyle());
bufferData.WriteByteSeq(guildGUID[7]);
bufferData << uint32(guild->GetEmblemInfo().GetColor());
bufferData.WriteByteSeq(guildGUID[6]);
bufferData << uint32(0); // Unk
if (guildSettings.GetComment().size() > 0)
bufferData.append(guildSettings.GetComment().c_str(), guildSettings.GetComment().size());
//.........这里部分代码省略.........
示例6: 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;
}
//.........这里部分代码省略.........
示例7: HandleGuildFinderBrowse
void WorldSession::HandleGuildFinderBrowse(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_LF_GUILD_BROWSE");
uint32 classRoles = 0;
uint32 availability = 0;
uint32 guildInterests = 0;
uint32 playerLevel = 0;
recvPacket >> playerLevel >> guildInterests >> availability >> classRoles;
Player* player = GetPlayer();
LFGuildPlayer settings(player->GetGUIDLow(), classRoles, availability, guildInterests, ANY_FINDER_LEVEL);
LFGuildStore guildList = sGuildFinderMgr->GetGuildsMatchingSetting(settings, player->GetTeamId());
uint32 guildCount = guildList.size();
if (guildCount == 0)
{
WorldPacket packet(SMSG_LF_GUILD_BROWSE_UPDATED);
packet.WriteBits(0, 18);
packet.FlushBits();
player->SendDirectMessage(&packet);
return;
}
bool returned = false;
if (!(classRoles & GUILDFINDER_ALL_ROLES) || classRoles > GUILDFINDER_ALL_ROLES)
returned = true;
if (!(availability & ALL_WEEK) || availability > ALL_WEEK)
returned = true;
if (!(guildInterests & ALL_INTERESTS) || guildInterests > ALL_INTERESTS)
returned = true;
if (playerLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || playerLevel < 1)
returned = true;
if (returned)
{
WorldPacket packet(SMSG_LF_GUILD_BROWSE_UPDATED);
packet.WriteBits(0, 18);
packet.FlushBits();
player->SendDirectMessage(&packet);
return;
}
ByteBuffer bufferData;
WorldPacket data(SMSG_LF_GUILD_BROWSE_UPDATED);
data.WriteBits(guildCount, 18);
for (LFGuildStore::const_iterator itr = guildList.begin(); itr != guildList.end(); ++itr)
{
LFGuildSettings guildSettings = itr->second;
Guild* guild = sGuildMgr->GetGuildById(itr->first);
ObjectGuid guildGUID = ObjectGuid(guild->GetGUID());
data.WriteBitSeq<4>(guildGUID);
data.WriteBits(guild->GetName().size(), 7);
data.WriteBitSeq<0, 1>(guildGUID);
data.WriteBits(guildSettings.GetComment().size(), 10);
data.WriteBitSeq<2, 7, 3, 6, 5>(guildGUID);
bufferData << uint8(sGuildFinderMgr->HasRequest(player->GetGUIDLow(), guild->GetGUID()));
bufferData << uint32(guild->GetLevel());
bufferData << uint32(guildSettings.GetInterests());
bufferData << uint32(0); // Unk
bufferData << uint32(guild->GetEmblemInfo().GetBorderStyle());
bufferData.WriteByteSeq<1, 4>(guildGUID);
bufferData << uint32(guild->GetEmblemInfo().GetStyle());
bufferData.WriteByteSeq<3>(guildGUID);
bufferData << uint32(50397223); // Unk Flags
bufferData << uint32(guild->GetEmblemInfo().GetColor());
bufferData.WriteString(guild->GetName());
bufferData << uint32(guildSettings.GetClassRoles());
bufferData << uint32(guildSettings.GetAvailability());
bufferData.WriteString(guildSettings.GetComment());
bufferData.WriteByteSeq<6, 7>(guildGUID);
bufferData << uint8(0); // Cached
bufferData.WriteByteSeq<5, 0>(guildGUID);
bufferData << uint32(guild->GetEmblemInfo().GetBorderColor());
bufferData << uint32(guild->GetMembersCount());
bufferData << uint32(guild->GetAchievementMgr().GetAchievementPoints());
bufferData.WriteByteSeq<2>(guildGUID);
bufferData << int32(guild->GetEmblemInfo().GetBackgroundColor());
}
data.FlushBits();
data.append(bufferData);
player->SendDirectMessage(&data);
}
示例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(WorldPackets::Calendar::CalendarGetCalendar& /*calendarGetCalendar*/)
{
ObjectGuid guid = _player->GetGUID();
time_t currTime = time(NULL);
WorldPackets::Calendar::CalendarSendCalendar packet;
packet.ServerNow = currTime;
packet.RaidOrigin = 1135753200; // Constant date, unk (28.12.2005 07:00)
packet.ServerTime = currTime;
CalendarInviteStore playerInvites = sCalendarMgr->GetPlayerInvites(guid);
for (auto const& invite : playerInvites)
{
WorldPackets::Calendar::CalendarSendCalendarInviteInfo inviteInfo;
inviteInfo.EventID = invite->GetEventId();
inviteInfo.InviteID = invite->GetInviteId();
inviteInfo.InviterGuid = invite->GetSenderGUID();
inviteInfo.Status = invite->GetStatus();
inviteInfo.Moderator = invite->GetRank();
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(invite->GetEventId()))
inviteInfo.InviteType = calendarEvent->IsGuildEvent() && calendarEvent->GetGuildId() == _player->GetGuildId();
packet.Invites.push_back(inviteInfo);
}
CalendarEventStore playerEvents = sCalendarMgr->GetPlayerEvents(guid);
for (auto const& event : playerEvents)
{
WorldPackets::Calendar::CalendarSendCalendarEventInfo eventInfo;
eventInfo.EventID = event->GetEventId();
eventInfo.Date = event->GetDate();
Guild* guild = sGuildMgr->GetGuildById(event->GetGuildId());
eventInfo.EventGuildID = guild ? guild->GetGUID() : ObjectGuid::Empty;
eventInfo.EventName = event->GetTitle();
eventInfo.EventType = event->GetType();
eventInfo.Flags = event->GetFlags();
eventInfo.OwnerGuid = event->GetOwnerGUID();
eventInfo.TextureID = event->GetTextureId();
packet.Events.push_back(eventInfo);
}
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
Player::BoundInstancesMap boundInstances = _player->GetBoundInstances(Difficulty(i));
for (auto const& boundInstance : boundInstances)
{
if (boundInstance.second.perm)
{
WorldPackets::Calendar::CalendarSendCalendarRaidLockoutInfo lockoutInfo;
InstanceSave const* save = boundInstance.second.save;
lockoutInfo.MapID = save->GetMapId();
lockoutInfo.DifficultyID = save->GetDifficultyID();
lockoutInfo.ExpireTime = save->GetResetTime() - currTime;
lockoutInfo.InstanceID = save->GetInstanceId(); // instance save id as unique instance copy id
packet.RaidLockouts.push_back(lockoutInfo);
}
}
}
std::set<uint32> sentMaps;
ResetTimeByMapDifficultyMap const& resets = sInstanceSaveMgr->GetResetTimeMap();
for (auto const& reset : resets)
{
uint32 mapID = PAIR64_LOPART(reset.first);
if (sentMaps.find(mapID) != sentMaps.end())
continue;
MapEntry const* mapEntry = sMapStore.LookupEntry(mapID);
if (!mapEntry || !mapEntry->IsRaid())
continue;
sentMaps.insert(mapID);
WorldPackets::Calendar::CalendarSendCalendarRaidResetInfo resetInfo;
resetInfo.MapID = mapID;
resetInfo.Duration = reset.second - currTime;
resetInfo.Offset = 0; // Never seen anything else in sniffs - still unknown
packet.RaidResets.push_back(resetInfo);
}
SendPacket(packet.Write());
}
示例10: HandleGuildFinderBrowse
void WorldSession::HandleGuildFinderBrowse(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_LF_GUILD_BROWSE");
uint32 classRoles = 0;
uint32 availability = 0;
uint32 guildInterests = 0;
uint32 playerLevel = 0; // Raw player level (1-85), do they use MAX_FINDER_LEVEL when on level 85 ?
recvPacket >> classRoles >> availability >> guildInterests >> playerLevel;
if (!(classRoles & GUILDFINDER_ALL_ROLES) || classRoles > GUILDFINDER_ALL_ROLES)
return;
if (!(availability & AVAILABILITY_ALWAYS) || availability > AVAILABILITY_ALWAYS)
return;
if (!(guildInterests & ALL_INTERESTS) || guildInterests > ALL_INTERESTS)
return;
if (playerLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || playerLevel < 1)
return;
Player* player = GetPlayer();
LFGuildPlayer settings(player->GetGUIDLow(), classRoles, availability, guildInterests, ANY_FINDER_LEVEL);
LFGuildStore guildList = sGuildFinderMgr->GetGuildsMatchingSetting(settings, player->GetTeamId());
uint32 guildCount = guildList.size();
if (guildCount == 0)
{
WorldPacket packet(SMSG_LF_GUILD_BROWSE_UPDATED, 0);
player->SendDirectMessage(&packet);
return;
}
ByteBuffer bufferData(65 * guildCount);
WorldPacket data(SMSG_LF_GUILD_BROWSE_UPDATED, 3 + guildCount * 65); // Estimated size
data.WriteBits(guildCount, 19);
for (LFGuildStore::const_iterator itr = guildList.begin(); itr != guildList.end(); ++itr)
{
LFGuildSettings guildSettings = itr->second;
Guild* guild = sGuildMgr->GetGuildById(itr->first);
ObjectGuid guildGUID = ObjectGuid(guild->GetGUID());
data.WriteBit(guildGUID[7]);
data.WriteBit(guildGUID[5]);
data.WriteBits(guild->GetName().size(), 8);
data.WriteBit(guildGUID[0]);
data.WriteBits(guildSettings.GetComment().size(), 11);
data.WriteBit(guildGUID[4]);
data.WriteBit(guildGUID[1]);
data.WriteBit(guildGUID[2]);
data.WriteBit(guildGUID[6]);
data.WriteBit(guildGUID[3]);
bufferData << uint32(guild->GetEmblemInfo().GetColor());
bufferData << uint32(guild->GetEmblemInfo().GetBorderStyle()); // Guessed
bufferData << uint32(guild->GetEmblemInfo().GetStyle());
bufferData.WriteString(guildSettings.GetComment());
bufferData << uint8(0); // Unk
bufferData.WriteByteSeq(guildGUID[5]);
bufferData << uint32(guildSettings.GetInterests());
bufferData.WriteByteSeq(guildGUID[6]);
bufferData.WriteByteSeq(guildGUID[4]);
bufferData << uint32(guild->GetLevel());
bufferData.WriteString(guild->GetName());
bufferData << uint32(guild->GetAchievementMgr().GetAchievementPoints());
bufferData.WriteByteSeq(guildGUID[7]);
bufferData << uint8(sGuildFinderMgr->HasRequest(player->GetGUIDLow(), guild->GetGUID())); // Request pending
bufferData.WriteByteSeq(guildGUID[2]);
bufferData.WriteByteSeq(guildGUID[0]);
bufferData << uint32(guildSettings.GetAvailability());
bufferData.WriteByteSeq(guildGUID[1]);
bufferData << uint32(guild->GetEmblemInfo().GetBackgroundColor());
bufferData << uint32(0); // Unk Int 2 (+ 128) // Always 0 or 1
bufferData << uint32(guild->GetEmblemInfo().GetBorderColor());
bufferData << uint32(guildSettings.GetClassRoles());
bufferData.WriteByteSeq(guildGUID[3]);
bufferData << uint32(guild->GetMembersCount());
}
data.FlushBits();
data.append(bufferData);
player->SendDirectMessage(&data);
}
示例11: HandleMirrorImageDataRequest
void WorldSession::HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorImageData& getMirrorImageData)
{
ObjectGuid guid = getMirrorImageData.UnitGUID;
// Get unit for which data is needed by client
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
if (!unit)
return;
if (!unit->HasAuraType(SPELL_AURA_CLONE_CASTER))
return;
// Get creator of the unit (SPELL_AURA_CLONE_CASTER does not stack)
Unit* creator = unit->GetAuraEffectsByType(SPELL_AURA_CLONE_CASTER).front()->GetCaster();
if (!creator)
return;
if (Player* player = creator->ToPlayer())
{
WorldPackets::Spells::MirrorImageComponentedData mirrorImageComponentedData;
mirrorImageComponentedData.UnitGUID = guid;
mirrorImageComponentedData.DisplayID = creator->GetDisplayId();
mirrorImageComponentedData.RaceID = creator->getRace();
mirrorImageComponentedData.Gender = creator->getGender();
mirrorImageComponentedData.ClassID = creator->getClass();
Guild* guild = player->GetGuild();
mirrorImageComponentedData.SkinColor = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_SKIN_ID);
mirrorImageComponentedData.FaceVariation = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_FACE_ID);
mirrorImageComponentedData.HairVariation = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_STYLE_ID);
mirrorImageComponentedData.HairColor = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_COLOR_ID);
mirrorImageComponentedData.BeardVariation = player->GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_FACIAL_STYLE);
mirrorImageComponentedData.GuildGUID = (guild ? guild->GetGUID() : ObjectGuid::Empty);
mirrorImageComponentedData.ItemDisplayID.reserve(11);
static EquipmentSlots const itemSlots[] =
{
EQUIPMENT_SLOT_HEAD,
EQUIPMENT_SLOT_SHOULDERS,
EQUIPMENT_SLOT_BODY,
EQUIPMENT_SLOT_CHEST,
EQUIPMENT_SLOT_WAIST,
EQUIPMENT_SLOT_LEGS,
EQUIPMENT_SLOT_FEET,
EQUIPMENT_SLOT_WRISTS,
EQUIPMENT_SLOT_HANDS,
EQUIPMENT_SLOT_TABARD,
EQUIPMENT_SLOT_BACK,
EQUIPMENT_SLOT_END
};
// Display items in visible slots
for (auto const& slot : itemSlots)
{
uint32 itemDisplayId;
if ((slot == EQUIPMENT_SLOT_HEAD && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM)) ||
(slot == EQUIPMENT_SLOT_BACK && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK)))
itemDisplayId = 0;
else if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
itemDisplayId = item->GetDisplayId();
else
itemDisplayId = 0;
mirrorImageComponentedData.ItemDisplayID.push_back(itemDisplayId);
}
SendPacket(mirrorImageComponentedData.Write());
}
else
{
WorldPackets::Spells::MirrorImageCreatureData mirrorImageCreatureData;
mirrorImageCreatureData.UnitGUID = guid;
mirrorImageCreatureData.DisplayID = creator->GetDisplayId();
SendPacket(mirrorImageCreatureData.Write());
}
}