Core/Chat: cleanup MonsterText methods
This commit is contained in:
@@ -0,0 +1 @@
|
||||
DELETE FROM `trinity_string` WHERE `ID` IN (28634,28635);
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "Cell.h"
|
||||
#include "CellImpl.h"
|
||||
#include "Chat.h"
|
||||
#include "ChatTextBuilder.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GossipDef.h"
|
||||
@@ -38,26 +38,6 @@
|
||||
#include "MoveSplineInit.h"
|
||||
#include "GameEventMgr.h"
|
||||
|
||||
class BroadcastTextBuilder
|
||||
{
|
||||
public:
|
||||
BroadcastTextBuilder(WorldObject const* obj, ChatMsg msgtype, uint32 id, WorldObject const* target, uint32 gender = GENDER_MALE)
|
||||
: _source(obj), _msgType(msgtype), _textId(id), _target(target), _gender(gender) { }
|
||||
|
||||
size_t operator()(WorldPacket* data, LocaleConstant locale) const
|
||||
{
|
||||
BroadcastText const* bct = sObjectMgr->GetBroadcastText(_textId);
|
||||
|
||||
return ChatHandler::BuildChatPacket(*data, _msgType, bct ? Language(bct->Language) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _gender) : "", 0, "", locale);
|
||||
}
|
||||
|
||||
WorldObject const* _source;
|
||||
ChatMsg _msgType;
|
||||
uint32 _textId;
|
||||
WorldObject const* _target;
|
||||
uint32 _gender;
|
||||
};
|
||||
|
||||
SmartScript::SmartScript()
|
||||
{
|
||||
go = NULL;
|
||||
@@ -232,7 +212,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
if (IsUnit(*itr))
|
||||
{
|
||||
(*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.onlySelf > 0);
|
||||
(*itr)->PlayDirectSound(e.action.sound.sound, e.action.sound.onlySelf ? (*itr)->ToPlayer() : nullptr);
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.onlySelf);
|
||||
}
|
||||
@@ -762,7 +742,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
me->DoFleeToGetAssistance();
|
||||
if (e.action.flee.withEmote)
|
||||
{
|
||||
BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_FLEE_FOR_ASSIST, NULL, me->getGender());
|
||||
Trinity::BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_FLEE_FOR_ASSIST);
|
||||
sCreatureTextMgr->SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE);
|
||||
}
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_FLEE_FOR_ASSIST: Creature %u DoFleeToGetAssistance", me->GetGUIDLow());
|
||||
@@ -1005,7 +985,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
me->CallForHelp((float)e.action.callHelp.range);
|
||||
if (e.action.callHelp.withEmote)
|
||||
{
|
||||
BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_CALL_FOR_HELP, NULL, me->getGender());
|
||||
Trinity::BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_CALL_FOR_HELP);
|
||||
sCreatureTextMgr->SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE);
|
||||
}
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_CALL_FOR_HELP: Creature %u", me->GetGUIDLow());
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "Battleground.h"
|
||||
#include "CellImpl.h"
|
||||
#include "Chat.h"
|
||||
#include "ChatTextBuilder.h"
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCEnums.h"
|
||||
@@ -42,29 +42,6 @@
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
namespace Trinity
|
||||
{
|
||||
class AchievementChatBuilder
|
||||
{
|
||||
public:
|
||||
AchievementChatBuilder(Player const* player, ChatMsg msgType, uint32 textId, uint32 achievementId)
|
||||
: _player(player), _msgType(msgType), _textId(textId), _achievementId(achievementId) { }
|
||||
|
||||
void operator()(WorldPacket& data, LocaleConstant locale)
|
||||
{
|
||||
BroadcastText const* bct = sObjectMgr->GetBroadcastText(_textId);
|
||||
|
||||
ChatHandler::BuildChatPacket(data, _msgType, bct ? Language(bct->Language) : LANG_UNIVERSAL, _player, _player, bct ? bct->GetText(locale, _player->getGender()) : "", _achievementId);
|
||||
}
|
||||
|
||||
private:
|
||||
Player const* _player;
|
||||
ChatMsg _msgType;
|
||||
uint32 _textId;
|
||||
uint32 _achievementId;
|
||||
};
|
||||
} // namespace Trinity
|
||||
|
||||
bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
|
||||
{
|
||||
if (dataType >= MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE)
|
||||
@@ -661,8 +638,8 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
|
||||
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()))
|
||||
{
|
||||
Trinity::AchievementChatBuilder _builder(GetPlayer(), CHAT_MSG_GUILD_ACHIEVEMENT, BROADCAST_TEXT_ACHIEVEMENT_EARNED, achievement->ID);
|
||||
Trinity::LocalizedPacketDo<Trinity::AchievementChatBuilder> _localizer(_builder);
|
||||
Trinity::BroadcastTextBuilder _builder(GetPlayer(), CHAT_MSG_GUILD_ACHIEVEMENT, BROADCAST_TEXT_ACHIEVEMENT_EARNED, GetPlayer(), achievement->ID);
|
||||
Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> _localizer(_builder);
|
||||
guild->BroadcastWorker(_localizer, GetPlayer());
|
||||
}
|
||||
|
||||
@@ -679,9 +656,9 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
|
||||
// if player is in world he can tell his friends about new achievement
|
||||
else if (GetPlayer()->IsInWorld())
|
||||
{
|
||||
Trinity::AchievementChatBuilder _builder(GetPlayer(), CHAT_MSG_ACHIEVEMENT, BROADCAST_TEXT_ACHIEVEMENT_EARNED, achievement->ID);
|
||||
Trinity::LocalizedPacketDo<Trinity::AchievementChatBuilder> _localizer(_builder);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::AchievementChatBuilder> > _worker(GetPlayer(), sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), _localizer);
|
||||
Trinity::BroadcastTextBuilder _builder(GetPlayer(), CHAT_MSG_ACHIEVEMENT, BROADCAST_TEXT_ACHIEVEMENT_EARNED, GetPlayer(), achievement->ID);
|
||||
Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> _localizer(_builder);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> > _worker(GetPlayer(), sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), _localizer);
|
||||
GetPlayer()->VisitNearbyWorldObject(sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), _worker);
|
||||
}
|
||||
|
||||
|
||||
@@ -1879,16 +1879,6 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const
|
||||
return true;
|
||||
}
|
||||
|
||||
void WorldObject::SendPlaySound(uint32 Sound, bool OnlySelf)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << Sound;
|
||||
if (OnlySelf && GetTypeId() == TYPEID_PLAYER)
|
||||
this->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
else
|
||||
SendMessageToSet(&data, true); // ToSelf ignored in this case
|
||||
}
|
||||
|
||||
void Object::ForceValuesUpdateAtIndex(uint32 i)
|
||||
{
|
||||
_changesMask.SetBit(i);
|
||||
@@ -1899,163 +1889,6 @@ void Object::ForceValuesUpdateAtIndex(uint32 i)
|
||||
}
|
||||
}
|
||||
|
||||
namespace Trinity
|
||||
{
|
||||
class MonsterChatBuilder
|
||||
{
|
||||
public:
|
||||
MonsterChatBuilder(WorldObject const* obj, ChatMsg msgtype, int32 textId, uint32 language, WorldObject const* target)
|
||||
: i_object(obj), i_msgtype(msgtype), i_textId(textId), i_language(Language(language)), i_target(target) { }
|
||||
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
||||
{
|
||||
if (BroadcastText const* broadcastText = sObjectMgr->GetBroadcastText(i_textId))
|
||||
{
|
||||
uint8 gender = GENDER_MALE;
|
||||
if (Unit const* unit = i_object->ToUnit())
|
||||
gender = unit->getGender();
|
||||
|
||||
std::string text = broadcastText->GetText(loc_idx, gender);
|
||||
ChatHandler::BuildChatPacket(data, i_msgtype, i_language, i_object, i_target, text, 0, "", loc_idx);
|
||||
}
|
||||
else
|
||||
TC_LOG_ERROR("entities.unit", "MonsterChatBuilder: `broadcast_text` id %i missing", i_textId);
|
||||
}
|
||||
|
||||
private:
|
||||
WorldObject const* i_object;
|
||||
ChatMsg i_msgtype;
|
||||
int32 i_textId;
|
||||
Language i_language;
|
||||
WorldObject const* i_target;
|
||||
};
|
||||
|
||||
class MonsterCustomChatBuilder
|
||||
{
|
||||
public:
|
||||
MonsterCustomChatBuilder(WorldObject const* obj, ChatMsg msgtype, const char* text, uint32 language, WorldObject const* target)
|
||||
: i_object(obj), i_msgtype(msgtype), i_text(text), i_language(Language(language)), i_target(target)
|
||||
{}
|
||||
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
||||
{
|
||||
ChatHandler::BuildChatPacket(data, i_msgtype, i_language, i_object, i_target, i_text, 0, "", loc_idx);
|
||||
}
|
||||
|
||||
private:
|
||||
WorldObject const* i_object;
|
||||
ChatMsg i_msgtype;
|
||||
const char* i_text;
|
||||
Language i_language;
|
||||
WorldObject const* i_target;
|
||||
};
|
||||
} // namespace Trinity
|
||||
|
||||
void WorldObject::MonsterSay(const char* text, uint32 language, WorldObject const* target)
|
||||
{
|
||||
CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY());
|
||||
|
||||
Cell cell(p);
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::MonsterCustomChatBuilder say_build(this, CHAT_MSG_MONSTER_SAY, text, language, target);
|
||||
Trinity::LocalizedPacketDo<Trinity::MonsterCustomChatBuilder> say_do(say_build);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterCustomChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), say_do);
|
||||
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterCustomChatBuilder> >, WorldTypeMapContainer > message(say_worker);
|
||||
cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY));
|
||||
}
|
||||
|
||||
void WorldObject::MonsterSay(int32 textId, uint32 language, WorldObject const* target)
|
||||
{
|
||||
CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY());
|
||||
|
||||
Cell cell(p);
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::MonsterChatBuilder say_build(this, CHAT_MSG_MONSTER_SAY, textId, language, target);
|
||||
Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), say_do);
|
||||
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
|
||||
cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY));
|
||||
}
|
||||
|
||||
void WorldObject::MonsterYell(const char* text, uint32 language, WorldObject const* target)
|
||||
{
|
||||
CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY());
|
||||
|
||||
Cell cell(p);
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::MonsterCustomChatBuilder say_build(this, CHAT_MSG_MONSTER_YELL, text, language, target);
|
||||
Trinity::LocalizedPacketDo<Trinity::MonsterCustomChatBuilder> say_do(say_build);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterCustomChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), say_do);
|
||||
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterCustomChatBuilder> >, WorldTypeMapContainer > message(say_worker);
|
||||
cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL));
|
||||
}
|
||||
|
||||
void WorldObject::MonsterYell(int32 textId, uint32 language, WorldObject const* target)
|
||||
{
|
||||
CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY());
|
||||
|
||||
Cell cell(p);
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::MonsterChatBuilder say_build(this, CHAT_MSG_MONSTER_YELL, textId, language, target);
|
||||
Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), say_do);
|
||||
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
|
||||
cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL));
|
||||
}
|
||||
|
||||
void WorldObject::MonsterTextEmote(const char* text, WorldObject const* target, bool IsBossEmote)
|
||||
{
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, LANG_UNIVERSAL,
|
||||
this, target, text);
|
||||
SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true);
|
||||
}
|
||||
|
||||
void WorldObject::MonsterTextEmote(int32 textId, WorldObject const* target, bool IsBossEmote)
|
||||
{
|
||||
CellCoord p = Trinity::ComputeCellCoord(GetPositionX(), GetPositionY());
|
||||
|
||||
Cell cell(p);
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::MonsterChatBuilder say_build(this, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, textId, LANG_UNIVERSAL, target);
|
||||
Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), say_do);
|
||||
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
|
||||
cell.Visit(p, message, *GetMap(), *this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE));
|
||||
}
|
||||
|
||||
void WorldObject::MonsterWhisper(const char* text, Player const* target, bool IsBossWhisper)
|
||||
{
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
LocaleConstant loc_idx = target->GetSession()->GetSessionDbLocaleIndex();
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, text, 0, "", loc_idx);
|
||||
target->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldObject::MonsterWhisper(int32 textId, Player const* target, bool IsBossWhisper)
|
||||
{
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
uint8 gender = GENDER_MALE;
|
||||
if (Unit const* unit = ToUnit())
|
||||
gender = unit->getGender();
|
||||
|
||||
LocaleConstant loc_idx = target->GetSession()->GetSessionDbLocaleIndex();
|
||||
BroadcastText const* broadcastText = sObjectMgr->GetBroadcastText(textId);
|
||||
std::string text = broadcastText->GetText(loc_idx, gender);
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, text.c_str(), 0, "", loc_idx);
|
||||
|
||||
target->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Unit::BuildHeartBeatMsg(WorldPacket* data) const
|
||||
{
|
||||
data->Initialize(MSG_MOVE_HEARTBEAT, 32);
|
||||
|
||||
@@ -652,15 +652,6 @@ class WorldObject : public Object, public WorldLocation
|
||||
|
||||
virtual uint8 getLevelForTarget(WorldObject const* /*target*/) const { return 1; }
|
||||
|
||||
void MonsterSay(const char* text, uint32 language, WorldObject const* target);
|
||||
void MonsterYell(const char* text, uint32 language, WorldObject const* target);
|
||||
void MonsterTextEmote(const char* text, WorldObject const* target, bool IsBossEmote = false);
|
||||
void MonsterWhisper(const char* text, Player const* target, bool IsBossWhisper = false);
|
||||
void MonsterSay(int32 textId, uint32 language, WorldObject const* target);
|
||||
void MonsterYell(int32 textId, uint32 language, WorldObject const* target);
|
||||
void MonsterTextEmote(int32 textId, WorldObject const* target, bool IsBossEmote = false);
|
||||
void MonsterWhisper(int32 textId, Player const* target, bool IsBossWhisper = false);
|
||||
|
||||
void PlayDistanceSound(uint32 sound_id, Player* target = NULL);
|
||||
void PlayDirectSound(uint32 sound_id, Player* target = NULL);
|
||||
|
||||
@@ -683,9 +674,6 @@ class WorldObject : public Object, public WorldLocation
|
||||
FlaggedValuesArray32<int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES> m_serverSideVisibility;
|
||||
FlaggedValuesArray32<int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES> m_serverSideVisibilityDetect;
|
||||
|
||||
// Low Level Packets
|
||||
void SendPlaySound(uint32 Sound, bool OnlySelf);
|
||||
|
||||
virtual void SetMap(Map* map);
|
||||
virtual void ResetMap();
|
||||
Map* GetMap() const { ASSERT(m_currMap); return m_currMap; }
|
||||
|
||||
@@ -20528,27 +20528,27 @@ void Player::StopCastingCharm()
|
||||
}
|
||||
}
|
||||
|
||||
void Player::Say(const std::string& text, const uint32 language)
|
||||
void Player::Say(std::string const& text, Language language, WorldObject const* /*= nullptr*/)
|
||||
{
|
||||
std::string _text(text);
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_SAY, language, _text);
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_SAY, Language(language), this, this, _text);
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_SAY, language, this, this, _text);
|
||||
SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), true);
|
||||
}
|
||||
|
||||
void Player::Yell(const std::string& text, const uint32 language)
|
||||
void Player::Yell(std::string const& text, Language language, WorldObject const* /*= nullptr*/)
|
||||
{
|
||||
std::string _text(text);
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_YELL, language, _text);
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_YELL, Language(language), this, this, _text);
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_YELL, language, this, this, _text);
|
||||
SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), true);
|
||||
}
|
||||
|
||||
void Player::TextEmote(const std::string& text)
|
||||
void Player::TextEmote(std::string const& text, WorldObject const* /*= nullptr*/, bool /*= false*/)
|
||||
{
|
||||
std::string _text(text);
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text);
|
||||
@@ -20558,40 +20558,40 @@ void Player::TextEmote(const std::string& text)
|
||||
SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHAT));
|
||||
}
|
||||
|
||||
void Player::Whisper(const std::string& text, uint32 language, uint64 receiver)
|
||||
void Player::Whisper(std::string const& text, Language language, Player* target, bool /*= false*/)
|
||||
{
|
||||
ASSERT(target);
|
||||
|
||||
bool isAddonMessage = language == LANG_ADDON;
|
||||
|
||||
if (!isAddonMessage) // if not addon data
|
||||
language = LANG_UNIVERSAL; // whispers should always be readable
|
||||
|
||||
Player* rPlayer = ObjectAccessor::FindPlayer(receiver);
|
||||
|
||||
std::string _text(text);
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, rPlayer);
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, target);
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, Language(language), this, this, _text);
|
||||
rPlayer->GetSession()->SendPacket(&data);
|
||||
target->GetSession()->SendPacket(&data);
|
||||
|
||||
// rest stuff shouldn't happen in case of addon message
|
||||
if (isAddonMessage)
|
||||
return;
|
||||
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER_INFORM, Language(language), rPlayer, rPlayer, _text);
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER_INFORM, Language(language), target, target, _text);
|
||||
GetSession()->SendPacket(&data);
|
||||
|
||||
if (!isAcceptWhispers() && !IsGameMaster() && !rPlayer->IsGameMaster())
|
||||
if (!isAcceptWhispers() && !IsGameMaster() && !target->IsGameMaster())
|
||||
{
|
||||
SetAcceptWhispers(true);
|
||||
ChatHandler(GetSession()).SendSysMessage(LANG_COMMAND_WHISPERON);
|
||||
}
|
||||
|
||||
// announce afk or dnd message
|
||||
if (rPlayer->isAFK())
|
||||
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());
|
||||
if (target->isAFK())
|
||||
ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_AFK, target->GetName().c_str(), target->autoReplyMsg.c_str());
|
||||
else if (target->isDND())
|
||||
ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_DND, target->GetName().c_str(), target->autoReplyMsg.c_str());
|
||||
}
|
||||
|
||||
Item* Player::GetMItem(uint32 id)
|
||||
|
||||
@@ -1215,13 +1215,13 @@ class Player : public Unit, public GridObject<Player>
|
||||
uint32 GetPhaseMaskForSpawn() const; // used for proper set phase for DB at GM-mode creature/GO spawn
|
||||
|
||||
/// Handles said message in regular chat based on declared language and in config pre-defined Range.
|
||||
void Say(std::string const& text, const uint32 language);
|
||||
void Say(std::string const& text, Language language, WorldObject const* = nullptr) override;
|
||||
/// Handles yelled message in regular chat based on declared language and in config pre-defined Range.
|
||||
void Yell(std::string const& text, const uint32 language);
|
||||
void Yell(std::string const& text, Language language, WorldObject const* = nullptr) override;
|
||||
/// Outputs an universal text which is supposed to be an action.
|
||||
void TextEmote(std::string const& text);
|
||||
void TextEmote(std::string const& text, WorldObject const* = nullptr, bool = false) override;
|
||||
/// Handles whispers from Addons and players based on sender, receiver's guid and language.
|
||||
void Whisper(std::string const& text, const uint32 language, uint64 receiver);
|
||||
void Whisper(std::string const& text, Language language, Player* receiver, bool = false) override;
|
||||
|
||||
/*********************************************************/
|
||||
/*** STORAGE SYSTEM ***/
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundScore.h"
|
||||
#include "CellImpl.h"
|
||||
#include "ChatTextBuilder.h"
|
||||
#include "ConditionMgr.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "CreatureAIImpl.h"
|
||||
@@ -8132,7 +8133,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
||||
if (triggerEntry == NULL)
|
||||
{
|
||||
// Don't cast unknown spell
|
||||
// TC_LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell %u has 0 in EffectTriggered[%d]. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex());
|
||||
TC_LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell %u (effIndex: %u) has unknown TriggerSpell %u. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex(), trigger_spell_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -17840,3 +17841,84 @@ bool Unit::IsHighestExclusiveAura(Aura const* aura, bool removeOtherAuraApplicat
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Unit::Talk(std::string const& text, ChatMsg msgType, Language language, float textRange, WorldObject const* target)
|
||||
{
|
||||
Trinity::CustomChatTextBuilder builder(this, msgType, text, language, target);
|
||||
Trinity::LocalizedPacketDo<Trinity::CustomChatTextBuilder> localizer(builder);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::CustomChatTextBuilder> > worker(this, textRange, localizer);
|
||||
VisitNearbyWorldObject(textRange, worker);
|
||||
}
|
||||
|
||||
void Unit::Say(std::string const& text, Language language, WorldObject const* target /*= nullptr*/)
|
||||
{
|
||||
Talk(text, CHAT_MSG_MONSTER_SAY, language, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), target);
|
||||
}
|
||||
|
||||
void Unit::Yell(std::string const& text, Language language, WorldObject const* target /*= nullptr*/)
|
||||
{
|
||||
Talk(text, CHAT_MSG_MONSTER_YELL, language, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), target);
|
||||
}
|
||||
|
||||
void Unit::TextEmote(std::string const& text, WorldObject const* target /*= nullptr*/, bool isBossEmote /*= false*/)
|
||||
{
|
||||
Talk(text, isBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, LANG_UNIVERSAL, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
|
||||
}
|
||||
|
||||
void Unit::Whisper(std::string const& text, Language language, Player* target, bool isBossWhisper /*= false*/)
|
||||
{
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
LocaleConstant locale = target->GetSession()->GetSessionDbLocaleIndex();
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, language, this, target, text, 0, "", locale);
|
||||
target->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
void Unit::Talk(uint32 textId, ChatMsg msgType, float textRange, WorldObject const* target)
|
||||
{
|
||||
if (!sObjectMgr->GetBroadcastText(textId))
|
||||
{
|
||||
TC_LOG_ERROR("entities.unit", "WorldObject::MonsterText: `broadcast_text` was not %u found", textId);
|
||||
return;
|
||||
}
|
||||
|
||||
Trinity::BroadcastTextBuilder builder(this, msgType, textId, target);
|
||||
Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> localizer(builder);
|
||||
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> > worker(this, textRange, localizer);
|
||||
VisitNearbyWorldObject(textRange, worker);
|
||||
}
|
||||
|
||||
void Unit::Say(uint32 textId, WorldObject const* target /*= nullptr*/)
|
||||
{
|
||||
Talk(textId, CHAT_MSG_MONSTER_SAY, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), target);
|
||||
}
|
||||
|
||||
void Unit::Yell(uint32 textId, WorldObject const* target /*= nullptr*/)
|
||||
{
|
||||
Talk(textId, CHAT_MSG_MONSTER_YELL, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), target);
|
||||
}
|
||||
|
||||
void Unit::TextEmote(uint32 textId, WorldObject const* target /*= nullptr*/, bool isBossEmote /*= false*/)
|
||||
{
|
||||
Talk(textId, isBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
|
||||
}
|
||||
|
||||
void Unit::Whisper(uint32 textId, Player* target, bool isBossWhisper /*= false*/)
|
||||
{
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
BroadcastText const* bct = sObjectMgr->GetBroadcastText(textId);
|
||||
if (!bct)
|
||||
{
|
||||
TC_LOG_ERROR("entities.unit", "WorldObject::MonsterWhisper: `broadcast_text` was not %u found", textId);
|
||||
return;
|
||||
}
|
||||
|
||||
LocaleConstant locale = target->GetSession()->GetSessionDbLocaleIndex();
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, bct->GetText(locale, getGender()), 0, "", locale);
|
||||
target->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
@@ -2158,6 +2158,17 @@ class Unit : public WorldObject
|
||||
int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const* aurEff, AuraType auraType, bool checkMiscValue = false, int32 miscValue = 0) const;
|
||||
bool IsHighestExclusiveAura(Aura const* aura, bool removeOtherAuraApplications = false);
|
||||
|
||||
virtual void Talk(std::string const& text, ChatMsg msgType, Language language, float textRange, WorldObject const* target);
|
||||
virtual void Say(std::string const& text, Language language, WorldObject const* target = nullptr);
|
||||
virtual void Yell(std::string const& text, Language language, WorldObject const* target = nullptr);
|
||||
virtual void TextEmote(std::string const& text, WorldObject const* target = nullptr, bool isBossEmote = false);
|
||||
virtual void Whisper(std::string const& text, Language language, Player* target, bool isBossWhisper = false);
|
||||
void Talk(uint32 textId, ChatMsg msgType, float textRange, WorldObject const* target);
|
||||
void Say(uint32 textId, WorldObject const* target = nullptr);
|
||||
void Yell(uint32 textId, WorldObject const* target = nullptr);
|
||||
void TextEmote(uint32 textId, WorldObject const* target = nullptr, bool isBossEmote = false);
|
||||
void Whisper(uint32 textId, Player* target, bool isBossWhisper = false);
|
||||
|
||||
protected:
|
||||
explicit Unit (bool isWorldObject);
|
||||
|
||||
|
||||
@@ -4602,7 +4602,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
|
||||
tableName.c_str(), tmp.Talk.ChatType, tmp.id);
|
||||
continue;
|
||||
}
|
||||
if (!tmp.Talk.TextID)
|
||||
if (!sObjectMgr->GetBroadcastText(uint32(tmp.Talk.TextID)))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u",
|
||||
tableName.c_str(), tmp.Talk.TextID, tmp.id);
|
||||
|
||||
@@ -254,11 +254,11 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
if (type == CHAT_MSG_SAY)
|
||||
sender->Say(msg, lang);
|
||||
sender->Say(msg, Language(lang));
|
||||
else if (type == CHAT_MSG_EMOTE)
|
||||
sender->TextEmote(msg);
|
||||
else if (type == CHAT_MSG_YELL)
|
||||
sender->Yell(msg, lang);
|
||||
sender->Yell(msg, Language(lang));
|
||||
} break;
|
||||
case CHAT_MSG_WHISPER:
|
||||
{
|
||||
@@ -298,7 +298,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
(HasPermission(rbac::RBAC_PERM_CAN_FILTER_WHISPERS) && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID())))
|
||||
sender->AddWhisperWhiteList(receiver->GetGUID());
|
||||
|
||||
GetPlayer()->Whisper(msg, lang, receiver->GetGUID());
|
||||
GetPlayer()->Whisper(msg, Language(lang), receiver);
|
||||
} break;
|
||||
case CHAT_MSG_PARTY:
|
||||
case CHAT_MSG_PARTY_LEADER:
|
||||
|
||||
@@ -373,84 +373,49 @@ void Map::ScriptsProcess()
|
||||
switch (step.script->command)
|
||||
{
|
||||
case SCRIPT_COMMAND_TALK:
|
||||
{
|
||||
if (step.script->Talk.ChatType > CHAT_TYPE_WHISPER && step.script->Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER)
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType);
|
||||
break;
|
||||
}
|
||||
if (step.script->Talk.Flags & SF_TALK_USE_PLAYER)
|
||||
{
|
||||
if (Player* player = _GetScriptPlayerSourceOrTarget(source, target, step.script))
|
||||
{
|
||||
LocaleConstant loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
|
||||
BroadcastText const* broadcastText = sObjectMgr->GetBroadcastText(step.script->Talk.TextID);
|
||||
std::string text = broadcastText->GetText(loc_idx, player->getGender());
|
||||
Unit* source = nullptr;
|
||||
|
||||
switch (step.script->Talk.ChatType)
|
||||
{
|
||||
case CHAT_TYPE_SAY:
|
||||
player->Say(text, LANG_UNIVERSAL);
|
||||
break;
|
||||
case CHAT_TYPE_YELL:
|
||||
player->Yell(text, LANG_UNIVERSAL);
|
||||
break;
|
||||
case CHAT_TYPE_TEXT_EMOTE:
|
||||
case CHAT_TYPE_BOSS_EMOTE:
|
||||
player->TextEmote(text);
|
||||
break;
|
||||
case CHAT_TYPE_WHISPER:
|
||||
case CHAT_MSG_RAID_BOSS_WHISPER:
|
||||
{
|
||||
uint64 targetGUID = target ? target->GetGUID() : 0;
|
||||
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
|
||||
TC_LOG_ERROR("scripts", "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
|
||||
else
|
||||
player->Whisper(text, LANG_UNIVERSAL, targetGUID);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break; // must be already checked at load
|
||||
}
|
||||
}
|
||||
}
|
||||
if (step.script->Talk.Flags & SF_TALK_USE_PLAYER)
|
||||
source = _GetScriptPlayerSourceOrTarget(source, target, step.script);
|
||||
else
|
||||
source = _GetScriptCreatureSourceOrTarget(source, target, step.script);
|
||||
|
||||
if (source)
|
||||
{
|
||||
// Source or target must be Creature.
|
||||
if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script))
|
||||
switch (step.script->Talk.ChatType)
|
||||
{
|
||||
uint64 targetGUID = target ? target->GetGUID() : 0;
|
||||
switch (step.script->Talk.ChatType)
|
||||
case CHAT_TYPE_SAY:
|
||||
source->Say(step.script->Talk.TextID, target);
|
||||
break;
|
||||
case CHAT_TYPE_YELL:
|
||||
source->Yell(step.script->Talk.TextID, target);
|
||||
break;
|
||||
case CHAT_TYPE_TEXT_EMOTE:
|
||||
case CHAT_TYPE_BOSS_EMOTE:
|
||||
source->TextEmote(step.script->Talk.TextID, target, step.script->Talk.ChatType == CHAT_TYPE_BOSS_EMOTE);
|
||||
break;
|
||||
case CHAT_TYPE_WHISPER:
|
||||
case CHAT_MSG_RAID_BOSS_WHISPER:
|
||||
{
|
||||
case CHAT_TYPE_SAY:
|
||||
cSource->MonsterSay(step.script->Talk.TextID, LANG_UNIVERSAL, target);
|
||||
break;
|
||||
case CHAT_TYPE_YELL:
|
||||
cSource->MonsterYell(step.script->Talk.TextID, LANG_UNIVERSAL, target);
|
||||
break;
|
||||
case CHAT_TYPE_TEXT_EMOTE:
|
||||
cSource->MonsterTextEmote(step.script->Talk.TextID, target);
|
||||
break;
|
||||
case CHAT_TYPE_BOSS_EMOTE:
|
||||
cSource->MonsterTextEmote(step.script->Talk.TextID, target, true);
|
||||
break;
|
||||
case CHAT_TYPE_WHISPER:
|
||||
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
|
||||
TC_LOG_ERROR("scripts", "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
|
||||
else
|
||||
cSource->MonsterWhisper(step.script->Talk.TextID, target->ToPlayer());
|
||||
break;
|
||||
case CHAT_MSG_RAID_BOSS_WHISPER:
|
||||
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
|
||||
TC_LOG_ERROR("scripts", "%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
|
||||
else
|
||||
cSource->MonsterWhisper(step.script->Talk.TextID, target->ToPlayer(), true);
|
||||
break;
|
||||
default:
|
||||
break; // must be already checked at load
|
||||
Player* receiver = target ? target->ToPlayer() : nullptr;
|
||||
if (!receiver)
|
||||
TC_LOG_ERROR("scripts", "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
|
||||
else
|
||||
source->Whisper(step.script->Talk.TextID, receiver, step.script->Talk.ChatType == CHAT_MSG_RAID_BOSS_WHISPER);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break; // must be already checked at load
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCRIPT_COMMAND_EMOTE:
|
||||
// Source or target must be Creature.
|
||||
|
||||
@@ -3798,7 +3798,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
|
||||
if (m_caster->getGender() > 0)
|
||||
gender = "her";
|
||||
sprintf(buf, "%s rubs %s [Decahedral Dwarven Dice] between %s hands and rolls. One %u and one %u.", m_caster->GetName().c_str(), gender, gender, urand(1, 10), urand(1, 10));
|
||||
m_caster->MonsterTextEmote(buf, NULL);
|
||||
m_caster->TextEmote(buf);
|
||||
break;
|
||||
}
|
||||
// Roll 'dem Bones - Worn Troll Dice
|
||||
@@ -3809,7 +3809,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
|
||||
if (m_caster->getGender() > 0)
|
||||
gender = "her";
|
||||
sprintf(buf, "%s causually tosses %s [Worn Troll Dice]. One %u and one %u.", m_caster->GetName().c_str(), gender, urand(1, 6), urand(1, 6));
|
||||
m_caster->MonsterTextEmote(buf, NULL);
|
||||
m_caster->TextEmote(buf);
|
||||
break;
|
||||
}
|
||||
// Death Knight Initiate Visual
|
||||
@@ -5783,14 +5783,18 @@ void Spell::EffectPlaySound(SpellEffIndex effIndex)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
Player* player = unitTarget->ToPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
switch (m_spellInfo->Id)
|
||||
{
|
||||
case 58730: // Restricted Flight Area
|
||||
case 58600: // Restricted Flight Area
|
||||
unitTarget->ToPlayer()->GetSession()->SendNotification(LANG_ZONE_NOFLYZONE);
|
||||
player->GetSession()->SendNotification(LANG_ZONE_NOFLYZONE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -5804,9 +5808,7 @@ void Spell::EffectPlaySound(SpellEffIndex effIndex)
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << uint32(soundId);
|
||||
unitTarget->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
player->PlayDirectSound(soundId, player);
|
||||
}
|
||||
|
||||
void Spell::EffectRemoveAura(SpellEffIndex effIndex)
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CHATTEXT_BUILDER_H
|
||||
#define __CHATTEXT_BUILDER_H
|
||||
|
||||
#include "Chat.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
||||
namespace Trinity
|
||||
{
|
||||
class BroadcastTextBuilder
|
||||
{
|
||||
public:
|
||||
BroadcastTextBuilder(Unit const* obj, ChatMsg msgType, uint32 textId, WorldObject const* target = nullptr, uint32 achievementId = 0)
|
||||
: _source(obj), _msgType(msgType), _textId(textId), _target(target), _achievementId(achievementId) { }
|
||||
|
||||
void operator()(WorldPacket& data, LocaleConstant locale)
|
||||
{
|
||||
BroadcastText const* bct = sObjectMgr->GetBroadcastText(_textId);
|
||||
ChatHandler::BuildChatPacket(data, _msgType, bct ? Language(bct->Language) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _source->getGender()) : "", _achievementId, "", locale);
|
||||
}
|
||||
|
||||
size_t operator()(WorldPacket* data, LocaleConstant locale) const
|
||||
{
|
||||
BroadcastText const* bct = sObjectMgr->GetBroadcastText(_textId);
|
||||
return ChatHandler::BuildChatPacket(*data, _msgType, bct ? Language(bct->Language) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _source->getGender()) : "", _achievementId, "", locale);
|
||||
}
|
||||
|
||||
private:
|
||||
Unit const* _source;
|
||||
ChatMsg _msgType;
|
||||
uint32 _textId;
|
||||
WorldObject const* _target;
|
||||
uint32 _achievementId;
|
||||
};
|
||||
|
||||
class CustomChatTextBuilder
|
||||
{
|
||||
public:
|
||||
CustomChatTextBuilder(WorldObject const* obj, ChatMsg msgType, std::string const& text, Language language = LANG_UNIVERSAL, WorldObject const* target = nullptr)
|
||||
: _source(obj), _msgType(msgType), _text(text), _language(language), _target(target) { }
|
||||
|
||||
void operator()(WorldPacket& data, LocaleConstant locale)
|
||||
{
|
||||
ChatHandler::BuildChatPacket(data, _msgType, _language, _source, _target, _text, 0, "", locale);
|
||||
}
|
||||
|
||||
private:
|
||||
WorldObject const* _source;
|
||||
ChatMsg _msgType;
|
||||
std::string _text;
|
||||
Language _language;
|
||||
WorldObject const* _target;
|
||||
};
|
||||
}
|
||||
// namespace Trinity
|
||||
|
||||
#endif // __CHATTEXT_BUILDER_H
|
||||
@@ -2266,7 +2266,7 @@ public:
|
||||
// Get the args that we might have (up to 2)
|
||||
char const* arg1 = strtok((char*)args, " ");
|
||||
char const* arg2 = strtok(NULL, " ");
|
||||
|
||||
|
||||
// Analyze them to see if we got either a playerName or duration or both
|
||||
if (arg1)
|
||||
{
|
||||
@@ -2452,7 +2452,7 @@ public:
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << uint32(soundId) << handler->GetSession()->GetPlayer()->GetGUID();
|
||||
data << uint32(soundId);
|
||||
sWorld->SendGlobalMessage(&data);
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId);
|
||||
|
||||
@@ -1222,7 +1222,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
creature->MonsterSay(args, LANG_UNIVERSAL, NULL);
|
||||
creature->Say(args, LANG_UNIVERSAL);
|
||||
|
||||
// make some emotes
|
||||
char lastchar = args[strlen(args) - 1];
|
||||
@@ -1251,7 +1251,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
creature->MonsterTextEmote(args, 0);
|
||||
creature->TextEmote(args);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1328,7 +1328,7 @@ public:
|
||||
if (handler->HasLowerSecurity(receiver, 0))
|
||||
return false;
|
||||
|
||||
creature->MonsterWhisper(text, receiver);
|
||||
creature->Whisper(text, LANG_UNIVERSAL, receiver);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1349,7 +1349,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
creature->MonsterYell(args, LANG_UNIVERSAL, NULL);
|
||||
creature->Yell(args, LANG_UNIVERSAL);
|
||||
|
||||
// make an emote
|
||||
creature->HandleEmoteCommand(EMOTE_ONESHOT_SHOUT);
|
||||
|
||||
@@ -214,7 +214,7 @@ public:
|
||||
target->LoadPath(pathid);
|
||||
target->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
|
||||
target->GetMotionMaster()->Initialize();
|
||||
target->MonsterSay("Path loaded.", LANG_UNIVERSAL, NULL);
|
||||
target->Say("Path loaded.", LANG_UNIVERSAL);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -267,7 +267,7 @@ public:
|
||||
target->SetDefaultMovementType(IDLE_MOTION_TYPE);
|
||||
target->GetMotionMaster()->MoveTargetedHome();
|
||||
target->GetMotionMaster()->Initialize();
|
||||
target->MonsterSay("Path unloaded.", LANG_UNIVERSAL, NULL);
|
||||
target->Say("Path unloaded.", LANG_UNIVERSAL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ EndScriptData */
|
||||
#include "deadmines.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Opcodes.h"
|
||||
|
||||
enum Sounds
|
||||
{
|
||||
@@ -101,9 +100,9 @@ class instance_deadmines : public InstanceMapScript
|
||||
case CANNON_GUNPOWDER_USED:
|
||||
CannonBlast_Timer = DATA_CANNON_BLAST_TIMER;
|
||||
// it's a hack - Mr. Smite should do that but his too far away
|
||||
pIronCladDoor->SetName("Mr. Smite");
|
||||
pIronCladDoor->MonsterYell(SAY_MR_SMITE_ALARM1, LANG_UNIVERSAL, NULL);
|
||||
DoPlaySound(pIronCladDoor, SOUND_MR_SMITE_ALARM1);
|
||||
//pIronCladDoor->SetName("Mr. Smite");
|
||||
//pIronCladDoor->MonsterYell(SAY_MR_SMITE_ALARM1, LANG_UNIVERSAL, NULL);
|
||||
pIronCladDoor->PlayDirectSound(SOUND_MR_SMITE_ALARM1);
|
||||
State = CANNON_BLAST_INITIATED;
|
||||
break;
|
||||
case CANNON_BLAST_INITIATED:
|
||||
@@ -114,8 +113,8 @@ class instance_deadmines : public InstanceMapScript
|
||||
ShootCannon();
|
||||
BlastOutDoor();
|
||||
LeverStucked();
|
||||
pIronCladDoor->MonsterYell(SAY_MR_SMITE_ALARM2, LANG_UNIVERSAL, NULL);
|
||||
DoPlaySound(pIronCladDoor, SOUND_MR_SMITE_ALARM2);
|
||||
//pIronCladDoor->MonsterYell(SAY_MR_SMITE_ALARM2, LANG_UNIVERSAL, NULL);
|
||||
pIronCladDoor->PlayDirectSound(SOUND_MR_SMITE_ALARM2);
|
||||
State = PIRATES_ATTACK;
|
||||
} else CannonBlast_Timer -= diff;
|
||||
break;
|
||||
@@ -170,7 +169,7 @@ class instance_deadmines : public InstanceMapScript
|
||||
if (GameObject* pDefiasCannon = instance->GetGameObject(DefiasCannonGUID))
|
||||
{
|
||||
pDefiasCannon->SetGoState(GO_STATE_ACTIVE);
|
||||
DoPlaySound(pDefiasCannon, SOUND_CANNONFIRE);
|
||||
pDefiasCannon->PlayDirectSound(SOUND_CANNONFIRE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +178,7 @@ class instance_deadmines : public InstanceMapScript
|
||||
if (GameObject* pIronCladDoor = instance->GetGameObject(IronCladDoorGUID))
|
||||
{
|
||||
pIronCladDoor->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
|
||||
DoPlaySound(pIronCladDoor, SOUND_DESTROYDOOR);
|
||||
pIronCladDoor->PlayDirectSound(SOUND_DESTROYDOOR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,13 +237,6 @@ class instance_deadmines : public InstanceMapScript
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DoPlaySound(GameObject* unit, uint32 sound)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << uint32(sound);
|
||||
unit->SendMessageToSet(&data, false);
|
||||
}
|
||||
};
|
||||
|
||||
InstanceScript* GetInstanceScript(InstanceMap* map) const override
|
||||
|
||||
@@ -560,25 +560,25 @@ public:
|
||||
{
|
||||
case 0: return 9999999;
|
||||
case 1:
|
||||
me->MonsterYell(SAY_DIALOG_MEDIVH_1, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(SAY_DIALOG_MEDIVH_1, LANG_UNIVERSAL);
|
||||
return 10000;
|
||||
case 2:
|
||||
if (arca)
|
||||
arca->MonsterYell(SAY_DIALOG_ARCANAGOS_2, LANG_UNIVERSAL, NULL);
|
||||
arca->Yell(SAY_DIALOG_ARCANAGOS_2, LANG_UNIVERSAL);
|
||||
return 20000;
|
||||
case 3:
|
||||
me->MonsterYell(SAY_DIALOG_MEDIVH_3, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(SAY_DIALOG_MEDIVH_3, LANG_UNIVERSAL);
|
||||
return 10000;
|
||||
case 4:
|
||||
if (arca)
|
||||
arca->MonsterYell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, NULL);
|
||||
arca->Yell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL);
|
||||
return 20000;
|
||||
case 5:
|
||||
me->MonsterYell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL);
|
||||
return 20000;
|
||||
case 6:
|
||||
if (arca)
|
||||
arca->MonsterYell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, NULL);
|
||||
arca->Yell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL);
|
||||
return 10000;
|
||||
case 7:
|
||||
FireArcanagosTimer = 500;
|
||||
@@ -588,7 +588,7 @@ public:
|
||||
DoCast(me, SPELL_MANA_SHIELD);
|
||||
return 10000;
|
||||
case 9:
|
||||
me->MonsterTextEmote(EMOTE_DIALOG_MEDIVH_7, NULL, false);
|
||||
me->TextEmote(EMOTE_DIALOG_MEDIVH_7);
|
||||
return 10000;
|
||||
case 10:
|
||||
if (arca)
|
||||
@@ -596,7 +596,7 @@ public:
|
||||
return 1000;
|
||||
case 11:
|
||||
if (arca)
|
||||
arca->MonsterYell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, NULL);
|
||||
arca->Yell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL);
|
||||
return 5000;
|
||||
case 12:
|
||||
if (arca)
|
||||
@@ -608,7 +608,7 @@ public:
|
||||
}
|
||||
return 10000;
|
||||
case 13:
|
||||
me->MonsterYell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL);
|
||||
return 10000;
|
||||
case 14:
|
||||
me->SetVisible(false);
|
||||
|
||||
@@ -352,7 +352,7 @@ public:
|
||||
Creature* speaker = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 1000);
|
||||
if (speaker)
|
||||
speaker->CastSpell(speaker, SPELL_HEAD_SPEAKS, false);
|
||||
me->MonsterTextEmote(EMOTE_LAUGHS, NULL);
|
||||
me->TextEmote(EMOTE_LAUGHS);
|
||||
}
|
||||
else laugh -= diff;
|
||||
}
|
||||
@@ -670,14 +670,14 @@ public:
|
||||
if (count < 3)
|
||||
{
|
||||
if (player)
|
||||
player->Say(Text[count], 0);
|
||||
player->Say(Text[count], LANG_UNIVERSAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoCast(me, SPELL_RHYME_BIG);
|
||||
if (player)
|
||||
{
|
||||
player->Say(Text[count], 0);
|
||||
player->Say(Text[count], LANG_UNIVERSAL);
|
||||
player->HandleEmoteCommand(ANIM_EMOTE_SHOUT);
|
||||
}
|
||||
wp_reached = true;
|
||||
@@ -735,7 +735,7 @@ public:
|
||||
if (laugh <= diff)
|
||||
{
|
||||
laugh = urand(11000, 22000);
|
||||
me->MonsterTextEmote(EMOTE_LAUGHS, NULL);
|
||||
me->TextEmote(EMOTE_LAUGHS);
|
||||
DoPlaySoundToSet(me, RandomLaugh[rand32() % 3]);
|
||||
}
|
||||
else laugh -= diff;
|
||||
|
||||
@@ -769,7 +769,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
me->MonsterTextEmote(EMOTE_UNABLE_TO_FIND, NULL);
|
||||
me->TextEmote(EMOTE_UNABLE_TO_FIND);
|
||||
EnterEvadeMode();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ class boss_hexlord_malacrass : public CreatureScript
|
||||
instance->SetData(DATA_HEXLORDEVENT, IN_PROGRESS);
|
||||
|
||||
DoZoneInCombat();
|
||||
me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_AGGRO, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_AGGRO);
|
||||
|
||||
for (uint8 i = 0; i < 4; ++i)
|
||||
@@ -327,11 +327,11 @@ class boss_hexlord_malacrass : public CreatureScript
|
||||
switch (urand(0, 1))
|
||||
{
|
||||
case 0:
|
||||
me->MonsterYell(YELL_KILL_ONE, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_KILL_ONE, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_KILL_ONE);
|
||||
break;
|
||||
case 1:
|
||||
me->MonsterYell(YELL_KILL_TWO, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_KILL_TWO, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_KILL_TWO);
|
||||
break;
|
||||
}
|
||||
@@ -341,7 +341,7 @@ class boss_hexlord_malacrass : public CreatureScript
|
||||
{
|
||||
instance->SetData(DATA_HEXLORDEVENT, DONE);
|
||||
|
||||
me->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_DEATH, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_DEATH);
|
||||
|
||||
for (uint8 i = 0; i < 4; ++i)
|
||||
@@ -415,7 +415,7 @@ class boss_hexlord_malacrass : public CreatureScript
|
||||
if (DrainPower_Timer <= diff)
|
||||
{
|
||||
DoCast(me, SPELL_DRAIN_POWER, true);
|
||||
me->MonsterYell(YELL_DRAIN_POWER, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_DRAIN_POWER, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_DRAIN_POWER);
|
||||
DrainPower_Timer = urand(40000, 55000); // must cast in 60 sec, or buff/debuff will disappear
|
||||
} else DrainPower_Timer -= diff;
|
||||
@@ -427,7 +427,7 @@ class boss_hexlord_malacrass : public CreatureScript
|
||||
else
|
||||
{
|
||||
DoCast(me, SPELL_SPIRIT_BOLTS, false);
|
||||
me->MonsterYell(YELL_SPIRIT_BOLTS, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_SPIRIT_BOLTS, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_SPIRIT_BOLTS);
|
||||
SpiritBolts_Timer = 40000;
|
||||
SiphonSoul_Timer = 10000; // ready to drain
|
||||
|
||||
@@ -227,7 +227,7 @@ class boss_nalorakk : public CreatureScript
|
||||
case 0:
|
||||
if (me->IsWithinDistInMap(who, 50))
|
||||
{
|
||||
me->MonsterYell(YELL_NALORAKK_WAVE1, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_NALORAKK_WAVE1, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE1);
|
||||
|
||||
(*me).GetMotionMaster()->MovePoint(1, NalorakkWay[1][0], NalorakkWay[1][1], NalorakkWay[1][2]);
|
||||
@@ -240,7 +240,7 @@ class boss_nalorakk : public CreatureScript
|
||||
case 2:
|
||||
if (me->IsWithinDistInMap(who, 40))
|
||||
{
|
||||
me->MonsterYell(YELL_NALORAKK_WAVE2, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_NALORAKK_WAVE2, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE2);
|
||||
|
||||
(*me).GetMotionMaster()->MovePoint(3, NalorakkWay[3][0], NalorakkWay[3][1], NalorakkWay[3][2]);
|
||||
@@ -253,7 +253,7 @@ class boss_nalorakk : public CreatureScript
|
||||
case 5:
|
||||
if (me->IsWithinDistInMap(who, 40))
|
||||
{
|
||||
me->MonsterYell(YELL_NALORAKK_WAVE3, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_NALORAKK_WAVE3, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE3);
|
||||
|
||||
(*me).GetMotionMaster()->MovePoint(6, NalorakkWay[6][0], NalorakkWay[6][1], NalorakkWay[6][2]);
|
||||
@@ -268,7 +268,7 @@ class boss_nalorakk : public CreatureScript
|
||||
{
|
||||
SendAttacker(who);
|
||||
|
||||
me->MonsterYell(YELL_NALORAKK_WAVE4, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_NALORAKK_WAVE4, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_NALORAKK_WAVE4);
|
||||
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
@@ -287,7 +287,7 @@ class boss_nalorakk : public CreatureScript
|
||||
{
|
||||
instance->SetData(DATA_NALORAKKEVENT, IN_PROGRESS);
|
||||
|
||||
me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_AGGRO, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_AGGRO);
|
||||
DoZoneInCombat();
|
||||
}
|
||||
@@ -296,7 +296,7 @@ class boss_nalorakk : public CreatureScript
|
||||
{
|
||||
instance->SetData(DATA_NALORAKKEVENT, DONE);
|
||||
|
||||
me->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_DEATH, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_DEATH);
|
||||
}
|
||||
|
||||
@@ -305,11 +305,11 @@ class boss_nalorakk : public CreatureScript
|
||||
switch (urand(0, 1))
|
||||
{
|
||||
case 0:
|
||||
me->MonsterYell(YELL_KILL_ONE, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_KILL_ONE, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_KILL_ONE);
|
||||
break;
|
||||
case 1:
|
||||
me->MonsterYell(YELL_KILL_TWO, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_KILL_TWO, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_KILL_TWO);
|
||||
break;
|
||||
}
|
||||
@@ -373,7 +373,7 @@ class boss_nalorakk : public CreatureScript
|
||||
if (Berserk_Timer <= diff)
|
||||
{
|
||||
DoCast(me, SPELL_BERSERK, true);
|
||||
me->MonsterYell(YELL_BERSERK, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_BERSERK, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_BERSERK);
|
||||
Berserk_Timer = 600000;
|
||||
} else Berserk_Timer -= diff;
|
||||
@@ -383,7 +383,7 @@ class boss_nalorakk : public CreatureScript
|
||||
if (inBearForm)
|
||||
{
|
||||
// me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 5122);
|
||||
me->MonsterYell(YELL_SHIFTEDTOTROLL, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_SHIFTEDTOTROLL, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_TOTROLL);
|
||||
me->RemoveAurasDueToSpell(SPELL_BEARFORM);
|
||||
Surge_Timer = urand(15000, 20000);
|
||||
@@ -395,7 +395,7 @@ class boss_nalorakk : public CreatureScript
|
||||
else
|
||||
{
|
||||
// me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, 0);
|
||||
me->MonsterYell(YELL_SHIFTEDTOBEAR, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_SHIFTEDTOBEAR, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_TOBEAR);
|
||||
DoCast(me, SPELL_BEARFORM, true);
|
||||
LaceratingSlash_Timer = 2000; // dur 18s
|
||||
@@ -426,7 +426,7 @@ class boss_nalorakk : public CreatureScript
|
||||
|
||||
if (Surge_Timer <= diff)
|
||||
{
|
||||
me->MonsterYell(YELL_SURGE, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_SURGE, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_YELL_SURGE);
|
||||
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 45, true);
|
||||
if (target)
|
||||
|
||||
@@ -280,7 +280,7 @@ public:
|
||||
{
|
||||
case 0:
|
||||
if (WaitTimer == WAIT_SECS)
|
||||
me->MonsterSay(NPCSAY_INIT, LANG_UNIVERSAL, NULL); //no blizzlike
|
||||
me->Say(NPCSAY_INIT, LANG_UNIVERSAL); //no blizzlike
|
||||
|
||||
if (WaitTimer <= diff)
|
||||
{
|
||||
@@ -310,7 +310,7 @@ public:
|
||||
{
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
|
||||
{
|
||||
me->MonsterSay(NPCSAY_END, LANG_UNIVERSAL, NULL); //not blizzlike
|
||||
me->Say(NPCSAY_END, LANG_UNIVERSAL); //not blizzlike
|
||||
player->GroupEventHappens(QUEST_PYREWOOD_AMBUSH, me);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -940,7 +940,7 @@ void hyjalAI::WaypointReached(uint32 waypointId)
|
||||
{
|
||||
if (waypointId == 1 || (waypointId == 0 && me->GetEntry() == THRALL))
|
||||
{
|
||||
me->MonsterYell(YELL_HURRY, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(YELL_HURRY, LANG_UNIVERSAL);
|
||||
WaitForTeleport = true;
|
||||
TeleportTimer = 20000;
|
||||
if (me->GetEntry() == JAINA)
|
||||
|
||||
@@ -29,7 +29,6 @@ EndScriptData */
|
||||
#include "hyjal_trash.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Chat.h"
|
||||
|
||||
/* Battle of Mount Hyjal encounters:
|
||||
@@ -185,15 +184,12 @@ public:
|
||||
|
||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
{
|
||||
if (i->GetSource())
|
||||
if (Player* player = i->GetSource())
|
||||
{
|
||||
WorldPacket packet;
|
||||
ChatHandler::BuildChatPacket(packet, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, unit, i->GetSource(), YELL_EFFORTS);
|
||||
i->GetSource()->GetSession()->SendPacket(&packet);
|
||||
|
||||
WorldPacket data2(SMSG_PLAY_SOUND, 4);
|
||||
data2 << 10986;
|
||||
i->GetSource()->GetSession()->SendPacket(&data2);
|
||||
ChatHandler::BuildChatPacket(packet, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, unit, player, YELL_EFFORTS);
|
||||
player->SendDirectMessage(&packet);
|
||||
player->PlayDirectSound(10986, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
{
|
||||
SetGazeOn(who);
|
||||
/// @todo use a script text
|
||||
me->MonsterTextEmote(EMOTE_NEARBY, NULL, true);
|
||||
me->TextEmote(EMOTE_NEARBY, nullptr, true);
|
||||
}
|
||||
else
|
||||
BossAI::MoveInLineOfSight(who);
|
||||
|
||||
@@ -1564,11 +1564,11 @@ class spell_auto_repair : public SpellScriptLoader
|
||||
if (!vehicle)
|
||||
return;
|
||||
|
||||
Player* driver = vehicle->GetPassenger(0) ? vehicle->GetPassenger(0)->ToPlayer() : NULL;
|
||||
Unit* driver = vehicle->GetPassenger(0);
|
||||
if (!driver)
|
||||
return;
|
||||
|
||||
driver->MonsterTextEmote(EMOTE_REPAIR, driver, true);
|
||||
driver->TextEmote(EMOTE_REPAIR, driver, true);
|
||||
|
||||
InstanceScript* instance = driver->GetInstanceScript();
|
||||
if (!instance)
|
||||
|
||||
@@ -977,15 +977,15 @@ public:
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* player = GetHitUnit()->ToPlayer())
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
switch (GetSpellInfo()->Id)
|
||||
{
|
||||
case SPELL_CORRECT_TRACKS:
|
||||
player->MonsterSay(sObjectMgr->GetTrinityStringForDBCLocale(SAY_CORRECT_TRACKS), LANG_UNIVERSAL, player);
|
||||
target->Say(SAY_CORRECT_TRACKS, target);
|
||||
break;
|
||||
case SPELL_INCORRECT_TRACKS:
|
||||
player->MonsterSay(sObjectMgr->GetTrinityStringForDBCLocale(SAY_INCORRECT_TRACKS), LANG_UNIVERSAL, player);
|
||||
target->Say(SAY_INCORRECT_TRACKS, target);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -31,8 +31,6 @@ EndScriptData */
|
||||
#include "Player.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
#define EMOTE_UNABLE_TO_SUMMON "%s is unable to summon Maiev Shadowsong and enter Phase 4. Resetting Encounter."
|
||||
|
||||
// Other defines
|
||||
#define CENTER_X 676.740f
|
||||
#define CENTER_Y 305.297f
|
||||
@@ -605,7 +603,7 @@ public:
|
||||
if (Conversation[count].emote)
|
||||
creature->HandleEmoteCommand(Conversation[count].emote); // Make the Creature do some animation!
|
||||
if (Conversation[count].text.size())
|
||||
creature->MonsterYell(Conversation[count].text.c_str(), LANG_UNIVERSAL, NULL); // Have the Creature yell out some text
|
||||
creature->Yell(Conversation[count].text.c_str(), LANG_UNIVERSAL); // Have the Creature yell out some text
|
||||
if (Conversation[count].sound)
|
||||
DoPlaySoundToSet(creature, Conversation[count].sound); // Play some sound on the creature
|
||||
}
|
||||
@@ -761,7 +759,6 @@ public:
|
||||
if (!MaievGUID) // If Maiev cannot be summoned, reset the encounter and post some errors to the console.
|
||||
{
|
||||
EnterEvadeMode();
|
||||
me->MonsterTextEmote(EMOTE_UNABLE_TO_SUMMON, NULL);
|
||||
TC_LOG_ERROR("scripts", "SD2 ERROR: Unable to summon Maiev Shadowsong (entry: 23197). Check your database to see if you have the proper SQL for Maiev Shadowsong (entry: 23197)");
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -281,7 +281,7 @@ public:
|
||||
if (continueTriggering)
|
||||
{
|
||||
DoCast(me, SPELL_BLESSING_OF_THE_TIDES);
|
||||
me->MonsterYell(SAY_GAIN_BLESSING_OF_TIDES, LANG_UNIVERSAL, NULL);
|
||||
me->Yell(SAY_GAIN_BLESSING_OF_TIDES, LANG_UNIVERSAL);
|
||||
DoPlaySoundToSet(me, SOUND_GAIN_BLESSING_OF_TIDES);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ public:
|
||||
|
||||
if (SpoutTimer <= diff)
|
||||
{
|
||||
me->MonsterTextEmote(EMOTE_SPOUT, NULL, true);
|
||||
me->TextEmote(EMOTE_SPOUT, nullptr, true);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
me->GetMotionMaster()->MoveRotate(20000, urand(0, 1) ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT);
|
||||
SpoutTimer = 45000;
|
||||
|
||||
+1
-1
@@ -181,7 +181,7 @@ class instance_magtheridons_lair : public InstanceMapScript
|
||||
Creature* Magtheridon = instance->GetCreature(MagtheridonGUID);
|
||||
if (Magtheridon && Magtheridon->IsAlive())
|
||||
{
|
||||
Magtheridon->MonsterTextEmote(EMOTE_BONDS_WEAKEN, NULL);
|
||||
Magtheridon->TextEmote(EMOTE_BONDS_WEAKEN);
|
||||
CageTimer = 120000;
|
||||
}
|
||||
HandleGameObject(DoorGUID, false);
|
||||
|
||||
@@ -1777,7 +1777,7 @@ class spell_q12847_summon_soul_moveto_bunny : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript *GetSpellScript() const override
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
return new spell_q12847_summon_soul_moveto_bunny_SpellScript();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user