Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 94514e58064d0fde1189d6850a86e8d59b96b643
- diff --git a/src/game/Map.cpp b/src/game/Map.cpp
- index 6a4a5e1..b944a38 100644
- --- a/src/game/Map.cpp
- +++ b/src/game/Map.cpp
- @@ -3176,36 +3176,6 @@ class StaticMonsterChatBuilder
- Unit* i_target;
- };
- -
- -/**
- - * Function simulates yell of creature
- - *
- - * @param guid must be creature guid of whom to Simulate the yell, non-creature guids not supported at this moment
- - * @param textId Id of the simulated text
- - * @param language language of the text
- - * @param target, can be NULL
- - */
- -void Map::MonsterYellToMap(ObjectGuid guid, int32 textId, uint32 language, Unit* target)
- -{
- - if (guid.IsAnyTypeCreature())
- - {
- - CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(guid.GetEntry());
- - if (!cInfo)
- - {
- - sLog.outError("Map::MonsterYellToMap: Called for nonexistent creature entry in guid: %s", guid.GetString().c_str());
- - return;
- - }
- -
- - MonsterYellToMap(cInfo, textId, language, target, guid.GetCounter());
- - }
- - else
- - {
- - sLog.outError("Map::MonsterYellToMap: Called for non creature guid: %s", guid.GetString().c_str());
- - return;
- - }
- -}
- -
- -
- /**
- * Function simulates yell of creature
- *
- @@ -3213,30 +3183,34 @@ void Map::MonsterYellToMap(ObjectGuid guid, int32 textId, uint32 language, Unit*
- * @param textId Id of the simulated text
- * @param language language of the text
- * @param target, can be NULL
- + * @param zoneId Only sent to players within that zone. If a negative value is used it is sent to whole map
- * @param senderLowGuid provide way proper show yell for near spawned creature with known lowguid,
- * 0 accepted by client else if this not important
- */
- -void Map::MonsterYellToMap(CreatureInfo const* cinfo, int32 textId, uint32 language, Unit* target, uint32 senderLowGuid /*= 0*/)
- +void Map::MonsterYellToMap(CreatureInfo const* cinfo, int32 textId, uint32 language, Unit* target, int32 zoneId /*= -1*/, uint32 senderLowGuid /*= 0*/)
- {
- StaticMonsterChatBuilder say_build(cinfo, CHAT_MSG_MONSTER_YELL, textId, language, target, senderLowGuid);
- MaNGOS::LocalizedPacketDo<StaticMonsterChatBuilder> say_do(say_build);
- Map::PlayerList const& pList = GetPlayers();
- for (PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
- - say_do(itr->getSource());
- + if (zoneId < 0 || itr->getSource()->GetZoneId() == zoneId)
- + say_do(itr->getSource());
- }
- /**
- * Function to play sound to all players in map
- *
- * @param soundId Played Sound
- + * @param zoneId Only sent to players within that zone. If a negative value is used it is sent to whole map
- */
- -void Map::PlayDirectSoundToMap(uint32 soundId)
- +void Map::PlayDirectSoundToMap(uint32 soundId, int32 zoneId /*= -1*/)
- {
- WorldPacket data(SMSG_PLAY_SOUND, 4);
- data << uint32(soundId);
- Map::PlayerList const& pList = GetPlayers();
- for (PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
- - itr->getSource()->SendDirectMessage(&data);
- + if (zoneId < 0 || itr->getSource()->GetZoneId() == zoneId)
- + itr->getSource()->SendDirectMessage(&data);
- }
- diff --git a/src/game/Map.h b/src/game/Map.h
- index 31e8731..319000f 100644
- --- a/src/game/Map.h
- +++ b/src/game/Map.h
- @@ -255,9 +255,8 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
- InstanceData* GetInstanceData() { return i_data; }
- uint32 GetScriptId() const { return i_script_id; }
- - void MonsterYellToMap(ObjectGuid guid, int32 textId, uint32 language, Unit* target);
- - void MonsterYellToMap(CreatureInfo const* cinfo, int32 textId, uint32 language, Unit* target, uint32 senderLowGuid = 0);
- - void PlayDirectSoundToMap(uint32 soundId);
- + void MonsterYellToMap(CreatureInfo const* cinfo, int32 textId, uint32 language, Unit* target, int32 zoneId = -1, uint32 senderLowGuid = 0);
- + void PlayDirectSoundToMap(uint32 soundId, int32 zoneId = -1);
- private:
- void LoadMapAndVMap(int gx, int gy);
- diff --git a/src/game/Object.cpp b/src/game/Object.cpp
- index 77fde06..11e524a 100644
- --- a/src/game/Object.cpp
- +++ b/src/game/Object.cpp
- @@ -1419,16 +1419,14 @@ void WorldObject::MonsterYell(int32 textId, uint32 language, Unit* target)
- Cell::VisitWorldObjects(this, say_worker, range);
- }
- -void WorldObject::MonsterYellToZone(int32 textId, uint32 language, Unit* target)
- +void WorldObject::MonsterYellToMap(int32 textId, uint32 language, Unit* target, int zoneId /*= -1*/)
- {
- MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, textId, language, target);
- MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
- - uint32 zoneid = GetZoneId();
- -
- Map::PlayerList const& pList = GetMap()->GetPlayers();
- - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
- - if(itr->getSource()->GetZoneId()==zoneid)
- + for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
- + if (zoneId < 0 || itr->getSource()->GetZoneId() == zoneId)
- say_do(itr->getSource());
- }
- diff --git a/src/game/Object.h b/src/game/Object.h
- index 000ebf8..e71cfc5 100644
- --- a/src/game/Object.h
- +++ b/src/game/Object.h
- @@ -540,7 +540,8 @@ class MANGOS_DLL_SPEC WorldObject : public Object
- void MonsterYell(int32 textId, uint32 language, Unit* target = NULL);
- void MonsterTextEmote(int32 textId, Unit* target, bool IsBossEmote = false);
- void MonsterWhisper(int32 textId, Unit* receiver, bool IsBossWhisper = false);
- - void MonsterYellToZone(int32 textId, uint32 language, Unit* target);
- + void MonsterYellToZone(int32 textId, uint32 language, Unit* target) { MonsterYellToMap(textId, language, target, GetZoneId()); }
- + void MonsterYellToMap(int32 textId, uint32 language, Unit* target, int zoneId = -1);
- static void BuildMonsterChat(WorldPacket *data, ObjectGuid senderGuid, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid, char const* targetName);
- void PlayDistanceSound(uint32 sound_id, Player* target = NULL);
Add Comment
Please, Sign In to add comment