mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[10761] Basic support for target-name in MonsterSay/etc
Change MonsterSay's target to pointer. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
146e7d3970
commit
16cd545df8
9 changed files with 72 additions and 72 deletions
|
|
@ -123,7 +123,7 @@ struct MANGOS_DLL_DECL ScriptedAI : public CreatureAI
|
||||||
|
|
||||||
void DoSay(int32 text_id, uint32 language)
|
void DoSay(int32 text_id, uint32 language)
|
||||||
{
|
{
|
||||||
m_creature->MonsterSay(text_id, language, ObjectGuid());
|
m_creature->MonsterSay(text_id, language);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoGoHome();
|
void DoGoHome();
|
||||||
|
|
|
||||||
|
|
@ -1335,31 +1335,31 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
|
||||||
switch((*i).second.Type)
|
switch((*i).second.Type)
|
||||||
{
|
{
|
||||||
case CHAT_TYPE_SAY:
|
case CHAT_TYPE_SAY:
|
||||||
pSource->MonsterSay(textEntry, (*i).second.Language, target ? target->GetObjectGuid() : ObjectGuid());
|
pSource->MonsterSay(textEntry, (*i).second.Language, target);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_YELL:
|
case CHAT_TYPE_YELL:
|
||||||
pSource->MonsterYell(textEntry, (*i).second.Language, target ? target->GetObjectGuid() : ObjectGuid());
|
pSource->MonsterYell(textEntry, (*i).second.Language, target);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_TEXT_EMOTE:
|
case CHAT_TYPE_TEXT_EMOTE:
|
||||||
pSource->MonsterTextEmote(textEntry, target ? target->GetObjectGuid() : ObjectGuid());
|
pSource->MonsterTextEmote(textEntry, target);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_BOSS_EMOTE:
|
case CHAT_TYPE_BOSS_EMOTE:
|
||||||
pSource->MonsterTextEmote(textEntry, target ? target->GetObjectGuid() : ObjectGuid(), true);
|
pSource->MonsterTextEmote(textEntry, target, true);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_WHISPER:
|
case CHAT_TYPE_WHISPER:
|
||||||
{
|
{
|
||||||
if (target && target->GetTypeId() == TYPEID_PLAYER)
|
if (target && target->GetTypeId() == TYPEID_PLAYER)
|
||||||
pSource->MonsterWhisper(textEntry, target->GetObjectGuid());
|
pSource->MonsterWhisper(textEntry, target);
|
||||||
else sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
|
else sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
|
||||||
}break;
|
}break;
|
||||||
case CHAT_TYPE_BOSS_WHISPER:
|
case CHAT_TYPE_BOSS_WHISPER:
|
||||||
{
|
{
|
||||||
if (target && target->GetTypeId() == TYPEID_PLAYER)
|
if (target && target->GetTypeId() == TYPEID_PLAYER)
|
||||||
pSource->MonsterWhisper(textEntry, target->GetObjectGuid(), true);
|
pSource->MonsterWhisper(textEntry, target, true);
|
||||||
else sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
|
else sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
|
||||||
}break;
|
}break;
|
||||||
case CHAT_TYPE_ZONE_YELL:
|
case CHAT_TYPE_ZONE_YELL:
|
||||||
pSource->MonsterYellToZone(textEntry, (*i).second.Language, target ? target->GetObjectGuid() : ObjectGuid());
|
pSource->MonsterYellToZone(textEntry, (*i).second.Language, target);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1020,7 +1020,7 @@ void GameObject::Use(Unit* user)
|
||||||
Creature* helper = player->SummonCreature(14496, x_i, y_i, GetPositionZ(), GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10000);
|
Creature* helper = player->SummonCreature(14496, x_i, y_i, GetPositionZ(), GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10000);
|
||||||
std::ostringstream output;
|
std::ostringstream output;
|
||||||
output << i << ": thisDist: " << thisDistance;
|
output << i << ": thisDist: " << thisDistance;
|
||||||
helper->MonsterSay(output.str().c_str(), LANG_UNIVERSAL, 0);
|
helper->MonsterSay(output.str().c_str(), LANG_UNIVERSAL);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (thisDistance <= lowestDist)
|
if (thisDistance <= lowestDist)
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ bool ChatHandler::HandleNpcSayCommand(char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pCreature->MonsterSay(args, LANG_UNIVERSAL, ObjectGuid());
|
pCreature->MonsterSay(args, LANG_UNIVERSAL);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +69,7 @@ bool ChatHandler::HandleNpcYellCommand(char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pCreature->MonsterYell(args, LANG_UNIVERSAL, ObjectGuid());
|
pCreature->MonsterYell(args, LANG_UNIVERSAL);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -89,7 +89,7 @@ bool ChatHandler::HandleNpcTextEmoteCommand(char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pCreature->MonsterTextEmote(args, ObjectGuid());
|
pCreature->MonsterTextEmote(args, NULL);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -114,7 +114,7 @@ bool ChatHandler::HandleNpcWhisperCommand(char* args)
|
||||||
if (HasLowerSecurity(target, 0))
|
if (HasLowerSecurity(target, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
pCreature->MonsterWhisper(args, target->GetObjectGuid());
|
pCreature->MonsterWhisper(args, target);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1877,7 +1877,7 @@ void Map::ScriptsProcess()
|
||||||
if (step.script->talk.flags & 0x02)
|
if (step.script->talk.flags & 0x02)
|
||||||
target = source;
|
target = source;
|
||||||
|
|
||||||
ObjectGuid unitTargetGuid = target ? target->GetObjectGuid() : ObjectGuid();
|
Unit* unitTarget = target && target->isType(TYPEMASK_UNIT) ? static_cast<Unit*>(target) : NULL;
|
||||||
int32 textId = step.script->talk.textId[0];
|
int32 textId = step.script->talk.textId[0];
|
||||||
|
|
||||||
// May have text for random
|
// May have text for random
|
||||||
|
|
@ -1897,35 +1897,35 @@ void Map::ScriptsProcess()
|
||||||
switch(step.script->talk.chatType)
|
switch(step.script->talk.chatType)
|
||||||
{
|
{
|
||||||
case CHAT_TYPE_SAY:
|
case CHAT_TYPE_SAY:
|
||||||
pSource->MonsterSay(textId, step.script->talk.language, unitTargetGuid);
|
pSource->MonsterSay(textId, step.script->talk.language, unitTarget);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_YELL:
|
case CHAT_TYPE_YELL:
|
||||||
pSource->MonsterYell(textId, step.script->talk.language, unitTargetGuid);
|
pSource->MonsterYell(textId, step.script->talk.language, unitTarget);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_TEXT_EMOTE:
|
case CHAT_TYPE_TEXT_EMOTE:
|
||||||
pSource->MonsterTextEmote(textId, unitTargetGuid);
|
pSource->MonsterTextEmote(textId, unitTarget);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_BOSS_EMOTE:
|
case CHAT_TYPE_BOSS_EMOTE:
|
||||||
pSource->MonsterTextEmote(textId, unitTargetGuid, true);
|
pSource->MonsterTextEmote(textId, unitTarget, true);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_WHISPER:
|
case CHAT_TYPE_WHISPER:
|
||||||
if (!unitTargetGuid.IsPlayer())
|
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) to %s, skipping.", step.script->id, step.script->talk.chatType, unitTargetGuid.GetString().c_str());
|
sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) to %s, skipping.", step.script->id, step.script->talk.chatType, unitTarget ? unitTarget->GetObjectGuid().GetString().c_str() : "<no target>");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pSource->MonsterWhisper(textId, unitTargetGuid);
|
pSource->MonsterWhisper(textId, unitTarget);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_BOSS_WHISPER:
|
case CHAT_TYPE_BOSS_WHISPER:
|
||||||
if (!unitTargetGuid.IsPlayer())
|
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) to %s, skipping.", step.script->id, step.script->talk.chatType, unitTargetGuid.GetString().c_str());
|
sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) to %s, skipping.", step.script->id, step.script->talk.chatType, unitTarget ? unitTarget->GetObjectGuid().GetString().c_str() : "<no target>");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pSource->MonsterWhisper(textId, unitTargetGuid, true);
|
pSource->MonsterWhisper(textId, unitTarget, true);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_ZONE_YELL:
|
case CHAT_TYPE_ZONE_YELL:
|
||||||
pSource->MonsterYellToZone(textId, step.script->talk.language, unitTargetGuid);
|
pSource->MonsterYellToZone(textId, step.script->talk.language, unitTarget);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break; // must be already checked at load
|
break; // must be already checked at load
|
||||||
|
|
|
||||||
|
|
@ -1540,36 +1540,37 @@ bool WorldObject::IsPositionValid() const
|
||||||
return MaNGOS::IsValidMapCoord(m_positionX,m_positionY,m_positionZ,m_orientation);
|
return MaNGOS::IsValidMapCoord(m_positionX,m_positionY,m_positionZ,m_orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::MonsterSay(const char* text, uint32 language, ObjectGuid targetGuid)
|
void WorldObject::MonsterSay(const char* text, uint32 language, Unit* target)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||||
BuildMonsterChat(&data, CHAT_MSG_MONSTER_SAY, text, language, GetName(), targetGuid);
|
BuildMonsterChat(&data, CHAT_MSG_MONSTER_SAY, text, language, GetName(), target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : "");
|
||||||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY),true);
|
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::MonsterYell(const char* text, uint32 language, ObjectGuid targetGuid)
|
void WorldObject::MonsterYell(const char* text, uint32 language, Unit* target)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||||
BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, text, language, GetName(), targetGuid);
|
BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, text, language, GetName(), target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : "");
|
||||||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_YELL),true);
|
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_YELL),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::MonsterTextEmote(const char* text, ObjectGuid targetGuid, bool IsBossEmote)
|
void WorldObject::MonsterTextEmote(const char* text, Unit* target, bool IsBossEmote)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||||
BuildMonsterChat(&data, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, text, LANG_UNIVERSAL, GetName(), targetGuid);
|
BuildMonsterChat(&data, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, text, LANG_UNIVERSAL,
|
||||||
SendMessageToSetInRange(&data,sWorld.getConfig(IsBossEmote ? CONFIG_FLOAT_LISTEN_RANGE_YELL : CONFIG_FLOAT_LISTEN_RANGE_TEXTEMOTE),true);
|
GetName(), target ? target->GetObjectGuid() : ObjectGuid(), target ? target->GetName() : "");
|
||||||
|
SendMessageToSetInRange(&data, sWorld.getConfig(IsBossEmote ? CONFIG_FLOAT_LISTEN_RANGE_YELL : CONFIG_FLOAT_LISTEN_RANGE_TEXTEMOTE), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::MonsterWhisper(const char* text, ObjectGuid targetGuid, bool IsBossWhisper)
|
void WorldObject::MonsterWhisper(const char* text, Unit* target, bool IsBossWhisper)
|
||||||
{
|
{
|
||||||
Player *player = sObjectMgr.GetPlayer(targetGuid);
|
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
||||||
if (!player || !player->GetSession())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||||
BuildMonsterChat(&data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, text, LANG_UNIVERSAL, GetName(), targetGuid);
|
BuildMonsterChat(&data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, text, LANG_UNIVERSAL,
|
||||||
player->GetSession()->SendPacket(&data);
|
GetName(), target->GetObjectGuid(), target->GetName());
|
||||||
|
((Player*)target)->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MaNGOS
|
namespace MaNGOS
|
||||||
|
|
@ -1577,14 +1578,13 @@ namespace MaNGOS
|
||||||
class MonsterChatBuilder
|
class MonsterChatBuilder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MonsterChatBuilder(WorldObject const& obj, ChatMsg msgtype, int32 textId, uint32 language, ObjectGuid targetGuid)
|
MonsterChatBuilder(WorldObject const& obj, ChatMsg msgtype, int32 textId, uint32 language, Unit* target)
|
||||||
: i_object(obj), i_msgtype(msgtype), i_textId(textId), i_language(language), i_targetGuid(targetGuid) {}
|
: i_object(obj), i_msgtype(msgtype), i_textId(textId), i_language(language), i_target(target) {}
|
||||||
void operator()(WorldPacket& data, int32 loc_idx)
|
void operator()(WorldPacket& data, int32 loc_idx)
|
||||||
{
|
{
|
||||||
char const* text = sObjectMgr.GetMangosString(i_textId,loc_idx);
|
char const* text = sObjectMgr.GetMangosString(i_textId,loc_idx);
|
||||||
|
|
||||||
// TODO: i_object.GetName() also must be localized?
|
i_object.BuildMonsterChat(&data, i_msgtype, text, i_language, i_object.GetNameForLocaleIdx(loc_idx), i_target ? i_target->GetObjectGuid() : ObjectGuid(), i_target ? i_target->GetNameForLocaleIdx(loc_idx) : "");
|
||||||
i_object.BuildMonsterChat(&data, i_msgtype, text, i_language, i_object.GetNameForLocaleIdx(loc_idx), i_targetGuid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -1592,32 +1592,32 @@ namespace MaNGOS
|
||||||
ChatMsg i_msgtype;
|
ChatMsg i_msgtype;
|
||||||
int32 i_textId;
|
int32 i_textId;
|
||||||
uint32 i_language;
|
uint32 i_language;
|
||||||
ObjectGuid i_targetGuid;
|
Unit* i_target;
|
||||||
};
|
};
|
||||||
} // namespace MaNGOS
|
} // namespace MaNGOS
|
||||||
|
|
||||||
void WorldObject::MonsterSay(int32 textId, uint32 language, ObjectGuid targetGuid)
|
void WorldObject::MonsterSay(int32 textId, uint32 language, Unit* target)
|
||||||
{
|
{
|
||||||
MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_SAY, textId, language, targetGuid);
|
MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_SAY, textId, language, target);
|
||||||
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
|
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
|
||||||
MaNGOS::CameraDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> > say_worker(this,sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY),say_do);
|
MaNGOS::CameraDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> > say_worker(this,sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY),say_do);
|
||||||
Cell::VisitWorldObjects(this, say_worker, sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY));
|
Cell::VisitWorldObjects(this, say_worker, sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::MonsterYell(int32 textId, uint32 language, ObjectGuid targetGuid)
|
void WorldObject::MonsterYell(int32 textId, uint32 language, Unit* target)
|
||||||
{
|
{
|
||||||
|
|
||||||
float range = sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_YELL);
|
float range = sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_YELL);
|
||||||
|
|
||||||
MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, textId, language, targetGuid);
|
MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, textId, language, target);
|
||||||
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
|
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
|
||||||
MaNGOS::CameraDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> > say_worker(this,range,say_do);
|
MaNGOS::CameraDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> > say_worker(this,range,say_do);
|
||||||
Cell::VisitWorldObjects(this, say_worker, sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_YELL));
|
Cell::VisitWorldObjects(this, say_worker, sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_YELL));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::MonsterYellToZone(int32 textId, uint32 language, ObjectGuid targetGuid)
|
void WorldObject::MonsterYellToZone(int32 textId, uint32 language, Unit* target)
|
||||||
{
|
{
|
||||||
MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, textId, language, targetGuid);
|
MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, textId, language, target);
|
||||||
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
|
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
|
||||||
|
|
||||||
uint32 zoneid = GetZoneId();
|
uint32 zoneid = GetZoneId();
|
||||||
|
|
@ -1628,32 +1628,32 @@ void WorldObject::MonsterYellToZone(int32 textId, uint32 language, ObjectGuid ta
|
||||||
say_do(itr->getSource());
|
say_do(itr->getSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::MonsterTextEmote(int32 textId, ObjectGuid targetGuid, bool IsBossEmote)
|
void WorldObject::MonsterTextEmote(int32 textId, Unit* target, bool IsBossEmote)
|
||||||
{
|
{
|
||||||
float range = sWorld.getConfig(IsBossEmote ? CONFIG_FLOAT_LISTEN_RANGE_YELL : CONFIG_FLOAT_LISTEN_RANGE_TEXTEMOTE);
|
float range = sWorld.getConfig(IsBossEmote ? CONFIG_FLOAT_LISTEN_RANGE_YELL : CONFIG_FLOAT_LISTEN_RANGE_TEXTEMOTE);
|
||||||
|
|
||||||
MaNGOS::MonsterChatBuilder say_build(*this, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, textId, LANG_UNIVERSAL, targetGuid);
|
MaNGOS::MonsterChatBuilder say_build(*this, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, textId, LANG_UNIVERSAL, target);
|
||||||
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
|
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
|
||||||
MaNGOS::CameraDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> > say_worker(this,range,say_do);
|
MaNGOS::CameraDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> > say_worker(this,range,say_do);
|
||||||
Cell::VisitWorldObjects(this, say_worker, range);
|
Cell::VisitWorldObjects(this, say_worker, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::MonsterWhisper(int32 textId, ObjectGuid targetGuid, bool IsBossWhisper)
|
void WorldObject::MonsterWhisper(int32 textId, Unit* target, bool IsBossWhisper)
|
||||||
{
|
{
|
||||||
Player *player = sObjectMgr.GetPlayer(targetGuid);
|
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
||||||
if (!player || !player->GetSession())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
|
uint32 loc_idx = ((Player*)target)->GetSession()->GetSessionDbLocaleIndex();
|
||||||
char const* text = sObjectMgr.GetMangosString(textId, loc_idx);
|
char const* text = sObjectMgr.GetMangosString(textId, loc_idx);
|
||||||
|
|
||||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||||
BuildMonsterChat(&data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, text, LANG_UNIVERSAL, GetNameForLocaleIdx(loc_idx), targetGuid);
|
BuildMonsterChat(&data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, text, LANG_UNIVERSAL,
|
||||||
|
GetNameForLocaleIdx(loc_idx), target->GetObjectGuid(), "");
|
||||||
|
|
||||||
player->GetSession()->SendPacket(&data);
|
((Player*)target)->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid) const
|
void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid, char const* targetName) const
|
||||||
{
|
{
|
||||||
*data << uint8(msgtype);
|
*data << uint8(msgtype);
|
||||||
*data << uint32(language);
|
*data << uint32(language);
|
||||||
|
|
@ -1664,8 +1664,8 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const*
|
||||||
*data << ObjectGuid(targetGuid); // Unit Target
|
*data << ObjectGuid(targetGuid); // Unit Target
|
||||||
if (!targetGuid.IsEmpty() && !targetGuid.IsPlayer())
|
if (!targetGuid.IsEmpty() && !targetGuid.IsPlayer())
|
||||||
{
|
{
|
||||||
*data << uint32(1); // target name length
|
*data << uint32(strlen(targetName)+1); // target name length
|
||||||
*data << uint8(0); // target name
|
*data << targetName; // target name
|
||||||
}
|
}
|
||||||
*data << uint32(strlen(text)+1);
|
*data << uint32(strlen(text)+1);
|
||||||
*data << text;
|
*data << text;
|
||||||
|
|
|
||||||
|
|
@ -444,16 +444,16 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
||||||
virtual void SendMessageToSetInRange(WorldPacket *data, float dist, bool self);
|
virtual void SendMessageToSetInRange(WorldPacket *data, float dist, bool self);
|
||||||
void SendMessageToSetExcept(WorldPacket *data, Player const* skipped_receiver);
|
void SendMessageToSetExcept(WorldPacket *data, Player const* skipped_receiver);
|
||||||
|
|
||||||
void MonsterSay(const char* text, uint32 language, ObjectGuid targetGuid);
|
void MonsterSay(const char* text, uint32 language, Unit* target = NULL);
|
||||||
void MonsterYell(const char* text, uint32 language, ObjectGuid targetGuid);
|
void MonsterYell(const char* text, uint32 language, Unit* target = NULL);
|
||||||
void MonsterTextEmote(const char* text, ObjectGuid targetGuid, bool IsBossEmote = false);
|
void MonsterTextEmote(const char* text, Unit* target, bool IsBossEmote = false);
|
||||||
void MonsterWhisper(const char* text, ObjectGuid targetGuid, bool IsBossWhisper = false);
|
void MonsterWhisper(const char* text, Unit* target, bool IsBossWhisper = false);
|
||||||
void MonsterSay(int32 textId, uint32 language, ObjectGuid targetGuid);
|
void MonsterSay(int32 textId, uint32 language, Unit* target = NULL);
|
||||||
void MonsterYell(int32 textId, uint32 language, ObjectGuid targetGuid);
|
void MonsterYell(int32 textId, uint32 language, Unit* target = NULL);
|
||||||
void MonsterTextEmote(int32 textId, ObjectGuid targetGuid, bool IsBossEmote = false);
|
void MonsterTextEmote(int32 textId, Unit* target, bool IsBossEmote = false);
|
||||||
void MonsterWhisper(int32 textId, ObjectGuid targetGuid, bool IsBossWhisper = false);
|
void MonsterWhisper(int32 textId, Unit* receiver, bool IsBossWhisper = false);
|
||||||
void MonsterYellToZone(int32 textId, uint32 language, ObjectGuid targetGuid);
|
void MonsterYellToZone(int32 textId, uint32 language, Unit* target);
|
||||||
void BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid) const;
|
void BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid, char const* targetName) const;
|
||||||
|
|
||||||
void PlayDistanceSound(uint32 sound_id, Player* target = NULL);
|
void PlayDistanceSound(uint32 sound_id, Player* target = NULL);
|
||||||
void PlayDirectSound(uint32 sound_id, Player* target = NULL);
|
void PlayDirectSound(uint32 sound_id, Player* target = NULL);
|
||||||
|
|
|
||||||
|
|
@ -220,10 +220,10 @@ bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint3
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
creature.MonsterSay(behavior->textid[rand() % i], LANG_UNIVERSAL, ObjectGuid());
|
creature.MonsterSay(behavior->textid[rand() % i], LANG_UNIVERSAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
creature.MonsterSay(behavior->textid[0], LANG_UNIVERSAL, ObjectGuid());
|
creature.MonsterSay(behavior->textid[0], LANG_UNIVERSAL);
|
||||||
}
|
}
|
||||||
} // wpBehaviour found
|
} // wpBehaviour found
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10760"
|
#define REVISION_NR "10761"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue