diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/EventAI/CreatureEventAI.cpp | 22 | ||||
-rw-r--r-- | src/server/game/AI/EventAI/CreatureEventAI.h | 7 | ||||
-rw-r--r-- | src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 24 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 18 |
4 files changed, 53 insertions, 18 deletions
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp index f34564b1389..ec236890fa8 100644 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -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; + } } } diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h index abb749ee28c..1c3d1f4e6e4 100644 --- a/src/server/game/AI/EventAI/CreatureEventAI.h +++ b/src/server/game/AI/EventAI/CreatureEventAI.h @@ -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 { diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index cd283333114..f8b9628d53b 100644 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -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 diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 5823f7a8294..4ea4b1ca033 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1106,24 +1106,6 @@ uint32 ObjectMgr::ChooseDisplayId(uint32 /*team*/, const CreatureInfo *cinfo, co else return data->displayid; - /*if (!team) - { - switch(cinfo->Entry) - { - case 28511: // Eye of Acherus - case 33114: // Flame Leviathan Seat (model 24914 chair) - case 33167: // Salvaged Demolisher Mechanic Seat - case 33189: // Liquid Pryite - return cinfo->Modelid1; - case 33218: // Pyrite Safety Container - return cinfo->Modelid2; - case 33143: // Overload Control Device - return cinfo->Modelid3; - default: - return cinfo->GetRandomValidModelId(); - } - }*/ - return display_id; } |