diff options
author | Anubisss <none@none> | 2009-05-27 21:30:03 +0200 |
---|---|---|
committer | Anubisss <none@none> | 2009-05-27 21:30:03 +0200 |
commit | 4ce92ed6fa6c73de41169669f7df0f35611d072e (patch) | |
tree | 8f56e36009562c12332710dcaff6e35e6b0d74ee /src | |
parent | ba934b35d6f8a13904463cfa1d5dd92e0a9c01f1 (diff) |
*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
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/docs/Text-tables.txt | 9 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp | 142 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp | 14 | ||||
-rw-r--r-- | src/game/CreatureAI.cpp | 22 |
4 files changed, 116 insertions, 71 deletions
diff --git a/src/bindings/scripts/docs/Text-tables.txt b/src/bindings/scripts/docs/Text-tables.txt index 2a539a72874..eac63384785 100644 --- a/src/bindings/scripts/docs/Text-tables.txt +++ b/src/bindings/scripts/docs/Text-tables.txt @@ -3,20 +3,20 @@ Texts Documentation ========================================= 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. Custom scripters are adviced to store their text data in custom_texts. -The three different tables has ranges of entries allowed for that table. -eventai_texts: entry -1 -> -999999 +The different tables has ranges of entries allowed for that table. +Reserved EventAI in Mangos entry -1 -> -999999 script_texts: entry -1000000 -> -1999999 custom_texts: entry -2000000 -> -2999999 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. @@ -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). 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). +6 CHAT_TYPE_ZONE_YELL Same as CHAT_TYPE_YELL but will display to all players in current zone. ========================================= diff --git a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp index 7e5cde2ce63..5df22182c1f 100644 --- a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp +++ b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp @@ -38,18 +38,21 @@ EndContentData */ ## npc_draenei_survivor ######*/ -#define SAY_HEAL1 -1000248 -#define SAY_HEAL2 -1000249 -#define SAY_HEAL3 -1000250 -#define SAY_HEAL4 -1000251 - -#define SAY_HELP1 -1000252 -#define SAY_HELP2 -1000253 -#define SAY_HELP3 -1000254 -#define SAY_HELP4 -1000255 - -#define SPELL_IRRIDATION 35046 -#define SPELL_STUNNED 28630 +enum +{ + SAY_HEAL1 = -1000248, + SAY_HEAL2 = -1000249, + SAY_HEAL3 = -1000250, + SAY_HEAL4 = -1000251, + + SAY_HELP1 = -1000252, + SAY_HELP2 = -1000253, + SAY_HELP3 = -1000254, + SAY_HELP4 = -1000255, + + SPELL_IRRIDATION = 35046, + SPELL_STUNNED = 28630 +}; 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 (pPlayer->GetTypeId() != TYPEID_PLAYER) - return; - switch (rand()%4) { case 0: DoScriptText(SAY_HEAL1, m_creature, pPlayer); break; @@ -183,33 +183,59 @@ CreatureAI* GetAI_npc_draenei_survivor(Creature *_Creature) ## npc_engineer_spark_overgrind ######*/ -#define SAY_TEXT -1000256 -#define SAY_EMOTE -1000257 -#define ATTACK_YELL -1000258 - -#define GOSSIP_FIGHT "Traitor! You will be brought to justice!" +enum +{ + 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 SPELL_DYNAMITE 7978 +#define GOSSIP_FIGHT "Traitor! You will be brought to justice!" 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 Emote_Timer; + bool IsTreeEvent; + void Reset() { Dynamite_Timer = 8000; 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) { - if( !m_creature->isInCombat() ) + if( !m_creature->isInCombat() && !IsTreeEvent ) { if (Emote_Timer < diff) { @@ -218,6 +244,8 @@ struct TRINITY_DLL_DECL npc_engineer_spark_overgrindAI : public ScriptedAI Emote_Timer = 120000 + rand()%30000; }else Emote_Timer -= diff; } + else if(IsTreeEvent) + return; if(!UpdateVictim()) return; @@ -239,7 +267,7 @@ CreatureAI* GetAI_npc_engineer_spark_overgrind(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->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 ) { player->CLOSE_GOSSIP_MENU(); - _Creature->setFaction(14); - DoScriptText(ATTACK_YELL, _Creature, player); + _Creature->setFaction(FACTION_HOSTILE); ((npc_engineer_spark_overgrindAI*)_Creature->AI())->AttackStart(player); } return true; @@ -299,14 +326,17 @@ CreatureAI* GetAI_npc_injured_draenei(Creature *_Creature) ## npc_magwin ######*/ -#define SAY_START -1000111 -#define SAY_AGGRO -1000112 -#define SAY_PROGRESS -1000113 -#define SAY_END1 -1000114 -#define SAY_END2 -1000115 -#define EMOTE_HUG -1000116 - -#define QUEST_A_CRY_FOR_SAY_HELP 9528 +enum +{ + SAY_START = -1000111, + SAY_AGGRO = -1000112, + SAY_PROGRESS = -1000113, + SAY_END1 = -1000114, + SAY_END2 = -1000115, + EMOTE_HUG = -1000116, + + QUEST_A_CRY_FOR_SAY_HELP = 9528 +}; struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI { @@ -334,8 +364,7 @@ struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI case 29: DoScriptText(EMOTE_HUG, m_creature, player); DoScriptText(SAY_END2, m_creature, player); - if (player && player->GetTypeId() == TYPEID_PLAYER) - ((Player*)player)->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP,m_creature); + player->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP,m_creature); break; } } @@ -357,7 +386,7 @@ struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI { Player* player = Unit::GetPlayer(PlayerGUID); 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 ######*/ -#define GEEZLE_SAY_1 -1000259 -#define SPARK_SAY_2 -1000260 -#define SPARK_SAY_3 -1000261 -#define GEEZLE_SAY_4 -1000262 -#define SPARK_SAY_5 -1000263 -#define SPARK_SAY_6 -1000264 -#define GEEZLE_SAY_7 -1000265 - -#define EMOTE_SPARK -1000266 - -#define MOB_SPARK 17243 -#define GO_NAGA_FLAG 181694 +enum +{ + GEEZLE_SAY_1 = -1000259, + SPARK_SAY_2 = -1000260, + SPARK_SAY_3 = -1000261, + GEEZLE_SAY_4 = -1000262, + SPARK_SAY_5 = -1000263, + SPARK_SAY_6 = -1000264, + GEEZLE_SAY_7 = -1000265, + + EMOTE_SPARK = -1000266, + + MOB_SPARK = 17243, + GO_NAGA_FLAG = 181694 +}; static float SparkPos[3] = {-5030.95, -11291.99, 7.97}; @@ -531,8 +563,11 @@ CreatureAI* GetAI_npc_geezleAI(Creature *_Creature) ## mob_nestlewood_owlkin ######*/ -#define INOCULATION_CHANNEL 29528 -#define INOCULATED_OWLKIN 16534 +enum +{ + INOCULATION_CHANNEL = 29528, + INOCULATED_OWLKIN = 16534 +}; struct TRINITY_DLL_DECL mob_nestlewood_owlkinAI : public ScriptedAI { @@ -618,6 +653,5 @@ void AddSC_azuremyst_isle() newscript->Name="mob_nestlewood_owlkin"; newscript->GetAI = &GetAI_mob_nestlewood_owlkinAI; newscript->RegisterSelf(); - } diff --git a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp index 369be61ac06..2581e9522ec 100644 --- a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp +++ b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp @@ -352,11 +352,11 @@ bool GOHello_go_manaforge_control_console(Player *player, GameObject* _GO) #define SPELL_SUNFURY_DISGUISE 34603 // Entries of Arcanist Ardonis, Commander Dawnforge, Pathaleon the Curators Image -int CreatureEntry[3][1] = +const uint32 CreatureEntry[3] = { - {19830}, // Ardonis - {19831}, // Dawnforge - {21504} // Pathaleon + 19830, // Ardonis + 19831, // Dawnforge + 21504 // Pathaleon }; struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI @@ -473,7 +473,7 @@ struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI { if (!isEvent) { - Creature *ardonis = SelectCreatureInGrid(CreatureEntry[0][0], 10.0f); + Creature *ardonis = SelectCreatureInGrid(CreatureEntry[0], 10.0f); if (!ardonis) return false; @@ -542,7 +542,7 @@ struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI //Phase 4 Pathaleon spawns up to phase 9 case 4: //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_Timer = 500; 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) { - Creature* Dawnforge = SearchDawnforge(player, CreatureEntry[1][0], 30.0f); + Creature* Dawnforge = SearchDawnforge(player, CreatureEntry[1], 30.0f); if (!Dawnforge) return false; diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp index e9970071f23..f61aca24405 100644 --- a/src/game/CreatureAI.cpp +++ b/src/game/CreatureAI.cpp @@ -73,14 +73,24 @@ void CreatureAI::DoZoneInCombat(Creature* creature) return; } - Map::PlayerList const &PlayerList = map->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + Map::PlayerList const &PlList = map->GetPlayers(); + + 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()); - i->getSource()->SetInCombatWith(creature); - creature->AddThreat(i->getSource(), 0.0f); + if(pPlayer->isGameMaster()) + continue; + + if(pPlayer->isAlive()) + { + creature->SetInCombatWith(pPlayer); + pPlayer->SetInCombatWith(creature); + creature->AddThreat(pPlayer, 0.0f); + } } } } |