mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[10365] Implement ACTION_T_MOUNT_TO_ENTRY_OR_MODEL (43) for creature eventAI.
Read doc/EventAI.txt for details. SQL query to update existing scripts are included (convert from using ACTION_T_SET_UNIT_FIELD, field 68) Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
40f70138da
commit
821bb9fcc4
9 changed files with 64 additions and 3 deletions
|
|
@ -142,6 +142,7 @@ For all ACTION_T_RANDOM, When a Particular Param is selected for the Event... Th
|
|||
40 ACTION_T_SET_SHEATH Sheath Sets sheath state for a creature (0 = no weapon, 1 = melee weapon, 2 = ranged weapon).
|
||||
41 ACTION_T_FORCE_DESPAWN Delay Despawns the creature, if delay = 0 immediate otherwise will despawn after delay time set in Param1 (in ms).
|
||||
42 ACTION_T_SET_INVINCIBILITY_HP_LEVEL HP_Level, HP_Percent Set min. health level for creature that can be set at damage as flat value or percent from max health
|
||||
43 ACTION_T_MOUNT_TO_ENTRY_OR_MODEL CreatureEntry, ModelId Set mount model from creature_template.entry (Param1) OR explicit modelId (Param2). If (Param1) AND (Param2) are both 0, unmount.
|
||||
|
||||
* = Use -1 where the param is expected to do nothing. Random constant is generated for each event, so if you have a random yell and a random sound, they will be linked up with each other (ie. param2 with param2).
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
|
|||
`version` varchar(120) default NULL,
|
||||
`creature_ai_version` varchar(120) default NULL,
|
||||
`cache_id` int(10) default '0',
|
||||
`required_10362_01_mangos_creature_movement_template` bit(1) default NULL
|
||||
`required_10365_01_mangos_creature_ai_scripts` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||
|
||||
--
|
||||
|
|
|
|||
5
sql/updates/10365_01_mangos_creature_ai_scripts.sql
Normal file
5
sql/updates/10365_01_mangos_creature_ai_scripts.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE db_version CHANGE COLUMN required_10362_01_mangos_creature_movement_template required_10365_01_mangos_creature_ai_scripts bit;
|
||||
|
||||
UPDATE creature_ai_scripts SET action1_type=43, action1_param1=0 WHERE action1_type=17 AND action1_param1=68;
|
||||
UPDATE creature_ai_scripts SET action2_type=43, action2_param1=0 WHERE action2_type=17 AND action2_param1=68;
|
||||
UPDATE creature_ai_scripts SET action3_type=43, action3_param1=0 WHERE action3_type=17 AND action3_param1=68;
|
||||
|
|
@ -81,6 +81,7 @@ pkgdata_DATA = \
|
|||
10353_01_mangos_mangos_string.sql \
|
||||
10353_02_mangos_command.sql \
|
||||
10362_01_mangos_creature_movement_template.sql \
|
||||
10365_01_mangos_creature_ai_scripts.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -142,4 +143,5 @@ EXTRA_DIST = \
|
|||
10353_01_mangos_mangos_string.sql \
|
||||
10353_02_mangos_command.sql \
|
||||
10362_01_mangos_creature_movement_template.sql \
|
||||
10365_01_mangos_creature_ai_scripts.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -804,6 +804,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 = Creature::ChooseDisplayId(0, cInfo);
|
||||
m_creature->Mount(display_id);
|
||||
}
|
||||
}
|
||||
//if no param1, then use value from param2 (modelId)
|
||||
else
|
||||
m_creature->Mount(action.mount.modelId);
|
||||
}
|
||||
else
|
||||
m_creature->Unmount();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,6 +109,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_END,
|
||||
};
|
||||
|
||||
|
|
@ -377,6 +378,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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -750,6 +750,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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10364"
|
||||
#define REVISION_NR "10365"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __REVISION_SQL_H__
|
||||
#define __REVISION_SQL_H__
|
||||
#define REVISION_DB_CHARACTERS "required_10332_02_characters_pet_aura"
|
||||
#define REVISION_DB_MANGOS "required_10362_01_mangos_creature_movement_template"
|
||||
#define REVISION_DB_MANGOS "required_10365_01_mangos_creature_ai_scripts"
|
||||
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
|
||||
#endif // __REVISION_SQL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue