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
This commit is contained in:
ModoX
2021-10-16 15:02:40 +02:00
committed by GitHub
parent 145a75dea6
commit e63c5e4253
4 changed files with 17 additions and 2 deletions

View File

@@ -0,0 +1,2 @@
--
UPDATE `creature_text` SET `TextRange`=5 WHERE `CreatureID`=130986 AND `GroupID` BETWEEN 0 AND 5;

View File

@@ -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;

View File

@@ -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

View File

@@ -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;