Implement ACTION_T_MOUNT_TO_ENTRY_OR_MODEL (43) for creature eventAI.
Read doc/EventAI.txt for details. Originally by NoFantasy. --HG-- branch : trunk
This commit is contained in:
@@ -826,6 +826,28 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level;
|
||||
break;
|
||||
}
|
||||
case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL:
|
||||
{
|
||||
if (action.mount.creatureId || action.mount.modelId)
|
||||
{
|
||||
// set model based on entry from creature_template
|
||||
if (action.mount.creatureId)
|
||||
{
|
||||
if (CreatureInfo const* cInfo = GetCreatureTemplateStore(action.mount.creatureId))
|
||||
{
|
||||
uint32 display_id = sObjectMgr.ChooseDisplayId(0, cInfo);
|
||||
me->Mount(display_id);
|
||||
}
|
||||
}
|
||||
//if no param1, then use value from param2 (modelId)
|
||||
else
|
||||
me->Mount(action.mount.modelId);
|
||||
}
|
||||
else
|
||||
me->Unmount();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,7 @@ enum EventAI_ActionType
|
||||
ACTION_T_SET_SHEATH = 40, // Sheath (0-passive,1-melee,2-ranged)
|
||||
ACTION_T_FORCE_DESPAWN = 41, // No Params
|
||||
ACTION_T_SET_INVINCIBILITY_HP_LEVEL = 42, // MinHpValue, format(0-flat,1-percent from max health)
|
||||
ACTION_T_MOUNT_TO_ENTRY_OR_MODEL = 43, // Creature_template entry(param1) OR ModelId (param2) (or 0 for both to unmount)
|
||||
|
||||
ACTION_T_SET_PHASE_MASK = 97,
|
||||
ACTION_T_SET_STAND_STATE = 98,
|
||||
@@ -398,6 +399,12 @@ struct CreatureEventAI_Action
|
||||
uint32 hp_level;
|
||||
uint32 is_percent;
|
||||
} invincibility_hp_level;
|
||||
// ACTION_T_MOUNT_TO_ENTRY_OR_MODEL = 43
|
||||
struct
|
||||
{
|
||||
uint32 creatureId; // set one from fields (or 0 for both to dismount)
|
||||
uint32 modelId;
|
||||
} mount;
|
||||
// RAW
|
||||
struct
|
||||
{
|
||||
|
||||
@@ -672,6 +672,30 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL:
|
||||
if (action.mount.creatureId != 0 || action.mount.modelId != 0)
|
||||
{
|
||||
if (action.mount.creatureId && !sCreatureStorage.LookupEntry<CreatureInfo>(action.mount.creatureId))
|
||||
{
|
||||
sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent Creature entry %u.", i, j+1, action.mount.creatureId);
|
||||
action.morph.creatureId = 0;
|
||||
}
|
||||
|
||||
if (action.mount.modelId)
|
||||
{
|
||||
if (action.mount.creatureId)
|
||||
{
|
||||
sLog.outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.mount.modelId, action.mount.creatureId);
|
||||
action.mount.modelId = 0;
|
||||
}
|
||||
else if (!sCreatureDisplayInfoStore.LookupEntry(action.mount.modelId))
|
||||
{
|
||||
sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent ModelId %u.", i, j+1, action.mount.modelId);
|
||||
action.mount.modelId = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_T_EVADE: //No Params
|
||||
case ACTION_T_FLEE_FOR_ASSIST: //No Params
|
||||
case ACTION_T_DIE: //No Params
|
||||
|
||||
Reference in New Issue
Block a user