[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:
Schmoozerd 2010-11-20 20:37:21 +03:00 committed by VladimirMangos
parent 146e7d3970
commit 16cd545df8
9 changed files with 72 additions and 72 deletions

View file

@ -1877,7 +1877,7 @@ void Map::ScriptsProcess()
if (step.script->talk.flags & 0x02)
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];
// May have text for random
@ -1897,35 +1897,35 @@ void Map::ScriptsProcess()
switch(step.script->talk.chatType)
{
case CHAT_TYPE_SAY:
pSource->MonsterSay(textId, step.script->talk.language, unitTargetGuid);
pSource->MonsterSay(textId, step.script->talk.language, unitTarget);
break;
case CHAT_TYPE_YELL:
pSource->MonsterYell(textId, step.script->talk.language, unitTargetGuid);
pSource->MonsterYell(textId, step.script->talk.language, unitTarget);
break;
case CHAT_TYPE_TEXT_EMOTE:
pSource->MonsterTextEmote(textId, unitTargetGuid);
pSource->MonsterTextEmote(textId, unitTarget);
break;
case CHAT_TYPE_BOSS_EMOTE:
pSource->MonsterTextEmote(textId, unitTargetGuid, true);
pSource->MonsterTextEmote(textId, unitTarget, true);
break;
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;
}
pSource->MonsterWhisper(textId, unitTargetGuid);
pSource->MonsterWhisper(textId, unitTarget);
break;
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;
}
pSource->MonsterWhisper(textId, unitTargetGuid, true);
pSource->MonsterWhisper(textId, unitTarget, true);
break;
case CHAT_TYPE_ZONE_YELL:
pSource->MonsterYellToZone(textId, step.script->talk.language, unitTargetGuid);
pSource->MonsterYellToZone(textId, step.script->talk.language, unitTarget);
break;
default:
break; // must be already checked at load