AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Guild::Member Class Reference

#include "Guild.h"

Public Member Functions

 Member (uint32 guildId, ObjectGuid guid, uint8 rankId)
 
void SetStats (Player *player)
 
void SetStats (std::string_view name, uint8 level, uint8 _class, uint8 gender, uint32 zoneId, uint32 accountId)
 
bool CheckStats () const
 
void SetPublicNote (std::string_view publicNote)
 
void SetOfficerNote (std::string_view officerNote)
 
void SetZoneID (uint32 id)
 
void SetLevel (uint8 var)
 
void AddFlag (uint8 var)
 
void RemFlag (uint8 var)
 
void ResetFlags ()
 
bool LoadFromDB (Field *fields)
 
void SaveToDB (CharacterDatabaseTransaction trans) const
 
ObjectGuid GetGUID () const
 
std::string const & GetName () const
 
uint32 GetAccountId () const
 
uint8 GetRankId () const
 
uint64 GetLogoutTime () const
 
std::string GetPublicNote () const
 
std::string GetOfficerNote () const
 
uint8 GetClass () const
 
uint8 GetLevel () const
 
uint8 GetGender () const
 
uint8 GetFlags () const
 
uint32 GetZoneId () const
 
bool IsOnline ()
 
void ChangeRank (uint8 newRank)
 
void UpdateLogoutTime ()
 
bool IsRank (uint8 rankId) const
 
bool IsRankNotLower (uint8 rankId) const
 
bool IsSamePlayer (ObjectGuid guid) const
 
void UpdateBankWithdrawValue (CharacterDatabaseTransaction trans, uint8 tabId, uint32 amount)
 
int32 GetBankWithdrawValue (uint8 tabId) const
 
void ResetValues ()
 
PlayerFindPlayer () const
 
void SubscribeToGuildBankUpdatePackets ()
 
void UnsubscribeFromGuildBankUpdatePackets ()
 
bool ShouldReceiveBankPartialUpdatePackets () const
 

Private Attributes

uint32 m_guildId
 
ObjectGuid m_guid
 
std::string m_name
 
uint32 m_zoneId
 
uint8 m_level
 
uint8 m_class
 
uint8 m_gender
 
uint8 m_flags
 
uint64 m_logoutTime
 
uint32 m_accountId
 
uint8 m_rankId
 
std::string m_publicNote
 
std::string m_officerNote
 
std::array< int32, GUILD_BANK_MAX_TABS+1 > m_bankWithdraw = {}
 
bool receiveGuildBankUpdatePackets
 

Detailed Description

Constructor & Destructor Documentation

◆ Member()

Guild::Member::Member ( uint32  guildId,
ObjectGuid  guid,
uint8  rankId 
)
inline
298 :
299 m_guildId(guildId),
300 m_guid(guid),
301 m_zoneId(0),
302 m_level(0),
303 m_class(0),
305 m_accountId(0),
306 m_rankId(rankId),
308 {
309 }
@ GUILDMEMBER_STATUS_NONE
Definition: Guild.h:230
uint32 m_guildId
Definition: Guild.h:359
ObjectGuid m_guid
Definition: Guild.h:361
uint8 m_class
Definition: Guild.h:365
uint32 m_zoneId
Definition: Guild.h:363
uint8 m_rankId
Definition: Guild.h:371
uint32 m_accountId
Definition: Guild.h:369
uint8 m_level
Definition: Guild.h:364
bool receiveGuildBankUpdatePackets
Definition: Guild.h:377
uint8 m_flags
Definition: Guild.h:367

Member Function Documentation

◆ AddFlag()

void Guild::Member::AddFlag ( uint8  var)
inline
320{ m_flags |= var; }

References m_flags.

◆ ChangeRank()

void Guild::Member::ChangeRank ( uint8  newRank)
569{
570 m_rankId = newRank;
571
572 // Update rank information in player's field, if he is online.
573 if (Player* player = FindPlayer())
574 player->SetRank(newRank);
575
577 stmt->SetData (0, newRank);
578 stmt->SetData(1, m_guid.GetCounter());
579 CharacterDatabase.Execute(stmt);
580}
@ CHAR_UPD_GUILD_MEMBER_RANK
Definition: CharacterDatabase.h:167
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: PreparedStatement.h:157
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:77
LowType GetCounter() const
Definition: ObjectGuid.h:145
Definition: Player.h:1081
Player * FindPlayer() const
Definition: Guild.h:352

References CHAR_UPD_GUILD_MEMBER_RANK, CharacterDatabase, and PreparedStatementBase::SetData().

Referenced by Guild::_SetLeaderGUID().

◆ CheckStats()

bool Guild::Member::CheckStats ( ) const
631{
632 if (m_level < 1)
633 {
634 LOG_ERROR("guild", "Player ({}) has a broken data in field `characters`.`level`, deleting him from guild!", m_guid.ToString());
635 return false;
636 }
637
638 if (m_class < CLASS_WARRIOR || m_class >= MAX_CLASSES)
639 {
640 LOG_ERROR("guild", "Player ({}) has a broken data in field `characters`.`class`, deleting him from guild!", m_guid.ToString());
641 return false;
642 }
643 return true;
644}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
#define MAX_CLASSES
Definition: SharedDefines.h:155
std::string ToString() const
Definition: ObjectGuid.cpp:47

References LOG_ERROR, and MAX_CLASSES.

Referenced by Guild::AddMember().

◆ FindPlayer()

Player * Guild::Member::FindPlayer ( ) const
inline
Player * FindConnectedPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:257

References ObjectAccessor::FindConnectedPlayer(), and m_guid.

Referenced by Guild::DeleteMember().

◆ GetAccountId()

uint32 Guild::Member::GetAccountId ( ) const
inline
329{ return m_accountId; }

References m_accountId.

◆ GetBankWithdrawValue()

int32 Guild::Member::GetBankWithdrawValue ( uint8  tabId) const
674{
675 // Guild master has unlimited amount.
678
679 return m_bankWithdraw[tabId];
680}
@ GUILD_WITHDRAW_SLOT_UNLIMITED
Definition: Guild.h:49
@ GUILD_WITHDRAW_MONEY_UNLIMITED
Definition: Guild.h:48
@ GUILD_BANK_MAX_TABS
Definition: Guild.h:42
@ GR_GUILDMASTER
Definition: Guild.h:65
bool IsRank(uint8 rankId) const
Definition: Guild.h:344
std::array< int32, GUILD_BANK_MAX_TABS+1 > m_bankWithdraw
Definition: Guild.h:375

References GR_GUILDMASTER, GUILD_BANK_MAX_TABS, GUILD_WITHDRAW_MONEY_UNLIMITED, and GUILD_WITHDRAW_SLOT_UNLIMITED.

Referenced by Guild::_GetMemberRemainingMoney(), and Guild::_GetMemberRemainingSlots().

◆ GetClass()

uint8 Guild::Member::GetClass ( ) const
inline
334{ return m_class; }

References m_class.

◆ GetFlags()

uint8 Guild::Member::GetFlags ( ) const
inline
337{ return m_flags; }

References m_flags.

◆ GetGender()

uint8 Guild::Member::GetGender ( ) const
inline
336{ return m_gender; }
uint8 m_gender
Definition: Guild.h:366

References m_gender.

◆ GetGUID()

ObjectGuid Guild::Member::GetGUID ( ) const
inline
327{ return m_guid; }

References m_guid.

Referenced by Guild::_SetLeaderGUID().

◆ GetLevel()

uint8 Guild::Member::GetLevel ( ) const
inline
335{ return m_level; }

References m_level.

◆ GetLogoutTime()

uint64 Guild::Member::GetLogoutTime ( ) const
inline
331{ return m_logoutTime; }
uint64 m_logoutTime
Definition: Guild.h:368

References m_logoutTime.

◆ GetName()

std::string const & Guild::Member::GetName ( ) const
inline
328{ return m_name; }
std::string m_name
Definition: Guild.h:362

References m_name.

Referenced by Guild::DeleteMember().

◆ GetOfficerNote()

std::string Guild::Member::GetOfficerNote ( ) const
inline
333{ return m_officerNote; }
std::string m_officerNote
Definition: Guild.h:373

References m_officerNote.

◆ GetPublicNote()

std::string Guild::Member::GetPublicNote ( ) const
inline
332{ return m_publicNote; }
std::string m_publicNote
Definition: Guild.h:372

References m_publicNote.

◆ GetRankId()

◆ GetZoneId()

uint32 Guild::Member::GetZoneId ( ) const
inline
338{ return m_zoneId; }

References m_zoneId.

◆ IsOnline()

bool Guild::Member::IsOnline ( )
inline
@ GUILDMEMBER_STATUS_ONLINE
Definition: Guild.h:231

References GUILDMEMBER_STATUS_ONLINE, and m_flags.

◆ IsRank()

bool Guild::Member::IsRank ( uint8  rankId) const
inline
344{ return m_rankId == rankId; }

References m_rankId.

Referenced by Guild::Validate().

◆ IsRankNotLower()

bool Guild::Member::IsRankNotLower ( uint8  rankId) const
inline
345{ return m_rankId <= rankId; }

References m_rankId.

Referenced by Guild::HandleRemoveMember().

◆ IsSamePlayer()

bool Guild::Member::IsSamePlayer ( ObjectGuid  guid) const
inline
346{ return m_guid == guid; }

References m_guid.

◆ LoadFromDB()

bool Guild::Member::LoadFromDB ( Field fields)
602{
603 m_publicNote = fields[3].Get<std::string>();
604 m_officerNote = fields[4].Get<std::string>();
605
606 for (uint8 i = 0; i <= GUILD_BANK_MAX_TABS; ++i)
607 m_bankWithdraw[i] = fields[5 + i].Get<uint32>();
608
609 SetStats(fields[12].Get<std::string>(),
610 fields[13].Get<uint8>(), // characters.level
611 fields[14].Get<uint8>(), // characters.class
612 fields[15].Get<uint8>(), // characters.gender
613 fields[16].Get<uint16>(), // characters.zone
614 fields[17].Get<uint32>()); // characters.account
615 m_logoutTime = fields[18].Get<uint32>(); // characters.logout_time
616
617 if (!CheckStats())
618 return false;
619
620 if (!m_zoneId)
621 {
622 LOG_ERROR("guild", "Player ({}) has broken zone-data", m_guid.ToString());
624 }
625 ResetFlags();
626 return true;
627}
std::uint8_t uint8
Definition: Define.h:109
std::uint32_t uint32
Definition: Define.h:107
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition: Field.h:112
static uint32 GetZoneIdFromDB(ObjectGuid guid)
Definition: Player.cpp:6348
bool CheckStats() const
Definition: Guild.cpp:630
void ResetFlags()
Definition: Guild.h:322
void SetStats(Player *player)
Definition: Guild.cpp:522

References Field::Get(), Player::GetZoneIdFromDB(), GUILD_BANK_MAX_TABS, and LOG_ERROR.

Referenced by Guild::LoadMemberFromDB().

◆ RemFlag()

void Guild::Member::RemFlag ( uint8  var)
inline
321{ m_flags &= ~var; }

References m_flags.

◆ ResetFlags()

void Guild::Member::ResetFlags ( )
inline

◆ ResetValues()

void Guild::Member::ResetValues ( )
665{
666 for (uint8 tabId = 0; tabId <= GUILD_BANK_MAX_TABS; ++tabId)
667 m_bankWithdraw[tabId] = 0;
668}

References GUILD_BANK_MAX_TABS.

◆ SaveToDB()

void Guild::Member::SaveToDB ( CharacterDatabaseTransaction  trans) const
588{
590 stmt->SetData(0, m_guildId);
591 stmt->SetData(1, m_guid.GetCounter());
592 stmt->SetData (2, m_rankId);
593 stmt->SetData(3, m_publicNote);
594 stmt->SetData(4, m_officerNote);
595 CharacterDatabase.ExecuteOrAppend(trans, stmt);
596}
@ CHAR_INS_GUILD_MEMBER
Definition: CharacterDatabase.h:143

References CHAR_INS_GUILD_MEMBER, CharacterDatabase, and PreparedStatementBase::SetData().

Referenced by Guild::AddMember().

◆ SetLevel()

void Guild::Member::SetLevel ( uint8  var)
inline
318{ m_level = var; }

References m_level.

◆ SetOfficerNote()

void Guild::Member::SetOfficerNote ( std::string_view  officerNote)
556{
557 if (m_officerNote == officerNote)
558 return;
559
560 m_officerNote = officerNote;
561
563 stmt->SetData(0, m_officerNote);
564 stmt->SetData(1, m_guid.GetCounter());
565 CharacterDatabase.Execute(stmt);
566}
@ CHAR_UPD_GUILD_MEMBER_OFFNOTE
Definition: CharacterDatabase.h:166

References CHAR_UPD_GUILD_MEMBER_OFFNOTE, CharacterDatabase, and PreparedStatementBase::SetData().

◆ SetPublicNote()

void Guild::Member::SetPublicNote ( std::string_view  publicNote)
543{
544 if (m_publicNote == publicNote)
545 return;
546
547 m_publicNote = publicNote;
548
550 stmt->SetData(0, m_publicNote);
551 stmt->SetData(1, m_guid.GetCounter());
552 CharacterDatabase.Execute(stmt);
553}
@ CHAR_UPD_GUILD_MEMBER_PNOTE
Definition: CharacterDatabase.h:165

References CHAR_UPD_GUILD_MEMBER_PNOTE, CharacterDatabase, and PreparedStatementBase::SetData().

◆ SetStats() [1/2]

void Guild::Member::SetStats ( Player player)
523{
524 m_name = player->GetName();
525 m_level = player->GetLevel();
526 m_class = player->getClass();
527 m_gender = player->getGender();
528 m_zoneId = player->GetZoneId();
529 m_accountId = player->GetSession()->GetAccountId();
530}
std::string const & GetName() const
Definition: Object.h:463
uint32 GetZoneId() const
Definition: Object.cpp:3157
WorldSession * GetSession() const
Definition: Player.h:1998
uint8 getGender() const
Definition: Unit.h:805
uint8 getClass() const
Definition: Unit.h:800
uint8 GetLevel() const
Definition: Unit.h:1024
uint32 GetAccountId() const
Definition: WorldSession.h:361

References WorldSession::GetAccountId(), Unit::getClass(), Unit::getGender(), Unit::GetLevel(), WorldObject::GetName(), Player::GetSession(), WorldObject::GetZoneId(), and Guild::m_name.

Referenced by Guild::AddMember().

◆ SetStats() [2/2]

void Guild::Member::SetStats ( std::string_view  name,
uint8  level,
uint8  _class,
uint8  gender,
uint32  zoneId,
uint32  accountId 
)
533{
534 m_name = name;
535 m_level = level;
536 m_class = _class;
537 m_gender = gender;
538 m_zoneId = zoneId;
539 m_accountId = accountId;
540}

References Guild::m_name.

◆ SetZoneID()

void Guild::Member::SetZoneID ( uint32  id)
inline
317{ m_zoneId = id; }

References m_zoneId.

◆ ShouldReceiveBankPartialUpdatePackets()

bool Guild::Member::ShouldReceiveBankPartialUpdatePackets ( ) const
inline

◆ SubscribeToGuildBankUpdatePackets()

void Guild::Member::SubscribeToGuildBankUpdatePackets ( )
inline

◆ UnsubscribeFromGuildBankUpdatePackets()

void Guild::Member::UnsubscribeFromGuildBankUpdatePackets ( )
inline

◆ UpdateBankWithdrawValue()

void Guild::Member::UpdateBankWithdrawValue ( CharacterDatabaseTransaction  trans,
uint8  tabId,
uint32  amount 
)
650{
651 m_bankWithdraw[tabId] += amount;
652
654 stmt->SetData(0, m_guid.GetCounter());
655 for (uint8 i = 0; i <= GUILD_BANK_MAX_TABS;)
656 {
657 uint32 withdraw = m_bankWithdraw[i++];
658 stmt->SetData(i, withdraw);
659 }
660
661 CharacterDatabase.ExecuteOrAppend(trans, stmt);
662}
@ CHAR_INS_GUILD_MEMBER_WITHDRAW
Definition: CharacterDatabase.h:179

References CHAR_INS_GUILD_MEMBER_WITHDRAW, CharacterDatabase, GUILD_BANK_MAX_TABS, and PreparedStatementBase::SetData().

Referenced by Guild::HandleMemberWithdrawMoney().

◆ UpdateLogoutTime()

void Guild::Member::UpdateLogoutTime ( )
583{
585}
Seconds GetGameTime()
Definition: GameTime.cpp:38

References GameTime::GetGameTime().

Member Data Documentation

◆ m_accountId

uint32 Guild::Member::m_accountId
private

Referenced by GetAccountId().

◆ m_bankWithdraw

std::array<int32, GUILD_BANK_MAX_TABS + 1> Guild::Member::m_bankWithdraw = {}
private

◆ m_class

uint8 Guild::Member::m_class
private

Referenced by GetClass().

◆ m_flags

uint8 Guild::Member::m_flags
private

◆ m_gender

uint8 Guild::Member::m_gender
private

Referenced by GetGender().

◆ m_guid

ObjectGuid Guild::Member::m_guid
private

Referenced by FindPlayer(), GetGUID(), and IsSamePlayer().

◆ m_guildId

uint32 Guild::Member::m_guildId
private

◆ m_level

uint8 Guild::Member::m_level
private

Referenced by GetLevel(), and SetLevel().

◆ m_logoutTime

uint64 Guild::Member::m_logoutTime
private

Referenced by GetLogoutTime().

◆ m_name

std::string Guild::Member::m_name
private

Referenced by GetName().

◆ m_officerNote

std::string Guild::Member::m_officerNote
private

Referenced by GetOfficerNote().

◆ m_publicNote

std::string Guild::Member::m_publicNote
private

Referenced by GetPublicNote().

◆ m_rankId

uint8 Guild::Member::m_rankId
private

Referenced by GetRankId(), IsRank(), and IsRankNotLower().

◆ m_zoneId

uint32 Guild::Member::m_zoneId
private

Referenced by GetZoneId(), and SetZoneID().

◆ receiveGuildBankUpdatePackets

bool Guild::Member::receiveGuildBankUpdatePackets
private