Core/SmartScripts: Fixed SAI targets 10 & 14 (SMART_TARGET_CREATURE_GUID, SMART_TARGET_GAMEOBJECT_GUID)

Note: If you used these targets to perform actions across maps, it will not work anymore, this functionality is deprecated as it was not safe.
This commit is contained in:
Shauren committed 2013-01-03 19:22:12 +01:00
1 parent 6a29a957dd
commit 59e4f6eb05
2 files changed
+14 -30

No files matched your search

+12 -28
View File
@@ -2260,46 +2260,30 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
case SMART_TARGET_CREATURE_GUID:
{
Creature* target = NULL;
if (e.target.unitGUID.entry)
if (!trigger && !GetBaseObject())
{
uint64 guid = MAKE_NEW_GUID(e.target.unitGUID.guid, e.target.unitGUID.entry, HIGHGUID_UNIT);
target = HashMapHolder<Creature>::Find(guid);
}
else
{
if (!trigger && !GetBaseObject())
{
sLog->outError(LOG_FILTER_SQL, "SMART_TARGET_CREATURE_GUID can not be used without invoker and without entry");
break;
}
target = FindCreatureNear(trigger ? trigger : GetBaseObject(), e.target.unitGUID.guid);
sLog->outError(LOG_FILTER_SQL, "SMART_TARGET_CREATURE_GUID can not be used without invoker");
break;
}
if (target)
target = FindCreatureNear(trigger ? trigger : GetBaseObject(), e.target.unitGUID.dbGuid);
if (target && (!e.target.unitGUID.entry || target->GetEntry() == e.target.unitGUID.entry))
l->push_back(target);
break;
}
case SMART_TARGET_GAMEOBJECT_GUID:
{
GameObject* target = NULL;
if (e.target.unitGUID.entry)
if (!trigger && !GetBaseObject())
{
uint64 guid = MAKE_NEW_GUID(e.target.goGUID.guid, e.target.goGUID.entry, HIGHGUID_GAMEOBJECT);
target = HashMapHolder<GameObject>::Find(guid);
}
else
{
if (!trigger && !GetBaseObject())
{
sLog->outError(LOG_FILTER_SQL, "SMART_TARGET_GAMEOBJECT_GUID can not be used without invoker and without entry");
break;
}
target = FindGameObjectNear(trigger ? trigger : GetBaseObject(), e.target.goGUID.guid);
sLog->outError(LOG_FILTER_SQL, "SMART_TARGET_GAMEOBJECT_GUID can not be used without invoker");
break;
}
if (target)
target = FindGameObjectNear(trigger ? trigger : GetBaseObject(), e.target.goGUID.dbGuid);
if (target && (!e.target.goGUID.entry || target->GetEntry() == e.target.goGUID.entry))
l->push_back(target);
break;
}