*Merge SD2.

*r983: Add additional checks for zoneInCombat-function.
*r984: Remove two useless functions, cleanup some code. - The most part of the patch skipped.
*r985: Clean up some code and prevent Spark from doing certain actions if in certain areas
*r986: Remove most EventAI code - Skip this patch
*r987: Correct and remove now obsolete documentation. - Skip: delete EventAI.txt

--HG--
branch : trunk
This commit is contained in:
Anubisss
2009-05-27 21:30:03 +02:00
parent ba934b35d6
commit 4ce92ed6fa
4 changed files with 110 additions and 65 deletions
+5 -4
View File
@@ -3,20 +3,20 @@ Texts Documentation
========================================= =========================================
Scriptdev2 Revision 695 introduces a new format for using texts in EventAI and SD2 Scripts. Scriptdev2 Revision 695 introduces a new format for using texts in EventAI and SD2 Scripts.
This information relates to the three *_texts tables located in the ScriptDev Database. This information relates to the *_texts tables located in the ScriptDev Database.
Any script can at any time access and use text from any of the three text tables, as long as the entry does in fact exist. Any script can at any time access and use text from any of the three text tables, as long as the entry does in fact exist.
Custom scripters are adviced to store their text data in custom_texts. Custom scripters are adviced to store their text data in custom_texts.
The three different tables has ranges of entries allowed for that table. The different tables has ranges of entries allowed for that table.
eventai_texts: entry -1 -> -999999 Reserved EventAI in Mangos entry -1 -> -999999
script_texts: entry -1000000 -> -1999999 script_texts: entry -1000000 -> -1999999
custom_texts: entry -2000000 -> -2999999 custom_texts: entry -2000000 -> -2999999
Any entry out of range for that table will display a startup error. Any entry out of range for that table will display a startup error.
========================================= =========================================
Basic Structure of eventai_texts, script_texts and custom_texts Basic Structure of script_texts and custom_texts
========================================= =========================================
Below is a the list of current fields within the texts tables. Below is a the list of current fields within the texts tables.
@@ -56,6 +56,7 @@ Below is the list of current Text types that texts tables can handle. These were
3 CHAT_TYPE_BOSS_EMOTE This type sets the text to be displayed as a text emote in orange in the chat log (Used only for specific Bosses). 3 CHAT_TYPE_BOSS_EMOTE This type sets the text to be displayed as a text emote in orange in the chat log (Used only for specific Bosses).
4 CHAT_TYPE_WHISPER This type sets the text to be displayed as a whisper to the player in the chat log. 4 CHAT_TYPE_WHISPER This type sets the text to be displayed as a whisper to the player in the chat log.
5 CHAT_TYPE_BOSS_WHISPER This type sets the text to be displayed as a whisper to the player in the chat log (Used only for specific Bosses). 5 CHAT_TYPE_BOSS_WHISPER This type sets the text to be displayed as a whisper to the player in the chat log (Used only for specific Bosses).
6 CHAT_TYPE_ZONE_YELL Same as CHAT_TYPE_YELL but will display to all players in current zone.
========================================= =========================================
@@ -38,18 +38,21 @@ EndContentData */
## npc_draenei_survivor ## npc_draenei_survivor
######*/ ######*/
#define SAY_HEAL1 -1000248 enum
#define SAY_HEAL2 -1000249 {
#define SAY_HEAL3 -1000250 SAY_HEAL1 = -1000248,
#define SAY_HEAL4 -1000251 SAY_HEAL2 = -1000249,
SAY_HEAL3 = -1000250,
SAY_HEAL4 = -1000251,
#define SAY_HELP1 -1000252 SAY_HELP1 = -1000252,
#define SAY_HELP2 -1000253 SAY_HELP2 = -1000253,
#define SAY_HELP3 -1000254 SAY_HELP3 = -1000254,
#define SAY_HELP4 -1000255 SAY_HELP4 = -1000255,
#define SPELL_IRRIDATION 35046 SPELL_IRRIDATION = 35046,
#define SPELL_STUNNED 28630 SPELL_STUNNED = 28630
};
struct TRINITY_DLL_DECL npc_draenei_survivorAI : public ScriptedAI struct TRINITY_DLL_DECL npc_draenei_survivorAI : public ScriptedAI
{ {
@@ -126,9 +129,6 @@ struct TRINITY_DLL_DECL npc_draenei_survivorAI : public ScriptedAI
if (Player *pPlayer = Unit::GetPlayer(pCaster)) if (Player *pPlayer = Unit::GetPlayer(pCaster))
{ {
if (pPlayer->GetTypeId() != TYPEID_PLAYER)
return;
switch (rand()%4) switch (rand()%4)
{ {
case 0: DoScriptText(SAY_HEAL1, m_creature, pPlayer); break; case 0: DoScriptText(SAY_HEAL1, m_creature, pPlayer); break;
@@ -183,33 +183,59 @@ CreatureAI* GetAI_npc_draenei_survivor(Creature *_Creature)
## npc_engineer_spark_overgrind ## npc_engineer_spark_overgrind
######*/ ######*/
#define SAY_TEXT -1000256 enum
#define SAY_EMOTE -1000257 {
#define ATTACK_YELL -1000258 SAY_TEXT = -1000256,
SAY_EMOTE = -1000257,
ATTACK_YELL = -1000258,
AREA_COVE = 3579,
AREA_ISLE = 3639,
QUEST_GNOMERCY = 9537,
FACTION_HOSTILE = 14,
SPELL_DYNAMITE = 7978
};
#define GOSSIP_FIGHT "Traitor! You will be brought to justice!" #define GOSSIP_FIGHT "Traitor! You will be brought to justice!"
#define SPELL_DYNAMITE 7978
struct TRINITY_DLL_DECL npc_engineer_spark_overgrindAI : public ScriptedAI struct TRINITY_DLL_DECL npc_engineer_spark_overgrindAI : public ScriptedAI
{ {
npc_engineer_spark_overgrindAI(Creature *c) : ScriptedAI(c) {} npc_engineer_spark_overgrindAI(Creature *c) : ScriptedAI(c)
{
NormFaction = c->getFaction();
NpcFlags = c->GetUInt32Value(UNIT_NPC_FLAGS);
if(c->GetAreaId() == AREA_COVE || c->GetAreaId() == AREA_ISLE)
IsTreeEvent = true;
}
uint32 NormFaction;
uint32 NpcFlags;
uint32 Dynamite_Timer; uint32 Dynamite_Timer;
uint32 Emote_Timer; uint32 Emote_Timer;
bool IsTreeEvent;
void Reset() void Reset()
{ {
Dynamite_Timer = 8000; Dynamite_Timer = 8000;
Emote_Timer = 120000 + rand()%30000; Emote_Timer = 120000 + rand()%30000;
m_creature->setFaction(875);
m_creature->setFaction(NormFaction);
m_creature->SetUInt32Value(UNIT_NPC_FLAGS, NpcFlags);
IsTreeEvent = false;
} }
void EnterCombat(Unit *who) { } void EnterCombat(Unit* who)
{
DoScriptText(ATTACK_YELL, m_creature, who);
}
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
{ {
if( !m_creature->isInCombat() ) if( !m_creature->isInCombat() && !IsTreeEvent )
{ {
if (Emote_Timer < diff) if (Emote_Timer < diff)
{ {
@@ -218,6 +244,8 @@ struct TRINITY_DLL_DECL npc_engineer_spark_overgrindAI : public ScriptedAI
Emote_Timer = 120000 + rand()%30000; Emote_Timer = 120000 + rand()%30000;
}else Emote_Timer -= diff; }else Emote_Timer -= diff;
} }
else if(IsTreeEvent)
return;
if(!UpdateVictim()) if(!UpdateVictim())
return; return;
@@ -239,7 +267,7 @@ CreatureAI* GetAI_npc_engineer_spark_overgrind(Creature *_Creature)
bool GossipHello_npc_engineer_spark_overgrind(Player *player, Creature *_Creature) bool GossipHello_npc_engineer_spark_overgrind(Player *player, Creature *_Creature)
{ {
if( player->GetQuestStatus(9537) == QUEST_STATUS_INCOMPLETE ) if( player->GetQuestStatus(QUEST_GNOMERCY) == QUEST_STATUS_INCOMPLETE )
player->ADD_GOSSIP_ITEM(0, GOSSIP_FIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->ADD_GOSSIP_ITEM(0, GOSSIP_FIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID());
@@ -251,8 +279,7 @@ bool GossipSelect_npc_engineer_spark_overgrind(Player *player, Creature *_Creatu
if( action == GOSSIP_ACTION_INFO_DEF ) if( action == GOSSIP_ACTION_INFO_DEF )
{ {
player->CLOSE_GOSSIP_MENU(); player->CLOSE_GOSSIP_MENU();
_Creature->setFaction(14); _Creature->setFaction(FACTION_HOSTILE);
DoScriptText(ATTACK_YELL, _Creature, player);
((npc_engineer_spark_overgrindAI*)_Creature->AI())->AttackStart(player); ((npc_engineer_spark_overgrindAI*)_Creature->AI())->AttackStart(player);
} }
return true; return true;
@@ -299,14 +326,17 @@ CreatureAI* GetAI_npc_injured_draenei(Creature *_Creature)
## npc_magwin ## npc_magwin
######*/ ######*/
#define SAY_START -1000111 enum
#define SAY_AGGRO -1000112 {
#define SAY_PROGRESS -1000113 SAY_START = -1000111,
#define SAY_END1 -1000114 SAY_AGGRO = -1000112,
#define SAY_END2 -1000115 SAY_PROGRESS = -1000113,
#define EMOTE_HUG -1000116 SAY_END1 = -1000114,
SAY_END2 = -1000115,
EMOTE_HUG = -1000116,
#define QUEST_A_CRY_FOR_SAY_HELP 9528 QUEST_A_CRY_FOR_SAY_HELP = 9528
};
struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI
{ {
@@ -334,8 +364,7 @@ struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI
case 29: case 29:
DoScriptText(EMOTE_HUG, m_creature, player); DoScriptText(EMOTE_HUG, m_creature, player);
DoScriptText(SAY_END2, m_creature, player); DoScriptText(SAY_END2, m_creature, player);
if (player && player->GetTypeId() == TYPEID_PLAYER) player->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP,m_creature);
((Player*)player)->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP,m_creature);
break; break;
} }
} }
@@ -357,7 +386,7 @@ struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI
{ {
Player* player = Unit::GetPlayer(PlayerGUID); Player* player = Unit::GetPlayer(PlayerGUID);
if (player) if (player)
((Player*)player)->FailQuest(QUEST_A_CRY_FOR_SAY_HELP); player->FailQuest(QUEST_A_CRY_FOR_SAY_HELP);
} }
} }
@@ -390,18 +419,21 @@ CreatureAI* GetAI_npc_magwinAI(Creature* pCreature)
## npc_geezle ## npc_geezle
######*/ ######*/
#define GEEZLE_SAY_1 -1000259 enum
#define SPARK_SAY_2 -1000260 {
#define SPARK_SAY_3 -1000261 GEEZLE_SAY_1 = -1000259,
#define GEEZLE_SAY_4 -1000262 SPARK_SAY_2 = -1000260,
#define SPARK_SAY_5 -1000263 SPARK_SAY_3 = -1000261,
#define SPARK_SAY_6 -1000264 GEEZLE_SAY_4 = -1000262,
#define GEEZLE_SAY_7 -1000265 SPARK_SAY_5 = -1000263,
SPARK_SAY_6 = -1000264,
GEEZLE_SAY_7 = -1000265,
#define EMOTE_SPARK -1000266 EMOTE_SPARK = -1000266,
#define MOB_SPARK 17243 MOB_SPARK = 17243,
#define GO_NAGA_FLAG 181694 GO_NAGA_FLAG = 181694
};
static float SparkPos[3] = {-5030.95, -11291.99, 7.97}; static float SparkPos[3] = {-5030.95, -11291.99, 7.97};
@@ -531,8 +563,11 @@ CreatureAI* GetAI_npc_geezleAI(Creature *_Creature)
## mob_nestlewood_owlkin ## mob_nestlewood_owlkin
######*/ ######*/
#define INOCULATION_CHANNEL 29528 enum
#define INOCULATED_OWLKIN 16534 {
INOCULATION_CHANNEL = 29528,
INOCULATED_OWLKIN = 16534
};
struct TRINITY_DLL_DECL mob_nestlewood_owlkinAI : public ScriptedAI struct TRINITY_DLL_DECL mob_nestlewood_owlkinAI : public ScriptedAI
{ {
@@ -618,6 +653,5 @@ void AddSC_azuremyst_isle()
newscript->Name="mob_nestlewood_owlkin"; newscript->Name="mob_nestlewood_owlkin";
newscript->GetAI = &GetAI_mob_nestlewood_owlkinAI; newscript->GetAI = &GetAI_mob_nestlewood_owlkinAI;
newscript->RegisterSelf(); newscript->RegisterSelf();
} }
@@ -352,11 +352,11 @@ bool GOHello_go_manaforge_control_console(Player *player, GameObject* _GO)
#define SPELL_SUNFURY_DISGUISE 34603 #define SPELL_SUNFURY_DISGUISE 34603
// Entries of Arcanist Ardonis, Commander Dawnforge, Pathaleon the Curators Image // Entries of Arcanist Ardonis, Commander Dawnforge, Pathaleon the Curators Image
int CreatureEntry[3][1] = const uint32 CreatureEntry[3] =
{ {
{19830}, // Ardonis 19830, // Ardonis
{19831}, // Dawnforge 19831, // Dawnforge
{21504} // Pathaleon 21504 // Pathaleon
}; };
struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI
@@ -473,7 +473,7 @@ struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI
{ {
if (!isEvent) if (!isEvent)
{ {
Creature *ardonis = SelectCreatureInGrid(CreatureEntry[0][0], 10.0f); Creature *ardonis = SelectCreatureInGrid(CreatureEntry[0], 10.0f);
if (!ardonis) if (!ardonis)
return false; return false;
@@ -542,7 +542,7 @@ struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI
//Phase 4 Pathaleon spawns up to phase 9 //Phase 4 Pathaleon spawns up to phase 9
case 4: case 4:
//spawn pathaleon's image //spawn pathaleon's image
m_creature->SummonCreature(CreatureEntry[2][0], 2325.851563, 2799.534668, 133.084229, 6.038996, TEMPSUMMON_TIMED_DESPAWN, 90000); m_creature->SummonCreature(CreatureEntry[2], 2325.851563, 2799.534668, 133.084229, 6.038996, TEMPSUMMON_TIMED_DESPAWN, 90000);
++Phase; ++Phase;
Phase_Timer = 500; Phase_Timer = 500;
break; break;
@@ -655,7 +655,7 @@ bool AreaTrigger_at_commander_dawnforge(Player *player, AreaTriggerEntry *at)
if (player->isAlive() && player->GetQuestStatus(QUEST_INFO_GATHERING) == QUEST_STATUS_INCOMPLETE) if (player->isAlive() && player->GetQuestStatus(QUEST_INFO_GATHERING) == QUEST_STATUS_INCOMPLETE)
{ {
Creature* Dawnforge = SearchDawnforge(player, CreatureEntry[1][0], 30.0f); Creature* Dawnforge = SearchDawnforge(player, CreatureEntry[1], 30.0f);
if (!Dawnforge) if (!Dawnforge)
return false; return false;
+16 -6
View File
@@ -73,14 +73,24 @@ void CreatureAI::DoZoneInCombat(Creature* creature)
return; return;
} }
Map::PlayerList const &PlayerList = map->GetPlayers(); Map::PlayerList const &PlList = map->GetPlayers();
for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if(PlList.isEmpty())
return;
for(Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
{ {
if (i->getSource()->isAlive()) if(Player* pPlayer = i->getSource())
{ {
creature->SetInCombatWith(i->getSource()); if(pPlayer->isGameMaster())
i->getSource()->SetInCombatWith(creature); continue;
creature->AddThreat(i->getSource(), 0.0f);
if(pPlayer->isAlive())
{
creature->SetInCombatWith(pPlayer);
pPlayer->SetInCombatWith(creature);
creature->AddThreat(pPlayer, 0.0f);
}
} }
} }
} }