aboutsummaryrefslogtreecommitdiff
path: root/src/game/Map.cpp
diff options
context:
space:
mode:
authorMachiavelli <none@none>2010-06-04 17:47:22 +0200
committerMachiavelli <none@none>2010-06-04 17:47:22 +0200
commitd3969ff9b3ed27a28cbc56c0c00b1c27d62d4661 (patch)
treee6dd202328cd1d8a759eeb2b346e5c07a0a9aa62 /src/game/Map.cpp
parent54ee0f6483a5f68fff55f7aedff6b8868cb87508 (diff)
Fix SCRIPT_COMMAND_EMOTE, allow it to be used in gossip scripts where source = player.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Map.cpp')
-rw-r--r--src/game/Map.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index 507076a8ad7..53efb35e373 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -3067,24 +3067,30 @@ void Map::ScriptsProcess()
}
case SCRIPT_COMMAND_EMOTE:
+ {
if (!source)
{
- sLog.outError("SCRIPT_COMMAND_EMOTE (script id: %u) call for NULL creature.", step.script->id);
+ sLog.outError("SCRIPT_COMMAND_EMOTE (script id: %u) call for NULL source.", step.script->id);
break;
}
- if (source->GetTypeId() != TYPEID_UNIT)
+ Creature* cSource = NULL;
+ cSource = source->ToCreature() != NULL ? source->ToCreature() : target->ToCreature();
+
+ if (!cSource)
{
- sLog.outError("SCRIPT_COMMAND_EMOTE (script id: %u) call for non-creature (TypeId: %u, Entry: %u, GUID: %u), skipping.",
- step.script->id, source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
+ sLog.outError("SCRIPT_COMMAND_TALK (script id: %u) call for non supported source (TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ step.script->id, source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
break;
}
if (step.script->datalong2)
- source->SetUInt32Value(UNIT_NPC_EMOTESTATE, step.script->datalong);
+ cSource->SetUInt32Value(UNIT_NPC_EMOTESTATE, step.script->datalong);
else
- ((Unit*)source)->HandleEmoteCommand(step.script->datalong);
+ cSource->HandleEmoteCommand(step.script->datalong);
break;
+ }
+
case SCRIPT_COMMAND_FIELD_SET:
if (!source)
{