[10748] Convert MonsterSay/Say and similar functions to ObjectGuid use.

This commit is contained in:
VladimirMangos 2010-11-19 20:32:53 +03:00
parent 12b80fec68
commit f5cf98e9f4
11 changed files with 84 additions and 85 deletions

View file

@ -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->Say(text_id,language,0); m_creature->Say(text_id, language, ObjectGuid());
} }
void DoGoHome(); void DoGoHome();

View file

@ -83,11 +83,11 @@ class Corpse : public WorldObject
Player* lootRecipient; Player* lootRecipient;
bool lootForBody; bool lootForBody;
void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); } void Say(int32 textId, uint32 language, ObjectGuid targetGuid) { MonsterSay(textId, language, targetGuid); }
void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void Yell(int32 textId, uint32 language, ObjectGuid targetGuid) { MonsterYell(textId, language, targetGuid); }
void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } void TextEmote(int32 textId, ObjectGuid targetGuid) { MonsterTextEmote(textId, targetGuid); }
void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); } void Whisper(int32 textId, ObjectGuid targetGuid) { MonsterWhisper(textId, targetGuid); }
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } void YellToZone(int32 textId, uint32 language, ObjectGuid targetGuid) { MonsterYellToZone(textId,language, targetGuid); }
GridReference<Corpse> &GetGridRef() { return m_gridRef; } GridReference<Corpse> &GetGridRef() { return m_gridRef; }

View file

@ -524,11 +524,11 @@ class MANGOS_DLL_SPEC Creature : public Unit
std::string GetScriptName() const; std::string GetScriptName() const;
uint32 GetScriptId() const; uint32 GetScriptId() const;
void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); } void Say(int32 textId, uint32 language, ObjectGuid targetGuid) { MonsterSay(textId, language, targetGuid); }
void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void Yell(int32 textId, uint32 language, ObjectGuid targetGuid) { MonsterYell(textId, language, targetGuid); }
void TextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false) { MonsterTextEmote(textId,TargetGuid,IsBossEmote); } void TextEmote(int32 textId, ObjectGuid targetGuid, bool IsBossEmote = false) { MonsterTextEmote(textId, targetGuid, IsBossEmote); }
void Whisper(int32 textId, uint64 receiver, bool IsBossWhisper = false) { MonsterWhisper(textId,receiver,IsBossWhisper); } void Whisper(int32 textId, ObjectGuid targetGuid, bool IsBossWhisper = false) { MonsterWhisper(textId, targetGuid, IsBossWhisper); }
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } void YellToZone(int32 textId, uint32 language, ObjectGuid targetGuid) { MonsterYellToZone(textId, language, targetGuid); }
// overwrite WorldObject function for proper name localization // overwrite WorldObject function for proper name localization
const char* GetNameForLocaleIdx(int32 locale_idx) const; const char* GetNameForLocaleIdx(int32 locale_idx) const;

View file

@ -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->GetGUID() : 0); pSource->MonsterSay(textEntry, (*i).second.Language, target ? target->GetObjectGuid() : ObjectGuid());
break; break;
case CHAT_TYPE_YELL: case CHAT_TYPE_YELL:
pSource->MonsterYell(textEntry, (*i).second.Language, target ? target->GetGUID() : 0); pSource->MonsterYell(textEntry, (*i).second.Language, target ? target->GetObjectGuid() : ObjectGuid());
break; break;
case CHAT_TYPE_TEXT_EMOTE: case CHAT_TYPE_TEXT_EMOTE:
pSource->MonsterTextEmote(textEntry, target ? target->GetGUID() : 0); pSource->MonsterTextEmote(textEntry, target ? target->GetObjectGuid() : ObjectGuid());
break; break;
case CHAT_TYPE_BOSS_EMOTE: case CHAT_TYPE_BOSS_EMOTE:
pSource->MonsterTextEmote(textEntry, target ? target->GetGUID() : 0, true); pSource->MonsterTextEmote(textEntry, target ? target->GetObjectGuid() : ObjectGuid(), 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->GetGUID()); pSource->MonsterWhisper(textEntry, target->GetObjectGuid());
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->GetGUID(), true); pSource->MonsterWhisper(textEntry, target->GetObjectGuid(), 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->GetGUID() : 0); pSource->MonsterYellToZone(textEntry, (*i).second.Language, target ? target->GetObjectGuid() : ObjectGuid());
break; break;
} }
} }

View file

@ -58,11 +58,11 @@ class DynamicObject : public WorldObject
bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const; bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const;
void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); } void Say(int32 textId, uint32 language, ObjectGuid targetGuid) { MonsterSay(textId, language, targetGuid); }
void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void Yell(int32 textId, uint32 language, ObjectGuid targetGuid) { MonsterYell(textId, language, targetGuid); }
void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } void TextEmote(int32 textId, ObjectGuid targetGuid) { MonsterTextEmote(textId, targetGuid); }
void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); } void Whisper(int32 textId, ObjectGuid targetGuid) { MonsterWhisper(textId, targetGuid); }
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } void YellToZone(int32 textId, uint32 language, ObjectGuid targetGuid) { MonsterYellToZone(textId, language, targetGuid); }
GridReference<DynamicObject> &GetGridRef() { return m_gridRef; } GridReference<DynamicObject> &GetGridRef() { return m_gridRef; }

View file

@ -597,11 +597,11 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
void UpdateRotationFields(float rotation2 = 0.0f, float rotation3 = 0.0f); void UpdateRotationFields(float rotation2 = 0.0f, float rotation3 = 0.0f);
void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); } void Say(int32 textId, uint32 language, ObjectGuid targetGuid) { MonsterSay(textId, language, targetGuid); }
void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void Yell(int32 textId, uint32 language, ObjectGuid targetGuid) { MonsterYell(textId, language, targetGuid); }
void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } void TextEmote(int32 textId, ObjectGuid targetGuid) { MonsterTextEmote(textId, targetGuid); }
void Whisper(int32 textId, uint64 receiver) { MonsterWhisper(textId,receiver); } void Whisper(int32 textId, ObjectGuid targetGuid) { MonsterWhisper(textId, targetGuid); }
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); } void YellToZone(int32 textId, uint32 language, ObjectGuid targetGuid) { MonsterYellToZone(textId, language, targetGuid); }
// overwrite WorldObject function for proper name localization // overwrite WorldObject function for proper name localization
const char* GetNameForLocaleIdx(int32 locale_idx) const; const char* GetNameForLocaleIdx(int32 locale_idx) const;

View file

@ -51,7 +51,7 @@ bool ChatHandler::HandleNpcSayCommand(char* args)
return false; return false;
} }
pCreature->MonsterSay(args, LANG_UNIVERSAL, 0); pCreature->MonsterSay(args, LANG_UNIVERSAL, ObjectGuid());
return true; return true;
} }
@ -69,7 +69,7 @@ bool ChatHandler::HandleNpcYellCommand(char* args)
return false; return false;
} }
pCreature->MonsterYell(args, LANG_UNIVERSAL, 0); pCreature->MonsterYell(args, LANG_UNIVERSAL, ObjectGuid());
return true; return true;
} }
@ -89,7 +89,7 @@ bool ChatHandler::HandleNpcTextEmoteCommand(char* args)
return false; return false;
} }
pCreature->MonsterTextEmote(args, 0); pCreature->MonsterTextEmote(args, ObjectGuid());
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->GetGUID()); pCreature->MonsterWhisper(args, target->GetObjectGuid());
return true; return true;
} }

View file

@ -1532,36 +1532,35 @@ 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, uint64 TargetGuid) void WorldObject::MonsterSay(const char* text, uint32 language, ObjectGuid targetGuid)
{ {
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(), targetGuid);
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, uint64 TargetGuid) void WorldObject::MonsterYell(const char* text, uint32 language, ObjectGuid targetGuid)
{ {
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(), targetGuid);
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, uint64 TargetGuid, bool IsBossEmote) void WorldObject::MonsterTextEmote(const char* text, ObjectGuid targetGuid, 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, GetName(), targetGuid);
SendMessageToSetInRange(&data,sWorld.getConfig(IsBossEmote ? CONFIG_FLOAT_LISTEN_RANGE_YELL : CONFIG_FLOAT_LISTEN_RANGE_TEXTEMOTE),true); SendMessageToSetInRange(&data,sWorld.getConfig(IsBossEmote ? CONFIG_FLOAT_LISTEN_RANGE_YELL : CONFIG_FLOAT_LISTEN_RANGE_TEXTEMOTE),true);
} }
void WorldObject::MonsterWhisper(const char* text, uint64 receiver, bool IsBossWhisper) void WorldObject::MonsterWhisper(const char* text, ObjectGuid targetGuid, bool IsBossWhisper)
{ {
Player *player = sObjectMgr.GetPlayer(receiver); Player *player = sObjectMgr.GetPlayer(targetGuid);
if(!player || !player->GetSession()) 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(),receiver); BuildMonsterChat(&data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, text, LANG_UNIVERSAL, GetName(), targetGuid);
player->GetSession()->SendPacket(&data); player->GetSession()->SendPacket(&data);
} }
@ -1570,14 +1569,14 @@ namespace MaNGOS
class MonsterChatBuilder class MonsterChatBuilder
{ {
public: public:
MonsterChatBuilder(WorldObject const& obj, ChatMsg msgtype, int32 textId, uint32 language, uint64 targetGUID) MonsterChatBuilder(WorldObject const& obj, ChatMsg msgtype, int32 textId, uint32 language, ObjectGuid targetGuid)
: 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_targetGuid(targetGuid) {}
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? // TODO: i_object.GetName() also must be localized?
i_object.BuildMonsterChat(&data,i_msgtype,text,i_language,i_object.GetNameForLocaleIdx(loc_idx),i_targetGUID); i_object.BuildMonsterChat(&data, i_msgtype, text, i_language, i_object.GetNameForLocaleIdx(loc_idx), i_targetGuid);
} }
private: private:
@ -1585,32 +1584,32 @@ namespace MaNGOS
ChatMsg i_msgtype; ChatMsg i_msgtype;
int32 i_textId; int32 i_textId;
uint32 i_language; uint32 i_language;
uint64 i_targetGUID; ObjectGuid i_targetGuid;
}; };
} // namespace MaNGOS } // namespace MaNGOS
void WorldObject::MonsterSay(int32 textId, uint32 language, uint64 TargetGuid) void WorldObject::MonsterSay(int32 textId, uint32 language, ObjectGuid targetGuid)
{ {
MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_SAY, textId,language,TargetGuid); MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_SAY, textId, language, targetGuid);
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, uint64 TargetGuid) void WorldObject::MonsterYell(int32 textId, uint32 language, ObjectGuid targetGuid)
{ {
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, targetGuid);
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, uint64 TargetGuid) void WorldObject::MonsterYellToZone(int32 textId, uint32 language, ObjectGuid targetGuid)
{ {
MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, textId,language,TargetGuid); MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, textId, language, targetGuid);
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build); MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
uint32 zoneid = GetZoneId(); uint32 zoneid = GetZoneId();
@ -1621,48 +1620,48 @@ void WorldObject::MonsterYellToZone(int32 textId, uint32 language, uint64 Target
say_do(itr->getSource()); say_do(itr->getSource());
} }
void WorldObject::MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote) void WorldObject::MonsterTextEmote(int32 textId, ObjectGuid targetGuid, 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, targetGuid);
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, uint64 receiver, bool IsBossWhisper) void WorldObject::MonsterWhisper(int32 textId, ObjectGuid targetGuid, bool IsBossWhisper)
{ {
Player *player = sObjectMgr.GetPlayer(receiver); Player *player = sObjectMgr.GetPlayer(targetGuid);
if(!player || !player->GetSession()) if (!player || !player->GetSession())
return; return;
uint32 loc_idx = player->GetSession()->GetSessionDbLocaleIndex(); uint32 loc_idx = player->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),receiver); BuildMonsterChat(&data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, text, LANG_UNIVERSAL, GetNameForLocaleIdx(loc_idx), targetGuid);
player->GetSession()->SendPacket(&data); player->GetSession()->SendPacket(&data);
} }
void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 targetGuid) const void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid) const
{ {
*data << (uint8)msgtype; *data << uint8(msgtype);
*data << (uint32)language; *data << uint32(language);
*data << (uint64)GetGUID(); *data << ObjectGuid(GetObjectGuid());
*data << (uint32)0; // 2.1.0 *data << uint32(0); // 2.1.0
*data << (uint32)(strlen(name)+1); *data << uint32(strlen(name)+1);
*data << name; *data << name;
*data << (uint64)targetGuid; // Unit Target *data << ObjectGuid(targetGuid); // Unit Target
if( targetGuid && !IS_PLAYER_GUID(targetGuid) ) if (!targetGuid.IsEmpty() && !targetGuid.IsPlayer())
{ {
*data << (uint32)1; // target name length *data << uint32(1); // target name length
*data << (uint8)0; // target name *data << uint8(0); // target name
} }
*data << (uint32)(strlen(text)+1); *data << uint32(strlen(text)+1);
*data << text; *data << text;
*data << (uint8)0; // ChatTag *data << uint8(0); // ChatTag
} }
void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/) void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/)

View file

@ -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, uint64 TargetGuid); void MonsterSay(const char* text, uint32 language, ObjectGuid targetGuid);
void MonsterYell(const char* text, uint32 language, uint64 TargetGuid); void MonsterYell(const char* text, uint32 language, ObjectGuid targetGuid);
void MonsterTextEmote(const char* text, uint64 TargetGuid, bool IsBossEmote = false); void MonsterTextEmote(const char* text, ObjectGuid targetGuid, bool IsBossEmote = false);
void MonsterWhisper(const char* text, uint64 receiver, bool IsBossWhisper = false); void MonsterWhisper(const char* text, ObjectGuid targetGuid, bool IsBossWhisper = false);
void MonsterSay(int32 textId, uint32 language, uint64 TargetGuid); void MonsterSay(int32 textId, uint32 language, ObjectGuid targetGuid);
void MonsterYell(int32 textId, uint32 language, uint64 TargetGuid); void MonsterYell(int32 textId, uint32 language, ObjectGuid targetGuid);
void MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false); void MonsterTextEmote(int32 textId, ObjectGuid targetGuid, bool IsBossEmote = false);
void MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper = false); void MonsterWhisper(int32 textId, ObjectGuid targetGuid, bool IsBossWhisper = false);
void MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid); void MonsterYellToZone(int32 textId, uint32 language, ObjectGuid targetGuid);
void BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 TargetGuid) const; void BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid) 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);

View file

@ -220,10 +220,10 @@ bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint3
break; break;
} }
creature.Say(behavior->textid[rand() % i], 0, 0); creature.Say(behavior->textid[rand() % i], LANG_UNIVERSAL, ObjectGuid());
} }
else else
creature.Say(behavior->textid[0], 0, 0); creature.Say(behavior->textid[0], LANG_UNIVERSAL, ObjectGuid());
} }
} // wpBehaviour found } // wpBehaviour found

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10747" #define REVISION_NR "10748"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__