Core/SmartAI: added ACTION_ACTIVATE_TAXI

--HG--
branch : trunk
This commit is contained in:
Rat
2010-11-19 20:23:08 +01:00
parent 5cd3904059
commit 67fa59fb68
3 changed files with 20 additions and 2 deletions
@@ -1138,6 +1138,15 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
SetScript9(e, urand(e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2));
break;
}
case SMART_ACTION_ACTIVATE_TAXI:
{
ObjectList* targets = GetTargets(e, unit);
if (!targets) return;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); itr++)
if (IsPlayer((*itr)))
(*itr)->ToPlayer()->ActivateTaxiPathTo(e.action.taxi.id);
break;
}
default:
sLog.outErrorDb("SmartScript::ProcessAction: Unhandled Action type %u", e.GetActionType());
break;
@@ -541,6 +541,15 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
case SMART_ACTION_ADD_QUEST:
if (e.action.quest.quest && !IsQuestValid(e, e.action.quest.quest)) return false;
break;
case SMART_ACTION_ACTIVATE_TAXI:
{
if (!sTaxiPathStore.LookupEntry(e.action.taxi.id))
{
sLog.outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id);
return false;
}
break;
}
case SMART_ACTION_RANDOM_EMOTE:
if (e.action.randomEmote.emote1 && !IsEmoteValid(e, e.action.randomEmote.emote1)) return false;
if (e.action.randomEmote.emote2 && !IsEmoteValid(e, e.action.randomEmote.emote2)) return false;
@@ -404,7 +404,7 @@ enum SMART_ACTION
SMART_ACTION_ATTACK_START = 49, //
SMART_ACTION_SUMMON_GO = 50, // GameObjectID, DespawnTime in ms,
SMART_ACTION_KILL_UNIT = 51, //
//SMART_ACTION_WP_LOAD = 52, // pathID
SMART_ACTION_ACTIVATE_TAXI = 52, // TaxiID
SMART_ACTION_WP_START = 53, // run/walk, pathID, canRepeat, quest, despawntime, reactState
SMART_ACTION_WP_PAUSE = 54, // time
SMART_ACTION_WP_STOP = 55, // despawnTime, quest, fail?
@@ -682,7 +682,7 @@ struct SmartAction
struct
{
uint32 id;
} wpLoad;
} taxi;
struct