[12741] Ported ACTION_T_SUMMON_UNIQUE from mangos-zero, updated descriptions

This commit is contained in:
sanctum32 2013-12-13 17:04:23 +02:00 committed by Antz
parent ad4fb2d31d
commit 2daeb8b63d
8 changed files with 1541 additions and 1706 deletions

View file

@ -2195,6 +2195,9 @@
/* */
#undef __NO_INCLUDE_WARN__
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

File diff suppressed because it is too large Load diff

View file

@ -151,7 +151,8 @@ For all ACTION_T_RANDOM Actions, When a Particular Param is selected for the Eve
44 ACTION_T_CHANCED_TEXT Chance, -TextId1, -TextId2 Displays by Chance (1..100) the specified -TextId. When -TextId2 is specified, the selection will be randomized. Text types are defined, along with other options for the text, in a table below. Param2 and Param3 needs to be negative.
45 ACTION_T_THROW_AI_EVENT EventType, Radius Throws an AIEvent of type (Param1) to nearby friendly Npcs in range of (Param2)
46 ACTION_T_SET_THROW_MASK EventTypeMask Marks for which AIEvents the npc will throw AIEvents on its own.
47 ACTION_T_EMOTE_TARGET EmoteId, TargetGuid NPC faces to creature (Param2) and does a specified emote id (Param1).
47 ACTION_T_SUMMON_UNIQUE CreatureID, Target, SummonID Only summons a creature when not already spawned (Param1) to attack target (Param2) at location specified by EventAI_Summons (Param3). Preventing multiple spawns of unique creatures.
48 ACTION_T_EMOTE_TARGET EmoteId, TargetGuid NPC faces to creature (Param2) and does a specified emote id (Param1).
* = 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).
@ -893,7 +894,16 @@ Currently supported are:
So if you want an npc to throw AIEvents automatically on death and on critical health, you would set its EventTypeMask to 0x03
-----------------------------
47 = ACTION_T_EMOTE_TARGET
47 = ACTION_T_SUMMON_UNIQUE
-----------------------------
* Parameter 1: CreatureID - The creature template ID to be summoned. The value here needs to be a valid creature template ID.
* Parameter 2: Target - The target type defining who the summoned creature will attack. The value in this field needs to be a valid target type as specified in the reference tables below. NOTE: Using target type 0 will cause the summoned creature to not attack anyone.
* Parameter 3: SummonID - The summon ID from the creature_ai_summons table controlling the position (and spawn time) where the summoned mob should be spawned at.
Only summons a creature when not already spawned (Param1) to attack target (Param2) at location specified by EventAI_Summons (Param3). Preventing multiple spawns of unique creatures.
-----------------------------
48 = ACTION_T_EMOTE_TARGET
-----------------------------
Parameter 1: The Emote ID that the creature should perform. (Emote IDs are also contained in the DBC but they can be found in the mangos source as well).
Parameter 2: Creature guid, to which emote dealer will performed.
@ -901,7 +911,6 @@ Parameter 2: Creature guid, to which emote dealer will performed.
The creature will perform a visual emote. Unlike a text emote, a visual emote is one where the creature will actually move or perform a gesture.
This is commonly used for NPC's who may perform a special action (Salute, Roar, ect...). Not all player emotes work for creature models.
=========================================
Target Types
=========================================

View file

@ -0,0 +1,5 @@
ALTER TABLE db_version CHANGE COLUMN required_12738_01_mangos_spell_template required_12741_01_mangos bit;
update creature_ai_scripts set action1_type=48 where action1_type=47;
update creature_ai_scripts set action2_type=48 where action2_type=47;
update creature_ai_scripts set action3_type=48 where action3_type=47;

View file

@ -960,6 +960,48 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_throwAIEventMask = action.setThrowMask.eventTypeMask;
break;
}
case ACTION_T_SUMMON_UNIQUE:
{
Creature* pCreature = NULL;
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_creature, action.summon_unique.creatureId, true, false, 100, true);
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pCreature, u_check);
Cell::VisitGridObjects(m_creature, searcher, 100);
WorldObject* pSpawn = NULL;
pSpawn = pCreature;
if (!pSpawn)
{
Unit* target = GetTargetByType(action.summon_unique.target, pActionInvoker, pAIEventSender, reportTargetError);
if (!target && reportTargetError)
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SUMMON_UNIQUE(%u), target-type %u", EventId, action.type, action.summon_unique.target);
CreatureEventAI_Summon_Map::const_iterator i = sEventAIMgr.GetCreatureEventAISummonMap().find(action.summon_unique.spawnId);
if (i == sEventAIMgr.GetCreatureEventAISummonMap().end())
{
sLog.outErrorEventAI("Failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_unique.creatureId, action.summon_unique.spawnId, EventId, m_creature->GetEntry());
return;
}
Creature* pCreature = NULL;
if ((*i).second.SpawnTimeSecs)
pCreature = m_creature->SummonCreature(action.summon_unique.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, (*i).second.SpawnTimeSecs);
else
pCreature = m_creature->SummonCreature(action.summon_unique.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_OOC_DESPAWN, 0);
if (!pCreature)
sLog.outErrorEventAI("Failed to spawn creature %u. EventId %d.Creature %d", action.summon_unique.creatureId, EventId, m_creature->GetEntry());
else if (action.summon_unique.target != TARGET_T_SELF && target)
pCreature->AI()->AttackStart(target);
break;
}
if (pSpawn)
{
return;
}
}
case ACTION_T_EMOTE_TARGET:
{
Unit* pCreature = m_creature->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, action.emoteTarget.targetGuid));

View file

@ -117,7 +117,8 @@ enum EventAI_ActionType
ACTION_T_CHANCED_TEXT = 44, // Chance to display the text, TextId1, optionally TextId2. If more than just -TextId1 is defined, randomize. Negative values.
ACTION_T_THROW_AI_EVENT = 45, // EventType, Radius, unused
ACTION_T_SET_THROW_MASK = 46, // EventTypeMask, unused, unused
ACTION_T_EMOTE_TARGET = 47, // EmoteId, TargetGuid
ACTION_T_SUMMON_UNIQUE = 47, // CreatureId, Target, SpawnId
ACTION_T_EMOTE_TARGET = 48, // EmoteId, TargetGuid
ACTION_T_END,
};
@ -398,7 +399,14 @@ struct CreatureEventAI_Action
uint32 unused1;
uint32 unused2;
} setThrowMask;
// ACTION_T_EMOTE_TARGET = 47
// ACTION_T_SUMMON_UNIQUE = 47
struct
{
uint32 creatureId;
uint32 target;
uint32 spawnId;
} summon_unique;
// ACTION_T_EMOTE_TARGET = 48
struct
{
uint32 emoteId;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12740"
#define REVISION_NR "12741"
#endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_12712_01_characters_characters"
#define REVISION_DB_MANGOS "required_12738_01_mangos_spell_template"
#define REVISION_DB_MANGOS "required_12741_01_mangos"
#define REVISION_DB_REALMD "required_c12484_02_realmd_account_access"
#endif // __REVISION_SQL_H__