Merge pull request #11397 from Dehravor/guild-view-offinote

Core/Guild: Don't allow players to view officer notes without proper rights
This commit is contained in:
Machiavelli committed 2014-01-17 03:47:01 -08:00
commit e2376fcb72
2 files changed
+13 -17

No files matched your search

+11 -15
View File
@@ -701,7 +701,7 @@ bool Guild::Member::CheckStats() const
return true;
}
void Guild::Member::WritePacket(WorldPacket& data) const
void Guild::Member::WritePacket(WorldPacket& data, bool sendOfficerNote) const
{
data << uint64(m_guid)
<< uint8(m_flags)
@@ -715,8 +715,12 @@ void Guild::Member::WritePacket(WorldPacket& data) const
if (!m_flags)
data << float(float(::time(NULL) - m_logoutTime) / DAY);
data << m_publicNote
<< m_officerNote;
data << m_publicNote;
if (sendOfficerNote)
data << m_officerNote;
else
data << "";
}
// Decreases amount of money/slots left for today.
@@ -1299,7 +1303,7 @@ bool Guild::SetName(std::string const& name)
return true;
}
void Guild::HandleRoster(WorldSession* session /*= NULL*/)
void Guild::HandleRoster(WorldSession* session)
{
// Guess size
WorldPacket data(SMSG_GUILD_ROSTER, (4 + m_motd.length() + 1 + m_info.length() + 1 + 4 + _GetRanksSize() * (4 + 4 + GUILD_BANK_MAX_TABS * (4 + 4)) + m_members.size() * 50));
@@ -1312,18 +1316,10 @@ void Guild::HandleRoster(WorldSession* session /*= NULL*/)
ritr->WritePacket(data);
for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
itr->second->WritePacket(data);
itr->second->WritePacket(data, _HasRankRight(session->GetPlayer(), GR_RIGHT_VIEWOFFNOTE));
if (session)
{
TC_LOG_DEBUG("guild", "SMSG_GUILD_ROSTER [%s]", session->GetPlayerInfo().c_str());
session->SendPacket(&data);
}
else
{
TC_LOG_DEBUG("guild", "SMSG_GUILD_ROSTER [Broadcast]");
BroadcastPacket(&data);
}
TC_LOG_DEBUG("guild", "SMSG_GUILD_ROSTER [%s]", session->GetPlayerInfo().c_str());
session->SendPacket(&data);
}
void Guild::HandleQuery(WorldSession* session)
+2 -2
View File
@@ -315,7 +315,7 @@ private:
bool LoadFromDB(Field* fields);
void SaveToDB(SQLTransaction& trans) const;
void WritePacket(WorldPacket& data) const;
void WritePacket(WorldPacket& data, bool sendOfficerNote) const;
uint64 GetGUID() const { return m_guid; }
std::string const& GetName() const { return m_name; }
@@ -661,7 +661,7 @@ public:
bool SetName(std::string const& name);
// Handle client commands
void HandleRoster(WorldSession* session = NULL); // NULL = broadcast
void HandleRoster(WorldSession* session);
void HandleQuery(WorldSession* session);
void HandleSetMOTD(WorldSession* session, std::string const& motd);
void HandleSetInfo(WorldSession* session, std::string const& info);