diff options
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index c0f844825f5..1348db72d8d 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -46,7 +46,7 @@ SmartScript::SmartScript() mLastTextID = 0; mTextGUID = 0; mUseTextTimer = false; - mTalkerEntry = 0; + talker = NULL; mTemplate = SMARTAI_TEMPLATE_BASIC; meOrigGUID = 0; goOrigGUID = 0; @@ -138,7 +138,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u return; ObjectList* targets = GetTargets(e, unit); - Creature* talker = me; + talker = me; if (targets) { for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) @@ -153,7 +153,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u delete targets; } - mTalkerEntry = talker->GetEntry(); mLastTextID = e.action.talk.textGroupID; mTextTimer = e.action.talk.duration; mTextGUID = IsPlayer(GetLastInvoker()) ? GetLastInvoker()->GetGUID() : 0;//invoker, used for $vars in texts @@ -211,10 +210,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (IsCreature(*itr)) + if (IsPlayer(*itr)) { - sCreatureTextMgr->SendSound((*itr)->ToCreature(), e.action.sound.sound, CHAT_MSG_MONSTER_SAY, 0, TextRange(e.action.sound.range), Team(0), false); - sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: source: %s (GuidLow: %u), sound: %u, range: %u", + (*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.range > 0 ? true : false); + sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u", (*itr)->GetName(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.range); } } @@ -2706,13 +2705,13 @@ void SmartScript::OnUpdate(uint32 const diff) { if (mTextTimer < diff) { - uint32 textID = mLastTextID; + uint32 temp = mLastTextID; mLastTextID = 0; - uint32 entry = mTalkerEntry; - mTalkerEntry = 0; mTextTimer = 0; mUseTextTimer = false; - ProcessEventsFor(SMART_EVENT_TEXT_OVER, NULL, textID, entry); + uint32 tempEntry = talker?talker->GetEntry():0; + talker = NULL; + ProcessEventsFor(SMART_EVENT_TEXT_OVER, NULL, temp, tempEntry); } else mTextTimer -= diff; } } |