diff options
author | ModoX <moardox@gmail.com> | 2021-10-16 15:02:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-16 15:02:40 +0200 |
commit | e63c5e425383fd8e12dcff2302f9c77d0aa5db2c (patch) | |
tree | 6aceb11ce600179c8384d236ab7b32543e22a32d | |
parent | 145a75dea6529f07d2875952658b59b34024251a (diff) |
Core/Chat: Added new TextRange personal to creature_text which sends the message to related target only (#27070)
* also updated creature_texts of Vigilant Quoram in Lightforged Intro zone as an example
-rw-r--r-- | sql/updates/world/master/2021_10_16_01_world.sql | 2 | ||||
-rw-r--r-- | src/server/game/Texts/CreatureTextMgr.cpp | 8 | ||||
-rw-r--r-- | src/server/game/Texts/CreatureTextMgr.h | 3 | ||||
-rw-r--r-- | src/server/game/Texts/CreatureTextMgrImpl.h | 6 |
4 files changed, 17 insertions, 2 deletions
diff --git a/sql/updates/world/master/2021_10_16_01_world.sql b/sql/updates/world/master/2021_10_16_01_world.sql new file mode 100644 index 00000000000..0c9da48e6a5 --- /dev/null +++ b/sql/updates/world/master/2021_10_16_01_world.sql @@ -0,0 +1,2 @@ +-- +UPDATE `creature_text` SET `TextRange`=5 WHERE `CreatureID`=130986 AND `GroupID` BETWEEN 0 AND 5; diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index 3f2cdb660eb..86a6aae3306 100644 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -112,7 +112,7 @@ void CreatureTextMgr::LoadCreatureTexts() } } - if (temp.TextRange > TEXT_RANGE_WORLD) + if (temp.TextRange > TEXT_RANGE_PERSONAL) { TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has incorrect TextRange %u.", temp.creatureId, temp.groupId, temp.id, temp.TextRange); temp.TextRange = TEXT_RANGE_NORMAL; @@ -333,6 +333,12 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket const* player->SendDirectMessage(data); return; } + case TEXT_RANGE_PERSONAL: + if (!whisperTarget || !whisperTarget->IsPlayer()) + return; + + whisperTarget->ToPlayer()->SendDirectMessage(data); + return; case TEXT_RANGE_NORMAL: default: break; diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h index 3c6adfdd9eb..72f3e99cf62 100644 --- a/src/server/game/Texts/CreatureTextMgr.h +++ b/src/server/game/Texts/CreatureTextMgr.h @@ -36,7 +36,8 @@ enum CreatureTextRange TEXT_RANGE_AREA = 1, TEXT_RANGE_ZONE = 2, TEXT_RANGE_MAP = 3, - TEXT_RANGE_WORLD = 4 + TEXT_RANGE_WORLD = 4, + TEXT_RANGE_PERSONAL = 5 }; struct CreatureTextEntry diff --git a/src/server/game/Texts/CreatureTextMgrImpl.h b/src/server/game/Texts/CreatureTextMgrImpl.h index a4d368457ad..19082aedcc6 100644 --- a/src/server/game/Texts/CreatureTextMgrImpl.h +++ b/src/server/game/Texts/CreatureTextMgrImpl.h @@ -145,6 +145,12 @@ void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder localizer(player); return; } + case TEXT_RANGE_PERSONAL: + if (!whisperTarget || !whisperTarget->IsPlayer()) + return; + + localizer(whisperTarget->ToPlayer()); + return; case TEXT_RANGE_NORMAL: default: break; |