Conflicts:
	src/server/game/Entities/Player/Player.cpp
This commit is contained in:
Subv committed 2012-12-23 13:24:59 -05:00
commit 7a2c81bfd0
9 files changed
+174 -52

No files matched your search

+17 -27
View File
@@ -2042,24 +2042,18 @@ bool Player::BuildEnumData(PreparedQueryResult result, ByteBuffer* dataBuffer, B
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::GetChatTag() const
@@ -20342,19 +20336,17 @@ void Player::Whisper(const std::string& text, uint32 language, uint64 receiver)
std::string _text(text);
sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, rPlayer);
// when player you are whispering to is dnd, he cannot receive your message, unless you are in gm mode
if (!rPlayer->isDND() || isGameMaster())
{
WorldPacket data(SMSG_MESSAGECHAT, 200);
BuildPlayerChat(&data, CHAT_MSG_WHISPER, _text, language);
rPlayer->GetSession()->SendPacket(&data);
WorldPacket data(SMSG_MESSAGECHAT, 200);
BuildPlayerChat(&data, CHAT_MSG_WHISPER, _text, language);
rPlayer->GetSession()->SendPacket(&data);
data.Initialize(SMSG_MESSAGECHAT, 200);
rPlayer->BuildPlayerChat(&data, CHAT_MSG_WHISPER_INFORM, _text, language);
GetSession()->SendPacket(&data);
}
else // announce to player that player he is whispering to is dnd and cannot receive his message
ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_DND, rPlayer->GetName().c_str(), rPlayer->dndMsg.c_str());
// rest stuff shouldn't happen in case of addon message
if (isAddonMessage)
return;
data.Initialize(SMSG_MESSAGECHAT, 200);
rPlayer->BuildPlayerChat(&data, CHAT_MSG_WHISPER_INFORM, _text, language);
GetSession()->SendPacket(&data);
if (!isAcceptWhispers() && !isGameMaster() && !rPlayer->isGameMaster())
{
@@ -20362,13 +20354,11 @@ void Player::Whisper(const std::string& text, uint32 language, uint64 receiver)
ChatHandler(GetSession()).SendSysMessage(LANG_COMMAND_WHISPERON);
}
// announce to player that player he is whispering to is afk
// announce afk or dnd message
if (rPlayer->isAFK())
ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_AFK, rPlayer->GetName().c_str(), rPlayer->afkMsg.c_str());
// if player whisper someone, auto turn of dnd to be able to receive an answer
if (isDND() && !rPlayer->isGameMaster())
ToggleDND();
ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_AFK, rPlayer->GetName().c_str(), rPlayer->autoReplyMsg.c_str());
else if (rPlayer->isDND())
ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_DND, rPlayer->GetName().c_str(), rPlayer->autoReplyMsg.c_str());
}
void Player::PetSpellInitialize()
+3 -4
View File
@@ -1291,13 +1291,12 @@ class Player : public Unit, public GridObject<Player>
Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask);
GameObject* GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const;
bool ToggleAFK();
bool ToggleDND();
void ToggleAFK();
void ToggleDND();
bool isAFK() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); }
bool isDND() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); }
uint8 GetChatTag() const;
std::string afkMsg;
std::string dndMsg;
std::string autoReplyMsg;
uint32 GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const* newSkin=NULL);
+31 -20
View File
@@ -472,40 +472,51 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
} break;
case CHAT_MSG_AFK:
{
if ((msg.empty() || !_player->isAFK()) && !_player->isInCombat())
if (!_player->isInCombat())
{
if (!_player->isAFK())
if (_player->isAFK()) // Already AFK
{
if (msg.empty())
msg = GetTrinityString(LANG_PLAYER_AFK_DEFAULT);
_player->afkMsg = msg;
_player->ToggleAFK(); // Remove AFK
else
_player->autoReplyMsg = msg; // Update message
}
else // New AFK mode
{
_player->autoReplyMsg = msg.empty() ? GetTrinityString(LANG_PLAYER_AFK_DEFAULT) : msg;
if (_player->isDND())
_player->ToggleDND();
_player->ToggleAFK();
}
sScriptMgr->OnPlayerChat(_player, type, lang, msg);
_player->ToggleAFK();
if (_player->isAFK() && _player->isDND())
_player->ToggleDND();
}
} break;
break;
}
case CHAT_MSG_DND:
{
if (msg.empty() || !_player->isDND())
if (_player->isDND()) // Already DND
{
if (!_player->isDND())
{
if (msg.empty())
msg = GetTrinityString(LANG_PLAYER_DND_DEFAULT);
_player->dndMsg = msg;
}
if (msg.empty())
_player->ToggleDND(); // Remove DND
else
_player->autoReplyMsg = msg; // Update message
}
else // New DND mode
{
_player->autoReplyMsg = msg.empty() ? GetTrinityString(LANG_PLAYER_DND_DEFAULT) : msg;
sScriptMgr->OnPlayerChat(_player, type, lang, msg);
if (_player->isAFK())
_player->ToggleAFK();
_player->ToggleDND();
if (_player->isDND() && _player->isAFK())
_player->ToggleAFK();
}
} break;
sScriptMgr->OnPlayerChat(_player, type, lang, msg);
break;
}
default:
sLog->outError(LOG_FILTER_NETWORKIO, "CHAT: unknown message type %u, lang: %u", type, lang);
break;
+1 -1
View File
@@ -5656,7 +5656,7 @@ SpellCastResult Spell::CheckCasterAuras() const
Unit::AuraEffectList const& stunAuras = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_STUN);
for (Unit::AuraEffectList::const_iterator i = stunAuras.begin(); i != stunAuras.end(); ++i)
{
if (!((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() & (1<<MECHANIC_STUN)))
if ((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() && !((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() & (1<<MECHANIC_STUN)))
{
foundNotStun = true;
break;