mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[11814] Use the same variable to store the message for AFK and DND
Also make code in this area easier to read Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
parent
e89d5db5e3
commit
5b0c0c9fa4
4 changed files with 42 additions and 40 deletions
|
|
@ -1649,41 +1649,37 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Player::ToggleAFK()
|
||||
void Player::ToggleAFK()
|
||||
{
|
||||
ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK);
|
||||
|
||||
bool state = HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK);
|
||||
|
||||
// afk player not allowed in battleground
|
||||
if (state && InBattleGround() && !InArena())
|
||||
if (isAFK() && InBattleGround() && !InArena())
|
||||
LeaveBattleground();
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
bool Player::ToggleDND()
|
||||
void Player::ToggleDND()
|
||||
{
|
||||
ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND);
|
||||
|
||||
return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND);
|
||||
}
|
||||
|
||||
uint8 Player::chatTag() const
|
||||
{
|
||||
// it's bitmask
|
||||
// 0x8 - ??
|
||||
// 0x4 - gm
|
||||
// 0x2 - dnd
|
||||
// 0x1 - afk
|
||||
if(isGMChat())
|
||||
// 0x2 - dnd
|
||||
// 0x4 - gm
|
||||
// 0x8 - ??
|
||||
|
||||
if (isGMChat()) // Always show GM icons if activated
|
||||
return 4;
|
||||
else if(isDND())
|
||||
return 3;
|
||||
if(isAFK())
|
||||
|
||||
if (isAFK())
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
if (isDND())
|
||||
return 3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options)
|
||||
|
|
@ -18390,9 +18386,9 @@ void Player::Whisper(const std::string& text, uint32 language, ObjectGuid receiv
|
|||
|
||||
// announce afk or dnd message
|
||||
if (rPlayer->isAFK())
|
||||
ChatHandler(this).PSendSysMessage(LANG_PLAYER_AFK, rPlayer->GetName(), rPlayer->afkMsg.c_str());
|
||||
ChatHandler(this).PSendSysMessage(LANG_PLAYER_AFK, rPlayer->GetName(), rPlayer->autoReplyMsg.c_str());
|
||||
else if (rPlayer->isDND())
|
||||
ChatHandler(this).PSendSysMessage(LANG_PLAYER_DND, rPlayer->GetName(), rPlayer->dndMsg.c_str());
|
||||
ChatHandler(this).PSendSysMessage(LANG_PLAYER_DND, rPlayer->GetName(), rPlayer->autoReplyMsg.c_str());
|
||||
}
|
||||
|
||||
void Player::PetSpellInitialize()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue