diff options
Diffstat (limited to 'src')
110 files changed, 7422 insertions, 2908 deletions
diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt index 0ee315816e1..5193297610d 100644 --- a/src/bindings/scripts/CMakeLists.txt +++ b/src/bindings/scripts/CMakeLists.txt @@ -67,25 +67,19 @@ SET(trinityscript_LIB_SRCS scripts/zone/black_temple/def_black_temple.h scripts/zone/black_temple/illidari_council.cpp scripts/zone/black_temple/instance_black_temple.cpp - scripts/zone/blackrock_depths/blackrock_depths.cpp - scripts/zone/blackrock_depths/instance_blackrock_depths.cpp - scripts/zone/blackrock_depths/def_blackrock_depths.h - scripts/zone/blackrock_depths/boss_ambassador_flamelash.cpp - scripts/zone/blackrock_depths/boss_angerrel.cpp - scripts/zone/blackrock_depths/boss_anubshiah.cpp - scripts/zone/blackrock_depths/boss_doomrel.cpp - scripts/zone/blackrock_depths/boss_doperel.cpp - scripts/zone/blackrock_depths/boss_emperor_dagran_thaurissan.cpp - scripts/zone/blackrock_depths/boss_general_angerforge.cpp - scripts/zone/blackrock_depths/boss_gloomrel.cpp + scripts/zone/blackrock_depths/blackrock_depths.cpp + scripts/zone/blackrock_depths/boss_ambassador_flamelash.cpp + scripts/zone/blackrock_depths/boss_anubshiah.cpp + scripts/zone/blackrock_depths/boss_emperor_dagran_thaurissan.cpp + scripts/zone/blackrock_depths/boss_general_angerforge.cpp scripts/zone/blackrock_depths/boss_gorosh_the_dervish.cpp - scripts/zone/blackrock_depths/boss_grizzle.cpp - scripts/zone/blackrock_depths/boss_haterel.cpp - scripts/zone/blackrock_depths/boss_high_interrogator_gerstahn.cpp - scripts/zone/blackrock_depths/boss_magmus.cpp - scripts/zone/blackrock_depths/boss_moira_bronzebeard.cpp - scripts/zone/blackrock_depths/boss_seethrel.cpp - scripts/zone/blackrock_depths/boss_vilerel.cpp + scripts/zone/blackrock_depths/boss_grizzle.cpp + scripts/zone/blackrock_depths/boss_high_interrogator_gerstahn.cpp + scripts/zone/blackrock_depths/boss_magmus.cpp + scripts/zone/blackrock_depths/boss_moira_bronzebeard.cpp + scripts/zone/blackrock_depths/boss_tomb_of_seven.cpp + scripts/zone/blackrock_depths/def_blackrock_depths.h + scripts/zone/blackrock_depths/instance_blackrock_depths.cpp scripts/zone/blackrock_spire/boss_drakkisath.cpp scripts/zone/blackrock_spire/boss_gyth.cpp scripts/zone/blackrock_spire/boss_halycon.cpp @@ -163,8 +157,11 @@ SET(trinityscript_LIB_SRCS scripts/zone/hellfire_citadel/blood_furnace/boss_broggok.cpp scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp scripts/zone/hellfire_citadel/blood_furnace/boss_the_maker.cpp + scripts/zone/hellfire_citadel/blood_furnace/instance_blood_furnace.cpp + scripts/zone/hellfire_citadel/blood_furnace/def_blood_furnace.h scripts/zone/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp scripts/zone/hellfire_citadel/hellfire_ramparts/boss_watchkeeper_gargolmar.cpp + scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp scripts/zone/hellfire_citadel/magtheridons_lair/def_magtheridons_lair.h scripts/zone/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp @@ -347,6 +344,7 @@ SET(trinityscript_LIB_SRCS scripts/zone/uldaman/boss_ironaya.cpp scripts/zone/uldaman/uldaman.cpp scripts/zone/undercity/undercity.cpp + scripts/zone/ungoro_crater/ungoro_crater.cpp scripts/zone/wailing_caverns/instance_wailing_caverns.cpp scripts/zone/western_plaguelands/western_plaguelands.cpp scripts/zone/westfall/westfall.cpp @@ -382,6 +380,8 @@ SET(trinityscript_LIB_SRCS add_library(trinityscript SHARED ${trinityscript_LIB_SRCS}) +add_definitions(-D_TRINITY_SCRIPT_CONFIG='"${CONF_DIR}/trinitycore.conf"') + target_link_libraries(trinityscript) set_target_properties(trinityscript PROPERTIES VERSION 4.2.0 SOVERSION 4) diff --git a/src/bindings/scripts/Makefile.am b/src/bindings/scripts/Makefile.am index 87cdb11db0a..ac5965336a6 100644 --- a/src/bindings/scripts/Makefile.am +++ b/src/bindings/scripts/Makefile.am @@ -102,24 +102,18 @@ scripts/zone/black_temple/def_black_temple.h \ scripts/zone/black_temple/illidari_council.cpp \ scripts/zone/black_temple/instance_black_temple.cpp \ scripts/zone/blackrock_depths/blackrock_depths.cpp \ -scripts/zone/blackrock_depths/instance_blackrock_depths.cpp \ -scripts/zone/blackrock_depths/def_blackrock_depths.h \ scripts/zone/blackrock_depths/boss_ambassador_flamelash.cpp \ -scripts/zone/blackrock_depths/boss_angerrel.cpp \ scripts/zone/blackrock_depths/boss_anubshiah.cpp \ -scripts/zone/blackrock_depths/boss_doomrel.cpp \ -scripts/zone/blackrock_depths/boss_doperel.cpp \ scripts/zone/blackrock_depths/boss_emperor_dagran_thaurissan.cpp \ scripts/zone/blackrock_depths/boss_general_angerforge.cpp \ -scripts/zone/blackrock_depths/boss_gloomrel.cpp \ scripts/zone/blackrock_depths/boss_gorosh_the_dervish.cpp \ scripts/zone/blackrock_depths/boss_grizzle.cpp \ -scripts/zone/blackrock_depths/boss_haterel.cpp \ scripts/zone/blackrock_depths/boss_high_interrogator_gerstahn.cpp \ scripts/zone/blackrock_depths/boss_magmus.cpp \ scripts/zone/blackrock_depths/boss_moira_bronzebeard.cpp \ -scripts/zone/blackrock_depths/boss_seethrel.cpp \ -scripts/zone/blackrock_depths/boss_vilerel.cpp \ +scripts/zone/blackrock_depths/boss_tomb_of_seven.cpp \ +scripts/zone/blackrock_depths/def_blackrock_depths.h \ +scripts/zone/blackrock_depths/instance_blackrock_depths.cpp \ scripts/zone/blackrock_spire/boss_drakkisath.cpp \ scripts/zone/blackrock_spire/boss_gyth.cpp \ scripts/zone/blackrock_spire/boss_halycon.cpp \ @@ -197,8 +191,11 @@ scripts/zone/gruuls_lair/instance_gruuls_lair.cpp \ scripts/zone/hellfire_citadel/blood_furnace/boss_broggok.cpp \ scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp \ scripts/zone/hellfire_citadel/blood_furnace/boss_the_maker.cpp \ +scripts/zone/hellfire_citadel/blood_furnace/instance_blood_furnace.cpp \ +scripts/zone/hellfire_citadel/blood_furnace/def_blood_furnace.h \ scripts/zone/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp \ scripts/zone/hellfire_citadel/hellfire_ramparts/boss_watchkeeper_gargolmar.cpp \ +scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp \ scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp \ scripts/zone/hellfire_citadel/magtheridons_lair/def_magtheridons_lair.h \ scripts/zone/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp \ diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index b804b40b4f8..4bca36cbc01 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -163,21 +163,16 @@ extern void AddSC_instance_black_temple(); //Blackrock Depths extern void AddSC_blackrock_depths(); extern void AddSC_boss_ambassador_flamelash(); -extern void AddSC_boss_angerrel(); extern void AddSC_boss_anubshiah(); -extern void AddSC_boss_doomrel(); -extern void AddSC_boss_doperel(); extern void AddSC_boss_draganthaurissan(); extern void AddSC_boss_general_angerforge(); -extern void AddSC_boss_gloomrel(); extern void AddSC_boss_gorosh_the_dervish(); extern void AddSC_boss_grizzle(); -extern void AddSC_boss_haterel(); extern void AddSC_boss_high_interrogator_gerstahn(); extern void AddSC_boss_magmus(); extern void AddSC_boss_moira_bronzebeard(); -extern void AddSC_boss_seethrel(); -extern void AddSC_boss_vilerel(); +extern void AddSC_boss_tomb_of_seven(); +extern void AddSC_instance_blackrock_depths(); //Blackrock Spire extern void AddSC_boss_drakkisath(); @@ -304,6 +299,7 @@ extern void AddSC_instance_gruuls_lair(); extern void AddSC_boss_broggok(); extern void AddSC_boss_kelidan_the_breaker(); extern void AddSC_boss_the_maker(); +extern void AddSC_instance_blood_furnace(); //--Magtheridon's Lair extern void AddSC_boss_magtheridon(); @@ -318,6 +314,7 @@ extern void AddSC_instance_shattered_halls(); //--Ramparts extern void AddSC_boss_watchkeeper_gargolmar(); extern void AddSC_boss_omor_the_unscarred(); +extern void AddSC_boss_vazruden_the_herald(); //Hellfire Peninsula extern void AddSC_boss_doomlordkazzak(); @@ -635,7 +632,7 @@ void LoadDatabase() QueryResult *result; //Get Version information - result = TScriptDB.PQuery("SELECT version FROM script_db_version"); + result = TScriptDB.PQuery("SELECT script_version FROM version LIMIT 1"); if (result) { @@ -646,7 +643,7 @@ void LoadDatabase() }else { - error_log("TSCR: Missing `script_db_version` information."); + error_log("TSCR: Missing `version.script_version` information."); outstring_log(""); } @@ -1372,22 +1369,17 @@ void ScriptsInit() //Blackfathom Depths //Blackrock Depths AddSC_blackrock_depths(); - AddSC_boss_ambassador_flamelash(); - AddSC_boss_angerrel(); - AddSC_boss_anubshiah(); - AddSC_boss_doomrel(); - AddSC_boss_doperel(); - AddSC_boss_draganthaurissan(); - AddSC_boss_general_angerforge(); - AddSC_boss_gloomrel(); - AddSC_boss_gorosh_the_dervish(); - AddSC_boss_grizzle(); - AddSC_boss_haterel(); - AddSC_boss_high_interrogator_gerstahn(); - AddSC_boss_magmus(); - AddSC_boss_moira_bronzebeard(); - AddSC_boss_seethrel(); - AddSC_boss_vilerel(); + AddSC_boss_ambassador_flamelash(); + AddSC_boss_anubshiah(); + AddSC_boss_draganthaurissan(); + AddSC_boss_general_angerforge(); + AddSC_boss_gorosh_the_dervish(); + AddSC_boss_grizzle(); + AddSC_boss_high_interrogator_gerstahn(); + AddSC_boss_magmus(); + AddSC_boss_moira_bronzebeard(); + AddSC_boss_tomb_of_seven(); + AddSC_instance_blackrock_depths(); //Blackrock Spire AddSC_boss_drakkisath(); @@ -1513,6 +1505,7 @@ void ScriptsInit() AddSC_boss_broggok(); AddSC_boss_kelidan_the_breaker(); AddSC_boss_the_maker(); + AddSC_instance_blood_furnace(); //--Magtheridon's Lair AddSC_boss_magtheridon(); @@ -1527,6 +1520,7 @@ void ScriptsInit() //--Ramparts AddSC_boss_watchkeeper_gargolmar(); AddSC_boss_omor_the_unscarred(); + AddSC_boss_vazruden_the_herald(); //Hellfire Peninsula AddSC_boss_doomlordkazzak(); diff --git a/src/bindings/scripts/VC71/71ScriptDev2.vcproj b/src/bindings/scripts/VC71/71ScriptDev2.vcproj index 564ac2d109e..e75de4546bb 100644 --- a/src/bindings/scripts/VC71/71ScriptDev2.vcproj +++ b/src/bindings/scripts/VC71/71ScriptDev2.vcproj @@ -1431,6 +1431,14 @@ RelativePath="..\scripts\zone\hellfire_citadel\blood_furnace\boss_the_maker.cpp" > </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\blood_furnace\def_blood_furnace.h" + > + </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\blood_furnace\instance_blood_furnace.cpp" + > + </File> </Filter> <Filter Name="Magtheridon's lair" @@ -1459,6 +1467,10 @@ RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_watchkeeper_gargolmar.cpp" > </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_vazruden_the_herald.cpp" + > + </File> </Filter> <Filter Name="Shattered Halls" @@ -2099,23 +2111,11 @@ <File RelativePath="..\scripts\zone\blackrock_depths\boss_ambassador_flamelash.cpp" > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_angerrel.cpp" - > - </File> + </File> <File RelativePath="..\scripts\zone\blackrock_depths\boss_anubshiah.cpp" > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_doomrel.cpp" - > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_doperel.cpp" - > - </File> + </File> <File RelativePath="..\scripts\zone\blackrock_depths\boss_emperor_dagran_thaurissan.cpp" > @@ -2123,11 +2123,7 @@ <File RelativePath="..\scripts\zone\blackrock_depths\boss_general_angerforge.cpp" > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_gloomrel.cpp" - > - </File> + </File> <File RelativePath="..\scripts\zone\blackrock_depths\boss_gorosh_the_dervish.cpp" > @@ -2135,11 +2131,7 @@ <File RelativePath="..\scripts\zone\blackrock_depths\boss_grizzle.cpp" > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_haterel.cpp" - > - </File> + </File> <File RelativePath="..\scripts\zone\blackrock_depths\boss_high_interrogator_gerstahn.cpp" > @@ -2151,13 +2143,9 @@ <File RelativePath="..\scripts\zone\blackrock_depths\boss_moira_bronzebeard.cpp" > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_seethrel.cpp" - > - </File> + </File> <File - RelativePath="..\scripts\zone\blackrock_depths\boss_vilerel.cpp" + RelativePath="..\scripts\zone\blackrock_depths\boss_tomb_of_seven.cpp" > </File> </Filter> diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index 7173c0f4950..1c84fabba2c 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -1608,6 +1608,14 @@ RelativePath="..\scripts\zone\hellfire_citadel\blood_furnace\boss_the_maker.cpp" > </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\blood_furnace\def_blood_furnace.h" + > + </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\blood_furnace\instance_blood_furnace.cpp" + > + </File> </Filter> <Filter Name="Magtheridon's lair" @@ -1636,6 +1644,10 @@ RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_watchkeeper_gargolmar.cpp" > </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_vazruden_the_herald.cpp" + > + </File> </Filter> <Filter Name="Shattered Halls" @@ -2276,23 +2288,11 @@ <File RelativePath="..\scripts\zone\blackrock_depths\boss_ambassador_flamelash.cpp" > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_angerrel.cpp" - > - </File> + </File> <File RelativePath="..\scripts\zone\blackrock_depths\boss_anubshiah.cpp" > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_doomrel.cpp" - > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_doperel.cpp" - > - </File> + </File> <File RelativePath="..\scripts\zone\blackrock_depths\boss_emperor_dagran_thaurissan.cpp" > @@ -2300,11 +2300,7 @@ <File RelativePath="..\scripts\zone\blackrock_depths\boss_general_angerforge.cpp" > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_gloomrel.cpp" - > - </File> + </File> <File RelativePath="..\scripts\zone\blackrock_depths\boss_gorosh_the_dervish.cpp" > @@ -2312,11 +2308,7 @@ <File RelativePath="..\scripts\zone\blackrock_depths\boss_grizzle.cpp" > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_haterel.cpp" - > - </File> + </File> <File RelativePath="..\scripts\zone\blackrock_depths\boss_high_interrogator_gerstahn.cpp" > @@ -2328,13 +2320,9 @@ <File RelativePath="..\scripts\zone\blackrock_depths\boss_moira_bronzebeard.cpp" > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_seethrel.cpp" - > - </File> + </File> <File - RelativePath="..\scripts\zone\blackrock_depths\boss_vilerel.cpp" + RelativePath="..\scripts\zone\blackrock_depths\boss_tomb_of_seven.cpp" > </File> </Filter> diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj index 2b6274afb28..d903219407e 100644 --- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj +++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj @@ -1601,6 +1601,14 @@ RelativePath="..\scripts\zone\hellfire_citadel\blood_furnace\boss_the_maker.cpp" > </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\blood_furnace\def_blood_furnace.h" + > + </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\blood_furnace\instance_blood_furnace.cpp" + > + </File> </Filter> <Filter Name="Magtheridon's lair" @@ -1626,6 +1634,10 @@ > </File> <File + RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_vazruden_the_herald.cpp" + > + </File> + <File RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_watchkeeper_gargolmar.cpp" > </File> @@ -2263,22 +2275,10 @@ > </File> <File - RelativePath="..\scripts\zone\blackrock_depths\boss_angerrel.cpp" - > - </File> - <File RelativePath="..\scripts\zone\blackrock_depths\boss_anubshiah.cpp" > </File> <File - RelativePath="..\scripts\zone\blackrock_depths\boss_doomrel.cpp" - > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_doperel.cpp" - > - </File> - <File RelativePath="..\scripts\zone\blackrock_depths\boss_emperor_dagran_thaurissan.cpp" > </File> @@ -2287,10 +2287,6 @@ > </File> <File - RelativePath="..\scripts\zone\blackrock_depths\boss_gloomrel.cpp" - > - </File> - <File RelativePath="..\scripts\zone\blackrock_depths\boss_gorosh_the_dervish.cpp" > </File> @@ -2299,10 +2295,6 @@ > </File> <File - RelativePath="..\scripts\zone\blackrock_depths\boss_haterel.cpp" - > - </File> - <File RelativePath="..\scripts\zone\blackrock_depths\boss_high_interrogator_gerstahn.cpp" > </File> @@ -2315,11 +2307,7 @@ > </File> <File - RelativePath="..\scripts\zone\blackrock_depths\boss_seethrel.cpp" - > - </File> - <File - RelativePath="..\scripts\zone\blackrock_depths\boss_vilerel.cpp" + RelativePath="..\scripts\zone\blackrock_depths\boss_tomb_of_seven.cpp" > </File> <File diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp index cbbb574d253..82e7ab04ca9 100644 --- a/src/bindings/scripts/include/sc_creature.cpp +++ b/src/bindings/scripts/include/sc_creature.cpp @@ -761,21 +761,25 @@ void ScriptedAI::DoTeleportAll(float x, float y, float z, float o) i_pl->TeleportTo(m_creature->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT); } -Unit* ScriptedAI::FindCreature(uint32 entry, float range) -{ +Unit* FindCreature(uint32 entry, float range, Unit* Finder) +{ + if(!Finder) + return NULL; Creature* target = NULL; - Trinity::AllCreaturesOfEntryInRange check(m_creature, entry, range); + Trinity::AllCreaturesOfEntryInRange check(Finder, entry, range); Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(target, check); - m_creature->VisitNearbyObject(range, searcher); + Finder->VisitNearbyObject(range, searcher); return target; } -GameObject* ScriptedAI::FindGameObject(uint32 entry, float range) +GameObject* FindGameObject(uint32 entry, float range, Unit* Finder) { + if(!Finder) + return NULL; GameObject* target = NULL; Trinity::AllGameObjectsWithEntryInGrid go_check(entry); Trinity::GameObjectSearcher<Trinity::AllGameObjectsWithEntryInGrid> searcher(target, go_check); - m_creature->VisitNearbyGridObject(range, searcher); + Finder->VisitNearbyGridObject(range, searcher); return target; } diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h index cf991baa301..6f60f8cf334 100644 --- a/src/bindings/scripts/include/sc_creature.h +++ b/src/bindings/scripts/include/sc_creature.h @@ -25,6 +25,12 @@ private: Creature *m_creature; }; +//Get a single creature of given entry +Unit* FindCreature(uint32 entry, float range, Unit* Finder); + +//Get a single gameobject of given entry +GameObject* FindGameObject(uint32 entry, float range, Unit* Finder); + struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI { ScriptedAI(Creature* creature) : m_creature(creature), InCombat(false), IsFleeing(false) {} @@ -153,12 +159,6 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI void DoTeleportPlayer(Unit* pUnit, float x, float y, float z, float o); void DoTeleportAll(float x, float y, float z, float o); - //Get a single creature of given entry - Unit* FindCreature(uint32 entry, float range); - - //Get a single gameobject of given entry - GameObject* FindGameObject(uint32 entry, float range); - //Returns friendly unit with the most amount of hp missing from max hp Unit* DoSelectLowestHpFriendly(float range, uint32 MinHPDiff = 1); diff --git a/src/bindings/scripts/scripts/item/item_scripts.cpp b/src/bindings/scripts/scripts/item/item_scripts.cpp index 22e437079f3..ba92a4adcd7 100644 --- a/src/bindings/scripts/scripts/item/item_scripts.cpp +++ b/src/bindings/scripts/scripts/item/item_scripts.cpp @@ -104,9 +104,13 @@ bool ItemUse_item_only_for_flight(Player *player, Item* _Item, SpellCastTargets bool ItemUse_item_attuned_crystal_cores(Player *player, Item* _Item, SpellCastTargets const& targets) { if( targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId()==TYPEID_UNIT && - targets.getUnitTarget()->GetEntry() == 24972 && targets.getUnitTarget()->isDead() ) - return false; - + targets.getUnitTarget()->GetEntry() == 24972 && targets.getUnitTarget()->isDead() && + (player->GetQuestStatus(11524) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(11525) == QUEST_STATUS_INCOMPLETE) ) + { + ((Creature*)targets.getUnitTarget())->RemoveCorpse(); + return false; + } + player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,_Item,NULL); return true; } diff --git a/src/bindings/scripts/scripts/npc/npcs_special.cpp b/src/bindings/scripts/scripts/npc/npcs_special.cpp index e67fa031d42..eaa841fe59d 100644 --- a/src/bindings/scripts/scripts/npc/npcs_special.cpp +++ b/src/bindings/scripts/scripts/npc/npcs_special.cpp @@ -31,6 +31,7 @@ npc_doctor 100% Gustaf Vanhowzen and Gregory Victor, quest 6622 npc_mount_vendor 100% Regular mount vendors all over the world. Display gossip if player doesn't meet the requirements to buy npc_rogue_trainer 80% Scripted trainers, so they are able to offer item 17126 for class quest 6681 npc_sayge 100% Darkmoon event fortune teller, buff player based on answers given +npc_snake_trap_serpents 80% AI for snakes that summoned by Snake Trap EndContentData */ #include "precompiled.h" @@ -272,7 +273,7 @@ static Location HordeCoords[]= { // Left, front -1017.25, -3500.85, 62.98, 4.34 }, - { // Right, Front + { // Right, Front -1020.95, -3499.21, 62.98, 4.34 } }; @@ -993,6 +994,142 @@ bool ReceiveEmote_npc_brewfest_reveler( Player *player, Creature *_Creature, uin return true; } +/*#### +## npc_snake_trap_serpents +####*/ + +#define SPELL_MIND_NUMBING_POISON 8692 //Viper +#define SPELL_DEADLY_POISON 34655 //Venomous Snake +#define SPELL_CRIPPLING_POISON 3409 //Viper + +#define VENOMOUS_SNAKE_TIMER 1200 +#define VIPER_TIMER 3000 + +#define C_VIPER 19921 + +#define RAND 5 + +struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI +{ + npc_snake_trap_serpentsAI(Creature *c) : ScriptedAI(c) {Reset();} + + uint32 SpellTimer; + Unit *Owner; + bool IsViper; + + void Aggro(Unit *who) {} + + void Reset() + { + Owner = m_creature->GetOwner(); + + if (!m_creature->isPet() || !Owner) + return; + + CreatureInfo const *Info = m_creature->GetCreatureInfo(); + + if(Info->Entry == C_VIPER) + IsViper = true; + + //We have to reload the states from db for summoned guardians + m_creature->SetMaxHealth(Info->maxhealth); + m_creature->SetHealth(Info->maxhealth); + m_creature->SetStatFloatValue(UNIT_FIELD_MINDAMAGE, Info->mindmg); + m_creature->SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, Info->maxdmg); + + //Add delta to make them not all hit the same time + uint32 delta = (rand() % 7) *100; + m_creature->SetStatFloatValue(UNIT_FIELD_BASEATTACKTIME, Info->baseattacktime + delta); + m_creature->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , Info->attackpower); + + InCombat = false; + + } + + //Redefined for random target selection: + void MoveInLineOfSight(Unit *who) + { + if (!m_creature->isPet() || !Owner) + return; + + if( !m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessiblePlaceFor(m_creature) && Owner->IsHostileTo(who))//don't attack not-pvp-flaged + { + if (m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + return; + + float attackRadius = m_creature->GetAttackDistance(who); + if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) + { + if (!(rand() % RAND) ) + { + m_creature->setAttackTimer(BASE_ATTACK, (rand() % 10) * 100); + SpellTimer = (rand() % 10) * 100; + AttackStart(who); + InCombat = true; + } + } + } + } + + void UpdateAI(const uint32 diff) + { + if (!m_creature->isPet() || !Owner) + return; + + //Follow if not in combat + if (!m_creature->hasUnitState(UNIT_STAT_FOLLOW)&& !InCombat) + { + m_creature->GetMotionMaster()->Clear(); + m_creature->GetMotionMaster()->MoveFollow(Owner,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE); + } + + //No victim -> get new from owner (need this because MoveInLineOfSight won't work while following -> corebug) + if (!m_creature->getVictim()) + { + if (InCombat) + DoStopAttack(); + + InCombat = false; + + if(Owner->getAttackerForHelper()) + AttackStart(Owner->getAttackerForHelper()); + + return; + } + + if (SpellTimer < diff) + { + if (IsViper) //Viper + { + if (rand() % 3 == 0) //33% chance to cast + { + uint32 spell; + if( rand() % 2 == 0) + spell = SPELL_MIND_NUMBING_POISON; + else + spell = SPELL_CRIPPLING_POISON; + + DoCast(m_creature->getVictim(),spell); + } + + SpellTimer = VIPER_TIMER; + } + else //Venomous Snake + { + if (rand() % 10 < 8) //80% chance to cast + DoCast(m_creature->getVictim(),SPELL_DEADLY_POISON); + SpellTimer = VENOMOUS_SNAKE_TIMER + (rand() %5)*100; + } + }else SpellTimer-=diff; + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_npc_snake_trap_serpents(Creature *_Creature) +{ + return new npc_snake_trap_serpentsAI(_Creature); +} + void AddSC_npcs_special() { Script *newscript; @@ -1064,4 +1201,9 @@ void AddSC_npcs_special() newscript->Name="npc_brewfest_reveler"; newscript->pReceiveEmote = &ReceiveEmote_npc_brewfest_reveler; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="npc_snake_trap_serpents"; + newscript->GetAI = &GetAI_npc_snake_trap_serpents; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp b/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp index 7aff80c0d02..ad03e9e8987 100644 --- a/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp +++ b/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp @@ -32,16 +32,16 @@ EndContentData */ ## npc_professor_phizzlethorpe ######*/ -#define SAY_PROGRESS_1 "Ok, $N. Follow me to the cave where I'll attempt to harness the power of the rune stone into these goggles." -#define SAY_PROGRESS_2 "I discovered this cave on our first day here. I believe the energy in the stone can be used to our advantage." -#define SAY_PROGRESS_3 "I'll begin drawing energy from the stone. Your job, $N, is to defend me. This place is cursed... trust me." -#define EMOTE_PROGRESS_4 "begins tinkering with the goggles before the stone." -#define SAY_AGGRO "Help!!! Get these things off me so I can get my work done!" -#define SAY_PROGRESS_5 "Almost done! Just a little longer!" -#define SAY_PROGRESS_6 "I've done it! I have harnessed the power of the stone into the goggles! Let's get out of here!" -#define SAY_PROGRESS_7 "Phew! Glad to be back from that creepy cave." -#define EMOTE_PROGRESS_8 "hands one glowing goggles over to Doctor Draxlegauge." -#define SAY_PROGRESS_9 "Doctor Draxlegauge will give you further instructions, $N. Many thanks for your help!" +#define SAY_PROGRESS_1 -1000235 +#define SAY_PROGRESS_2 -1000236 +#define SAY_PROGRESS_3 -1000237 +#define EMOTE_PROGRESS_4 -1000238 +#define SAY_AGGRO -1000239 +#define SAY_PROGRESS_5 -1000240 +#define SAY_PROGRESS_6 -1000241 +#define SAY_PROGRESS_7 -1000242 +#define EMOTE_PROGRESS_8 -1000243 +#define SAY_PROGRESS_9 -1000244 #define QUEST_SUNKEN_TREASURE 665 #define MOB_VENGEFUL_SURGE 2776 @@ -50,29 +50,32 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI { npc_professor_phizzlethorpeAI(Creature *c) : npc_escortAI(c) {Reset();} + bool Completed; + void WaypointReached(uint32 i) { Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); switch(i) { - case 4:DoSay(SAY_PROGRESS_2, LANG_UNIVERSAL, player, true);break; - case 5:DoSay(SAY_PROGRESS_3, LANG_UNIVERSAL, player, true);break; - case 8:DoTextEmote(EMOTE_PROGRESS_4, NULL);break; + case 4:DoScriptText(SAY_PROGRESS_2, m_creature, player);break; + case 5:DoScriptText(SAY_PROGRESS_3, m_creature, player);break; + case 8:DoScriptText(EMOTE_PROGRESS_4, m_creature);break; case 9: { m_creature->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96, -2142.49, 20.15, 1.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); m_creature->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96, -2142.49, 20.15, 1.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); break; } - case 10:DoSay(SAY_PROGRESS_5, LANG_UNIVERSAL, player, true);break; - case 11:DoSay(SAY_PROGRESS_6, LANG_UNIVERSAL, player, true);break; - case 19:DoSay(SAY_PROGRESS_7, LANG_UNIVERSAL, player, true); break; + case 10:DoScriptText(SAY_PROGRESS_5, m_creature, player);break; + case 11:DoScriptText(SAY_PROGRESS_6, m_creature, player);break; + case 19:DoScriptText(SAY_PROGRESS_7, m_creature, player); break; case 20: - DoTextEmote(EMOTE_PROGRESS_8, NULL); - DoSay(SAY_PROGRESS_9, LANG_UNIVERSAL, player, true); + DoScriptText(EMOTE_PROGRESS_8, m_creature); + DoScriptText(SAY_PROGRESS_9, m_creature, player); + Completed = true; if(player) - ((Player*)player)->GroupEventHappens(QUEST_SUNKEN_TREASURE, m_creature); + ((Player*)player)->GroupEventHappens(QUEST_SUNKEN_TREASURE, m_creature); break; } } @@ -82,16 +85,20 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI summoned->AI()->AttackStart(m_creature); } - void Reset(){} + void Reset() + { + Completed = true; + m_creature->setFaction(35); + } void Aggro(Unit* who) { - DoSay(SAY_AGGRO, LANG_UNIVERSAL, NULL); + DoScriptText(SAY_AGGRO, m_creature, NULL); } void JustDied(Unit* killer) { - if (PlayerGUID) + if (PlayerGUID && !Completed ) { Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); if (player) @@ -109,7 +116,7 @@ bool QuestAccept_npc_professor_phizzlethorpe(Player* player, Creature* creature, { if (quest->GetQuestId() == QUEST_SUNKEN_TREASURE) { - creature->Say(SAY_PROGRESS_1, LANG_UNIVERSAL, player->GetGUID()); + DoScriptText(SAY_PROGRESS_1, creature, player); ((npc_escortAI*)(creature->AI()))->Start(false, false, false, player->GetGUID()); creature->setFaction(113); } diff --git a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp index 85ce5ea0bea..fcbb931cf06 100644 --- a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp +++ b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp @@ -202,7 +202,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI { case 0: { m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - GameObject* Cage = FindGameObject(GO_CAGE, 99); + GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature); if(Cage) Cage->SetGoState(0); break;} @@ -232,7 +232,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI if (!IsBeingEscorted) m_creature->setFaction(1602); - GameObject* Cage = FindGameObject(GO_CAGE, 99); + GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature); if(Cage) Cage->SetGoState(1); } diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp index 440f233bccf..5f4eae9fbfe 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp @@ -241,7 +241,7 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI { DoCast(m_creature->getVictim(),SPELL_ARCANE_BOLT); ArcaneBolt_Timer = 2000 + rand()%2500; - Unit *shaffar = FindCreature(ENTRY_SHAFFAR, 100); + Unit *shaffar = FindCreature(ENTRY_SHAFFAR, 100, m_creature); if(!shaffar || shaffar->isDead()) { m_creature->SetVisibility(VISIBILITY_OFF); diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp index de45a54e043..cbd8df9e649 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp @@ -189,19 +189,17 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance { switch( type ) { - case TYPE_HELLMAW: - return Encounter[0]; - case TYPE_OVERSEER: - return Encounter[1]; - case DATA_GRANDMASTERVORPILEVENT: - return Encounter[3]; + case TYPE_HELLMAW: return Encounter[0]; + case TYPE_OVERSEER: return Encounter[1]; + case DATA_GRANDMASTERVORPILEVENT: return Encounter[3]; + case DATA_MURMUREVENT: return Encounter[4]; } return false; } uint64 GetData64(uint32 identifier) { - if(identifier == DATA_GRANDMASTERVORPIL) + if(identifier == DATA_GRANDMASTERVORPIL) return GrandmasterVorpil; return 0; diff --git a/src/bindings/scripts/scripts/zone/azshara/azshara.cpp b/src/bindings/scripts/scripts/zone/azshara/azshara.cpp index 972bb2b81d5..262754a0f92 100644 --- a/src/bindings/scripts/scripts/zone/azshara/azshara.cpp +++ b/src/bindings/scripts/scripts/zone/azshara/azshara.cpp @@ -154,6 +154,7 @@ bool GossipSelect_npc_loramus_thalipedes(Player *player, Creature *_Creature, ui /*#### # mob_rizzle_sprysprocket ####*/ + #define MOB_DEPTH_CHARGE 23025 #define SPELL_RIZZLE_BLACKJACK 39865 #define SPELL_RIZZLE_ESCAPE 39871 @@ -162,9 +163,12 @@ bool GossipSelect_npc_loramus_thalipedes(Player *player, Creature *_Creature, ui #define SPELL_PERIODIC_DEPTH_CHARGE 39912 #define SPELL_GIVE_SOUTHFURY_MOONSTONE 39886 -#define SAY_RIZZLE_START "You, there! Hand over that moonstone and nobody gets hurt!" -#define SAY_RIZZLE_GRENADE "Just chill!" -#define SAY_RIZZLE_FINAL "All right, you win! I surrender! Just don't hurt me!" +#define SAY_RIZZLE_START -1000245 +#define SAY_RIZZLE_GRENADE -1000246 +#define SAY_RIZZLE_FINAL -1000247 + +#define GOSSIP_GET_MOONSTONE "Hand over the Southfury moonstone and I'll let you go." + //next message must be send to player when Rizzle jump into river, not implemented #define MSG_ESCAPE_NOTICE "Rizzle Sprysprocket takes the Southfury moonstone and escapes into the river. Follow her!" @@ -231,7 +235,6 @@ float WPs[58][4] = {1873.57, -3695.32, 33.9118, 3.44} }; - struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI { mob_rizzle_sprysprocketAI(Creature *c) : ScriptedAI(c) {Reset();} @@ -327,7 +330,7 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI Player *player = (Player *)Unit::GetUnit((*m_creature), PlayerGUID); if(player) { - DoWhisper(SAY_RIZZLE_GRENADE, player); + DoScriptText(SAY_RIZZLE_GRENADE, m_creature, player); DoCast(player, SPELL_RIZZLE_FROST_GRENADE, true); } Grenade_Timer = 30000; @@ -344,7 +347,7 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI float dist = m_creature->GetDistance(player); if(dist < 10 && m_creature->GetPositionX() > player->GetPositionX() && !Reached) { - DoYell(SAY_RIZZLE_FINAL, LANG_UNIVERSAL, NULL); + DoScriptText(SAY_RIZZLE_FINAL, m_creature); m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 1); m_creature->setFaction(35); m_creature->StopMoving(); @@ -375,7 +378,7 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI if(who->GetTypeId() == TYPEID_PLAYER && ((Player *)who)->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) { PlayerGUID = who->GetGUID(); - DoYell(SAY_RIZZLE_START, LANG_UNIVERSAL, NULL); + DoScriptText(SAY_RIZZLE_START, m_creature); DoCast(who, SPELL_RIZZLE_BLACKJACK, false); return; } @@ -394,7 +397,7 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI return; } - CurrWP++; + ++CurrWP; ContinueWP = true; } @@ -404,7 +407,7 @@ bool GossipHello_mob_rizzle_sprysprocket(Player *player, Creature *_Creature) { if(player->GetQuestStatus(10994) != QUEST_STATUS_INCOMPLETE) return true; - player->ADD_GOSSIP_ITEM( 0, "Hand over the Southfury moonstone and I'll let you go.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_GET_MOONSTONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(10811,_Creature->GetGUID()); return true; } 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 8e94e1adc18..569e2ae8bc5 100644 --- a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp +++ b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp @@ -39,15 +39,15 @@ EndContentData */ ## npc_draenei_survivor ######*/ -#define HEAL1 "The last thing I remember is the ship falling and us getting into the pods. I'll go see how I can help. Thank you!" -#define HEAL2 "$C, Where am I? Who are you? Oh no! What happened to the ship?." -#define HEAL3 "$C You saved me! I owe you a debt that I can never repay. I'll go see if I can help the others." -#define HEAL4 "Ugh... what is this place? Is that all that's left of the ship over there?" +#define HEAL1 -1000248 +#define HEAL2 -1000249 +#define HEAL3 -1000250 +#define HEAL4 -1000251 -#define HELP1 "Oh, the pain..." -#define HELP2 "Everything hurts, Please make it stop..." -#define HELP3 "Ughhh... I hurt. Can you help me?" -#define HELP4 "I don't know if I can make it, please help me..." +#define HELP1 -1000252 +#define HELP2 -1000253 +#define HELP3 -1000254 +#define HELP4 -1000255 struct TRINITY_DLL_DECL npc_draenei_survivorAI : public ScriptedAI { @@ -94,22 +94,22 @@ struct TRINITY_DLL_DECL npc_draenei_survivorAI : public ScriptedAI switch (rand()%4) //Random switch between 4 texts { case 0: - DoSay(HELP1, LANG_UNIVERSAL, NULL); + DoScriptText(HELP1, m_creature); SayingTimer = 15000; say = false; break; case 1: - DoSay(HELP2, LANG_UNIVERSAL, NULL); + DoScriptText(HELP2, m_creature); SayingTimer = 15000; say = false; break; case 2: - DoSay(HELP3, LANG_UNIVERSAL, NULL); + DoScriptText(HELP3, m_creature); SayingTimer = 15000; say = false; break; case 3: - DoSay(HELP4, LANG_UNIVERSAL, NULL); + DoScriptText(HELP4, m_creature); SayingTimer = 15000; say = false; break; @@ -181,10 +181,10 @@ struct TRINITY_DLL_DECL npc_draenei_survivorAI : public ScriptedAI m_creature->HandleEmoteCommand(ANIM_RISE); switch (rand()%4) //This switch doesn't work at all, creature say nothing! { - case 0: DoSay(HEAL1, LANG_UNIVERSAL, Hitter); break; - case 1: DoSay(HEAL2, LANG_UNIVERSAL, Hitter); break; - case 2: DoSay(HEAL3, LANG_UNIVERSAL, Hitter); break; - case 3: DoSay(HEAL4, LANG_UNIVERSAL, Hitter); break; + case 0: DoScriptText(HEAL1, m_creature, Hitter); break; + case 1: DoScriptText(HEAL2, m_creature, Hitter); break; + case 2: DoScriptText(HEAL3, m_creature, Hitter); break; + case 3: DoScriptText(HEAL4, m_creature, Hitter); break; } HealSay = true; } @@ -199,10 +199,12 @@ CreatureAI* GetAI_npc_draenei_survivor(Creature *_Creature) ## npc_engineer_spark_overgrind ######*/ -#define SAY_TEXT "Yes Master, all goes along as planned." -#define SAY_EMOTE "puts the shell to his ear." +#define SAY_TEXT -1000256 +#define SAY_EMOTE -1000257 +#define ATTACK_YELL -1000258 + #define GOSSIP_FIGHT "Traitor! You will be brought to justice!" -#define ATTACK_YELL "Now I cut you!" + #define SPELL_DYNAMITE 7978 struct TRINITY_DLL_DECL npc_engineer_spark_overgrindAI : public ScriptedAI @@ -227,8 +229,8 @@ struct TRINITY_DLL_DECL npc_engineer_spark_overgrindAI : public ScriptedAI { if (Emote_Timer < diff) { - DoSay(SAY_TEXT,LANG_UNIVERSAL,NULL); - DoTextEmote(SAY_EMOTE,NULL); + DoScriptText(SAY_TEXT, m_creature); + DoScriptText(SAY_EMOTE, m_creature); Emote_Timer = 120000 + rand()%30000; }else Emote_Timer -= diff; } @@ -266,7 +268,7 @@ bool GossipSelect_npc_engineer_spark_overgrind(Player *player, Creature *_Creatu { player->CLOSE_GOSSIP_MENU(); _Creature->setFaction(14); - _Creature->Yell(ATTACK_YELL, LANG_UNIVERSAL, player->GetGUID()); + DoScriptText(ATTACK_YELL, _Creature, player); ((npc_engineer_spark_overgrindAI*)_Creature->AI())->AttackStart(player); } return true; @@ -468,15 +470,16 @@ bool GossipSelect_npc_susurrus(Player *player, Creature *_Creature, uint32 sende ## npc_geezle ######*/ -#define GEEZLE_SAY_1 "What's the big idea, Spark?" -#define SPARK_SAY_2 "What's the big idea? You nearly blew my cover, idiot! I told you to put the compass and navigation maps somewhere safe - not out in the open for any fool to discover." -#define SPARK_SAY_3 "The Master has gone to great lengths to secure information about the whereabouts of the Exodar. You could have blown the entire operation, including the cover of our spy on the inside." -#define GEEZLE_SAY_4 "Relax, Spark! I have it all under control. We'll strip mine the Exodar right out from under 'em - making both you and I very, very rich in the process." -#define SPARK_SAY_5 "Relax? Do you know what Kael'thas does to those that fail him, Geezle? Eternal suffering and pain... Do NOT screw this up, fool." -#define SPARK_SAY_6 "Our Bloodmyst scouts have located our contact. The fool, Velen, will soon leave himself open and defenseless -- long enough for us to strike! Now get out of my sight before I vaporize you..." -#define GEEZLE_SAY_7 "Yes, sir. It won't happen again..." +#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 EMOTE_SPARK "picks up the naga flag." #define MOB_SPARK 17243 #define GO_NAGA_FLAG 181694 @@ -526,31 +529,19 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI case 0: return 99999; case 1: //DespawnNagaFlag(true); - ((Creature*)Spark)->TextEmote(EMOTE_SPARK, NULL, false); + DoScriptText(EMOTE_SPARK, Spark); return 1000; case 2: - DoSay(GEEZLE_SAY_1, LANG_UNIVERSAL, Spark); + DoScriptText(GEEZLE_SAY_1, m_creature, Spark); Spark->SetInFront(m_creature); m_creature->SetInFront(Spark); return 5000; - case 3: - ((Creature*)Spark)->Say(SPARK_SAY_2, LANG_UNIVERSAL, NULL); - return 7000; - case 4: - ((Creature*)Spark)->Say(SPARK_SAY_3, LANG_UNIVERSAL, NULL); - return 8000; - case 5: - DoSay(GEEZLE_SAY_4, LANG_UNIVERSAL, Spark); - return 8000; - case 6: - ((Creature*)Spark)->Say(SPARK_SAY_5, LANG_UNIVERSAL, NULL); - return 9000; - case 7: - ((Creature*)Spark)->Say(SPARK_SAY_6, LANG_UNIVERSAL, NULL); - return 8000; - case 8: - DoSay(GEEZLE_SAY_7, LANG_UNIVERSAL, Spark); - return 2000; + case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; + case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; + case 5: DoScriptText(GEEZLE_SAY_4, m_creature, Spark); return 8000; + case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000; + case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000; + case 8: DoScriptText(GEEZLE_SAY_7, m_creature, Spark); return 2000; case 9: m_creature->GetMotionMaster()->MoveTargetedHome(); Spark->GetMotionMaster()->MovePoint(0, -5030.95, -11291.99, 7.97); @@ -597,7 +588,7 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI { if(EventStarted) { - SayTimer = NextStep(Step++); + SayTimer = NextStep(++Step); } }else SayTimer -= diff; } diff --git a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp index 24f4d134464..238918ed973 100644 --- a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp +++ b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp @@ -24,7 +24,7 @@ EndScriptData */ /* ContentData npc_beaten_corpse npc_sputtervalve -npc_taskmaster_fizzule remove hack when Trinity implement feature/detect spell kind to not aggro +npc_taskmaster_fizzule npc_twiggy_flathead npc_wizzlecrank_shredder EndContentData */ @@ -36,12 +36,14 @@ EndContentData */ ## npc_beaten_corpse ######*/ +#define GOSSIP_CORPSE "Examine corpse in detail..." + bool GossipHello_npc_beaten_corpse(Player *player, Creature *_Creature) { if( player->GetQuestStatus(4921) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(4921) == QUEST_STATUS_COMPLETE) - player->ADD_GOSSIP_ITEM(0,"Examine corpse in detail...",GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_CORPSE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(3557,_Creature->GetGUID()); + player->SEND_GOSSIP_MENU(3557, _Creature->GetGUID()); return true; } @@ -49,7 +51,7 @@ bool GossipSelect_npc_beaten_corpse(Player *player, Creature *_Creature, uint32 { if(action == GOSSIP_ACTION_INFO_DEF +1) { - player->SEND_GOSSIP_MENU(3558,_Creature->GetGUID()); + player->SEND_GOSSIP_MENU(3558, _Creature->GetGUID()); player->KilledMonster( 10668,_Creature->GetGUID() ); } return true; @@ -59,15 +61,17 @@ bool GossipSelect_npc_beaten_corpse(Player *player, Creature *_Creature, uint32 ## npc_sputtervalve ######*/ +#define GOSSIP_SPUTTERVALVE "Can you tell me about this shard?" + bool GossipHello_npc_sputtervalve(Player *player, Creature *_Creature) { if (_Creature->isQuestGiver()) player->PrepareQuestMenu( _Creature->GetGUID() ); if( player->GetQuestStatus(6981) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(0,"Can you tell me about this shard?",GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(0, GOSSIP_SPUTTERVALVE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(),_Creature->GetGUID()); + player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); return true; } @@ -75,7 +79,7 @@ bool GossipSelect_npc_sputtervalve(Player *player, Creature *_Creature, uint32 s { if(action == GOSSIP_ACTION_INFO_DEF) { - player->SEND_GOSSIP_MENU(2013,_Creature->GetGUID()); + player->SEND_GOSSIP_MENU(2013, _Creature->GetGUID()); player->AreaExploredOrEventHappens(6981); } return true; @@ -85,7 +89,7 @@ bool GossipSelect_npc_sputtervalve(Player *player, Creature *_Creature, uint32 s ## npc_taskmaster_fizzule ######*/ -//#define FACTION_HOSTILE_F 430 +//#define FACTION_HOSTILE_F 430 #define FACTION_HOSTILE_F 16 #define FACTION_FRIENDLY_F 35 @@ -173,11 +177,11 @@ bool ReciveEmote_npc_taskmaster_fizzule(Player *player, Creature *_Creature, uin #define BIG_WILL 6238 #define AFFRAY_CHALLENGER 6240 -#define SAY_BIG_WILL_READY "Ready when you are, warrior" -#define SAY_TWIGGY_FLATHEAD_BEGIN "The Affray has begun, get ready to fight!" -#define SAY_TWIGGY_FLATHEAD_FRAY "You! Enter the fray!" -#define SAY_TWIGGY_FLATHEAD_DOWN "Challenger is down!" -#define SAY_TWIGGY_FLATHEAD_OVER "The Affray is over" +#define SAY_BIG_WILL_READY -1000267 +#define SAY_TWIGGY_FLATHEAD_BEGIN -1000268 +#define SAY_TWIGGY_FLATHEAD_FRAY -1000269 +#define SAY_TWIGGY_FLATHEAD_DOWN -1000270 +#define SAY_TWIGGY_FLATHEAD_OVER -1000271 float AffrayChallengerLoc[6][4]= { @@ -214,7 +218,8 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI Wave = 0; PlayerGUID = 0; - for(uint8 i = 0; i < 6; i++) { + for(uint8 i = 0; i < 6; ++i) + { AffrayChallenger[i] = 0; Challenger_down[i] = false; } @@ -249,14 +254,17 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI if(!pWarrior->isAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) { EventInProgress = false; - DoYell(SAY_TWIGGY_FLATHEAD_DOWN,LANG_UNIVERSAL,NULL); + DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, m_creature); pWarrior->FailQuest(1719); - for(uint8 i = 0; i < 6; i++) { - if (AffrayChallenger[i]) { + for(uint8 i = 0; i < 6; ++i) + { + if (AffrayChallenger[i]) + { Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), AffrayChallenger[i]); if(pCreature) { - if(pCreature->isAlive()) { + if(pCreature->isAlive()) + { pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pCreature->setDeathState(JUST_DIED); @@ -267,7 +275,8 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI Challenger_down[i] = false; } - if (BigWill) { + if (BigWill) + { Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), BigWill); if(pCreature) { if(pCreature->isAlive()) { @@ -280,22 +289,24 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI BigWill = 0; } - if (!EventGrate && EventInProgress) { + if (!EventGrate && EventInProgress) + { float x,y,z; pWarrior->GetPosition(x, y, z); if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) { pWarrior->AreaExploredOrEventHappens(1719); - DoYell(SAY_TWIGGY_FLATHEAD_BEGIN,LANG_UNIVERSAL,NULL); + DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, m_creature); - for(uint8 i = 0; i < 6; i++) { + for(uint8 i = 0; i < 6; ++i) + { Creature* pCreature = m_creature->SummonCreature(AFFRAY_CHALLENGER, AffrayChallengerLoc[i][0], AffrayChallengerLoc[i][1], AffrayChallengerLoc[i][2], AffrayChallengerLoc[i][3], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); if(!pCreature) continue; pCreature->setFaction(35); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pCreature->HandleEmoteCommand(15); + pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); AffrayChallenger[i] = pCreature->GetGUID(); } Wave_Timer = 5000; @@ -303,13 +314,18 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI EventGrate = true; } } - else if (EventInProgress) { - if (Challenger_checker < diff) { - for(uint8 i = 0; i < 6; i++) { - if (AffrayChallenger[i]) { + else if (EventInProgress) + { + if (Challenger_checker < diff) + { + for(uint8 i = 0; i < 6; ++i) + { + if (AffrayChallenger[i]) + { Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), AffrayChallenger[i]); - if((!pCreature || (!pCreature->isAlive())) && !Challenger_down[i]) { - DoYell(SAY_TWIGGY_FLATHEAD_DOWN,LANG_UNIVERSAL,NULL); + if((!pCreature || (!pCreature->isAlive())) && !Challenger_down[i]) + { + DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, m_creature); Challenger_down[i] = true; } } @@ -317,17 +333,20 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI Challenger_checker = 1000; } else Challenger_checker -= diff; - if(Wave_Timer < diff) { - if (AffrayChallenger[Wave] && Wave < 6 && !EventBigWill) { - DoYell(SAY_TWIGGY_FLATHEAD_FRAY,LANG_UNIVERSAL,NULL); + if(Wave_Timer < diff) + { + if (AffrayChallenger[Wave] && Wave < 6 && !EventBigWill) + { + DoScriptText(SAY_TWIGGY_FLATHEAD_FRAY, m_creature); Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), AffrayChallenger[Wave]); - if(pCreature && (pCreature->isAlive())) { + if(pCreature && (pCreature->isAlive())) + { pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pCreature->HandleEmoteCommand(15); + pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); pCreature->setFaction(14); ((CreatureAI*)pCreature->AI())->AttackStart(pWarrior); - Wave++; + ++Wave; Wave_Timer = 20000; } } @@ -338,16 +357,18 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI //pCreature->GetMotionMaster()->MovePoint(0, -1693, -4343, 4.32); //pCreature->GetMotionMaster()->MovePoint(1, -1684, -4333, 2.78); pCreature->GetMotionMaster()->MovePoint(2, -1682, -4329, 2.79); - //pCreature->HandleEmoteCommand(15); - pCreature->HandleEmoteCommand(27); + //pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + pCreature->HandleEmoteCommand(EMOTE_STATE_READYUNARMED); EventBigWill = true; Wave_Timer = 1000; } } - else if (Wave >= 6 && EventBigWill && BigWill) { + else if (Wave >= 6 && EventBigWill && BigWill) + { Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), BigWill); - if (!pCreature || !pCreature->isAlive()) { - DoYell(SAY_TWIGGY_FLATHEAD_OVER,LANG_UNIVERSAL,NULL); + if (!pCreature || !pCreature->isAlive()) + { + DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, m_creature); EventInProgress = false; EventBigWill = false; EventGrate = false; @@ -360,25 +381,26 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI } } }; + CreatureAI* GetAI_npc_twiggy_flathead(Creature *_Creature) { return new npc_twiggy_flatheadAI (_Creature); } /*##### -## npc_wizzlecrank_shredder NOTE: Part2 will be in ACID +## npc_wizzlecrank_shredder #####*/ -#define SAY_PROGRESS_1 "Alright, alright I think I can figure out how to operate this thing..." -#define SAY_PROGRESS_2 "Arrrgh! This isn't right!" -#define SAY_PROGRESS_3 "Okay, I think I've got it, now. Follow me, $N!" +#define SAY_PROGRESS_1 -1000272 +#define SAY_PROGRESS_2 -1000273 +#define SAY_PROGRESS_3 -1000274 -#define SAY_MERCENARY_4 "There's the stolen shredder! Stop it or Lugwizzle will have our hides!" +#define SAY_MERCENARY_4 -1000275 -#define SAY_PROGRESS_5 "Looks like we're out of woods, eh? Wonder what this does..." -#define SAY_PROGRESS_6 "Come on, don't break down on me now!" -#define SAY_PROGRESS_7 "That was a close one! Well, let's get going, it's still a ways to Ratchet!" -#define SAY_PROGRESS_8 "Hmm... I don't think this blinking red light is a good thing..." +#define SAY_PROGRESS_5 -1000276 +#define SAY_PROGRESS_6 -1000277 +#define SAY_PROGRESS_7 -1000278 +#define SAY_PROGRESS_8 -1000279 #define QUEST_ESCAPE 863 #define NPC_PILOT 3451 @@ -388,6 +410,8 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI { npc_wizzlecrank_shredderAI(Creature* c) : npc_escortAI(c) {Reset();} + bool Completed; + void WaypointReached(uint32 i) { Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); @@ -397,27 +421,28 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI switch(i) { - case 0: DoSay(SAY_PROGRESS_1, LANG_UNIVERSAL, NULL); + case 0: DoScriptText(SAY_PROGRESS_1, m_creature); m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 1: DoSay(SAY_PROGRESS_2, LANG_UNIVERSAL, NULL); break; - case 10: DoSay(SAY_PROGRESS_3, LANG_UNIVERSAL, player); + case 1: DoScriptText(SAY_PROGRESS_2, m_creature); break; + case 10: DoScriptText(SAY_PROGRESS_3, m_creature, player); m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; case 20:{ - Unit* Mercenary = FindCreature(MOB_MERCENARY, 99); + Unit* Mercenary = FindCreature(MOB_MERCENARY, 99, m_creature); if(Mercenary) { - ((Creature*)Mercenary)->Yell(SAY_MERCENARY_4, LANG_UNIVERSAL, NULL); + DoScriptText(SAY_MERCENARY_4, Mercenary); ((Creature*)Mercenary)->AI()->AttackStart(m_creature); AttackStart(Mercenary); } }break; - case 21: DoSay(SAY_PROGRESS_5, LANG_UNIVERSAL, NULL); + case 21: DoScriptText(SAY_PROGRESS_5, m_creature); m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 28: DoSay(SAY_PROGRESS_6, LANG_UNIVERSAL, NULL); break; - case 29: DoSay(SAY_PROGRESS_7, LANG_UNIVERSAL, NULL); break; - case 30: DoSay(SAY_PROGRESS_8, LANG_UNIVERSAL, NULL); break; + case 28: DoScriptText(SAY_PROGRESS_6, m_creature); break; + case 29: DoScriptText(SAY_PROGRESS_7, m_creature); break; + case 30: DoScriptText(SAY_PROGRESS_8, m_creature); break; case 31: m_creature->SummonCreature(NPC_PILOT, 1088.77, -2985.39, 91.84, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 300000); m_creature->setDeathState(JUST_DIED); + Completed = true; if (player && player->GetTypeId() == TYPEID_PLAYER) ((Player*)player)->GroupEventHappens(QUEST_ESCAPE, m_creature); break; @@ -427,13 +452,15 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI void Reset() { m_creature->setDeathState(ALIVE); + Completed = false; + m_creature->setFaction(69); } void Aggro(Unit* who){} void JustDied(Unit* killer) { - if (PlayerGUID) + if (PlayerGUID && !Completed) { Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); if (player) @@ -461,8 +488,8 @@ CreatureAI* GetAI_npc_wizzlecrank_shredderAI(Creature *_Creature) { npc_wizzlecrank_shredderAI* thisAI = new npc_wizzlecrank_shredderAI(_Creature); - thisAI->AddWaypoint(0, 1109.15, -3104.11, 82.41, 6000);//say1 spw - thisAI->AddWaypoint(1, 1105.39, -3102.86, 82.74, 2000);//say2 crazy running + thisAI->AddWaypoint(0, 1109.15, -3104.11, 82.41, 6000); + thisAI->AddWaypoint(1, 1105.39, -3102.86, 82.74, 2000); thisAI->AddWaypoint(2, 1104.97, -3108.52, 83.10, 1000); thisAI->AddWaypoint(3, 1110.01, -3110.48, 82.81, 1000); thisAI->AddWaypoint(4, 1111.72, -3103.03, 82.21, 1000); @@ -471,7 +498,7 @@ CreatureAI* GetAI_npc_wizzlecrank_shredderAI(Creature *_Creature) thisAI->AddWaypoint(7, 1112.55, -3106.56, 82.31, 1000); thisAI->AddWaypoint(8, 1108.12, -3111.04, 82.99, 1000); thisAI->AddWaypoint(9, 1109.32, -3100.39, 82.08, 1000); - thisAI->AddWaypoint(10, 1109.32, -3100.39, 82.08, 6000);//end of crazy running + thisAI->AddWaypoint(10, 1109.32, -3100.39, 82.08, 6000); thisAI->AddWaypoint(11, 1098.92, -3095.14, 82.97); thisAI->AddWaypoint(12, 1100.94, -3082.60, 82.83); thisAI->AddWaypoint(13, 1101.12, -3068.83, 82.53); @@ -480,19 +507,19 @@ CreatureAI* GetAI_npc_wizzlecrank_shredderAI(Creature *_Creature) thisAI->AddWaypoint(16, 1098.22, -3027.84, 83.79); thisAI->AddWaypoint(17, 1109.51, -3015.92, 85.73); thisAI->AddWaypoint(18, 1119.87, -3007.21, 87.08); - thisAI->AddWaypoint(19, 1130.23, -3002.49, 91.27, 5000);//twice - thisAI->AddWaypoint(20, 1130.23, -3002.49, 91.27, 3000);//mercenary - thisAI->AddWaypoint(21, 1130.23, -3002.49, 91.27, 4000);//say - thisAI->AddWaypoint(22, 1129.73, -2985.89, 92.46);//crazy running + thisAI->AddWaypoint(19, 1130.23, -3002.49, 91.27, 5000); + thisAI->AddWaypoint(20, 1130.23, -3002.49, 91.27, 3000); + thisAI->AddWaypoint(21, 1130.23, -3002.49, 91.27, 4000); + thisAI->AddWaypoint(22, 1129.73, -2985.89, 92.46); thisAI->AddWaypoint(23, 1124.10, -2983.29, 92.81); thisAI->AddWaypoint(24, 1111.74, -2992.38, 91.59); thisAI->AddWaypoint(25, 1111.06, -2976.54, 91.81); thisAI->AddWaypoint(26, 1099.91, -2991.17, 91.67); thisAI->AddWaypoint(27, 1096.32, -2981.55, 91.73); - thisAI->AddWaypoint(28, 1091.28, -2985.82, 91.74, 4000);//6 - thisAI->AddWaypoint(29, 1091.28, -2985.82, 91.74, 3000);//7 - thisAI->AddWaypoint(30, 1091.28, -2985.82, 91.74, 7000);//8 - thisAI->AddWaypoint(31, 1091.28, -2985.82, 91.74, 3000);//justdied summon creature + thisAI->AddWaypoint(28, 1091.28, -2985.82, 91.74, 4000); + thisAI->AddWaypoint(29, 1091.28, -2985.82, 91.74, 3000); + thisAI->AddWaypoint(30, 1091.28, -2985.82, 91.74, 7000); + thisAI->AddWaypoint(31, 1091.28, -2985.82, 91.74, 3000); return (CreatureAI*)thisAI; } diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp index 0372bf6ea61..348d21c4959 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp @@ -153,7 +153,7 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI Phase = 0; m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,0); + m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); } void Aggro(Unit* who) @@ -227,18 +227,18 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI switch(Counter) { case 0: - m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,375); // I R ANNNGRRRY! + m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); // I R ANNNGRRRY! Timer = 3000; break; case 1: Timer = 2800; - m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,374); // Release the cube + m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SUBMERGE); // Release the cube break; case 2: Timer = 5000; if(Creature* Summon = DoSpawnCreature(23417+Phase, 0, 0, 0, 0, TEMPSUMMON_DEAD_DESPAWN, 0)) { - m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,373); // Ribs: open + m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED); // Ribs: open Summon->AI()->AttackStart(SelectUnit(SELECT_TARGET_TOPAGGRO, 0)); EssenceGUID = Summon->GetGUID(); }else EnterEvadeMode(); @@ -263,7 +263,7 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI case 4: Timer = 1500; if(Essence->IsWithinDistInMap(m_creature, 10)) - Essence->SetUInt32Value(UNIT_NPC_EMOTESTATE, 374); //rotate and disappear + Essence->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SUBMERGE); //rotate and disappear else return; break; @@ -420,7 +420,7 @@ struct TRINITY_DLL_DECL boss_essence_of_sufferingAI : public ScriptedAI if(SoulDrainTimer < diff) { - DoCast(m_creature, SPELL_SOUL_DRAIN); + DoCast(m_creature->getVictim(), SPELL_SOUL_DRAIN); SoulDrainTimer = 60000; }else SoulDrainTimer -= diff; diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp index ea7fc3cbd1e..d380131d18c 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp @@ -77,9 +77,9 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI if(m_creature->isAlive()) { pInstance->SetData(DATA_SUPREMUSEVENT, NOT_STARTED); - ToggleDoors(true); + //ToggleDoors(true); } - else ToggleDoors(false); + //else ToggleDoors(false); } HatefulStrikeTimer = 5000; diff --git a/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp b/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp index 645a70df9f5..2f1a456fb35 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp @@ -55,8 +55,6 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance uint64 BloodElfCouncilVoice; uint64 IllidanStormrage; - uint16 BossKilled; - uint64 NajentusGate; uint64 MainTempleDoors; uint64 ShadeOfAkamaDoor; @@ -71,6 +69,7 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance uint64 IllidanDoor[2]; uint32 Encounters[ENCOUNTERS]; + std::string str_data; void Initialize() { @@ -87,8 +86,6 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance BloodElfCouncilVoice = 0; IllidanStormrage = 0; - BossKilled = 0; - NajentusGate = 0; MainTempleDoors = 0; ShadeOfAkamaDoor= 0; @@ -103,29 +100,48 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance IllidanDoor[0] = 0; IllidanDoor[1] = 0; - for(uint8 i = 0; i < ENCOUNTERS; i++) + for(uint8 i = 0; i < ENCOUNTERS; ++i) Encounters[i] = NOT_STARTED; } bool IsEncounterInProgress() const { - for(uint8 i = 0; i < ENCOUNTERS; i++) + for(uint8 i = 0; i < ENCOUNTERS; ++i) if(Encounters[i] == IN_PROGRESS) return true; return false; } - void OpenDoor(uint64 DoorGUID, bool open) - { - if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID)) - Door->SetUInt32Value(GAMEOBJECT_STATE, open ? 0 : 1); - } - - void CloseDoor(uint64 DoorGUID, bool close) - { - if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID)) - Door->SetUInt32Value(GAMEOBJECT_STATE, close ? 1 : 0); - } + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } + + debug_log("TSCR: Instance Black Temple: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } + + void HandleGameObject(uint64 guid, uint32 state) + { + Player *player = GetPlayerInMap(); + + if (!player || !guid) + { + debug_log("TSCR: Black Temple: HandleGameObject fail"); + return; + } + + if (GameObject *go = GameObject::GetGameObject(*player,guid)) + go->SetGoState(state); + } void OnCreatureCreate(Creature *creature, uint32 creature_entry) { @@ -150,38 +166,19 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance { switch(go->GetEntry()) { - case 185483: // Gate past Naj'entus (at the entrance to Supermoose's courtyards) - NajentusGate = go->GetGUID();break; - case 185882: // Main Temple Doors - right past Supermoose (Supremus) - MainTempleDoors = go->GetGUID();break; - case 185478: - ShadeOfAkamaDoor = go->GetGUID();break; - case 185480: - CommonDoor = go->GetGUID();break; - case 186153: - TeronDoor = go->GetGUID();break; - case 185892: - GuurtogDoor = go->GetGUID();break; - case 185479: - TempleDoor = go->GetGUID();break; - case 185482: - MotherDoor = go->GetGUID();break; - case 185481: - CouncilDoor = go->GetGUID();break; - case 186152://used by council - SimpleDoor = go->GetGUID();break; - case 185905: // Gate leading to Temple Summit - IllidanGate = go->GetGUID(); - go->SetUInt32Value(GAMEOBJECT_FLAGS,GO_FLAG_NODESPAWN+GO_FLAG_INTERACT_COND); - break; - case 186261: // Right door at Temple Summit - IllidanDoor[0] = go->GetGUID(); - go->SetUInt32Value(GAMEOBJECT_FLAGS,GO_FLAG_NODESPAWN+GO_FLAG_INTERACT_COND); - break; - case 186262: // Left door at Temple Summit - IllidanDoor[1] = go->GetGUID(); - go->SetUInt32Value(GAMEOBJECT_FLAGS,GO_FLAG_NODESPAWN+GO_FLAG_INTERACT_COND); - break; + case 185483: NajentusGate = go->GetGUID();break; // Gate past Naj'entus (at the entrance to Supermoose's courtyards) + case 185882: MainTempleDoors = go->GetGUID();break; // Main Temple Doors - right past Supermoose (Supremus) + case 185478: ShadeOfAkamaDoor = go->GetGUID();break; + case 185480: CommonDoor = go->GetGUID();break; + case 186153: TeronDoor = go->GetGUID();break; + case 185892: GuurtogDoor = go->GetGUID();break; + case 185479: TempleDoor = go->GetGUID();break; + case 185482: MotherDoor = go->GetGUID();break; + case 185481: CouncilDoor = go->GetGUID();break; + case 186152: SimpleDoor = go->GetGUID();break; + case 185905: IllidanGate = go->GetGUID(); break; // Gate leading to Temple Summit + case 186261: IllidanDoor[0] = go->GetGUID(); break; // Right door at Temple Summit + case 186262: IllidanDoor[1] = go->GetGUID(); break; // Left door at Temple Summit } } @@ -215,54 +212,82 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance { switch(type) { - case DATA_HIGHWARLORDNAJENTUSEVENT: Encounters[0] = data; break; - case DATA_SUPREMUSEVENT: Encounters[1] = data; break; - case DATA_SHADEOFAKAMAEVENT: Encounters[2] = data; break; - case DATA_TERONGOREFIENDEVENT: Encounters[3] = data; break; - case DATA_GURTOGGBLOODBOILEVENT: Encounters[4] = data; break; - case DATA_RELIQUARYOFSOULSEVENT: Encounters[5] = data; break; - case DATA_MOTHERSHAHRAZEVENT: Encounters[6] = data; break; - case DATA_ILLIDARICOUNCILEVENT: Encounters[7] = data; break; + case DATA_HIGHWARLORDNAJENTUSEVENT: + if(data == DONE) + { + HandleGameObject(NajentusGate, 0); + } + Encounters[0] = data;break; + case DATA_SUPREMUSEVENT: + if(data == DONE) + { + HandleGameObject(NajentusGate, 0); + } + Encounters[1] = data; break; + case DATA_SHADEOFAKAMAEVENT: + if(data == IN_PROGRESS) + { + HandleGameObject(ShadeOfAkamaDoor, 1); + }else HandleGameObject(ShadeOfAkamaDoor, 0); + Encounters[2] = data; break; + case DATA_TERONGOREFIENDEVENT: + if(data == IN_PROGRESS) + { + HandleGameObject(TeronDoor, 1); + HandleGameObject(CommonDoor, 1); + }else + { + HandleGameObject(TeronDoor, 0); + HandleGameObject(CommonDoor, 0); + } + Encounters[3] = data; break; + case DATA_GURTOGGBLOODBOILEVENT: + if(data == DONE) + { + HandleGameObject(GuurtogDoor, 0); + } + Encounters[4] = data; break; + case DATA_RELIQUARYOFSOULSEVENT: + if(data == DONE) + { + HandleGameObject(TempleDoor, 0); + } + Encounters[5] = data; break; + case DATA_MOTHERSHAHRAZEVENT: + if(data == DONE) + { + HandleGameObject(MotherDoor, 0); + } + Encounters[6] = data; break; + case DATA_ILLIDARICOUNCILEVENT: + if(data == IN_PROGRESS) + { + HandleGameObject(CouncilDoor, 1); + HandleGameObject(SimpleDoor, 1); + }else + { + HandleGameObject(CouncilDoor, 0); + HandleGameObject(SimpleDoor, 0); + } + Encounters[7] = data; break; case DATA_ILLIDANSTORMRAGEEVENT: Encounters[8] = data; break; } - if(data == DONE) - { - SaveToDB(); - BossKilled++; - } - CheckInstanceStatus(); - } - - void CheckInstanceStatus() - { - if(BossKilled >= 6) - OpenDoor(TempleDoor, true); - if(Encounters[0] == DONE) - OpenDoor(NajentusGate, true); - if(Encounters[2] == IN_PROGRESS) - CloseDoor(ShadeOfAkamaDoor, true); - else OpenDoor(ShadeOfAkamaDoor, true); - if(Encounters[3] == IN_PROGRESS) - { - CloseDoor(TeronDoor, true); - CloseDoor(CommonDoor, true); - }else{ - OpenDoor(TeronDoor, true); - OpenDoor(CommonDoor, true); - } - if(Encounters[4] == DONE) - OpenDoor(GuurtogDoor, true); - if(Encounters[6] == DONE) - OpenDoor(MotherDoor, true); - if(Encounters[7] == IN_PROGRESS) - { - CloseDoor(CouncilDoor, true); - CloseDoor(SimpleDoor, true); - }else{ - OpenDoor(CouncilDoor, true); - OpenDoor(SimpleDoor, true); - } + if (data == DONE) + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << Encounters[0] << " " << Encounters[1] << " " + << Encounters[2] << " " << Encounters[3] << " " << Encounters[4] + << " " << Encounters[5] << " " << Encounters[6] << " " << Encounters[7] + << " " << Encounters[8]; + + str_data = saveStream.str(); + + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } } uint32 GetData(uint32 type) @@ -283,42 +308,32 @@ struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance return 0; } - const char* Save() - { - OUT_SAVE_INST_DATA; - std::ostringstream stream; - stream << Encounters[0] << " " << Encounters[1] << " " << Encounters[2] << " " - << Encounters[3] << " " << Encounters[4] << " " << Encounters[5] << " " - << Encounters[6] << " " << Encounters[7] << " " << Encounters[8]; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if(out) - { - OUT_SAVE_INST_DATA_COMPLETE; - return out; - } - - return NULL; - } - - void Load(const char* in) - { - if(!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - std::istringstream stream(in); - stream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] - >> Encounters[4] >> Encounters[5] >> Encounters[6] >> Encounters[7] - >> Encounters[8]; - for(uint8 i = 0; i < ENCOUNTERS; ++i) - if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. - Encounters[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } + const char* Save() + { + return str_data.c_str(); + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + std::istringstream loadStream(in); + loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] + >> Encounters[3] >> Encounters[4] >> Encounters[5] >> Encounters[6] + >> Encounters[7] >> Encounters[8]; + + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if (Encounters[i] == IN_PROGRESS) + Encounters[i] = NOT_STARTED; + + OUT_LOAD_INST_DATA_COMPLETE; + } }; InstanceData* GetInstanceData_instance_black_temple(Map* map) diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp index 2930f6eafec..e0aa40d060c 100644 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp +++ b/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp @@ -17,11 +17,13 @@ /* ScriptData SDName: Blackrock_Depths SD%Complete: 95 -SDComment: Quest support: 4001, 4342, 7604, 4322. Vendor Lokhtos Darkbargainer. +SDComment: Quest support: 4001, 4342, 7604, 4322. Vendor Lokhtos Darkbargainer. Need to rewrite the Jail Break support SDCategory: Blackrock Depths EndScriptData */ /* ContentData +at_ring_of_law +npc_grimstone mob_phalanx npc_kharan_mighthammer npc_lokhtos_darkbargainer @@ -29,12 +31,305 @@ npc_dughal_stormwing npc_marshal_windsor npc_marshal_reginald_windsor npc_tobias_seecher +npc_rocknot EndContentData */ #include "precompiled.h" #include "../../npc/npc_escortAI.h" #include "def_blackrock_depths.h" +#define C_GRIMSTONE 10096 +#define C_THELDREN 16059 + +//4 or 6 in total? 1+2+1 / 2+2+2 / 3+3. Depending on this, code should be changed. +#define MOB_AMOUNT 4 + +uint32 RingMob[]= +{ + 8925, // Dredge Worm + 8926, // Deep Stinger + 8927, // Dark Screecher + 8928, // Burrowing Thundersnout + 8933, // Cave Creeper + 8932, // Borer Beetle +}; + +uint32 RingBoss[]= +{ + 9027, // Gorosh + 9028, // Grizzle + 9029, // Eviscerator + 9030, // Ok'thor + 9031, // Anub'shiah + 9032, // Hedrum +}; + +float RingLocations[6][3]= +{ + {604.802673, -191.081985, -54.058590}, // ring + {604.072998, -222.106918, -52.743759}, // first gate + {621.400391, -214.499054, -52.814453}, // hiding in corner + {601.300781, -198.556992, -53.950256}, // ring + {631.818359, -180.548126, -52.654770}, // second gate + {627.390381, -201.075974, -52.692917} // hiding in corner +}; + +bool AreaTrigger_at_ring_of_law(Player *player, AreaTriggerEntry *at) +{ + ScriptedInstance* pInstance = ((ScriptedInstance*)player->GetInstanceData()); + + if (pInstance) + { + if (pInstance->GetData(TYPE_RING_OF_LAW) == IN_PROGRESS || pInstance->GetData(TYPE_RING_OF_LAW) == DONE) + return false; + + pInstance->SetData(TYPE_RING_OF_LAW,IN_PROGRESS); + player->SummonCreature(C_GRIMSTONE,625.559,-205.618,-52.735,2.609,TEMPSUMMON_DEAD_DESPAWN,0); + + return false; + } + return false; +} + +/*###### +## npc_grimstone +######*/ + +//TODO: implement quest part of event (different end boss) +struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI +{ + npc_grimstoneAI(Creature *c) : npc_escortAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + MobSpawnId = rand()%6; + Reset(); + } + + ScriptedInstance* pInstance; + + uint8 EventPhase; + uint32 Event_Timer; + + uint8 MobSpawnId; + uint8 MobCount; + uint32 MobDeath_Timer; + + uint64 RingMobGUID[4]; + uint64 RingBossGUID; + + bool CanWalk; + + void Reset() + { + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + EventPhase = 0; + Event_Timer = 1000; + + MobCount = 0; + MobDeath_Timer = 0; + + for(uint8 i = 0; i < MOB_AMOUNT; i++) + RingMobGUID[i] = 0; + + RingBossGUID = 0; + + CanWalk = false; + } + + void Aggro(Unit *who) { } + + void DoGate(uint32 id, uint32 state) + { + if (GameObject *go = GameObject::GetGameObject(*m_creature,pInstance->GetData64(id))) + go->SetGoState(state); + + debug_log("SD2: npc_grimstone, arena gate update state."); + } + + //TODO: move them to center + void SummonRingMob() + { + if (Creature* tmp = m_creature->SummonCreature(RingMob[MobSpawnId],608.960,-235.322,-53.907,1.857,TEMPSUMMON_DEAD_DESPAWN,0)) + RingMobGUID[MobCount] = tmp->GetGUID(); + + ++MobCount; + + if (MobCount == MOB_AMOUNT) + MobDeath_Timer = 2500; + } + + //TODO: move them to center + void SummonRingBoss() + { + if (Creature* tmp = m_creature->SummonCreature(RingBoss[rand()%6],644.300,-175.989,-53.739,3.418,TEMPSUMMON_DEAD_DESPAWN,0)) + RingBossGUID = tmp->GetGUID(); + + MobDeath_Timer = 2500; + } + + void WaypointReached(uint32 i) + { + switch(i) + { + case 0: + DoScriptText(-1000000, m_creature);//2 + CanWalk = false; + Event_Timer = 5000; + break; + case 1: + DoScriptText(-1000000, m_creature);//4 + CanWalk = false; + Event_Timer = 5000; + break; + case 2: + CanWalk = false; + break; + case 3: + DoScriptText(-1000000, m_creature);//5 + break; + case 4: + DoScriptText(-1000000, m_creature);//6 + CanWalk = false; + Event_Timer = 5000; + break; + case 5: + if (pInstance) + { + pInstance->SetData(TYPE_RING_OF_LAW,DONE); + debug_log("SD2: npc_grimstone: event reached end and set complete."); + } + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (!pInstance) + return; + + if (MobDeath_Timer) + { + if (MobDeath_Timer <= diff) + { + MobDeath_Timer = 2500; + + if (RingBossGUID) + { + Creature *boss = (Creature*)Unit::GetUnit(*m_creature,RingBossGUID); + if (boss && !boss->isAlive() && boss->isDead()) + { + RingBossGUID = 0; + Event_Timer = 5000; + MobDeath_Timer = 0; + return; + } + return; + } + + for(uint8 i = 0; i < MOB_AMOUNT; i++) + { + Creature *mob = (Creature*)Unit::GetUnit(*m_creature,RingMobGUID[i]); + if (mob && !mob->isAlive() && mob->isDead()) + { + RingMobGUID[i] = 0; + --MobCount; + + //seems all are gone, so set timer to continue and discontinue this + if (!MobCount) + { + Event_Timer = 5000; + MobDeath_Timer = 0; + } + } + } + }else MobDeath_Timer -= diff; + } + + if (Event_Timer) + { + if (Event_Timer <= diff) + { + switch(EventPhase) + { + case 0: + DoScriptText(-1000000, m_creature);//1 + DoGate(DATA_ARENA4,1); + Start(false, false, false); + CanWalk = true; + Event_Timer = 0; + break; + case 1: + CanWalk = true; + Event_Timer = 0; + break; + case 2: + Event_Timer = 2000; + break; + case 3: + DoGate(DATA_ARENA1,0); + Event_Timer = 3000; + break; + case 4: + CanWalk = true; + m_creature->SetVisibility(VISIBILITY_OFF); + SummonRingMob(); + Event_Timer = 8000; + break; + case 5: + SummonRingMob(); + SummonRingMob(); + Event_Timer = 8000; + break; + case 6: + SummonRingMob(); + Event_Timer = 0; + break; + case 7: + m_creature->SetVisibility(VISIBILITY_ON); + DoGate(DATA_ARENA1,1); + DoScriptText(-1000000, m_creature);//4 + CanWalk = true; + Event_Timer = 0; + break; + case 8: + DoGate(DATA_ARENA2,0); + Event_Timer = 5000; + break; + case 9: + m_creature->SetVisibility(VISIBILITY_OFF); + SummonRingBoss(); + Event_Timer = 0; + break; + case 10: + //if quest, complete + DoGate(DATA_ARENA2,1); + DoGate(DATA_ARENA3,0); + DoGate(DATA_ARENA4,0); + CanWalk = true; + Event_Timer = 0; + break; + } + ++EventPhase; + }else Event_Timer -= diff; + } + + if (CanWalk) + npc_escortAI::UpdateAI(diff); + } +}; + +CreatureAI* GetAI_npc_grimstone(Creature *_Creature) +{ + npc_grimstoneAI* Grimstone_AI = new npc_grimstoneAI(_Creature); + + for(uint8 i = 0; i < 6; ++i) + Grimstone_AI->AddWaypoint(i, RingLocations[i][0], RingLocations[i][1], RingLocations[i][2]); + + return (CreatureAI*)Grimstone_AI; + +} + /*###### ## mob_phalanx ######*/ @@ -107,19 +402,33 @@ CreatureAI* GetAI_mob_phalanx(Creature *_Creature) #define QUEST_4001 4001 #define QUEST_4342 4342 +#define GOSSIP_ITEM_KHARAN_1 "I need to know where the princess are, Kharan!" +#define GOSSIP_ITEM_KHARAN_2 "All is not lost, Kharan!" + +#define GOSSIP_ITEM_KHARAN_3 "Gor'shak is my friend, you can trust me." +#define GOSSIP_ITEM_KHARAN_4 "Not enough, you need to tell me more." +#define GOSSIP_ITEM_KHARAN_5 "So what happened?" +#define GOSSIP_ITEM_KHARAN_6 "Continue..." +#define GOSSIP_ITEM_KHARAN_7 "So you suspect that someone on the inside was involved? That they were tipped off?" +#define GOSSIP_ITEM_KHARAN_8 "Continue with your story please." +#define GOSSIP_ITEM_KHARAN_9 "Indeed." +#define GOSSIP_ITEM_KHARAN_10 "The door is open, Kharan. You are a free man." + bool GossipHello_npc_kharan_mighthammer(Player *player, Creature *_Creature) { if( _Creature->isQuestGiver() ) player->PrepareQuestMenu( _Creature->GetGUID() ); if( player->GetQuestStatus(QUEST_4001) == QUEST_STATUS_INCOMPLETE ) - player->ADD_GOSSIP_ITEM( 0, "I need to know where the princess are, Kharan!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_ITEM_KHARAN_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); if( player->GetQuestStatus(4342) == QUEST_STATUS_INCOMPLETE ) - player->ADD_GOSSIP_ITEM( 0, "All is not lost, Kharan!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_ITEM_KHARAN_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - if( player->GetTeam() == HORDE ) player->SEND_GOSSIP_MENU(2473, _Creature->GetGUID()); - if( player->GetTeam() == ALLIANCE ) player->SEND_GOSSIP_MENU(2474, _Creature->GetGUID()); + if (player->GetTeam() == HORDE) + player->SEND_GOSSIP_MENU(2473, _Creature->GetGUID()); + else + player->SEND_GOSSIP_MENU(2474, _Creature->GetGUID()); return true; } @@ -129,42 +438,44 @@ bool GossipSelect_npc_kharan_mighthammer(Player *player, Creature *_Creature, ui switch (action) { case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(0, "Gor'shak is my friend, you can trust me.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_KHARAN_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); player->SEND_GOSSIP_MENU(2475, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(0, "Not enough, you need to tell me more.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_KHARAN_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); player->SEND_GOSSIP_MENU(2476, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(0, "So what happened?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_KHARAN_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); player->SEND_GOSSIP_MENU(2477, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(0, "Continue...", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_KHARAN_6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); player->SEND_GOSSIP_MENU(2478, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM(0, "So you suspect that someone on the inside was involved? That they were tipped off?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_KHARAN_7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); player->SEND_GOSSIP_MENU(2479, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+6: - player->ADD_GOSSIP_ITEM(0, "Continue with your story please.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_KHARAN_8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); player->SEND_GOSSIP_MENU(2480, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+7: - player->ADD_GOSSIP_ITEM(0, "Indeed.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+8); + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_KHARAN_9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+8); player->SEND_GOSSIP_MENU(2481, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+8: - player->ADD_GOSSIP_ITEM(0, "The door is open, Kharan. You are a free man.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_KHARAN_10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); player->SEND_GOSSIP_MENU(2482, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+9: player->CLOSE_GOSSIP_MENU(); - if( player->GetTeam() == HORDE ) player->AreaExploredOrEventHappens(QUEST_4001); - if( player->GetTeam() == ALLIANCE ) player->AreaExploredOrEventHappens(QUEST_4342); + if (player->GetTeam() == HORDE) + player->AreaExploredOrEventHappens(QUEST_4001); + else + player->AreaExploredOrEventHappens(QUEST_4342); break; } return true; @@ -179,19 +490,22 @@ bool GossipSelect_npc_kharan_mighthammer(Player *player, Creature *_Creature, ui #define QUEST_A_BINDING_CONTRACT 7604 #define SPELL_CREATE_THORIUM_BROTHERHOOD_CONTRACT_DND 23059 +#define GOSSIP_ITEM_SHOW_ACCESS "Show me what I have access to, Lothos." +#define GOSSIP_ITEM_GET_CONTRACT "Get Thorium Brotherhood Contract" + bool GossipHello_npc_lokhtos_darkbargainer(Player *player, Creature *_Creature) { if (_Creature->isQuestGiver()) player->PrepareQuestMenu( _Creature->GetGUID() ); if (_Creature->isVendor() && player->GetReputationRank(59) >= REP_FRIENDLY) - player->ADD_GOSSIP_ITEM( 1, "Show me what I have access to, Lothos.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + player->ADD_GOSSIP_ITEM( 1, GOSSIP_ITEM_SHOW_ACCESS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); if (player->GetQuestRewardStatus(QUEST_A_BINDING_CONTRACT) != 1 && !player->HasItemCount(ITEM_THRORIUM_BROTHERHOOD_CONTRACT, 1, true) && player->HasItemCount(ITEM_SULFURON_INGOT, 1)) { - player->ADD_GOSSIP_ITEM(0, "Get Thorium Brotherhood Contract", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_GET_CONTRACT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); } if (player->GetReputationRank(59) < REP_FRIENDLY) @@ -209,10 +523,9 @@ bool GossipSelect_npc_lokhtos_darkbargainer(Player *player, Creature *_Creature, player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_CREATE_THORIUM_BROTHERHOOD_CONTRACT_DND, false); } - if (action == GOSSIP_ACTION_TRADE) - { - player->SEND_VENDORLIST( _Creature->GetGUID() ); - } + if (action == GOSSIP_ACTION_TRADE) + player->SEND_VENDORLIST( _Creature->GetGUID() ); + return true; } @@ -225,7 +538,7 @@ bool GossipSelect_npc_lokhtos_darkbargainer(Player *player, Creature *_Creature, #define GOSSIP_DUGHAL "You're free, Dughal! Get out of here!" ScriptedInstance *pInstance; - +/* struct TRINITY_DLL_DECL npc_dughal_stormwingAI : public npc_escortAI { npc_dughal_stormwingAI(Creature *c) : npc_escortAI(c) { Reset(); } @@ -308,7 +621,7 @@ bool GossipSelect_npc_dughal_stormwing(Player *player, Creature *_Creature, uint } return true; } - + */ /*###### ## npc_marshal_windsor ######*/ @@ -325,7 +638,7 @@ bool GossipSelect_npc_dughal_stormwing(Player *player, Creature *_Creature, uint #define MOB_ENTRY_REGINALD_WINDSOR 9682 Player* PlayerStart; - +/* struct TRINITY_DLL_DECL npc_marshal_windsorAI : public npc_escortAI { npc_marshal_windsorAI(Creature *c) : npc_escortAI(c) @@ -354,7 +667,7 @@ struct TRINITY_DLL_DECL npc_marshal_windsorAI : public npc_escortAI pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_IN_PROGRESS); break; case 13: - m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING);/*EMOTE_STATE_WORK*/ + m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK break; case 14: pInstance->SetData(DATA_GATE_SR,0); @@ -364,7 +677,7 @@ struct TRINITY_DLL_DECL npc_marshal_windsorAI : public npc_escortAI m_creature->Say(SAY_WINDSOR_9, LANG_UNIVERSAL, PlayerGUID); break; case 17: - m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING);/*EMOTE_STATE_WORK*/ + m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK break; case 18: pInstance->SetData(DATA_GATE_SC,0); @@ -468,7 +781,7 @@ bool QuestAccept_npc_marshal_windsor(Player *player, Creature *creature, Quest c } return false; } - + */ /*###### ## npc_marshal_reginald_windsor ######*/ @@ -491,7 +804,7 @@ bool QuestAccept_npc_marshal_windsor(Player *player, Creature *creature, Quest c #define MOB_ENTRY_CREST_KILLER 9680 int wp = 0; - +/* struct TRINITY_DLL_DECL npc_marshal_reginald_windsorAI : public npc_escortAI { npc_marshal_reginald_windsorAI(Creature *c) : npc_escortAI(c) @@ -681,13 +994,13 @@ CreatureAI* GetAI_npc_marshal_reginald_windsor(Creature *_Creature) return (CreatureAI*)marshal_reginald_windsorAI; } - +*/ /*###### ## npc_tobias_seecher ######*/ #define SAY_TOBIAS_FREE "Thank you! I will run for safety immediately!" - +/* struct TRINITY_DLL_DECL npc_tobias_seecherAI : public npc_escortAI { npc_tobias_seecherAI(Creature *c) :npc_escortAI(c) {Reset();} @@ -775,6 +1088,172 @@ bool GossipSelect_npc_tobias_seecher(Player *player, Creature *_Creature, uint32 } return true; } +*/ + +/*###### +## npc_rocknot +######*/ + +#define SAY_GOT_BEER -1230000 +#define SPELL_DRUNKEN_RAGE 14872 +#define QUEST_ALE 4295 + +float BarWpLocations[8][3]= +{ + {883.294861, -188.926300, -43.703655}, + {872.763550, -185.605621, -43.703655}, //b1 + {867.923401, -188.006393, -43.703655}, //b2 + {863.295898, -190.795212, -43.703655}, //b3 + {856.139587, -194.652756, -43.703655}, //b4 + {851.878906, -196.928131, -43.703655}, //b5 + {877.035217, -187.048080, -43.703655}, + {891.198000, -197.924000, -43.620400} //home +}; + +uint32 BarWpWait[8]= +{ + 0, + 5000, + 5000, + 5000, + 5000, + 15000, + 0, + 0 +}; + +struct TRINITY_DLL_DECL npc_rocknotAI : public npc_escortAI +{ + npc_rocknotAI(Creature *c) : npc_escortAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } + + ScriptedInstance* pInstance; + + uint32 BreakKeg_Timer; + uint32 BreakDoor_Timer; + + void Reset() + { + if (IsBeingEscorted) + return; + + BreakKeg_Timer = 0; + BreakDoor_Timer = 0; + } + + void Aggro(Unit *who) { } + + void DoGo(uint32 id, uint32 state) + { + if (GameObject *go = GameObject::GetGameObject(*m_creature,pInstance->GetData64(id))) + go->SetGoState(state); + } + + void WaypointReached(uint32 i) + { + if (!pInstance) + return; + + switch(i) + { + case 1: + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + break; + case 2: + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); + break; + case 3: + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); + break; + case 4: + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + break; + case 5: + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + BreakKeg_Timer = 2000; + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (!pInstance) + return; + + if (BreakKeg_Timer) + { + if (BreakKeg_Timer <= diff) + { + DoGo(DATA_GO_BAR_KEG,0); + BreakKeg_Timer = 0; + BreakDoor_Timer = 1000; + }else BreakKeg_Timer -= diff; + } + + if (BreakDoor_Timer) + { + if (BreakDoor_Timer <= diff) + { + DoGo(DATA_GO_BAR_DOOR,2); + DoGo(DATA_GO_BAR_KEG_TRAP,0); //doesn't work very well, leaving code here for future + //spell by trap has effect61, this indicate the bar go hostile + + if (Unit *tmp = Unit::GetUnit(*m_creature,pInstance->GetData64(DATA_PHALANX))) + tmp->setFaction(14); + + //for later, this event(s) has alot more to it. + //optionally, DONE can trigger bar to go hostile. + pInstance->SetData(TYPE_BAR,DONE); + + BreakDoor_Timer = 0; + }else BreakDoor_Timer -= diff; + } + + npc_escortAI::UpdateAI(diff); + } +}; + +CreatureAI* GetAI_npc_rocknot(Creature *_Creature) +{ + npc_rocknotAI* Rocknot_AI = new npc_rocknotAI(_Creature); + + for(uint8 i = 0; i < 8; ++i) + Rocknot_AI->AddWaypoint(i, BarWpLocations[i][0], BarWpLocations[i][1], BarWpLocations[i][2], BarWpWait[i]); + + return (CreatureAI*)Rocknot_AI; +} + +bool ChooseReward_npc_rocknot(Player *player, Creature *_Creature, const Quest *_Quest, uint32 item) +{ + ScriptedInstance* pInstance = ((ScriptedInstance*)_Creature->GetInstanceData()); + + if (!pInstance) + return true; + + if (pInstance->GetData(TYPE_BAR) == DONE || pInstance->GetData(TYPE_BAR) == SPECIAL) + return true; + + if (_Quest->GetQuestId() == QUEST_ALE) + { + if (pInstance->GetData(TYPE_BAR) != IN_PROGRESS) + pInstance->SetData(TYPE_BAR,IN_PROGRESS); + + pInstance->SetData(TYPE_BAR,SPECIAL); + + //keep track of amount in instance script, returns SPECIAL if amount ok and event in progress + if (pInstance->GetData(TYPE_BAR) == SPECIAL) + { + DoScriptText(SAY_GOT_BEER, _Creature); + _Creature->CastSpell(_Creature,SPELL_DRUNKEN_RAGE,false); + ((npc_escortAI*)(_Creature->AI()))->Start(false, false, false); + } + } + + return true; +} /*###### ## @@ -784,6 +1263,16 @@ void AddSC_blackrock_depths() { Script *newscript; + newscript = new Script; + newscript->Name = "at_ring_of_law"; + newscript->pAreaTrigger = &AreaTrigger_at_ring_of_law; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_grimstone"; + newscript->GetAI = &GetAI_npc_grimstone; + newscript->RegisterSelf(); + newscript = new Script; newscript->Name="phalanx"; newscript->GetAI = &GetAI_mob_phalanx; @@ -800,7 +1289,7 @@ void AddSC_blackrock_depths() newscript->pGossipHello = &GossipHello_npc_lokhtos_darkbargainer; newscript->pGossipSelect = &GossipSelect_npc_lokhtos_darkbargainer; newscript->RegisterSelf(); - +/* newscript = new Script; newscript->Name="npc_dughal_stormwing"; newscript->pGossipHello = &GossipHello_npc_dughal_stormwing; @@ -824,5 +1313,11 @@ void AddSC_blackrock_depths() newscript = new Script; newscript->Name="npc_marshal_reginald_windsor"; newscript->GetAI = &GetAI_npc_marshal_reginald_windsor; - newscript->RegisterSelf(); + newscript->RegisterSelf();*/ + + newscript = new Script; + newscript->Name = "npc_rocknot"; + newscript->GetAI = &GetAI_npc_rocknot; + newscript->pChooseReward = &ChooseReward_npc_rocknot; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_angerrel.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/boss_angerrel.cpp deleted file mode 100644 index 4cc3a8cc424..00000000000 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_angerrel.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Angerrel -SD%Complete: 100 -SDComment: -SDCategory: Blackrock Depths -EndScriptData */ - -#include "precompiled.h" - -#define SPELL_SUNDERARMOR 24317 -#define SPELL_SHIELDBLOCK 12169 -#define SPELL_STRIKE 15580 - -struct TRINITY_DLL_DECL boss_angerrelAI : public ScriptedAI -{ - boss_angerrelAI(Creature *c) : ScriptedAI(c) {Reset();} - - uint32 SunderArmor_Timer; - uint32 ShieldBlock_Timer; - uint32 Strike_Timer; - - void Reset() - { - SunderArmor_Timer = 8000; - ShieldBlock_Timer = 15000; - Strike_Timer = 12000; - } - - void Aggro(Unit *who) - { - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) - return; - - //SunderArmor_Timer - if (SunderArmor_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_SUNDERARMOR); - SunderArmor_Timer = 28000; - }else SunderArmor_Timer -= diff; - - //ShieldBlock_Timer - if (ShieldBlock_Timer < diff) - { - DoCast(m_creature,SPELL_SHIELDBLOCK); - ShieldBlock_Timer = 25000; - }else ShieldBlock_Timer -= diff; - - //Strike_Timer - if (Strike_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_STRIKE); - Strike_Timer = 10000; - }else Strike_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; -CreatureAI* GetAI_boss_angerrel(Creature *_Creature) -{ - return new boss_angerrelAI (_Creature); -} - -void AddSC_boss_angerrel() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_angerrel"; - newscript->GetAI = &GetAI_boss_angerrel; - newscript->RegisterSelf(); -} diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_doomrel.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/boss_doomrel.cpp deleted file mode 100644 index 216321a5762..00000000000 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_doomrel.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Doomrel -SD%Complete: 100 -SDComment: -SDCategory: Blackrock Depths -EndScriptData */ - -#include "precompiled.h" - -#define SPELL_SHADOWBOLTVOLLEY 17228 -#define SPELL_IMMOLATE 15505 -#define SPELL_CURSEOFWEAKNESS 17227 -#define SPELL_DEMONARMOR 11735 - -struct TRINITY_DLL_DECL boss_doomrelAI : public ScriptedAI -{ - boss_doomrelAI(Creature *c) : ScriptedAI(c) {Reset();} - - uint32 ShadowVolley_Timer; - uint32 Immolate_Timer; - uint32 CurseOfWeakness_Timer; - uint32 DemonArmor_Timer; - bool Voidwalkers; - int Rand; - int RandX; - int RandY; - Creature* Summoned; - - void Reset() - { - ShadowVolley_Timer = 10000; - Immolate_Timer = 18000; - CurseOfWeakness_Timer = 5000; - DemonArmor_Timer = 16000; - Voidwalkers = false; - } - - void Aggro(Unit *who) - { - } - - void SummonVoidwalkers(Unit* victim) - { - Rand = rand()%5; - switch (rand()%2) - { - case 0: RandX = 0 - Rand; break; - case 1: RandX = 0 + Rand; break; - } - Rand = 0; - Rand = rand()%5; - switch (rand()%2) - { - case 0: RandY = 0 - Rand; break; - case 1: RandY = 0 + Rand; break; - } - Rand = 0; - Summoned = DoSpawnCreature(16119, RandX, RandY, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000); - if(Summoned) - ((CreatureAI*)Summoned->AI())->AttackStart(victim); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) - return; - - //ShadowVolley_Timer - if (ShadowVolley_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_SHADOWBOLTVOLLEY); - ShadowVolley_Timer = 12000; - }else ShadowVolley_Timer -= diff; - - //Immolate_Timer - if (Immolate_Timer < diff) - { - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,0); - if (target)DoCast(target,SPELL_IMMOLATE); - Immolate_Timer = 25000; - }else Immolate_Timer -= diff; - - //CurseOfWeakness_Timer - if (CurseOfWeakness_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_CURSEOFWEAKNESS); - CurseOfWeakness_Timer = 45000; - }else CurseOfWeakness_Timer -= diff; - - //DemonArmor_Timer - if (DemonArmor_Timer < diff) - { - DoCast(m_creature,SPELL_DEMONARMOR); - DemonArmor_Timer = 300000; - }else DemonArmor_Timer -= diff; - - //Summon Voidwalkers - if (!Voidwalkers && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 51 ) - { - SummonVoidwalkers(m_creature->getVictim()); - SummonVoidwalkers(m_creature->getVictim()); - SummonVoidwalkers(m_creature->getVictim()); - Voidwalkers = true; - } - - DoMeleeAttackIfReady(); - } -}; -CreatureAI* GetAI_boss_doomrel(Creature *_Creature) -{ - return new boss_doomrelAI (_Creature); -} - -void AddSC_boss_doomrel() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_doomrel"; - newscript->GetAI = &GetAI_boss_doomrel; - newscript->RegisterSelf(); -} diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_doperel.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/boss_doperel.cpp deleted file mode 100644 index bfecf682764..00000000000 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_doperel.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Doperel -SD%Complete: 100 -SDComment: -SDCategory: Blackrock Depths -EndScriptData */ - -#include "precompiled.h" - -#define SPELL_SINISTERSTRIKE 15581 -#define SPELL_BACKSTAB 15582 -#define SPELL_GOUGE 13579 - -struct TRINITY_DLL_DECL boss_doperelAI : public ScriptedAI -{ - boss_doperelAI(Creature *c) : ScriptedAI(c) {Reset();} - - uint32 SinisterStrike_Timer; - uint32 BackStab_Timer; - uint32 Gouge_Timer; - - void Reset() - { - SinisterStrike_Timer = 8000; - BackStab_Timer = 12000; - Gouge_Timer = 6000; - } - - void Aggro(Unit *who) - { - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) - return; - - //SinisterStrike_Timer - if (SinisterStrike_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_SINISTERSTRIKE); - SinisterStrike_Timer = 7000; - }else SinisterStrike_Timer -= diff; - - //BackStab_Timer - if (BackStab_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_BACKSTAB); - BackStab_Timer = 6000; - }else BackStab_Timer -= diff; - - //Gouge_Timer - if (Gouge_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_GOUGE); - Gouge_Timer = 8000; - }else Gouge_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; -CreatureAI* GetAI_boss_doperel(Creature *_Creature) -{ - return new boss_doperelAI (_Creature); -} - -void AddSC_boss_doperel() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_doperel"; - newscript->GetAI = &GetAI_boss_doperel; - newscript->RegisterSelf(); -} diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_gloomrel.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/boss_gloomrel.cpp deleted file mode 100644 index 1c426688d47..00000000000 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_gloomrel.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Gloomrel -SD%Complete: 80 -SDComment: Learning Smelt Dark Iron if tribute quest rewarded. Missing event and re-spawn GO Spectral Chalice -SDCategory: Blackrock Depths -EndScriptData */ - -#include "precompiled.h" - -#define SPELL_HAMSTRING 9080 -#define SPELL_CLEAVE 15579 -#define SPELL_MORTALSTRIKE 15708 - -struct TRINITY_DLL_DECL boss_gloomrelAI : public ScriptedAI -{ - boss_gloomrelAI(Creature *c) : ScriptedAI(c) {Reset();} - - uint32 HamString_Timer; - uint32 Cleave_Timer; - uint32 MortalStrike_Timer; - - void Reset() - { - HamString_Timer = 19000; - Cleave_Timer = 6000; - MortalStrike_Timer = 10000; - - m_creature->setFaction(734); - } - - void Aggro(Unit *who) - { - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) - return; - - //HamString_Timer - if (HamString_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_HAMSTRING); - HamString_Timer = 14000; - }else HamString_Timer -= diff; - - //Cleave_Timer - if (Cleave_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_CLEAVE); - Cleave_Timer = 8000; - }else Cleave_Timer -= diff; - - //MortalStrike_Timer - if (MortalStrike_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_MORTALSTRIKE); - MortalStrike_Timer = 12000; - }else MortalStrike_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; -CreatureAI* GetAI_boss_gloomrel(Creature *_Creature) -{ - return new boss_gloomrelAI (_Creature); -} - -bool GossipHello_boss_gloomrel(Player *player, Creature *_Creature) -{ - if (player->GetQuestRewardStatus(4083) == 1 && player->GetSkillValue(SKILL_MINING) >= 230 && !player->HasSpell(14891) ) - player->ADD_GOSSIP_ITEM(0, "Teach me the art of smelting dark iron", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - - if (player->GetQuestRewardStatus(4083) == 0 && player->GetSkillValue(SKILL_MINING) >= 230) - player->ADD_GOSSIP_ITEM(0, "I want to pay tribute", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - - player->ADD_GOSSIP_ITEM(0, "Challenge", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(2602, _Creature->GetGUID()); - - return true; -} - -bool GossipSelect_boss_gloomrel(Player *player, Creature *_Creature, uint32 sender, uint32 action ) -{ - switch (action) - { - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM( 0, "Continue...", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - player->SEND_GOSSIP_MENU(2606, _Creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+11: - player->CLOSE_GOSSIP_MENU(); - _Creature->CastSpell(player, 14894, false); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM( 0, "[PH] Continue...", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); - player->SEND_GOSSIP_MENU(2604, _Creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+22: - player->CLOSE_GOSSIP_MENU(); - //re-spawn object here - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM( 0, "[PH] Continue...", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 33); - player->SEND_GOSSIP_MENU(2605, _Creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+33: - player->CLOSE_GOSSIP_MENU(); - //start event here, below code just temporary - _Creature->setFaction(754); - break; - } - return true; -} - -void AddSC_boss_gloomrel() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_gloomrel"; - newscript->GetAI = &GetAI_boss_gloomrel; - newscript->pGossipHello = &GossipHello_boss_gloomrel; - newscript->pGossipSelect = &GossipSelect_boss_gloomrel; - newscript->RegisterSelf(); -} diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_haterel.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/boss_haterel.cpp deleted file mode 100644 index 640f528706f..00000000000 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_haterel.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Haterel -SD%Complete: 100 -SDComment: -SDCategory: Blackrock Depths -EndScriptData */ - -#include "precompiled.h" - -#define SPELL_SHADOWBOLT 17483 //Not sure if right ID -#define SPELL_MANABURN 10876 -#define SPELL_SHADOWSHIELD 22417 -#define SPELL_STRIKE 15580 - -struct TRINITY_DLL_DECL boss_haterelAI : public ScriptedAI -{ - boss_haterelAI(Creature *c) : ScriptedAI(c) {Reset();} - - uint32 ShadowBolt_Timer; - uint32 ManaBurn_Timer; - uint32 ShadowShield_Timer; - uint32 Strike_Timer; - - void Reset() - { - ShadowBolt_Timer = 15000; - ManaBurn_Timer = 3000; - ShadowShield_Timer = 8000; - Strike_Timer = 12000; - } - - void Aggro(Unit *who) - { - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) - return; - - //ShadowBolt_Timer - if (ShadowBolt_Timer < diff) - { - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,0); - if (target) DoCast(target,SPELL_SHADOWBOLT); - ShadowBolt_Timer = 7000; - }else ShadowBolt_Timer -= diff; - - //ManaBurn_Timer - if (ManaBurn_Timer < diff) - { - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,0); - if (target) DoCast(target,SPELL_MANABURN); - ManaBurn_Timer = 13000; - }else ManaBurn_Timer -= diff; - - //ShadowShield_Timer - if (ShadowShield_Timer < diff) - { - DoCast(m_creature,SPELL_SHADOWSHIELD); - ShadowShield_Timer = 25000; - }else ShadowShield_Timer -= diff; - - //Strike_Timer - if (Strike_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_STRIKE); - Strike_Timer = 10000; - }else Strike_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_haterel(Creature *_Creature) -{ - return new boss_haterelAI (_Creature); -} - -void AddSC_boss_haterel() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_haterel"; - newscript->GetAI = &GetAI_boss_haterel; - newscript->RegisterSelf(); -} diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_seethrel.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/boss_seethrel.cpp deleted file mode 100644 index 4d6d6ea3916..00000000000 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_seethrel.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Seethrel -SD%Complete: 100 -SDComment: -SDCategory: Blackrock Depths -EndScriptData */ - -#include "precompiled.h" - -#define SPELL_FROSTBOLT 16799 -#define SPELL_FROSTARMOR 15784 //This is actually a buff he gives himself -#define SPELL_BLIZZARD 19099 -#define SPELL_FROSTNOVA 15063 -#define SPELL_FROSTWARD 15004 - -struct TRINITY_DLL_DECL boss_seethrelAI : public ScriptedAI -{ - boss_seethrelAI(Creature *c) : ScriptedAI(c) {Reset();} - - uint32 FrostArmor_Timer; - uint32 Frostbolt_Timer; - uint32 Blizzard_Timer; - uint32 FrostNova_Timer; - uint32 FrostWard_Timer; - - void Reset() - { - FrostArmor_Timer = 2000; - Frostbolt_Timer = 6000; - Blizzard_Timer = 18000; - FrostNova_Timer = 12000; - FrostWard_Timer = 25000; - - m_creature->CastSpell(m_creature,SPELL_FROSTARMOR,true); - } - - void Aggro(Unit *who) - { - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) - return; - - //FrostArmor_Timer - if (FrostArmor_Timer < diff) - { - DoCast(m_creature, SPELL_FROSTARMOR); - FrostArmor_Timer = 180000; - }else FrostArmor_Timer -= diff; - - //Frostbolt_Timer - if (Frostbolt_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_FROSTBOLT); - Frostbolt_Timer = 15000; - }else Frostbolt_Timer -= diff; - - //Blizzard_Timer - if (Blizzard_Timer < diff) - { - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,0); - if (target) DoCast(target,SPELL_BLIZZARD); - Blizzard_Timer = 22000; - }else Blizzard_Timer -= diff; - - //FrostNova_Timer - if (FrostNova_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_FROSTNOVA); - FrostNova_Timer = 14000; - }else FrostNova_Timer -= diff; - - //FrostWard_Timer - if (FrostWard_Timer < diff) - { - DoCast(m_creature,SPELL_FROSTWARD); - FrostWard_Timer = 68000; - }else FrostWard_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; -CreatureAI* GetAI_boss_seethrel(Creature *_Creature) -{ - return new boss_seethrelAI (_Creature); -} - -void AddSC_boss_seethrel() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_seethrel"; - newscript->GetAI = &GetAI_boss_seethrel; - newscript->RegisterSelf(); -} diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_tomb_of_seven.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/boss_tomb_of_seven.cpp new file mode 100644 index 00000000000..d687b6aae01 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/blackrock_depths/boss_tomb_of_seven.cpp @@ -0,0 +1,643 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_Tomb_Of_Seven +SD%Complete: 50 +SDComment: Learning Smelt Dark Iron if tribute quest rewarded. Missing event and re-spawn GO Spectral Chalice +SDCategory: Blackrock Depths +EndScriptData */ + +#include "precompiled.h" +#include "def_blackrock_depths.h" + +#define FACTION_NEUTRAL 734 +#define FACTION_HOSTILE 754 + +#define SPELL_SUNDERARMOR 24317 +#define SPELL_SHIELDBLOCK 12169 +#define SPELL_STRIKE 15580 + +struct TRINITY_DLL_DECL boss_angerrelAI : public ScriptedAI +{ + boss_angerrelAI(Creature *c) : ScriptedAI(c) {Reset();} + + uint32 SunderArmor_Timer; + uint32 ShieldBlock_Timer; + uint32 Strike_Timer; + + void Reset() + { + SunderArmor_Timer = 8000; + ShieldBlock_Timer = 15000; + Strike_Timer = 12000; + } + + void Aggro(Unit *who) + { + } + + void UpdateAI(const uint32 diff) + { + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + return; + + //SunderArmor_Timer + if (SunderArmor_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_SUNDERARMOR); + SunderArmor_Timer = 28000; + }else SunderArmor_Timer -= diff; + + //ShieldBlock_Timer + if (ShieldBlock_Timer < diff) + { + DoCast(m_creature,SPELL_SHIELDBLOCK); + ShieldBlock_Timer = 25000; + }else ShieldBlock_Timer -= diff; + + //Strike_Timer + if (Strike_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_STRIKE); + Strike_Timer = 10000; + }else Strike_Timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_angerrel(Creature *_Creature) +{ + return new boss_angerrelAI (_Creature); +} + +#define SPELL_SINISTERSTRIKE 15581 +#define SPELL_BACKSTAB 15582 +#define SPELL_GOUGE 13579 + +struct TRINITY_DLL_DECL boss_doperelAI : public ScriptedAI +{ + boss_doperelAI(Creature *c) : ScriptedAI(c) {Reset();} + + uint32 SinisterStrike_Timer; + uint32 BackStab_Timer; + uint32 Gouge_Timer; + + void Reset() + { + SinisterStrike_Timer = 8000; + BackStab_Timer = 12000; + Gouge_Timer = 6000; + } + + void Aggro(Unit *who) + { + } + + void UpdateAI(const uint32 diff) + { + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + return; + + //SinisterStrike_Timer + if (SinisterStrike_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_SINISTERSTRIKE); + SinisterStrike_Timer = 7000; + }else SinisterStrike_Timer -= diff; + + //BackStab_Timer + if (BackStab_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_BACKSTAB); + BackStab_Timer = 6000; + }else BackStab_Timer -= diff; + + //Gouge_Timer + if (Gouge_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_GOUGE); + Gouge_Timer = 8000; + }else Gouge_Timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_doperel(Creature *_Creature) +{ + return new boss_doperelAI (_Creature); +} + +#define SPELL_SHADOWBOLT 17483 //Not sure if right ID +#define SPELL_MANABURN 10876 +#define SPELL_SHADOWSHIELD 22417 + +struct TRINITY_DLL_DECL boss_haterelAI : public ScriptedAI +{ + boss_haterelAI(Creature *c) : ScriptedAI(c) {Reset();} + + uint32 ShadowBolt_Timer; + uint32 ManaBurn_Timer; + uint32 ShadowShield_Timer; + uint32 Strike_Timer; + + void Reset() + { + ShadowBolt_Timer = 15000; + ManaBurn_Timer = 3000; + ShadowShield_Timer = 8000; + Strike_Timer = 12000; + } + + void Aggro(Unit *who) + { + } + + void UpdateAI(const uint32 diff) + { + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + return; + + //ShadowBolt_Timer + if (ShadowBolt_Timer < diff) + { + Unit* target = NULL; + target = SelectUnit(SELECT_TARGET_RANDOM,0); + if (target) DoCast(target,SPELL_SHADOWBOLT); + ShadowBolt_Timer = 7000; + }else ShadowBolt_Timer -= diff; + + //ManaBurn_Timer + if (ManaBurn_Timer < diff) + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_MANABURN); + + ManaBurn_Timer = 13000; + }else ManaBurn_Timer -= diff; + + //ShadowShield_Timer + if (ShadowShield_Timer < diff) + { + DoCast(m_creature,SPELL_SHADOWSHIELD); + ShadowShield_Timer = 25000; + }else ShadowShield_Timer -= diff; + + //Strike_Timer + if (Strike_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_STRIKE); + Strike_Timer = 10000; + }else Strike_Timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_haterel(Creature *_Creature) +{ + return new boss_haterelAI (_Creature); +} + +#define SPELL_MINDBLAST 15587 +#define SPELL_HEAL 15586 +#define SPELL_PRAYEROFHEALING 15585 +#define SPELL_SHIELD 10901 + +struct TRINITY_DLL_DECL boss_vilerelAI : public ScriptedAI +{ + boss_vilerelAI(Creature *c) : ScriptedAI(c) {Reset();} + + uint32 MindBlast_Timer; + uint32 Heal_Timer; + uint32 PrayerOfHealing_Timer; + uint32 Shield_Timer; + + void Reset() + { + MindBlast_Timer = 10000; + Heal_Timer = 35000; + PrayerOfHealing_Timer = 25000; + Shield_Timer = 3000; + } + + void Aggro(Unit *who) + { + } + + void UpdateAI(const uint32 diff) + { + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + return; + + //MindBlast_Timer + if (MindBlast_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_MINDBLAST); + MindBlast_Timer = 7000; + }else MindBlast_Timer -= diff; + + //Heal_Timer + if (Heal_Timer < diff) + { + DoCast(m_creature,SPELL_HEAL); + Heal_Timer = 20000; + }else Heal_Timer -= diff; + + //PrayerOfHealing_Timer + if (PrayerOfHealing_Timer < diff) + { + DoCast(m_creature,SPELL_PRAYEROFHEALING); + PrayerOfHealing_Timer = 30000; + }else PrayerOfHealing_Timer -= diff; + + //Shield_Timer + if (Shield_Timer < diff) + { + DoCast(m_creature,SPELL_SHIELD); + Shield_Timer = 30000; + }else Shield_Timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_vilerel(Creature *_Creature) +{ + return new boss_vilerelAI (_Creature); +} + +#define SPELL_FROSTBOLT 16799 +#define SPELL_FROSTARMOR 15784 //This is actually a buff he gives himself +#define SPELL_BLIZZARD 19099 +#define SPELL_FROSTNOVA 15063 +#define SPELL_FROSTWARD 15004 + +struct TRINITY_DLL_DECL boss_seethrelAI : public ScriptedAI +{ + boss_seethrelAI(Creature *c) : ScriptedAI(c) {Reset();} + + uint32 FrostArmor_Timer; + uint32 Frostbolt_Timer; + uint32 Blizzard_Timer; + uint32 FrostNova_Timer; + uint32 FrostWard_Timer; + + void Reset() + { + FrostArmor_Timer = 2000; + Frostbolt_Timer = 6000; + Blizzard_Timer = 18000; + FrostNova_Timer = 12000; + FrostWard_Timer = 25000; + + m_creature->CastSpell(m_creature,SPELL_FROSTARMOR,true); + } + + void Aggro(Unit *who) + { + } + + void UpdateAI(const uint32 diff) + { + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + return; + + //FrostArmor_Timer + if (FrostArmor_Timer < diff) + { + DoCast(m_creature, SPELL_FROSTARMOR); + FrostArmor_Timer = 180000; + }else FrostArmor_Timer -= diff; + + //Frostbolt_Timer + if (Frostbolt_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_FROSTBOLT); + Frostbolt_Timer = 15000; + }else Frostbolt_Timer -= diff; + + //Blizzard_Timer + if (Blizzard_Timer < diff) + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_BLIZZARD); + + Blizzard_Timer = 22000; + }else Blizzard_Timer -= diff; + + //FrostNova_Timer + if (FrostNova_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_FROSTNOVA); + FrostNova_Timer = 14000; + }else FrostNova_Timer -= diff; + + //FrostWard_Timer + if (FrostWard_Timer < diff) + { + DoCast(m_creature,SPELL_FROSTWARD); + FrostWard_Timer = 68000; + }else FrostWard_Timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_seethrel(Creature *_Creature) +{ + return new boss_seethrelAI (_Creature); +} + +#define SPELL_HAMSTRING 9080 +#define SPELL_CLEAVE 15579 +#define SPELL_MORTALSTRIKE 15708 + +struct TRINITY_DLL_DECL boss_gloomrelAI : public ScriptedAI +{ + boss_gloomrelAI(Creature *c) : ScriptedAI(c) {Reset();} + + uint32 Hamstring_Timer; + uint32 Cleave_Timer; + uint32 MortalStrike_Timer; + + void Reset() + { + Hamstring_Timer = 19000; + Cleave_Timer = 6000; + MortalStrike_Timer = 10000; + + m_creature->setFaction(FACTION_NEUTRAL); + } + + void Aggro(Unit *who) + { + } + + void UpdateAI(const uint32 diff) + { + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) + return; + + //Hamstring_Timer + if (Hamstring_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_HAMSTRING); + Hamstring_Timer = 14000; + }else Hamstring_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_CLEAVE); + Cleave_Timer = 8000; + }else Cleave_Timer -= diff; + + //MortalStrike_Timer + if (MortalStrike_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_MORTALSTRIKE); + MortalStrike_Timer = 12000; + }else MortalStrike_Timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_gloomrel(Creature *_Creature) +{ + return new boss_gloomrelAI (_Creature); +} + +#define GOSSIP_ITEM_TEACH_1 "Teach me the art of smelting dark iron" +#define GOSSIP_ITEM_TEACH_2 "Continue..." +#define GOSSIP_ITEM_TRIBUTE "I want to pay tribute" + +bool GossipHello_boss_gloomrel(Player *player, Creature *_Creature) +{ + if (player->GetQuestRewardStatus(4083) == 1 && player->GetSkillValue(SKILL_MINING) >= 230 && !player->HasSpell(14891) ) + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_TEACH_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + + if (player->GetQuestRewardStatus(4083) == 0 && player->GetSkillValue(SKILL_MINING) >= 230) + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_TRIBUTE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + + return true; +} + +bool GossipSelect_boss_gloomrel(Player *player, Creature *_Creature, uint32 sender, uint32 action ) +{ + switch (action) + { + case GOSSIP_ACTION_INFO_DEF+1: + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_TEACH_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + player->SEND_GOSSIP_MENU(2606, _Creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+11: + player->CLOSE_GOSSIP_MENU(); + _Creature->CastSpell(player, 14894, false); + break; + case GOSSIP_ACTION_INFO_DEF+2: + player->ADD_GOSSIP_ITEM(0, "[PH] Continue...", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); + player->SEND_GOSSIP_MENU(2604, _Creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+22: + player->CLOSE_GOSSIP_MENU(); + //re-spawn object here + break; + } + return true; +} + +#define SPELL_SHADOWBOLTVOLLEY 17228 +#define SPELL_IMMOLATE 15505 +#define SPELL_CURSEOFWEAKNESS 17227 +#define SPELL_DEMONARMOR 11735 + +struct TRINITY_DLL_DECL boss_doomrelAI : public ScriptedAI +{ + boss_doomrelAI(Creature *c) : ScriptedAI(c) {Reset();} + + uint32 ShadowVolley_Timer; + uint32 Immolate_Timer; + uint32 CurseOfWeakness_Timer; + uint32 DemonArmor_Timer; + bool Voidwalkers; + int Rand; + int RandX; + int RandY; + Creature* Summoned; + + void Reset() + { + ShadowVolley_Timer = 10000; + Immolate_Timer = 18000; + CurseOfWeakness_Timer = 5000; + DemonArmor_Timer = 16000; + Voidwalkers = false; + + m_creature->setFaction(FACTION_NEUTRAL); + } + + void Aggro(Unit *who) + { + } + + void SummonVoidwalkers(Unit* victim) + { + Rand = rand()%5; + switch (rand()%2) + { + case 0: RandX = 0 - Rand; break; + case 1: RandX = 0 + Rand; break; + } + Rand = 0; + Rand = rand()%5; + switch (rand()%2) + { + case 0: RandY = 0 - Rand; break; + case 1: RandY = 0 + Rand; break; + } + Rand = 0; + Summoned = DoSpawnCreature(16119, RandX, RandY, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000); + if(Summoned) + ((CreatureAI*)Summoned->AI())->AttackStart(victim); + } + + void UpdateAI(const uint32 diff) + { + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) + return; + + //ShadowVolley_Timer + if (ShadowVolley_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_SHADOWBOLTVOLLEY); + ShadowVolley_Timer = 12000; + }else ShadowVolley_Timer -= diff; + + //Immolate_Timer + if (Immolate_Timer < diff) + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_IMMOLATE); + + Immolate_Timer = 25000; + }else Immolate_Timer -= diff; + + //CurseOfWeakness_Timer + if (CurseOfWeakness_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_CURSEOFWEAKNESS); + CurseOfWeakness_Timer = 45000; + }else CurseOfWeakness_Timer -= diff; + + //DemonArmor_Timer + if (DemonArmor_Timer < diff) + { + DoCast(m_creature,SPELL_DEMONARMOR); + DemonArmor_Timer = 300000; + }else DemonArmor_Timer -= diff; + + //Summon Voidwalkers + if (!Voidwalkers && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 51 ) + { + SummonVoidwalkers(m_creature->getVictim()); + SummonVoidwalkers(m_creature->getVictim()); + SummonVoidwalkers(m_creature->getVictim()); + Voidwalkers = true; + } + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_doomrel(Creature *_Creature) +{ + return new boss_doomrelAI (_Creature); +} + +#define GOSSIP_ITEM_CHALLENGE "Your bondage is at an end, Doom'rel. I challenge you!" + +bool GossipHello_boss_doomrel(Player *player, Creature *_Creature) +{ + player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_CHALLENGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->SEND_GOSSIP_MENU(2601, _Creature->GetGUID()); + + return true; +} + +bool GossipSelect_boss_doomrel(Player *player, Creature *_Creature, uint32 sender, uint32 action ) +{ + switch (action) + { + case GOSSIP_ACTION_INFO_DEF+1: + player->ADD_GOSSIP_ITEM( 0, "[PH] Continue...", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->SEND_GOSSIP_MENU(2605, _Creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + player->CLOSE_GOSSIP_MENU(); + //start event here, below code just temporary + _Creature->setFaction(FACTION_HOSTILE); + break; + } + return true; +} + +void AddSC_boss_tomb_of_seven() +{ + Script *newscript; + + newscript = new Script; + newscript->Name = "boss_angerrel"; + newscript->GetAI = &GetAI_boss_angerrel; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "boss_doperel"; + newscript->GetAI = &GetAI_boss_doperel; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "boss_haterel"; + newscript->GetAI = &GetAI_boss_haterel; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "boss_vilerel"; + newscript->GetAI = &GetAI_boss_vilerel; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "boss_seethrel"; + newscript->GetAI = &GetAI_boss_seethrel; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "boss_gloomrel"; + newscript->GetAI = &GetAI_boss_gloomrel; + newscript->pGossipHello = &GossipHello_boss_gloomrel; + newscript->pGossipSelect = &GossipSelect_boss_gloomrel; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "boss_doomrel"; + newscript->GetAI = &GetAI_boss_doomrel; + newscript->pGossipHello = &GossipHello_boss_doomrel; + newscript->pGossipSelect = &GossipSelect_boss_doomrel; + newscript->RegisterSelf(); +} diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_vilerel.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/boss_vilerel.cpp deleted file mode 100644 index 962b243ff28..00000000000 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_vilerel.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Vilerel -SD%Complete: 100 -SDComment: -SDCategory: Blackrock Depths -EndScriptData */ - -#include "precompiled.h" - -#define SPELL_MINDBLAST 15587 -#define SPELL_HEAL 15586 -#define SPELL_PRAYEROFHEALING 15585 -#define SPELL_SHIELD 10901 - -struct TRINITY_DLL_DECL boss_vilerelAI : public ScriptedAI -{ - boss_vilerelAI(Creature *c) : ScriptedAI(c) {Reset();} - - uint32 MindBlast_Timer; - uint32 Heal_Timer; - uint32 PrayerOfHealing_Timer; - uint32 Shield_Timer; - - void Reset() - { - MindBlast_Timer = 10000; - Heal_Timer = 35000; - PrayerOfHealing_Timer = 25000; - Shield_Timer = 3000; - } - - void Aggro(Unit *who) - { - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) - return; - - //MindBlast_Timer - if (MindBlast_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_MINDBLAST); - MindBlast_Timer = 7000; - }else MindBlast_Timer -= diff; - - //Heal_Timer - if (Heal_Timer < diff) - { - DoCast(m_creature,SPELL_HEAL); - Heal_Timer = 20000; - }else Heal_Timer -= diff; - - //PrayerOfHealing_Timer - if (PrayerOfHealing_Timer < diff) - { - DoCast(m_creature,SPELL_PRAYEROFHEALING); - PrayerOfHealing_Timer = 30000; - }else PrayerOfHealing_Timer -= diff; - - //Shield_Timer - if (Shield_Timer < diff) - { - DoCast(m_creature,SPELL_SHIELD); - Shield_Timer = 30000; - }else Shield_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; -CreatureAI* GetAI_boss_vilerel(Creature *_Creature) -{ - return new boss_vilerelAI (_Creature); -} - -void AddSC_boss_vilerel() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_vilerel"; - newscript->GetAI = &GetAI_boss_vilerel; - newscript->RegisterSelf(); -} diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/def_blackrock_depths.h b/src/bindings/scripts/scripts/zone/blackrock_depths/def_blackrock_depths.h index f6da69c8044..1a7f8962752 100644 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/def_blackrock_depths.h +++ b/src/bindings/scripts/scripts/zone/blackrock_depths/def_blackrock_depths.h @@ -1,35 +1,26 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software licensed under GPL version 2 - * Please see the included DOCS/LICENSE.TXT for more information */ - -#ifndef DEF_BLACKROCK_DEPTHS_H -#define DEF_BLACKROCK_DEPTHS_H - -#define DATA_DUGHAL 0 -#define DATA_SUPPLY_ROOM 1 -#define DATA_JAZ 2 -#define DATA_SHILL 3 -#define DATA_CREST 4 -#define DATA_TOBIAS 5 -#define DATA_QUEST_JAIL_BREAK 6 - -#define ENCOUNTER_STATE_NOT_STARTED 100 -#define ENCOUNTER_STATE_BEFORE_START 101 -#define ENCOUNTER_STATE_IN_PROGRESS 102 -#define ENCOUNTER_STATE_OBJECTIVE_COMPLETED 103 -#define ENCOUNTER_STATE_ENDED 104 -#define ENCOUNTER_STATE_FAILED 105 - -#define DATA_GATE_D 111 -#define DATA_GATE_SR 112 -#define DATA_GATE_J 113 -#define DATA_GATE_S 114 -#define DATA_GATE_C 115 -#define DATA_GATE_T 116 -#define DATA_GATE_SC 117 -#define DATA_CREATURE_JAZ 118 -#define DATA_CREATURE_OGRABISI 119 -#define DATA_CREATURE_CREST 120 -#define DATA_CREATURE_SHILL 121 - +/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> +* This program is free software licensed under GPL version 2 +* Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef DEF_BRD_H +#define DEF_BRD_H + +#define TYPE_RING_OF_LAW 1 +#define TYPE_VAULT 2 +#define TYPE_BAR 3 +#define TYPE_TOMB_OF_SEVEN 4 +#define TYPE_LYCEUM 5 +#define TYPE_IRON_HALL 6 + +#define DATA_EMPEROR 10 +#define DATA_PHALANX 11 + +#define DATA_ARENA1 12 +#define DATA_ARENA2 13 +#define DATA_ARENA3 14 +#define DATA_ARENA4 15 + +#define DATA_GO_BAR_KEG 16 +#define DATA_GO_BAR_KEG_TRAP 17 +#define DATA_GO_BAR_DOOR 18 #endif
\ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp index 301301c27c2..8a45955c706 100644 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp +++ b/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp @@ -32,209 +32,276 @@ update `instance_template` set `script`='instance_blackrock_depths' where `map`= #include "precompiled.h" #include "def_blackrock_depths.h" -#define ENCOUNTERS 7 - +#define ENCOUNTERS 6 + +#define C_EMPEROR 9019 +#define C_PHALANX 9502 + +#define GO_ARENA1 161525 +#define GO_ARENA2 161522 +#define GO_ARENA3 161524 +#define GO_ARENA4 161523 +#define GO_SHADOW_LOCK 161460 +#define GO_SHADOW_MECHANISM 161461 +#define GO_SHADOW_GIANT_DOOR 157923 +#define GO_SHADOW_DUMMY 161516 +#define GO_BAR_KEG_SHOT 170607 +#define GO_BAR_KEG_TRAP 171941 +#define GO_BAR_DOOR 170571 +#define GO_TOMB_ENTER 170576 +#define GO_TOMB_EXIT 170577 +#define GO_LYCEUM 170558 +#define GO_GOLEM_ROOM_N 170573 +#define GO_GOLEM_ROOM_S 170574 +#define GO_THONE_ROOM 170575 + struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance { instance_blackrock_depths(Map *map) : ScriptedInstance(map) {Initialize();}; + + uint32 Encounter[ENCOUNTERS]; + std::string str_data; + + uint64 EmperorGUID; + uint64 PhalanxGUID; + + uint64 GoArena1GUID; + uint64 GoArena2GUID; + uint64 GoArena3GUID; + uint64 GoArena4GUID; + uint64 GoShadowLockGUID; + uint64 GoShadowMechGUID; + uint64 GoShadowGiantGUID; + uint64 GoShadowDummyGUID; + uint64 GoBarKegGUID; + uint64 GoBarKegTrapGUID; + uint64 GoBarDoorGUID; + uint64 GoTombEnterGUID; + uint64 GoTombExitGUID; + uint64 GoLyceumGUID; + uint64 GoGolemNGUID; + uint64 GoGolemSGUID; + uint64 GoThoneGUID; - uint64 GateDughal; - uint64 SupplyRoomGate; - uint64 GateJaz; - uint64 GateShill; - uint64 GateCrest; - uint64 GateTobias; - uint64 SupplyCrate; - - uint64 Jaz; - uint64 Ograbisi; - uint64 ShillDinger; - uint64 CrestKiller; - - uint32 state; - - bool Encounters[ENCOUNTERS]; - + uint32 BarAleCount; + void Initialize() - { - - GateDughal = 0; - SupplyRoomGate = 0; - GateJaz = 0; - GateShill = 0; - GateCrest = 0; - GateTobias = 0; - SupplyCrate = 0; - - Jaz = 0; - Ograbisi = 0; - ShillDinger = 0; - CrestKiller = 0; + { + EmperorGUID = 0; + PhalanxGUID = 0; - state = 0; + GoArena1GUID = 0; + GoArena2GUID = 0; + GoArena3GUID = 0; + GoArena4GUID = 0; + GoShadowLockGUID = 0; + GoShadowMechGUID = 0; + GoShadowGiantGUID = 0; + GoShadowDummyGUID = 0; + GoBarKegGUID = 0; + GoBarKegTrapGUID = 0; + GoBarDoorGUID = 0; + GoTombEnterGUID = 0; + GoTombExitGUID = 0; + GoLyceumGUID = 0; + GoGolemNGUID = 0; + GoGolemSGUID = 0; + GoThoneGUID = 0; + BarAleCount = 0; + for(uint8 i = 0; i < ENCOUNTERS; i++) - Encounters[i] = false; - } - - bool IsEncounterInProgress() const + Encounter[i] = NOT_STARTED; + } + + Player* GetPlayerInMap() { - for(uint8 i = 0; i < ENCOUNTERS; i++) - if(Encounters[i]) return true; - - return false; - } - - void OpenGO(uint64 DoorGUID, bool open) - { - if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID)) - Door->SetUInt32Value(GAMEOBJECT_STATE, open ? 0 : 1); - } + Map::PlayerList const& players = instance->GetPlayers(); - void CloseGO(uint64 DoorGUID, bool close) - { - if(GameObject *Door = instance->GetGameObjectInMap(DoorGUID)) - Door->SetUInt32Value(GAMEOBJECT_STATE, close ? 1 : 0); - } + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } + + debug_log("SD2: Instance Blackrock Depths: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } + + void OnCreatureCreate(Creature *creature, uint32 creature_entry) + { + switch(creature->GetEntry()) + { + case C_EMPEROR: EmperorGUID = creature->GetGUID(); break; + case C_PHALANX: PhalanxGUID = creature->GetGUID(); break; + } + } - uint32 GetData(uint32 type) + void OnObjectCreate(GameObject* go) + { + switch(go->GetEntry()) + { + case GO_ARENA1: GoArena1GUID = go->GetGUID(); break; + case GO_ARENA2: GoArena2GUID = go->GetGUID(); break; + case GO_ARENA3: GoArena3GUID = go->GetGUID(); break; + case GO_ARENA4: GoArena4GUID = go->GetGUID(); break; + case GO_SHADOW_LOCK: GoShadowLockGUID = go->GetGUID(); break; + case GO_SHADOW_MECHANISM: GoShadowMechGUID = go->GetGUID(); break; + case GO_SHADOW_GIANT_DOOR: GoShadowGiantGUID = go->GetGUID(); break; + case GO_SHADOW_DUMMY: GoShadowDummyGUID = go->GetGUID(); break; + case GO_BAR_KEG_SHOT: GoBarKegGUID = go->GetGUID(); break; + case GO_BAR_KEG_TRAP: GoBarKegTrapGUID = go->GetGUID(); break; + case GO_BAR_DOOR: GoBarDoorGUID = go->GetGUID(); break; + case GO_TOMB_ENTER: GoTombEnterGUID = go->GetGUID(); break; + case GO_TOMB_EXIT: GoTombExitGUID = go->GetGUID(); break; + case GO_LYCEUM: GoLyceumGUID = go->GetGUID(); break; + case GO_GOLEM_ROOM_N: GoGolemNGUID = go->GetGUID(); break; + case GO_GOLEM_ROOM_S: GoGolemSGUID = go->GetGUID(); break; + case GO_THONE_ROOM: GoThoneGUID = go->GetGUID(); break; + } + } + + void SetData(uint32 type, uint32 data) { + Player *player = GetPlayerInMap(); + + if (!player) + { + debug_log("SD2: Instance Blackrock Depths: SetData (Type: %u Data %u) cannot find any player.", type, data); + return; + } + + debug_log("SD2: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); + switch(type) { - case DATA_DUGHAL: return Encounters[0];break; - case DATA_SUPPLY_ROOM: return Encounters[1];break; - case DATA_JAZ: return Encounters[2];break; - case DATA_SHILL: return Encounters[3];break; - case DATA_CREST: return Encounters[4];break; - case DATA_TOBIAS: return Encounters[5];break; - case DATA_QUEST_JAIL_BREAK: return Encounters[6];break; - case DATA_GATE_D: return GateDughal; break; - case DATA_GATE_T: return GateTobias; break; - case DATA_GATE_C: return GateCrest; break; - case DATA_GATE_J: return GateJaz; break; - case DATA_GATE_S: return GateShill; break; - case DATA_CREATURE_JAZ: - if((((Creature*)Jaz)->isDead())) - state = 1; - else - state = 0; + case TYPE_RING_OF_LAW: + Encounter[0] = data; break; - case DATA_CREATURE_OGRABISI: - if((((Creature*)Ograbisi)->isDead())) - state = 1; - else - state = 0; + case TYPE_VAULT: + Encounter[1] = data; break; - case DATA_CREATURE_CREST: - if((((Creature*)CrestKiller)->isDead())) - state = 1; + case TYPE_BAR: + if (data == SPECIAL) + ++BarAleCount; else - state = 0; + Encounter[2] = data; break; - case DATA_CREATURE_SHILL: - if((((Creature*)ShillDinger)->isDead())) - state = 1; - else - state = 0; + case TYPE_TOMB_OF_SEVEN: + Encounter[3] = data; + break; + case TYPE_LYCEUM: + Encounter[4] = data; + break; + case TYPE_IRON_HALL: + Encounter[5] = data; break; } + + if (data == DONE) + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << Encounter[0] << " " << Encounter[1] << " " << Encounter[2] << " " + << Encounter[3] << " " << Encounter[4] << " " << Encounter[5]; + + str_data = saveStream.str(); + + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case TYPE_RING_OF_LAW: + return Encounter[0]; + case TYPE_VAULT: + return Encounter[1]; + case TYPE_BAR: + if (Encounter[2] == IN_PROGRESS && BarAleCount == 3) + return SPECIAL; + else + return Encounter[2]; + case TYPE_TOMB_OF_SEVEN: + return Encounter[3]; + case TYPE_LYCEUM: + return Encounter[4]; + case TYPE_IRON_HALL: + return Encounter[5]; + } return 0; } - - void OnObjectCreate(GameObject *go) + + uint64 GetData64(uint32 data) { - switch(go->GetEntry()) + switch(data) { - case 170561: SupplyRoomGate = go->GetGUID(); state = go->GetUInt32Value(GAMEOBJECT_STATE); break; - case 170562: GateDughal = go->GetGUID(); state = go->GetUInt32Value(GAMEOBJECT_STATE); break; - case 170566: GateTobias = go->GetGUID(); state = go->GetUInt32Value(GAMEOBJECT_STATE); break; - case 170567: GateCrest = go->GetGUID(); state = go->GetUInt32Value(GAMEOBJECT_STATE); break; - case 170568: GateJaz = go->GetGUID(); state = go->GetUInt32Value(GAMEOBJECT_STATE); break; - case 170569: GateShill = go->GetGUID(); state = go->GetUInt32Value(GAMEOBJECT_STATE); break; - case 166872: SupplyCrate = go->GetGUID(); state = go->GetUInt32Value(GAMEOBJECT_STATE); break; + case DATA_EMPEROR: + return EmperorGUID; + case DATA_PHALANX: + return PhalanxGUID; + case DATA_ARENA1: + return GoArena1GUID; + case DATA_ARENA2: + return GoArena2GUID; + case DATA_ARENA3: + return GoArena3GUID; + case DATA_ARENA4: + return GoArena4GUID; + case DATA_GO_BAR_KEG: + return GoBarKegGUID; + case DATA_GO_BAR_KEG_TRAP: + return GoBarKegTrapGUID; + case DATA_GO_BAR_DOOR: + return GoBarDoorGUID; } + return 0; } - - void OnCreatureCreate(Creature *creature, uint32 creature_entry) + + const char* Save() { - switch(creature_entry) - { - case 9680: CrestKiller = creature->GetGUID(); break; - case 9677: Ograbisi = creature->GetGUID(); break; - case 9681: Jaz = creature->GetGUID(); break; - case 9678: ShillDinger = creature->GetGUID(); break; - } + return str_data.c_str(); } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_DUGHAL: Encounters[0] = data; break; - case DATA_SUPPLY_ROOM: Encounters[1] = data; break; - case DATA_JAZ: Encounters[2] = data; break; - case DATA_SHILL: Encounters[3] = data; break; - case DATA_CREST: Encounters[4] = data; break; - case DATA_TOBIAS: Encounters[5] = data; break; - case DATA_QUEST_JAIL_BREAK: Encounters[6] = data; break; - case DATA_GATE_SR: - if(SupplyRoomGate) - { - if(data == NOT_STARTED) - OpenGO(SupplyRoomGate, true); - else - CloseGO(SupplyRoomGate, true); - } - break; - case DATA_GATE_SC: - if(SupplyCrate) - { - if(data == NOT_STARTED) - OpenGO(SupplyCrate, true); - else - CloseGO(SupplyCrate, true); - } - break; - case DATA_CREATURE_JAZ: - if(data) - { - (((Creature*)Jaz)->setFaction(54)); - (((Creature*)Ograbisi)->setFaction(54)); - (((Creature*)Ograbisi)->Say("Ograbisi needs new hat", LANG_UNIVERSAL, NULL)); - } - else - { - (((Creature*)Jaz)->setFaction(35)); - (((Creature*)Ograbisi)->setFaction(35)); - } - break; - case DATA_CREATURE_SHILL: - if(data) - (((Creature*)ShillDinger)->setFaction(54)); - else - (((Creature*)ShillDinger)->setFaction(35)); - break; - case DATA_CREATURE_CREST: - if(data) - (((Creature*)CrestKiller)->setFaction(54)); - else - (((Creature*)CrestKiller)->setFaction(35)); - break; - } - } + std::istringstream loadStream(in); + loadStream >> Encounter[0] >> Encounter[1] >> Encounter[2] >> Encounter[3] + >> Encounter[4] >> Encounter[5]; + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if (Encounter[i] == IN_PROGRESS) + Encounter[i] = NOT_STARTED; + + OUT_LOAD_INST_DATA_COMPLETE; + } }; - + InstanceData* GetInstanceData_instance_blackrock_depths(Map* map) { - return new instance_blackrock_depths(map); + return new instance_blackrock_depths(map); } - -void AddSC_instance_blackrock_depths() -{ - Script *newscript; - newscript = new Script; - newscript->Name = "instance_blackrock_depths"; - newscript->GetInstanceData = &GetInstanceData_instance_blackrock_depths; - newscript->RegisterSelf(); -}
\ No newline at end of file + + void AddSC_instance_blackrock_depths() + { + Script *newscript; + newscript = new Script; + newscript->Name = "instance_blackrock_depths"; + newscript->GetInstanceData = &GetInstanceData_instance_blackrock_depths; + newscript->RegisterSelf(); + }
\ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp b/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp index fba1ed20c72..116c08d4b0a 100644 --- a/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp +++ b/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp @@ -64,11 +64,11 @@ CreatureAI* GetAI_mobs_bladespire_ogre(Creature *_Creature) ## mobs_nether_drake ######*/ -#define SAY_NIHIL_1 "Muahahahaha! You fool! You've released me from my banishment in the interstices between space and time!" -#define SAY_NIHIL_2 "All of Draenor shall quick beneath my feet! I will destroy this world and reshape it in my image!" -#define SAY_NIHIL_3 "Where shall I begin? I cannot bother myself with a worm such as yourself. There is a world to be conquered!" -#define SAY_NIHIL_4 "No doubt the fools that banished me are long dead. I shall take wing survey my demense. Pray to whatever gods you hold dear that we do not meet again." -#define SAY_NIHIL_INTERRUPT "NOOOOooooooo!" +#define SAY_NIHIL_1 -1000396 +#define SAY_NIHIL_2 -1000397 +#define SAY_NIHIL_3 -1000398 +#define SAY_NIHIL_4 -1000399 +#define SAY_NIHIL_INTERRUPT -1000400 #define ENTRY_WHELP 20021 #define ENTRY_PROTO 21821 @@ -156,7 +156,7 @@ struct TRINITY_DLL_DECL mobs_nether_drakeAI : public ScriptedAI case ENTRY_NIHIL: if( NihilSpeech_Phase ) { - DoYell(SAY_NIHIL_INTERRUPT,LANG_UNIVERSAL,NULL); + DoScriptText(SAY_NIHIL_INTERRUPT, m_creature); IsNihil = false; switch(rand()%3) { @@ -196,19 +196,19 @@ struct TRINITY_DLL_DECL mobs_nether_drakeAI : public ScriptedAI switch( NihilSpeech_Phase ) { case 1: - DoSay(SAY_NIHIL_1,LANG_UNIVERSAL,NULL); + DoScriptText(SAY_NIHIL_1, m_creature); ++NihilSpeech_Phase; break; case 2: - DoSay(SAY_NIHIL_2,LANG_UNIVERSAL,NULL); + DoScriptText(SAY_NIHIL_2, m_creature); ++NihilSpeech_Phase; break; case 3: - DoSay(SAY_NIHIL_3,LANG_UNIVERSAL,NULL); + DoScriptText(SAY_NIHIL_3, m_creature); ++NihilSpeech_Phase; break; case 4: - DoSay(SAY_NIHIL_4,LANG_UNIVERSAL,NULL); + DoScriptText(SAY_NIHIL_4, m_creature); ++NihilSpeech_Phase; break; case 5: @@ -261,6 +261,8 @@ CreatureAI* GetAI_mobs_nether_drake(Creature *_Creature) ## npc_daranelle ######*/ +#define SAY_DARANELLE -1000401 + struct TRINITY_DLL_DECL npc_daranelleAI : public ScriptedAI { npc_daranelleAI(Creature *c) : ScriptedAI(c) {Reset();} @@ -279,7 +281,7 @@ struct TRINITY_DLL_DECL npc_daranelleAI : public ScriptedAI { if(who->HasAura(36904,0)) { - DoSay("Good $N, you are under the spell's influence. I must analyze it quickly, then we can talk.",LANG_COMMON,who); + DoScriptText(SAY_DARANELLE, m_creature, who); //TODO: Move the below to updateAI and run if this statement == true ((Player*)who)->KilledMonster(21511, m_creature->GetGUID()); ((Player*)who)->RemoveAurasDueToSpell(36904); @@ -299,10 +301,12 @@ CreatureAI* GetAI_npc_daranelle(Creature *_Creature) ## npc_overseer_nuaar ######*/ +#define GOSSIP_HON "Overseer, I am here to negotiate on behalf of the Cenarion Expedition." + bool GossipHello_npc_overseer_nuaar(Player *player, Creature *_Creature) { if (player->GetQuestStatus(10682) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "Overseer, I am here to negotiate on behalf of the Cenarion Expedition.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(10532, _Creature->GetGUID()); @@ -323,10 +327,13 @@ bool GossipSelect_npc_overseer_nuaar(Player *player, Creature *_Creature, uint32 ## npc_saikkal_the_elder ######*/ +#define GOSSIP_HSTE "Yes... yes, it's me." +#define GOSSIP_SSTE "Yes elder. Tell me more of the book." + bool GossipHello_npc_saikkal_the_elder(Player *player, Creature *_Creature) { if (player->GetQuestStatus(10980) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "Yes... yes, it's me.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HSTE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(10794, _Creature->GetGUID()); @@ -338,7 +345,7 @@ bool GossipSelect_npc_saikkal_the_elder(Player *player, Creature *_Creature, uin switch (action) { case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM( 0, "Yes elder. Tell me more of the book.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SSTE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); player->SEND_GOSSIP_MENU(10795, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: diff --git a/src/bindings/scripts/scripts/zone/blasted_lands/blasted_lands.cpp b/src/bindings/scripts/scripts/zone/blasted_lands/blasted_lands.cpp index b47abcb4c15..0d89f711148 100644 --- a/src/bindings/scripts/scripts/zone/blasted_lands/blasted_lands.cpp +++ b/src/bindings/scripts/scripts/zone/blasted_lands/blasted_lands.cpp @@ -62,6 +62,8 @@ bool GossipSelect_npc_deathly_usher(Player *player, Creature *_Creature, uint32 /*###### ## npc_fallen_hero_of_horde ######*/ +#define GOSSIP_H_F1 "Why are you here?" +#define GOSSIP_H_F2 "Continue story..." #define GOSSIP_ITEM_FALLEN "Continue..." @@ -77,13 +79,13 @@ bool GossipHello_npc_fallen_hero_of_horde(Player *player, Creature *_Creature) player->PrepareQuestMenu( _Creature->GetGUID() ); if (player->GetQuestStatus(2784) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "Why are you here?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_H_F1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); if (player->GetQuestStatus(2801) == QUEST_STATUS_INCOMPLETE && player->GetTeam() == HORDE) - player->ADD_GOSSIP_ITEM( 0, "Continue story...", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_H_F2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); if (player->GetQuestStatus(2801) == QUEST_STATUS_INCOMPLETE && player->GetTeam() == ALLIANCE) - player->ADD_GOSSIP_ITEM( 0, "Why are you here?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_H_F1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); diff --git a/src/bindings/scripts/scripts/zone/burning_steppes/burning_steppes.cpp b/src/bindings/scripts/scripts/zone/burning_steppes/burning_steppes.cpp index 935bf302705..e61ce75c92c 100644 --- a/src/bindings/scripts/scripts/zone/burning_steppes/burning_steppes.cpp +++ b/src/bindings/scripts/scripts/zone/burning_steppes/burning_steppes.cpp @@ -31,6 +31,19 @@ EndContentData */ ## npc_ragged_john ######*/ +#define GOSSIP_HELLO "Official buisness, John. I need some information about Marsha Windsor. Tell me about the last time you saw him." +#define GOSSIP_SELECT1 "So what did you do?" +#define GOSSIP_SELECT2 "Start making sense, dwarf. I don't want to have anything to do with your cracker, your pappy, or any sort of 'discreditin'." +#define GOSSIP_SELECT3 "Ironfoe?" +#define GOSSIP_SELECT4 "Interesting... continue John." +#define GOSSIP_SELECT5 "So that's how Windsor died..." +#define GOSSIP_SELECT6 "So how did he die?" +#define GOSSIP_SELECT7 "Ok so where the hell is he? Wait a minute! Are you drunk?" +#define GOSSIP_SELECT8 "WHY is he in Blackrock Depths?" +#define GOSSIP_SELECT9 "300? So the Dark Irons killed him and dragged him into the Depths?" +#define GOSSIP_SELECT10 "Ahh... Ironfoe" +#define GOSSIP_SELECT11 "Thanks, Ragged John. Your story was very uplifting and informative" + struct TRINITY_DLL_DECL npc_ragged_johnAI : public ScriptedAI { npc_ragged_johnAI(Creature *c) : ScriptedAI(c) { Reset(); } @@ -65,7 +78,7 @@ bool GossipHello_npc_ragged_john(Player *player, Creature *_Creature) player->PrepareQuestMenu( _Creature->GetGUID() ); if (player->GetQuestStatus(4224) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "Official buisness, John. I need some information about Marsha Windsor. Tell me about the last time you saw him.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(2713, _Creature->GetGUID()); return true; @@ -76,47 +89,47 @@ bool GossipSelect_npc_ragged_john(Player *player, Creature *_Creature, uint32 se switch (action) { case GOSSIP_ACTION_INFO_DEF: - player->ADD_GOSSIP_ITEM( 0, "So what did you do?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SELECT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(2714, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM( 0, "Start making sense, dwarf. I don't want to have anything to do with your cracker, your pappy, or any sort of 'discreditin'.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SELECT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->SEND_GOSSIP_MENU(2715, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM( 0, "Ironfoe?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SELECT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); player->SEND_GOSSIP_MENU(2716, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM( 0, "Interesting... continue John.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SELECT4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); player->SEND_GOSSIP_MENU(2717, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM( 0, "So that's how Windsor died...", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SELECT5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); player->SEND_GOSSIP_MENU(2718, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM( 0, "So how did he die?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SELECT6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); player->SEND_GOSSIP_MENU(2719, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+6: - player->ADD_GOSSIP_ITEM( 0, "Ok so where the hell is he? Wait a minute! Are you drunk?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SELECT7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); player->SEND_GOSSIP_MENU(2720, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+7: - player->ADD_GOSSIP_ITEM( 0, "WHY is he in Blackrock Depths?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SELECT8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); player->SEND_GOSSIP_MENU(2721, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+8: - player->ADD_GOSSIP_ITEM( 0, "300? So the Dark Irons killed him and dragged him into the Depths?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SELECT9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); player->SEND_GOSSIP_MENU(2722, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+9: - player->ADD_GOSSIP_ITEM( 0, "Ahh... Ironfoe", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SELECT10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); player->SEND_GOSSIP_MENU(2723, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+10: - player->ADD_GOSSIP_ITEM( 0, "Thanks, Ragged John. Your story was very uplifting and informative", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SELECT11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); player->SEND_GOSSIP_MENU(2725, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+11: diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp index 8cafa2f99c0..466fb647e40 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp @@ -86,7 +86,10 @@ struct TRINITY_DLL_DECL boss_aeonusAI : public ScriptedAI DoScriptText(SAY_DEATH, m_creature); if (pInstance) + { pInstance->SetData(TYPE_RIFT,DONE); + pInstance->SetData(TYPE_MEDIVH,DONE);//FIXME: later should be removed + } } void KilledUnit(Unit *victim) diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h index 1e28156857f..164d26223b9 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h @@ -5,6 +5,10 @@ #ifndef DEF_HYJAL_H #define DEF_HYJAL_H +#define WORLD_STATE_WAVES 2842 +#define WORLD_STATE_ENEMY 2453 +#define WORLD_STATE_ENEMYCOUNT 2454 + #define DATA_ANETHERON 1 #define DATA_ANETHERONEVENT 2 #define DATA_ARCHIMONDE 3 @@ -21,5 +25,5 @@ #define DATA_TRASH 14 #define DATA_RESET_TRASH_COUNT 15 -#define ERROR_INST_DATA "SD2: Instance data not set properly for Mount Hyjal. Encounters will be buggy" +#define ERROR_INST_DATA "TSCR: Instance data not set properly for Mount Hyjal. Encounters will be buggy" #endif diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp index cbb8ce53b91..4e4734f817a 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp @@ -17,13 +17,12 @@ /* ScriptData SDName: HyjalAI SD%Complete: 90 -SDComment: World Packet workaround for World States +SDComment: SDCategory: Caverns of Time, Mount Hyjal EndScriptData */ #include "precompiled.h" #include "hyjalAI.h" -#include "WorldPacket.h" // Locations for summoning waves in Alliance base float AllianceBase[4][3]= @@ -99,9 +98,9 @@ void hyjalAI::Reset() memset(Spell, 0, sizeof(Spell)); //Reset World States - UpdateWorldState(WORLDSTATE_WAVES, 0); - UpdateWorldState(WORLDSTATE_ENEMY, 0); - UpdateWorldState(WORLDSTATE_ENEMYCOUNT, 0); + UpdateWorldState(WORLD_STATE_WAVES, 0); + UpdateWorldState(WORLD_STATE_ENEMY, 0); + UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0); //Reset Instance Data for trash count if(pInstance) @@ -204,22 +203,24 @@ void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3]) uint32 stateValue = Count+1; if(FirstBossDead) stateValue -= 9; // Subtract 9 from it to give the proper wave number if we are greater than 8 - UpdateWorldState(WORLDSTATE_WAVES, stateValue); // Set world state to our current wave number - UpdateWorldState(WORLDSTATE_ENEMY, 1); - //UpdateWorldState(WORLDSTATE_ENEMYCOUNT, EnemyCount); // Let Instance Script handle this - pInstance->SetData(DATA_TRASH, EnemyCount); + UpdateWorldState(WORLD_STATE_WAVES, stateValue); // Set world state to our current wave number + UpdateWorldState(WORLD_STATE_ENEMY, 1); // Enable world state + + pInstance->SetData(DATA_TRASH, EnemyCount); // Send data for instance script to update count + if(!Debug) NextWaveTimer = wave[Count].WaveTimer; else { NextWaveTimer = 15000; - DoTextEmote(": Debug Mode is enabled. Next Wave in 15 seconds", NULL); + debug_log("TSCR: HyjalAI: debug mode is enabled. Next Wave in 15 seconds"); } } else { - UpdateWorldState(WORLDSTATE_WAVES, 0); // Set world state for waves to 0 to disable it. - UpdateWorldState(WORLDSTATE_ENEMYCOUNT, 1); // Set World State for enemies invading to 1. + UpdateWorldState(WORLD_STATE_WAVES, 0); // Set world state for waves to 0 to disable it. + UpdateWorldState(WORLD_STATE_ENEMY, 1); + UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 1); // Set World State for enemies invading to 1. Summon = false; } CheckTimer = 5000; @@ -241,9 +242,9 @@ void hyjalAI::StartEvent(Player* player) m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - UpdateWorldState(WORLDSTATE_WAVES, 0); - UpdateWorldState(WORLDSTATE_ENEMY, 0); - UpdateWorldState(WORLDSTATE_ENEMYCOUNT, 0); + UpdateWorldState(WORLD_STATE_WAVES, 0); + UpdateWorldState(WORLD_STATE_ENEMY, 0); + UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0); } uint32 hyjalAI::GetInstanceData(uint32 Event) @@ -291,20 +292,25 @@ void hyjalAI::Talk(uint32 id) DoScriptText(YellId, m_creature); } -// Slight workaround for now -void hyjalAI::UpdateWorldState(uint32 field, uint32 value) +void hyjalAI::UpdateWorldState(uint32 id, uint32 state) { Map * map = m_creature->GetMap(); - if(!map->IsDungeon()) return; - - WorldPacket data(SMSG_UPDATE_WORLD_STATE, 8); - - data << field; - data << value; + + if(!map->IsDungeon()) + return; - map->SendToPlayers(&data); + Map::PlayerList const& players = map->GetPlayers(); + + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* player = itr->getSource()) + player->SendUpdateWorldState(id,state); + } + }else debug_log("TSCR: HyjalAI: UpdateWorldState, but PlayerList is empty"); - // TODO: Uncomment and remove everything above this line only when the core patch for this is accepted + //remove everything above this line only when/if the core patch for this is accepted and needed //m_creature->GetMap()->UpdateWorldState(field, value); } @@ -420,7 +426,7 @@ void hyjalAI::UpdateAI(const uint32 diff) CheckTimer = 0; m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); BossGUID[i] = 0; - UpdateWorldState(WORLDSTATE_ENEMY, 0); // Reset world state for enemies to disable it + UpdateWorldState(WORLD_STATE_ENEMY, 0); // Reset world state for enemies to disable it } } } diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h index b89290cd875..0c638385e78 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h @@ -27,10 +27,6 @@ #define SPELL_TELEPORT_VISUAL 41232 -#define WORLDSTATE_WAVES 2842 -#define WORLDSTATE_ENEMY 2453 -#define WORLDSTATE_ENEMYCOUNT 2454 - //Spells for Jaina #define SPELL_BRILLIANCE_AURA 31260 // The database must handle this spell via creature_addon #define SPELL_BLIZZARD 31266 diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp index 92c17f655a3..1d67582927b 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp @@ -23,7 +23,6 @@ EndScriptData */ #include "precompiled.h" #include "def_hyjal.h" -#include "WorldPacket.h" #define ENCOUNTERS 5 @@ -121,7 +120,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance case DATA_TRASH: if(data) Trash = data; else Trash--; - UpdateWorldState(2453, data); + UpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash); break; } @@ -145,13 +144,18 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance return 0; } - void UpdateWorldState(uint32 field, uint32 value) + void UpdateWorldState(uint32 id, uint32 state) { - WorldPacket data(SMSG_UPDATE_WORLD_STATE, 8); - data << field; - data << value; - - instance->SendToPlayers(&data); + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* player = itr->getSource()) + player->SendUpdateWorldState(id,state); + } + }else debug_log("TSCR: Instance Hyjal: UpdateWorldState, but PlayerList is empty!"); } const char* Save() diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp index dda2ceda354..933b4c0361f 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp @@ -59,13 +59,13 @@ EndScriptData */ #define SPELL_POISON_CLEANSING_EFFECT 8167 #define SPELL_EARTHBIND_TOTEM 38304 #define SPELL_EARTHBIND_TOTEM_EFFECT 6474 -#define SPELL_WINDFURY_WEAPON 32911 +#define SPELL_WINDFURY_WEAPON 38184 //Caribdis Spells #define SPELL_WATER_BOLT_VOLLEY 38335 #define SPELL_TIDAL_SURGE 38358 #define SPELL_TIDAL_SURGE_FREEZE 38357 -#define SPELL_HEAL 41386 +#define SPELL_HEAL 38330 #define SPELL_SUMMON_CYCLONE 38337 #define SPELL_CYCLONE_CYCLONE 29538 diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp index e3a6f226dcd..af702cf22dc 100644 --- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp +++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp @@ -65,7 +65,7 @@ EndScriptData */ #define SPELL_SUMMON_WATER_GLOBULE_3 37860 #define SPELL_SUMMON_WATER_GLOBULE_4 37861 -#define SPELL_SUMMON_MURLOC_A6 39813 +/*#define SPELL_SUMMON_MURLOC_A6 39813 #define SPELL_SUMMON_MURLOC_A7 39814 #define SPELL_SUMMON_MURLOC_A8 39815 #define SPELL_SUMMON_MURLOC_A9 39816 @@ -75,7 +75,21 @@ EndScriptData */ #define SPELL_SUMMON_MURLOC_B7 39819 #define SPELL_SUMMON_MURLOC_B8 39820 #define SPELL_SUMMON_MURLOC_B9 39821 -#define SPELL_SUMMON_MURLOC_B10 39822 +#define SPELL_SUMMON_MURLOC_B10 39822*/ + +float MurlocCords[10][5] = +{ + {21920, 424.36, -715.4, -7.14, 0.124}, + {21920, 425.13, -719.3, -7.14, 0.124}, + {21920, 425.05, -724.23, -7.14, 0.124}, + {21920, 424.91, -728.68, -7.14, 0.124}, + {21920, 424.84, -732.18, -7.14, 0.124}, + {21920, 321.05, -734.2, -13.15, 0.124}, + {21920, 321.05, -729.4, -13.15, 0.124}, + {21920, 321.05, -724.03, -13.15, 0.124}, + {21920, 321.05, -718.73, -13.15, 0.124}, + {21920, 321.05, -714.24, -13.15, 0.124} +}; //Creatures #define WATER_GLOBULE 21913 @@ -97,7 +111,6 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI uint32 WateryGrave_Timer; uint32 Earthquake_Timer; uint32 WateryGlobules_Timer; - uint32 SummonSpell; uint32 globulespell[4]; int8 Playercount; int8 counter; @@ -190,41 +203,16 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI case 1: DoScriptText(SAY_SUMMON2, m_creature); break; } - Unit* target; - using std::set; - set<int> SummonList; - set<int>::iterator itr; - - target = SelectUnit(SELECT_TARGET_RANDOM, 0, 50, true); - m_creature->CastSpell(target, SummonSpell, false); - SummonSpell++; - - for (int8 i = 0; i < 9; i++) //bad hack - { //instead of casting 9 spell in one update - counter = 0; // selecet 9 players which cast our spells - do{target = SelectUnit(SELECT_TARGET_RANDOM, 0, 50, true); //check if player is already selected - if(counter > Playercount) - break; - if(target) itr = SummonList.find(target->GetGUID()); - counter++; - } while (itr != SummonList.end()); - - if(target){ - SummonList.insert(target->GetGUID()); - target->CastSpell(target, SummonSpell, false); //player cast on himself (this works) - } - SummonSpell++; - - if(SummonSpell > SPELL_SUMMON_MURLOC_B10) //reset all variables for earthquake - { - SummonSpell = SPELL_SUMMON_MURLOC_A6; - SummonList.clear(); - DoScriptText(EMOTE_EARTHQUAKE, m_creature); - Earthquake = false; - Earthquake_Timer = 40000+rand()%5000; - } + for(uint8 i = 0; i < 10; i++) + { + Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); + Creature* Murloc = m_creature->SummonCreature(MurlocCords[i][0],MurlocCords[i][1],MurlocCords[i][2],MurlocCords[i][3],MurlocCords[i][4], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); + Murloc->AI()->AttackStart(target); } - } + DoScriptText(EMOTE_EARTHQUAKE, m_creature); + Earthquake = false; + Earthquake_Timer = 40000+rand()%5000; + } }else Earthquake_Timer -= diff; //TidalWave_Timer @@ -303,7 +291,7 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI }; //Water Globule AI -#define SPELL_GLOBULE_EXPLOSION 37852 +#define SPELL_GLOBULE_EXPLOSION 37871 struct TRINITY_DLL_DECL mob_water_globuleAI : public ScriptedAI { diff --git a/src/bindings/scripts/scripts/zone/deadmines/deadmines.cpp b/src/bindings/scripts/scripts/zone/deadmines/deadmines.cpp index 23d65ce42f7..4174aa20bd5 100644 --- a/src/bindings/scripts/scripts/zone/deadmines/deadmines.cpp +++ b/src/bindings/scripts/scripts/zone/deadmines/deadmines.cpp @@ -197,9 +197,9 @@ bool ItemUse_item_defias_gunpowder(Player *player, Item* _Item, SpellCastTargets player->GetSession()->SendNotification("Instance script not initialized"); return true; } - if (pInstance->GetData(EVENT_STATE)!=CANNON_NOT_USED) + if (pInstance->GetData(EVENT_STATE)!= CANNON_NOT_USED) return false; - if(targets.getGOTarget() && targets.getGOTarget()->GetTypeId()==TYPEID_GAMEOBJECT && + if(targets.getGOTarget() && targets.getGOTarget()->GetTypeId() == TYPEID_GAMEOBJECT && targets.getGOTarget()->GetEntry() == GO_DEFIAS_CANNON) { pInstance->SetData(EVENT_STATE, CANNON_GUNPOWDER_USED); diff --git a/src/bindings/scripts/scripts/zone/dun_morogh/dun_morogh.cpp b/src/bindings/scripts/scripts/zone/dun_morogh/dun_morogh.cpp index a03fd7c775b..634a05d3ebe 100644 --- a/src/bindings/scripts/scripts/zone/dun_morogh/dun_morogh.cpp +++ b/src/bindings/scripts/scripts/zone/dun_morogh/dun_morogh.cpp @@ -31,7 +31,7 @@ EndContentData */ ## npc_narm_faulk ######*/ -#define SAY_HEAL "Thank you, dear Paladin, you just saved my life." +#define SAY_HEAL -1000280 struct TRINITY_DLL_DECL npc_narm_faulkAI : public ScriptedAI { @@ -76,7 +76,7 @@ struct TRINITY_DLL_DECL npc_narm_faulkAI : public ScriptedAI m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); //m_creature->RemoveAllAuras(); - DoSay(SAY_HEAL,LANG_COMMON,NULL); + DoScriptText(SAY_HEAL, m_creature); spellHit = true; } } diff --git a/src/bindings/scripts/scripts/zone/eastern_plaguelands/eastern_plaguelands.cpp b/src/bindings/scripts/scripts/zone/eastern_plaguelands/eastern_plaguelands.cpp index 96cbe5729bb..44abf0da806 100644 --- a/src/bindings/scripts/scripts/zone/eastern_plaguelands/eastern_plaguelands.cpp +++ b/src/bindings/scripts/scripts/zone/eastern_plaguelands/eastern_plaguelands.cpp @@ -45,9 +45,8 @@ struct TRINITY_DLL_DECL mobs_ghoul_flayerAI : public ScriptedAI void JustDied(Unit* Killer) { if( Killer->GetTypeId() == TYPEID_PLAYER ) - DoSpawnCreature(11064,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000); + DoSpawnCreature(11064, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 60000); } - }; CreatureAI* GetAI_mobs_ghoul_flayer(Creature *_Creature) diff --git a/src/bindings/scripts/scripts/zone/elwynn_forest/elwynn_forest.cpp b/src/bindings/scripts/scripts/zone/elwynn_forest/elwynn_forest.cpp index 72b166b5703..4e18572260f 100644 --- a/src/bindings/scripts/scripts/zone/elwynn_forest/elwynn_forest.cpp +++ b/src/bindings/scripts/scripts/zone/elwynn_forest/elwynn_forest.cpp @@ -31,7 +31,7 @@ EndContentData */ ## npc_henze_faulk ######*/ -#define SAY_HEAL "Thank you, dear Paladin, you just saved my life." +#define SAY_HEAL -1000280 struct TRINITY_DLL_DECL npc_henze_faulkAI : public ScriptedAI { @@ -76,7 +76,7 @@ struct TRINITY_DLL_DECL npc_henze_faulkAI : public ScriptedAI m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); //m_creature->RemoveAllAuras(); - DoSay(SAY_HEAL,LANG_COMMON,NULL); + DoScriptText(SAY_HEAL, m_creature); spellHit = true; } } diff --git a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp index 1126352de8c..6149b185cfa 100644 --- a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp +++ b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp @@ -60,6 +60,12 @@ CreatureAI* GetAI_mobs_mana_tapped(Creature *_Creature) ## npc_prospector_anvilward ######*/ +#define GOSSIP_HELLO "I need a moment of your time, sir." +#define GOSSIP_SELECT "Why... yes, of course. I've something to show you right inside this building, Mr. Anvilward." + +#define SAY_PR_1 -1000281 +#define SAY_PR_2 -1000282 + #define QUEST_THE_DWARVEN_SPY 8483 struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI @@ -70,17 +76,16 @@ struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI // Pure Virtual Functions void WaypointReached(uint32 i) { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + + if(!player) + return; + switch (i) { - case 0: - m_creature->Say("Very well. Let's see what you have to show me, $N.", LANG_UNIVERSAL, PlayerGUID); - break; - case 5: - m_creature->Say("What manner of trick is this, $R? If you seek to ambush me, I warn you I will not go down quietly!", LANG_UNIVERSAL, PlayerGUID); - break; - case 6: - m_creature->setFaction(24); - break; + case 0: DoScriptText(SAY_PR_1, m_creature, player); break; + case 5: DoScriptText(SAY_PR_2, m_creature, player); break; + case 6: m_creature->setFaction(24); break; } } @@ -88,20 +93,17 @@ struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI void Reset() { - //Default npc faction m_creature->setFaction(35); } void JustDied(Unit* killer) - { - //Default npc faction + { m_creature->setFaction(35); } void UpdateAI(const uint32 diff) { - npc_escortAI::UpdateAI(diff); //Must update npc_escortAI - + npc_escortAI::UpdateAI(diff); } }; @@ -114,8 +116,8 @@ CreatureAI* GetAI_npc_prospector_anvilward(Creature *_Creature) thisAI->AddWaypoint(2, 9309.63, -6658.84, 22.43); thisAI->AddWaypoint(3, 9304.43, -6649.31, 26.46); thisAI->AddWaypoint(4, 9298.83, -6648.00, 28.61); - thisAI->AddWaypoint(5, 9291.06, -6653.46, 31.83,2500); - thisAI->AddWaypoint(6, 9289.08, -6660.17, 31.85,5000); + thisAI->AddWaypoint(5, 9291.06, -6653.46, 31.83, 2500); + thisAI->AddWaypoint(6, 9289.08, -6660.17, 31.85, 5000); thisAI->AddWaypoint(7, 9291.06, -6653.46, 31.83); return (CreatureAI*)thisAI; @@ -124,7 +126,7 @@ CreatureAI* GetAI_npc_prospector_anvilward(Creature *_Creature) bool GossipHello_npc_prospector_anvilward(Player *player, Creature *_Creature) { if( player->GetQuestStatus(QUEST_THE_DWARVEN_SPY) == QUEST_STATUS_INCOMPLETE ) - player->ADD_GOSSIP_ITEM(0, "I need a moment of your time, sir.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(8239, _Creature->GetGUID()); return true; @@ -135,12 +137,11 @@ bool GossipSelect_npc_prospector_anvilward(Player *player, Creature *_Creature, switch(action) { case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM( 0, "Why... yes, of course. I've something to show you right inside this building, Mr. Anvilward.",GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SELECT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); player->SEND_GOSSIP_MENU(8240, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: player->CLOSE_GOSSIP_MENU(); - //attack,defend,walk ((npc_escortAI*)(_Creature->AI()))->Start(true, true, false, player->GetGUID()); break; } @@ -636,11 +637,11 @@ CreatureAI* GetAI_npc_apprentice_mirvedaAI(Creature *_Creature) } /*###### -## npc_infused_crystal not working yet. +## npc_infused_crystal ######*/ #define MOB_ENRAGED_WRAITH 17086 -#define EMOTE "releases the last of its energies into the nerarby runestone, succesfully reactivating it." +#define EMOTE -1000283 #define QUEST_POWERING_OUR_DEFENSES 8490 struct Location @@ -718,7 +719,7 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI { if(EndTimer < diff && Progress) { - DoTextEmote(EMOTE, NULL); + DoScriptText(EMOTE, m_creature); Completed = true; if (PlayerGUID) { diff --git a/src/bindings/scripts/scripts/zone/felwood/felwood.cpp b/src/bindings/scripts/scripts/zone/felwood/felwood.cpp index 2cd6d05579e..4aa752add77 100644 --- a/src/bindings/scripts/scripts/zone/felwood/felwood.cpp +++ b/src/bindings/scripts/scripts/zone/felwood/felwood.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Felwood SD%Complete: 95 -SDComment: Quest support: related to 4101&4102 (To obtain Cenarion Beacon) +SDComment: Quest support: 4101, 4102 SDCategory: Felwood EndScriptData */ @@ -58,7 +58,7 @@ bool GossipHello_npcs_riverbreeze_and_silversky(Player *player, Creature *_Creat { player->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(2849, _Creature->GetGUID()); - }else if( player->GetTeam()==ALLIANCE ) + }else if( player->GetTeam() == ALLIANCE ) player->SEND_GOSSIP_MENU(2843, _Creature->GetGUID()); else player->SEND_GOSSIP_MENU(2842, _Creature->GetGUID()); diff --git a/src/bindings/scripts/scripts/zone/feralas/feralas.cpp b/src/bindings/scripts/scripts/zone/feralas/feralas.cpp index e0a89fe5905..0abd9fdf34f 100644 --- a/src/bindings/scripts/scripts/zone/feralas/feralas.cpp +++ b/src/bindings/scripts/scripts/zone/feralas/feralas.cpp @@ -27,13 +27,15 @@ EndScriptData */ ## npc_gregan_brewspewer ######*/ +#define GOSSIP_HELLO "Buy somethin', will ya?" + bool GossipHello_npc_gregan_brewspewer(Player *player, Creature *_Creature) { if( _Creature->isQuestGiver() ) player->PrepareQuestMenu( _Creature->GetGUID() ); if( _Creature->isVendor() && player->GetQuestStatus(3909) == QUEST_STATUS_INCOMPLETE ) - player->ADD_GOSSIP_ITEM(0, "Buy somethin', will ya?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(2433,_Creature->GetGUID()); return true; @@ -57,7 +59,7 @@ bool GossipSelect_npc_gregan_brewspewer(Player *player, Creature *_Creature, uin bool GossipHello_npc_screecher_spirit(Player *player, Creature *_Creature) { - player->SEND_GOSSIP_MENU(2039,_Creature->GetGUID() ); + player->SEND_GOSSIP_MENU(2039, _Creature->GetGUID() ); player->TalkedToCreature(_Creature->GetEntry(), _Creature->GetGUID()); _Creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); diff --git a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp index acef59df670..ecbd37abf2e 100644 --- a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp +++ b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp @@ -35,10 +35,12 @@ EndContentData */ ## npc_blood_knight_dawnstar ######*/ +#define GOSSIP_H_BKD "Take Blood Knight Insignia" + bool GossipHello_npc_blood_knight_dawnstar(Player *player, Creature *_Creature) { if (player->GetQuestStatus(9692) == QUEST_STATUS_INCOMPLETE && !player->HasItemCount(24226,1,true)) - player->ADD_GOSSIP_ITEM( 0, "Take Blood Knight Insignia", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_H_BKD, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); @@ -64,21 +66,23 @@ bool GossipSelect_npc_blood_knight_dawnstar(Player *player, Creature *_Creature, ## npc_budd_nedreck ######*/ +#define GOSSIP_HBN "You gave the crew disguises?" + bool GossipHello_npc_budd_nedreck(Player *player, Creature *_Creature) { if( _Creature->isQuestGiver()) player->PrepareQuestMenu( _Creature->GetGUID() ); if( player->GetQuestStatus(11166) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(0,"You gave the crew disguises?",GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(0, GOSSIP_HBN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(),_Creature->GetGUID()); + player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); return true; } bool GossipSelect_npc_budd_nedreck(Player *player, Creature *_Creature, uint32 sender, uint32 action ) { - if( action==GOSSIP_ACTION_INFO_DEF ) + if( action == GOSSIP_ACTION_INFO_DEF ) { player->CLOSE_GOSSIP_MENU(); _Creature->CastSpell(player, 42540, false); @@ -98,7 +102,7 @@ bool GossipHello_npc_rathis_tomber(Player *player, Creature *_Creature) if( _Creature->isVendor() && player->GetQuestRewardStatus(9152) ) { player->ADD_GOSSIP_ITEM(1, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - player->SEND_GOSSIP_MENU(8432,_Creature->GetGUID()); + player->SEND_GOSSIP_MENU(8432, _Creature->GetGUID()); }else player->SEND_GOSSIP_MENU(8431,_Creature->GetGUID()); @@ -137,11 +141,11 @@ bool GOHello_gilded_brazier(Player *player, GameObject* _GO) #define SAY_PROGRESS3 -1000143 #define SAY_END1 -1000144 #define SAY_END2 -1000145 -#define SAY_CAPTAIN_ANSWER -1000146 +#define SAY_CAPTAIN_ANSWER -1000146 -#define QUEST_ESCAPE_FROM_THE_CATACOMBS 9212 -#define GO_CAGE 181152 -#define NPC_CAPTAIN_HELIOS 16220 +#define QUEST_ESCAPE_FROM_THE_CATACOMBS 9212 +#define GO_CAGE 181152 +#define NPC_CAPTAIN_HELIOS 16220 struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI { @@ -161,7 +165,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI case 0: { m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - GameObject* Cage = FindGameObject(GO_CAGE, 99); + GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature); if(Cage) Cage->SetGoState(0); DoScriptText(SAY_START, m_creature, player); @@ -183,10 +187,8 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI m_creature->AI()->AttackStart(Summ1); break; } - case 19: - m_creature->SetSpeed(MOVE_RUN, 1.5f); break; - case 25: - m_creature->SetSpeed(MOVE_WALK, 1.0f); break; + case 19: m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; + case 25: m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; case 30: if (player && player->GetTypeId() == TYPEID_PLAYER) ((Player*)player)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS,m_creature); @@ -198,7 +200,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI case 33: m_creature->SetOrientation(5.858011); DoScriptText(SAY_END2, m_creature, player); - Unit* CaptainHelios = FindCreature(NPC_CAPTAIN_HELIOS, 50); + Unit* CaptainHelios = FindCreature(NPC_CAPTAIN_HELIOS, 50, m_creature); if(CaptainHelios) DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, player); break; @@ -212,7 +214,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI if (!IsBeingEscorted) m_creature->setFaction(1602); - GameObject* Cage = FindGameObject(GO_CAGE, 99); + GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature); if(Cage) Cage->SetGoState(1); } diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp index 73d07388f6e..1a01cdab769 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp @@ -16,8 +16,8 @@ /* ScriptData SDName: Boss_Kelidan_The_Breaker -SD%Complete: 60 -SDComment: Event with channeleres vs. boss not implemented yet +SD%Complete: 100 +SDComment: SDCategory: Hellfire Citadel, Blood Furnace EndScriptData */ @@ -27,6 +27,7 @@ mob_shadowmoon_channeler EndContentData */ #include "precompiled.h" +#include "def_blood_furnace.h" #define SAY_WAKE -1542000 @@ -40,6 +41,8 @@ EndContentData */ #define SAY_DIE -1542007 #define SPELL_CORRUPTION 30938 +#define SPELL_EVOCATION 30935 +#define SPELL_BURNING_NOVA 30940 #define SPELL_FIRE_NOVA 33132 #define H_SPELL_FIRE_NOVA 37371 @@ -47,8 +50,23 @@ EndContentData */ #define SPELL_SHADOW_BOLT_VOLLEY 28599 #define H_SPELL_SHADOW_BOLT_VOLLEY 40070 -#define SPELL_BURNING_NOVA 30940 -#define SPELL_VORTEX 37370 +#define ENTRY_KELIDAN 17377 +#define ENTRY_CHANNELER 17653 + +const float ShadowmoonChannelers[5][4]= +{ + {302,-87,-24.4,0.157}, + {321,-63.5,-24.6,4.887}, + {346,-74.5,-24.6,3.595}, + {344,-103.5,-24.5,2.356}, + {316,-109,-24.6,1.257} +}; + +class TRINITY_DLL_DECL BurningNovaAura : public Aura +{ + public: + BurningNovaAura(SpellEntry *spell, uint32 eff, Unit *target, Unit *caster) : Aura(spell, eff, NULL, target, caster, NULL){} +}; struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI { @@ -56,6 +74,7 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI { pInstance = ((ScriptedInstance*)c->GetInstanceData()); HeroicMode = m_creature->GetMap()->IsHeroic(); + for(int i=0; i<5; ++i) Channelers[i] = 0; Reset(); } @@ -66,19 +85,28 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI uint32 BurningNova_Timer; uint32 Firenova_Timer; uint32 Corruption_Timer; + uint32 check_Timer; bool Firenova; + bool addYell; + uint64 Channelers[5]; void Reset() { ShadowVolley_Timer = 1000; BurningNova_Timer = 15000; Corruption_Timer = 5000; + check_Timer = 0; Firenova = false; + addYell = false; + SummonChannelers(); } void Aggro(Unit *who) { DoScriptText(SAY_WAKE, m_creature); + if (m_creature->IsNonMeleeSpellCasted(false)) + m_creature->InterruptNonMeleeSpells(true); + DoStartMovement(who); } void KilledUnit(Unit* victim) @@ -93,21 +121,89 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI } } + void ChannelerEngaged(Unit* who) + { + if(who && !addYell) + { + addYell = true; + switch(rand()%3) + { + case 0: DoScriptText(SAY_ADD_AGGRO_1, m_creature); break; + case 1: DoScriptText(SAY_ADD_AGGRO_2, m_creature); break; + default: DoScriptText(SAY_ADD_AGGRO_3, m_creature); break; + } + } + for(int i=0; i<5; ++i) + { + Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); + if(who && channeler && !channeler->isInCombat()) + channeler->AI()->AttackStart(who); + } + } + + void ChannelerDied(Unit* killer) + { + for(int i=0; i<5; ++i) + { + Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); + if(channeler && channeler->isAlive()) + return; + } + + if(killer) + m_creature->AI()->AttackStart(killer); + } + + uint64 GetChanneled(Creature *channeler1) + { + SummonChannelers(); + if(!channeler1) return NULL; + int i; + for(i=0; i<5; ++i) + { + Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); + if(channeler && channeler->GetGUID()==channeler1->GetGUID()) + break; + } + return Channelers[(i+2)%5]; + } + + void SummonChannelers() + { + for(int i=0; i<5; ++i) + { + Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]); + if(!channeler || channeler->isDead()) + channeler = m_creature->SummonCreature(ENTRY_CHANNELER,ShadowmoonChannelers[i][0],ShadowmoonChannelers[i][1],ShadowmoonChannelers[i][2],ShadowmoonChannelers[i][3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,300000); + Channelers[i] = channeler->GetGUID(); + } + } + void JustDied(Unit* Killer) { DoScriptText(SAY_DIE, m_creature); + if(pInstance) + pInstance->SetData(DATA_KELIDANEVENT, DONE); } void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + { + if(check_Timer < diff) + { + if (!m_creature->IsNonMeleeSpellCasted(false)) + DoCast(m_creature,SPELL_EVOCATION); + check_Timer = 5000; + }else check_Timer -= diff; return; + } if (Firenova) { if (Firenova_Timer < diff) { - DoCast(m_creature,HeroicMode ? H_SPELL_FIRE_NOVA : SPELL_FIRE_NOVA); + DoCast(m_creature,HeroicMode ? H_SPELL_FIRE_NOVA : SPELL_FIRE_NOVA,true); Firenova = false; ShadowVolley_Timer = 2000; }else Firenova_Timer -=diff; @@ -134,10 +230,18 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI DoScriptText(SAY_NOVA, m_creature); - if (HeroicMode) - DoCast(m_creature,SPELL_VORTEX); + if(SpellEntry *nova = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_BURNING_NOVA)) + { + for(uint32 i = 0; i < 3; ++i) + if(nova->Effect[i] == SPELL_EFFECT_APPLY_AURA) + { + Aura *Aur = new BurningNovaAura(nova, i, m_creature, m_creature); + m_creature->AddAura(Aur); + } + } - DoCast(m_creature,SPELL_BURNING_NOVA); + if (HeroicMode) + DoTeleportAll(m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation()); BurningNova_Timer = 20000+rand()%8000; Firenova_Timer= 5000; @@ -161,9 +265,7 @@ CreatureAI* GetAI_boss_kelidan_the_breaker(Creature *_Creature) #define H_SPELL_SHADOW_BOLT 15472 #define SPELL_MARK_OF_SHADOW 30937 - -#define SPELL_CHANNELING 0 //initial spell channeling boss/each other not known - //when engaged all channelers must stop, trigger yell (SAY_ADD_AGGRO_*), and engage. +#define SPELL_CHANNELING 39123 struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI { @@ -179,22 +281,49 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI uint32 ShadowBolt_Timer; uint32 MarkOfShadow_Timer; + uint32 check_Timer; void Reset() { ShadowBolt_Timer = 1000+rand()%1000; MarkOfShadow_Timer = 5000+rand()%2000; + check_Timer = 0; + if (m_creature->IsNonMeleeSpellCasted(false)) + m_creature->InterruptNonMeleeSpells(true); } void Aggro(Unit* who) { - //trigger boss to yell + if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100, m_creature)) + ((boss_kelidan_the_breakerAI*)Kelidan->AI())->ChannelerEngaged(who); + if (m_creature->IsNonMeleeSpellCasted(false)) + m_creature->InterruptNonMeleeSpells(true); + DoStartMovement(who); + } + + void JustDied(Unit* Killer) + { + if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100, m_creature)) + ((boss_kelidan_the_breakerAI*)Kelidan->AI())->ChannelerDied(Killer); } void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + { + if(check_Timer < diff) + { + if (!m_creature->IsNonMeleeSpellCasted(false)) + if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100, m_creature)) + { + uint64 channeler = ((boss_kelidan_the_breakerAI*)Kelidan->AI())->GetChanneled(m_creature); + if(Unit *channeled = Unit::GetUnit(*m_creature, channeler)) + DoCast(channeled,SPELL_CHANNELING); + } + check_Timer = 5000; + }else check_Timer -= diff; return; + } if (MarkOfShadow_Timer < diff) { @@ -231,4 +360,4 @@ void AddSC_boss_kelidan_the_breaker() newscript->Name="mob_shadowmoon_channeler"; newscript->GetAI = &GetAI_mob_shadowmoon_channeler; newscript->RegisterSelf(); -} +}
\ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/def_blood_furnace.h b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/def_blood_furnace.h new file mode 100644 index 00000000000..6462b401d3d --- /dev/null +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/def_blood_furnace.h @@ -0,0 +1,9 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef DEF_BLOOD_FURNACE_H +#define DEF_BLOOD_FURNACE_H + +#define DATA_KELIDANEVENT 1 +#endif
\ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/instance_blood_furnace.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/instance_blood_furnace.cpp new file mode 100644 index 00000000000..3c803350bb6 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/instance_blood_furnace.cpp @@ -0,0 +1,112 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Instance_Blood_Furnace +SD%Complete: 85 +SDComment: +SDCategory: Hellfire Citadel, Blood Furnace +EndScriptData */ + +#include "precompiled.h" +#include "def_blood_furnace.h" + +#define ENTRY_SEWER1 181823 +#define ENTRY_SEWER2 181766 + +struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance +{ + instance_blood_furnace(Map *map) : ScriptedInstance(map) {Initialize();}; + + + uint64 Sewer1GUID; + uint64 Sewer2GUID; + + + void Initialize() + { + Sewer1GUID = 0; + Sewer2GUID = 0; + } + + void OnObjectCreate(GameObject *go) + { + switch(go->GetEntry()) + { + case ENTRY_SEWER1: Sewer1GUID = go->GetGUID(); break; + case ENTRY_SEWER2: Sewer2GUID = go->GetGUID(); break; + } + } + + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } + + debug_log("TSCR: Instance Blood Furnace: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } + + void HandleGameObject(uint64 guid, uint32 state) + { + Player *player = GetPlayerInMap(); + + if (!player || !guid) + { + debug_log("TSCR: Blood Furnace: HandleGameObject fail"); + return; + } + + if (GameObject *go = GameObject::GetGameObject(*player,guid)) + go->SetGoState(state); + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_KELIDANEVENT: + if( data == DONE ) + { + HandleGameObject(Sewer1GUID,0); + HandleGameObject(Sewer2GUID,0); + } + break; + } + } +}; + +InstanceData* GetInstanceData_instance_blood_furnace(Map* map) +{ + return new instance_blood_furnace(map); +} + +void AddSC_instance_blood_furnace() +{ + Script *newscript; + newscript = new Script; + newscript->Name = "instance_blood_furnace"; + newscript->GetInstanceData = &GetInstanceData_instance_blood_furnace; + newscript->RegisterSelf(); +}
\ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp new file mode 100644 index 00000000000..a89d6d04aa9 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp @@ -0,0 +1,490 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +Name: Boss_Vazruden_the_Herald +%Complete: 90 +Comment: +Category: Hellfire Citadel, Hellfire Ramparts +EndScriptData */ + +#include "precompiled.h" + +#define SPELL_FIREBALL (HeroicMode?36920:34653) +#define SPELL_CONE_OF_FIRE (HeroicMode?36921:30926) +#define SPELL_SUMMON_LIQUID_FIRE (HeroicMode?30928:23971) +#define SPELL_BELLOWING_ROAR 39427 +#define SPELL_REVENGE (HeroicMode?40392:19130) +#define SPELL_KIDNEY_SHOT 30621 +#define SPELL_FIRE_NOVA_VISUAL 19823 + +#define ENTRY_HELLFIRE_SENTRY 17517 +#define ENTRY_VAZRUDEN_HERALD 17307 +#define ENTRY_VAZRUDEN 17537 +#define ENTRY_NAZAN 17536 +#define ENTRY_LIQUID_FIRE 22515 +#define ENTRY_REINFORCED_FEL_IRON_CHEST (HeroicMode?185169:185168) + +#define SAY_INTRO -1543017 +#define SAY_WIPE -1543018 +#define SAY_AGGRO_1 -1543019 +#define SAY_AGGRO_2 -1543020 +#define SAY_AGGRO_3 -1543021 +#define SAY_KILL_1 -1543022 +#define SAY_KILL_2 -1543023 +#define SAY_DIE -1543024 +#define EMOTE -1543025 + +#define PATH_ENTRY 2081 + +const float VazrudenMiddle[3] = {-1406.5, 1746.5, 81.2}; +const float VazrudenRing[2][3] = +{ + {-1430, 1705, 112}, + {-1377, 1760, 112} +}; + +struct TRINITY_DLL_DECL boss_nazanAI : public ScriptedAI +{ + boss_nazanAI(Creature *c) : ScriptedAI(c) + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + VazrudenGUID = 0; + flight = true; + Reset(); + } + + uint32 Fireball_Timer; + uint32 ConeOfFire_Timer; + uint32 BellowingRoar_Timer; + uint32 Fly_Timer; + uint32 Turn_Timer; + uint32 UnsummonCheck; + bool flight; + uint64 VazrudenGUID; + bool HeroicMode; + SpellEntry *liquid_fire; + + void Reset() + { + Fireball_Timer = 4000; + Fly_Timer = 45000; + Turn_Timer = 0; + UnsummonCheck = 5000; + } + + void Aggro(Unit* who) {} + + void JustSummoned(Creature *summoned) + { + if(summoned && summoned->GetEntry() == ENTRY_LIQUID_FIRE) + { + summoned->SetLevel(m_creature->getLevel()); + summoned->setFaction(m_creature->getFaction()); + summoned->CastSpell(summoned,SPELL_SUMMON_LIQUID_FIRE,true); + summoned->CastSpell(summoned,SPELL_FIRE_NOVA_VISUAL,true); + } + } + + void SpellHitTarget(Unit* target, const SpellEntry* entry) + { + if(target && entry->Id == SPELL_FIREBALL) + m_creature->SummonCreature(ENTRY_LIQUID_FIRE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),target->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,30000); + } + + void UpdateAI(const uint32 diff) + { + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + { + if(UnsummonCheck < diff && m_creature->isAlive()) + { + m_creature->SetLootRecipient(NULL); + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->RemoveCorpse(); + }else UnsummonCheck -= diff; + return; + } + + if(Fireball_Timer < diff) + { + if(Unit *victim = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(victim, SPELL_FIREBALL,true); + Fireball_Timer = 4000+rand()%3000; + }else Fireball_Timer -= diff; + + if(flight) // phase 1 - the flight + { + Creature *Vazruden = (Creature*)Unit::GetUnit(*m_creature,VazrudenGUID); + if(Fly_Timer < diff || !(Vazruden && Vazruden->isAlive() && (Vazruden->GetHealth()*5 > Vazruden->GetMaxHealth()))) + { + flight = false; + BellowingRoar_Timer = 6000; + ConeOfFire_Timer = 12000; + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING); + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + m_creature->GetMotionMaster()->Clear(); + if(Unit *victim = SelectUnit(SELECT_TARGET_NEAREST,0)) + m_creature->AI()->AttackStart(victim); + DoStartMovement(m_creature->getVictim()); + DoScriptText(EMOTE, m_creature); + return; + }else Fly_Timer -= diff; + + if(Turn_Timer < diff) + { + uint32 waypoint = (Fly_Timer/10000)%2; + if(m_creature->GetDistance(VazrudenRing[waypoint][0],VazrudenRing[waypoint][1],VazrudenRing[waypoint][2]) > 5) + m_creature->GetMotionMaster()->MovePoint(0,VazrudenRing[waypoint][0],VazrudenRing[waypoint][1],VazrudenRing[waypoint][2]); + Turn_Timer = 10000; + }else Turn_Timer -= diff; + } + else // phase 2 - land fight + { + if(ConeOfFire_Timer < diff) + { + DoCast(m_creature, SPELL_CONE_OF_FIRE); + ConeOfFire_Timer = 12000; + Fireball_Timer = 4000; + }else ConeOfFire_Timer -= diff; + + if(HeroicMode && BellowingRoar_Timer < diff) + { + DoCast(m_creature, SPELL_BELLOWING_ROAR); + BellowingRoar_Timer = 45000; + }else BellowingRoar_Timer -= diff; + + DoMeleeAttackIfReady(); + } + } +}; + +struct TRINITY_DLL_DECL boss_vazrudenAI : public ScriptedAI +{ + boss_vazrudenAI(Creature *c) : ScriptedAI(c) + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + } + + uint32 Revenge_Timer; + bool HeroicMode; + bool WipeSaid; + uint32 UnsummonCheck; + + void Reset() + { + Revenge_Timer = 4000; + UnsummonCheck = 2000; + WipeSaid = false; + } + + void Aggro(Unit *who) + { + switch(rand()%3) + { + case 0: DoScriptText(SAY_AGGRO_1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO_2, m_creature); break; + default: DoScriptText(SAY_AGGRO_3, m_creature); break; + } + } + + void KilledUnit(Unit* who) + { + if(who && who->GetEntry()!=ENTRY_VAZRUDEN) + switch(rand()%2) + { + case 0: DoScriptText(SAY_KILL_1, m_creature); break; + default: DoScriptText(SAY_KILL_2, m_creature); break; + } + } + + void JustDied(Unit* who) + { + if(who && who != m_creature) + DoScriptText(SAY_DIE, m_creature); + } + + void UpdateAI(const uint32 diff) + { + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + { + if(UnsummonCheck < diff && m_creature->isAlive()) + { + if(!WipeSaid) + { + DoScriptText(SAY_WIPE, m_creature); + WipeSaid = true; + } + m_creature->SetLootRecipient(NULL); + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->RemoveCorpse(); + }else UnsummonCheck -= diff; + return; + } + + if(Revenge_Timer < diff) + { + if(Unit *victim = m_creature->getVictim()) + DoCast(victim, SPELL_REVENGE); + Revenge_Timer = 5000; + }else Revenge_Timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI +{ + boss_vazruden_the_heraldAI(Creature *c) : ScriptedAI(c) + { + summoned = false; + sentryDown = false; + NazanGUID = 0; + VazrudenGUID = 0; + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + } + + uint32 phase; + uint32 waypoint; + uint32 check; + bool sentryDown; + uint64 NazanGUID; + uint64 VazrudenGUID; + bool summoned; + bool HeroicMode; + + void Reset() + { + phase = 0; + waypoint = 0; + check = 0; + UnsummonAdds(); + m_creature->GetMotionMaster()->MovePath(PATH_ENTRY, true); + } + + void UnsummonAdds() + { + if(summoned) + { + Creature *Nazan = (Creature*)Unit::GetUnit(*m_creature, NazanGUID); + Creature *Vazruden = (Creature*)Unit::GetUnit(*m_creature, VazrudenGUID); + if(Nazan || (Nazan = (Creature *)FindCreature(ENTRY_NAZAN, 5000, m_creature))) + { + Nazan->SetLootRecipient(NULL); + Nazan->SetVisibility(VISIBILITY_OFF); + Nazan->DealDamage(Nazan, Nazan->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + Nazan->RemoveCorpse(); + NazanGUID = 0; + } + if(Vazruden || (Vazruden = (Creature *)FindCreature(ENTRY_VAZRUDEN, 5000, m_creature))) + { + Vazruden->SetLootRecipient(NULL); + Vazruden->SetVisibility(VISIBILITY_OFF); + Vazruden->DealDamage(Vazruden, Vazruden->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + Vazruden->RemoveCorpse(); + VazrudenGUID = 0; + } + summoned = false; + m_creature->clearUnitState(UNIT_STAT_ROOT); + m_creature->SetVisibility(VISIBILITY_ON); + } + } + + void SummonAdds() + { + if(!summoned) + { + Creature* Vazruden = m_creature->SummonCreature(ENTRY_VAZRUDEN,VazrudenMiddle[0],VazrudenMiddle[1],VazrudenMiddle[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,6000000); + VazrudenGUID = Vazruden->GetGUID(); + Creature* Nazan = m_creature->SummonCreature(ENTRY_NAZAN,VazrudenMiddle[0],VazrudenMiddle[1],VazrudenMiddle[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,6000000); + NazanGUID = Nazan->GetGUID(); + summoned = true; + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->addUnitState(UNIT_STAT_ROOT); + } + } + + void Aggro(Unit *who) + { + if(phase==0) + { + phase = 1; + check = 0; + DoScriptText(SAY_INTRO, m_creature); + } + } + + void JustSummoned(Creature *summoned) + { + if(!summoned) return; + Unit *victim = m_creature->getVictim(); + if(summoned->GetEntry() == ENTRY_NAZAN) + { + ((boss_nazanAI *)summoned->AI())->VazrudenGUID = VazrudenGUID; + summoned->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING); + summoned->SetSpeed(MOVE_FLIGHT, 2.5); + if(victim) + ((ScriptedAI*)summoned->AI())->AttackStart(victim,false); + } + else if(victim) + summoned->AI()->AttackStart(victim); + } + + void SentryDownBy(Unit* killer) + { + if(sentryDown) + { + AttackStart(killer, false); + sentryDown = false; + } + else + sentryDown = true; + } + + void UpdateAI(const uint32 diff) + { + switch(phase) + { + case 0: // circle around the platform + return; + break; + case 1: // go to the middle and begin the fight + if(check < diff) + { + if(m_creature->GetDistance(VazrudenMiddle[0],VazrudenMiddle[1],VazrudenMiddle[2])>5) + { + m_creature->GetMotionMaster()->Clear(); + m_creature->GetMotionMaster()->MovePoint(0,VazrudenMiddle[0],VazrudenMiddle[1],VazrudenMiddle[2]); + check = 1000; + } + else + { + SummonAdds(); + phase = 2; + return; + } + }else check -= diff; + break; + default: // adds do the job now + if(check < diff) + { + Creature *Nazan = (Creature*)Unit::GetUnit(*m_creature, NazanGUID); + Creature *Vazruden = (Creature*)Unit::GetUnit(*m_creature, VazrudenGUID); + if(Nazan && Nazan->isAlive() || Vazruden && Vazruden->isAlive()) + { + if(Nazan && Nazan->getVictim() || Vazruden && Vazruden->getVictim()) + return; + else + { + UnsummonAdds(); + EnterEvadeMode(); + } + }else + { + m_creature->SummonGameObject(ENTRY_REINFORCED_FEL_IRON_CHEST,VazrudenMiddle[0],VazrudenMiddle[1],VazrudenMiddle[2],0,0,0,0,0,0); + m_creature->SetLootRecipient(NULL); + m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + check = 2000; + }else check -= diff; + break; + } + } +}; + +struct TRINITY_DLL_DECL mob_hellfire_sentryAI : public ScriptedAI +{ + mob_hellfire_sentryAI(Creature *c) : ScriptedAI(c) + { Reset();} + + uint32 KidneyShot_Timer; + + void Reset() + { + KidneyShot_Timer = 3000+rand()%4000; + } + + void Aggro(Unit* who) {} + + void JustDied(Unit* who) + { + if(Creature *herald = (Creature *)FindCreature(ENTRY_VAZRUDEN_HERALD,150, m_creature)) + ((boss_vazruden_the_heraldAI *)herald->AI())->SentryDownBy(who); + } + + void UpdateAI(const uint32 diff) + { + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + return; + + if(KidneyShot_Timer < diff) + { + if(Unit *victim = m_creature->getVictim()) + DoCast(victim, SPELL_KIDNEY_SHOT); + KidneyShot_Timer = 20000; + }else KidneyShot_Timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_vazruden_the_herald(Creature *_Creature) +{ + return new boss_vazruden_the_heraldAI (_Creature); +} + +CreatureAI* GetAI_boss_vazruden(Creature *_Creature) +{ + return new boss_vazrudenAI (_Creature); +} + + +CreatureAI* GetAI_boss_nazan(Creature *_Creature) +{ + return new boss_nazanAI (_Creature); +} + +CreatureAI* GetAI_mob_hellfire_sentry(Creature *_Creature) +{ + return new mob_hellfire_sentryAI (_Creature); +} + +void AddSC_boss_vazruden_the_herald() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_vazruden_the_herald"; + newscript->GetAI = &GetAI_boss_vazruden_the_herald; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="boss_vazruden"; + newscript->GetAI = &GetAI_boss_vazruden; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="boss_nazan"; + newscript->GetAI = &GetAI_boss_nazan; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_hellfire_sentry"; + newscript->GetAI = &GetAI_mob_hellfire_sentry; + newscript->RegisterSelf(); +}
\ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp b/src/bindings/scripts/scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp index c73fbd22225..1264a72f0cb 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp @@ -23,6 +23,19 @@ EndScriptData */ #include "precompiled.h" +#define SAY_INTRO -1000375 +#define SAY_AGGRO1 -1000376 +#define SAY_AGGRO2 -1000377 +#define SAY_SURPREME1 -1000378 +#define SAY_SURPREME2 -1000379 +#define SAY_KILL1 -1000380 +#define SAY_KILL2 -1000381 +#define SAY_KILL3 -1000382 +#define SAY_DEATH -1000383 +#define EMOTE_FRENZY -1000384 +#define SAY_RAND1 -1000385 +#define SAY_RAND2 -1000386 + #define SPELL_SHADOWVOLLEY 32963 #define SPELL_CLEAVE 31779 #define SPELL_THUNDERCLAP 36706 @@ -55,13 +68,39 @@ struct TRINITY_DLL_DECL boss_doomlordkazzakAI : public ScriptedAI Twisted_Reflection_Timer = 33000; // Timer may be incorrect } - void Aggro(Unit *who) {} + void JustRespawned() + { + DoScriptText(SAY_INTRO, m_creature); + } + + void Aggro(Unit *who) + { + switch(rand()%2) + { + case 0: DoScriptText(SAY_AGGRO1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO2, m_creature); break; + } + } void KilledUnit(Unit* victim) { // When Kazzak kills a player (not pets/totems), he regens some health - if(victim->GetTypeId() == TYPEID_PLAYER) + if (victim->GetTypeId() != TYPEID_PLAYER) + return; + DoCast(m_creature,SPELL_CAPTURESOUL); + + switch(rand()%3) + { + case 0: DoScriptText(SAY_KILL1, m_creature); break; + case 1: DoScriptText(SAY_KILL2, m_creature); break; + case 2: DoScriptText(SAY_KILL3, m_creature); break; + } + } + + void JustDied(Unit *victim) + { + DoScriptText(SAY_DEATH, m_creature); } void UpdateAI(const uint32 diff) @@ -112,6 +151,7 @@ struct TRINITY_DLL_DECL boss_doomlordkazzakAI : public ScriptedAI //Enrage_Timer if (Enrage_Timer < diff) { + DoScriptText(EMOTE_FRENZY, m_creature); DoCast(m_creature,SPELL_ENRAGE); Enrage_Timer = 30000; }else Enrage_Timer -= diff; @@ -126,6 +166,7 @@ struct TRINITY_DLL_DECL boss_doomlordkazzakAI : public ScriptedAI } }; + CreatureAI* GetAI_boss_doomlordkazzak(Creature *_Creature) { return new boss_doomlordkazzakAI (_Creature); diff --git a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp index 903787adebe..b5fab052181 100644 --- a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp +++ b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp @@ -34,13 +34,15 @@ EndContentData */ ## npc_ayren_cloudbreaker ######*/ +#define GOSSIP_FLY1 "Speaking of action, I've been ordered to undertake an air strike." +#define GOSSIP_FLY2 "I need to intercept the Dawnblade reinforcements." bool GossipHello_npc_ayren_cloudbreaker(Player *player, Creature *_Creature) { if( player->GetQuestStatus(11532) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(11533) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(0,"Speaking of action, I've been ordered to undertake an air strike.",GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_FLY1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); if( player->GetQuestStatus(11542) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(11543) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(0,"I need to intercept the Dawnblade reinforcements.",GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM(0, GOSSIP_FLY2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(),_Creature->GetGUID()); return true; @@ -65,8 +67,8 @@ bool GossipSelect_npc_ayren_cloudbreaker(Player *player, Creature *_Creature, ui ## npc_converted_sentry ######*/ -#define SAY_CONVERTED_1 "Deployment sucessful. Trespassers will be neutralized." -#define SAY_CONVERTED_2 "Objective acquired. Initiating security routines." +#define SAY_CONVERTED_1 -1000284 +#define SAY_CONVERTED_2 -1000284 #define SPELL_CONVERT_CREDIT 45009 @@ -95,10 +97,10 @@ struct TRINITY_DLL_DECL npc_converted_sentryAI : public ScriptedAI if( Timer <= diff ) { uint32 i = urand(1,2); - if( i=1 ) DoSay(SAY_CONVERTED_1,LANG_UNIVERSAL,NULL); - else DoSay(SAY_CONVERTED_2,LANG_UNIVERSAL,NULL); + if( i=1 ) DoScriptText(SAY_CONVERTED_1, m_creature); + else DoScriptText(SAY_CONVERTED_2, m_creature); - DoCast(m_creature,SPELL_CONVERT_CREDIT); + DoCast(m_creature, SPELL_CONVERT_CREDIT); ((Pet*)m_creature)->SetDuration(7500); Credit = true; }else Timer -= diff; @@ -114,10 +116,12 @@ CreatureAI* GetAI_npc_converted_sentry(Creature *_Creature) ## npc_unrestrained_dragonhawk ######*/ +#define GOSSIP_UD "<Ride the dragonhawk to Sun's Reach>" + bool GossipHello_npc_unrestrained_dragonhawk(Player *player, Creature *_Creature) { if( player->GetQuestStatus(11542) == QUEST_STATUS_COMPLETE || player->GetQuestStatus(11543) == QUEST_STATUS_COMPLETE ) - player->ADD_GOSSIP_ITEM(0,"<Ride the dragonhawk to Sun's Reach>",GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_UD, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(),_Creature->GetGUID()); return true; @@ -170,7 +174,7 @@ struct TRINITY_DLL_DECL npc_greengill_slaveAI : public ScriptedAI ((Player*)plr)->KilledMonster(25086, m_creature->GetGUID()); } DoCast(m_creature, ENRAGE); - Unit* Myrmidon = FindCreature(DM, 70); + Unit* Myrmidon = FindCreature(DM, 70, m_creature); if(Myrmidon) { m_creature->AddThreat(Myrmidon, 100000.0f); diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp index 3f0d6dd7a27..99283ca7097 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp @@ -276,13 +276,13 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI { for (uint8 i = 0; i < 4; ++i) { - Unit* Temp = NULL; + Creature* Temp = NULL; if (AddGUID[i]) { - Temp = Unit::GetUnit((*m_creature),AddGUID[i]); + Temp = (Creature*)Unit::GetUnit((*m_creature),AddGUID[i]); if (Temp && Temp->isAlive()) if (!Temp->SelectHostilTarget() || !Temp->getVictim() ) - ((Creature*)Temp)->AI()->AttackStart(m_creature->getVictim()); + Temp->AI()->AttackStart(m_creature->getVictim()); } } CheckAdds_Timer = 5000; diff --git a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp index 1d2760be73c..5b5dd3dabd9 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp @@ -61,9 +61,10 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance uint64 GamesmansExitDoor; // Door after Chess uint64 NetherspaceDoor; // Door at Malchezaar uint64 MastersTerraceDoor[2]; - uint64 ImageGUID; + bool NightbaneSummoned; + void Initialize() { for (uint8 i = 0; i < ENCOUNTERS; ++i) @@ -87,8 +88,9 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance NetherspaceDoor = 0; MastersTerraceDoor[0]= 0; MastersTerraceDoor[1]= 0; - ImageGUID = 0; + + NightbaneSummoned = false; } bool IsEncounterInProgress() const @@ -131,6 +133,9 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case 17229: KilrekGUID = creature->GetGUID(); break; case 15688: TerestianGUID = creature->GetGUID(); break; case 15687: MoroesGUID = creature->GetGUID(); break; + case 17225: if(NightbaneSummoned)creature->RemoveFromWorld(); + else NightbaneSummoned = true; + break; } } diff --git a/src/bindings/scripts/scripts/zone/loch_modan/loch_modan.cpp b/src/bindings/scripts/scripts/zone/loch_modan/loch_modan.cpp index 0e48a72535f..5d0cbad452b 100644 --- a/src/bindings/scripts/scripts/zone/loch_modan/loch_modan.cpp +++ b/src/bindings/scripts/scripts/zone/loch_modan/loch_modan.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Loch_Modan SD%Complete: 100 -SDComment: Quest support: 3181 (only to argue with pebblebitty to get to searing gorge, before quest rewarded) +SDComment: Quest support: 3181 SDCategory: Loch Modan EndScriptData */ @@ -31,13 +31,22 @@ EndContentData */ ## npc_mountaineer_pebblebitty ######*/ +#define GOSSIP_MP "Open the gate please, i need to get to Searing Gorge" + +#define GOSSIP_MP1 "But i need to get there, now open the gate!" +#define GOSSIP_MP2 "Ok, so what is this other way?" +#define GOSSIP_MP3 "Doesn't matter, i'm invulnerable." +#define GOSSIP_MP4 "Yes..." +#define GOSSIP_MP5 "Ok, i'll try to remember that." +#define GOSSIP_MP6 "A key? Ok!" + bool GossipHello_npc_mountaineer_pebblebitty(Player *player, Creature *_Creature) { if (_Creature->isQuestGiver()) player->PrepareQuestMenu( _Creature->GetGUID() ); if (!player->GetQuestRewardStatus(3181) == 1) - player->ADD_GOSSIP_ITEM( 0, "Open the gate please, i need to get to Searing Gorge", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_MP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); @@ -49,27 +58,27 @@ bool GossipSelect_npc_mountaineer_pebblebitty(Player *player, Creature *_Creatur switch (action) { case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM( 0, "But i need to get there, now open the gate!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_MP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->SEND_GOSSIP_MENU(1833, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM( 0, "Ok, so what is this other way?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_MP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); player->SEND_GOSSIP_MENU(1834, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM( 0, "Doesn't matter, i'm invulnerable.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_MP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); player->SEND_GOSSIP_MENU(1835, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM( 0, "Yes...", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_MP4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); player->SEND_GOSSIP_MENU(1836, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM( 0, "Ok, i'll try to remember that.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_MP5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); player->SEND_GOSSIP_MENU(1837, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+6: - player->ADD_GOSSIP_ITEM( 0, "A key? Ok!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_MP6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); player->SEND_GOSSIP_MENU(1838, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+7: diff --git a/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp b/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp index 38b38fe9c6b..f2433ea9234 100644 --- a/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp +++ b/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp @@ -36,6 +36,9 @@ EndContentData */ ## npc_bunthen_plainswind ######*/ +#define GOSSIP_BP1 "Do you know where I can find Half Pendant of Aquatic Endurance?" +#define GOSSIP_BP2 "I'd like to fly to Thunder Bluff." + bool GossipHello_npc_bunthen_plainswind(Player *player, Creature *_Creature) { if(player->getClass() != CLASS_DRUID) @@ -43,16 +46,16 @@ bool GossipHello_npc_bunthen_plainswind(Player *player, Creature *_Creature) else if(player->GetTeam() != HORDE) { if(player->GetQuestStatus(272) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "Do you know where I can find Half Pendant of Aquatic Endurance?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_BP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->SEND_GOSSIP_MENU(4917,_Creature->GetGUID()); } else if(player->getClass() == CLASS_DRUID && player->GetTeam() == HORDE) { - player->ADD_GOSSIP_ITEM( 0, "I'd like to fly to Thunder Bluff.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_BP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); if(player->GetQuestStatus(30) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "Do you know where I can find Half Pendant of Aquatic Endurance?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_BP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); player->SEND_GOSSIP_MENU(4918,_Creature->GetGUID()); } @@ -141,6 +144,8 @@ bool GossipSelect_npc_great_bear_spirit(Player *player, Creature *_Creature, uin ## npc_silva_filnaveth ######*/ +#define GOSSIP_SF1 "Do you know where I can find Half Pendant of Aquatic Agility?" +#define GOSSIP_SF2 "I'd like to fly to Rut'theran Village." bool GossipHello_npc_silva_filnaveth(Player *player, Creature *_Creature) { if(player->getClass() != CLASS_DRUID) @@ -148,16 +153,16 @@ bool GossipHello_npc_silva_filnaveth(Player *player, Creature *_Creature) else if(player->GetTeam() != ALLIANCE) { if(player->GetQuestStatus(30) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "Do you know where I can find Half Pendant of Aquatic Agility?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->SEND_GOSSIP_MENU(4915,_Creature->GetGUID()); } else if(player->getClass() == CLASS_DRUID && player->GetTeam() == ALLIANCE) { - player->ADD_GOSSIP_ITEM( 0, "I'd like to fly to Rut'theran Village.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SF2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); if(player->GetQuestStatus(272) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "Do you know where I can find Half Pendant of Aquatic Agility?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); player->SEND_GOSSIP_MENU(4914,_Creature->GetGUID()); } @@ -243,6 +248,7 @@ float Clintar_spirit_WP[41][5] = }; #define ASPECT_RAVEN 22915 + #define ASPECT_RAVEN_SUMMON_X 7472.96 #define ASPECT_RAVEN_SUMMON_Y -3074.18 #define ASPECT_RAVEN_SUMMON_Z 427.566 @@ -250,13 +256,14 @@ float Clintar_spirit_WP[41][5] = #define CLINTAR_SPIRIT_SUMMON_Y -3122.5632 #define CLINTAR_SPIRIT_SUMMON_Z 438.9842 #define CLINTAR_SPIRIT_SUMMON_O 0.8594 -#define CLINTAR_SPIRIT_SAY_START "A shadowy, sinister presence has invader the Emerald Dream. Its power is poised to spill over into our world, $N. We must oppose it! That's why I cannot accompany you in person." -#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 "The Emerald Dream will never be yours!" -#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2 "Begone from this place!" -#define CLINTAR_SPIRIT_SAY_GET_ONE "That's the first relic, but there are still two more. Follow me, $N." -#define CLINTAR_SPIRIT_SAY_GET_TWO "I've recovered the second relic. Take a moment to rest, and then we'll continue to the last reliquary." -#define CLINTAR_SPIRIT_SAY_GET_THREE "We have all three of the relics, but my energy is rapidly fading. We must make our way back to Dreamwarden Lurosa! He will let you know what to do next." -#define CLINTAR_SPIRIT_SAY_GET_FINAL "Lurosa, I am entrusting the Relics of Aviana to $N, who will take them to Morthis Whisperwing. I must return completely to the Emerald Dream now. Do not let $N fail!" + +#define CLINTAR_SPIRIT_SAY_START -1000286 +#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 -1000287 +#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2 -1000288 +#define CLINTAR_SPIRIT_SAY_GET_ONE -1000289 +#define CLINTAR_SPIRIT_SAY_GET_TWO -1000290 +#define CLINTAR_SPIRIT_SAY_GET_THREE -1000291 +#define CLINTAR_SPIRIT_SAY_GET_FINAL -1000292 struct TRINITY_DLL_DECL npc_clintar_spiritAI : public npc_escortAI { @@ -289,6 +296,7 @@ public: { if(!PlayerGUID) return; + Player *player = (Player *)Unit::GetUnit((*m_creature), PlayerGUID); if(player && player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) { @@ -314,12 +322,8 @@ public: uint32 rnd = rand()%2; switch(rnd) { - case 0: - m_creature->Say(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1, 0, who->GetGUID()); - break; - case 1: - m_creature->Say(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2, 0,who->GetGUID()); - break; + case 0: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1, m_creature, who); break; + case 1: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2, m_creature, who); break; } } @@ -329,7 +333,7 @@ public: return; if(player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) { - for(uint8 i = 0; i < 41; i++) + for(uint8 i = 0; i < 41; ++i) { AddWaypoint(i, Clintar_spirit_WP[i][0], Clintar_spirit_WP[i][1], Clintar_spirit_WP[i][2], (uint32)Clintar_spirit_WP[i][4]); } @@ -392,7 +396,7 @@ public: break; case 1: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - m_creature->Say(CLINTAR_SPIRIT_SAY_GET_ONE,0,PlayerGUID); + DoScriptText(CLINTAR_SPIRIT_SAY_GET_ONE, m_creature, player); Event_onWait = false; break; } @@ -415,7 +419,7 @@ public: switch(Step) { case 0: - m_creature->Say(CLINTAR_SPIRIT_SAY_GET_TWO,0,PlayerGUID); + DoScriptText(CLINTAR_SPIRIT_SAY_GET_TWO, m_creature, player); Event_Timer = 15000; Step = 1; break; @@ -462,7 +466,7 @@ public: switch(Step) { case 0: - m_creature->Say(CLINTAR_SPIRIT_SAY_GET_THREE, 0, PlayerGUID); + DoScriptText(CLINTAR_SPIRIT_SAY_GET_THREE, m_creature, player); Event_Timer = 4000; Step = 1; break; @@ -476,7 +480,7 @@ public: { case 0: m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, 2); - m_creature->Say(CLINTAR_SPIRIT_SAY_GET_FINAL, 0, PlayerGUID); + DoScriptText(CLINTAR_SPIRIT_SAY_GET_FINAL, m_creature, player); player->CompleteQuest(10965); Event_Timer = 1500; Step = 1; diff --git a/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp b/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp index 72125a8e2d9..a2027ac3904 100644 --- a/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp +++ b/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp @@ -32,13 +32,15 @@ EndContentData */ # npc_skorn_whitecloud ######*/ +#define GOSSIP_SW "Tell me a story, Skorn." + bool GossipHello_npc_skorn_whitecloud(Player *player, Creature *_Creature) { if (_Creature->isQuestGiver()) player->PrepareQuestMenu( _Creature->GetGUID() ); if (!player->GetQuestRewardStatus(770)) - player->ADD_GOSSIP_ITEM( 0, "Tell me a story, Skorn.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF ); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF ); player->SEND_GOSSIP_MENU(522,_Creature->GetGUID()); diff --git a/src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp b/src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp index c4647f207f2..598d64fdc8d 100644 --- a/src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp +++ b/src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp @@ -80,10 +80,15 @@ CreatureAI* GetAI_mob_shattered_rumbler(Creature *_Creature) #define SPELL_VISUAL_SLEEP 16093 #define SPELL_SPEAR_THROW 32248 -#define LUMP_SAY0 "In Nagrand, food hunt ogre!" -#define LUMP_SAY1 "You taste good with maybe a little salt and pepper." +#define LUMP_SAY0 -1000293 +#define LUMP_SAY1 -1000294 -#define LUMP_DEFEAT "OK, OK! Lump give up!" +#define LUMP_DEFEAT -1000295 + +#define GOSSIP_HL "I need answers, ogre!" +#define GOSSIP_SL1 "Why are Boulderfist out this far? You know that this is Kurenai territory." +#define GOSSIP_SL2 "And you think you can just eat anything you want? You're obviously trying to eat the Broken of Telaar." +#define GOSSIP_SL3 "This means war, Lump! War I say!" struct TRINITY_DLL_DECL mob_lumpAI : public ScriptedAI { @@ -121,7 +126,7 @@ struct TRINITY_DLL_DECL mob_lumpAI : public ScriptedAI m_creature->CombatStop(); m_creature->setFaction(1080); //friendly m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, PLAYER_STATE_SIT); - m_creature->Say(LUMP_DEFEAT, LANG_UNIVERSAL, 0); + DoScriptText(LUMP_DEFEAT, m_creature); bReset = true; } @@ -138,12 +143,8 @@ struct TRINITY_DLL_DECL mob_lumpAI : public ScriptedAI switch(rand()%2) { - case 0: - DoSay(LUMP_SAY0,LANG_UNIVERSAL,NULL); - break; - case 1: - DoSay(LUMP_SAY1,LANG_UNIVERSAL,NULL); - break; + case 0: DoScriptText(LUMP_SAY0, m_creature); break; + case 1: DoScriptText(LUMP_SAY1, m_creature); break; } } @@ -184,7 +185,7 @@ CreatureAI* GetAI_mob_lump(Creature *_creature) bool GossipHello_mob_lump(Player *player, Creature *_Creature) { if (player->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "I need answers, ogre!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(9352, _Creature->GetGUID()); @@ -196,15 +197,15 @@ bool GossipSelect_mob_lump(Player *player, Creature *_Creature, uint32 sender, u switch (action) { case GOSSIP_ACTION_INFO_DEF: - player->ADD_GOSSIP_ITEM( 0, "Why are Boulderfist out this far? You know that this is Kurenai territory.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(9353, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM( 0, "And you think you can just eat anything you want? You're obviously trying to eat the Broken of Telaar.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->SEND_GOSSIP_MENU(9354, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM( 0, "This means war, Lump! War I say!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SL3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); player->SEND_GOSSIP_MENU(9355, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+3: @@ -249,6 +250,17 @@ CreatureAI* GetAI_mob_sunspring_villager(Creature *_Creature) ## npc_altruis_the_sufferer ######*/ +#define GOSSIP_HATS1 "I see twisted steel and smell sundered earth." +#define GOSSIP_HATS2 "Well...?" +#define GOSSIP_HATS3 "[PH] Story about Illidan's Pupil" + +#define GOSSIP_SATS1 "Legion?" +#define GOSSIP_SATS2 "And now?" +#define GOSSIP_SATS3 "How do you see them now?" +#define GOSSIP_SATS4 "Forge camps?" +#define GOSSIP_SATS5 "Ok." +#define GOSSIP_SATS6 "[PH] Story done" + bool GossipHello_npc_altruis_the_sufferer(Player *player, Creature *_Creature) { if (_Creature->isQuestGiver()) @@ -256,15 +268,15 @@ bool GossipHello_npc_altruis_the_sufferer(Player *player, Creature *_Creature) //gossip before obtaining Survey the Land if ( player->GetQuestStatus(9991) == QUEST_STATUS_NONE ) - player->ADD_GOSSIP_ITEM( 0, "I see twisted steel and smell sundered earth.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+10); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HATS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+10); //gossip when Survey the Land is incomplete (technically, after the flight) if (player->GetQuestStatus(9991) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "Well...?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+20); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HATS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+20); //wowwiki.com/Varedis if (player->GetQuestStatus(10646) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "[PH] Story about Illidan's Pupil", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+30); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HATS3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+30); player->SEND_GOSSIP_MENU(9419, _Creature->GetGUID()); @@ -276,19 +288,19 @@ bool GossipSelect_npc_altruis_the_sufferer(Player *player, Creature *_Creature, switch (action) { case GOSSIP_ACTION_INFO_DEF+10: - player->ADD_GOSSIP_ITEM( 0, "Legion?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SATS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); player->SEND_GOSSIP_MENU(9420, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+11: - player->ADD_GOSSIP_ITEM( 0, "And now?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SATS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); player->SEND_GOSSIP_MENU(9421, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+12: - player->ADD_GOSSIP_ITEM( 0, "How do you see them now?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SATS3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); player->SEND_GOSSIP_MENU(9422, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+13: - player->ADD_GOSSIP_ITEM( 0, "Forge camps?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SATS4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); player->SEND_GOSSIP_MENU(9423, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+14: @@ -296,7 +308,7 @@ bool GossipSelect_npc_altruis_the_sufferer(Player *player, Creature *_Creature, break; case GOSSIP_ACTION_INFO_DEF+20: - player->ADD_GOSSIP_ITEM( 0, "Ok.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SATS5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); player->SEND_GOSSIP_MENU(9427, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+21: @@ -305,7 +317,7 @@ bool GossipSelect_npc_altruis_the_sufferer(Player *player, Creature *_Creature, break; case GOSSIP_ACTION_INFO_DEF+30: - player->ADD_GOSSIP_ITEM( 0, "[PH] Story done", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 31); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SATS6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 31); player->SEND_GOSSIP_MENU(384, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+31: @@ -336,6 +348,21 @@ bool QuestAccept_npc_altruis_the_sufferer(Player *player, Creature *creature, Qu ## npc_greatmother_geyah ######*/ +#define GOSSIP_HGG1 "Hello, Greatmother. Garrosh told me that you wanted to speak with me." +#define GOSSIP_HGG2 "Garrosh is beyond redemption, Greatmother. I fear that in helping the Mag'har, I have convinced Garrosh that he is unfit to lead." + +#define GOSSIP_SGG1 "You raised all of the orcs here, Greatmother?" +#define GOSSIP_SGG2 "Do you believe that?" +#define GOSSIP_SGG3 "What can be done? I have tried many different things. I have done my best to help the people of Nagrand. Each time I have approached Garrosh, he has dismissed me." +#define GOSSIP_SGG4 "Left? How can you choose to leave?" +#define GOSSIP_SGG5 "What is this duty?" +#define GOSSIP_SGG6 "Is there anything I can do for you, Greatmother?" +#define GOSSIP_SGG7 "I have done all that I could, Greatmother. I thank you for your kind words." +#define GOSSIP_SGG8 "Greatmother, you are the mother of Durotan?" +#define GOSSIP_SGG9 "Greatmother, I never had the honor. Durotan died long before my time, but his heroics are known to all on my world. The orcs of Azeroth reside in a place known as Durotar, named after your son. And ... (You take a moment to breathe and think through what you are about to tell the Greatmother.)" +#define GOSSIP_SGG10 "It is my Warchief, Greatmother. The leader of my people. From my world. He ... He is the son of Durotan. He is your grandchild." +#define GOSSIP_SGG11 "I will return to Azeroth at once, Greatmother." + //all the textId's for the below is unknown, but i do believe the gossip item texts are proper. bool GossipHello_npc_greatmother_geyah(Player *player, Creature *_Creature) { @@ -344,12 +371,12 @@ bool GossipHello_npc_greatmother_geyah(Player *player, Creature *_Creature) if (player->GetQuestStatus(10044) == QUEST_STATUS_INCOMPLETE) { - player->ADD_GOSSIP_ITEM( 0, "Hello, Greatmother. Garrosh told me that you wanted to speak with me.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HGG1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(),_Creature->GetGUID()); } else if (player->GetQuestStatus(10172) == QUEST_STATUS_INCOMPLETE) { - player->ADD_GOSSIP_ITEM( 0, "Garrosh is beyond redemption, Greatmother. I fear that in helping the Mag'har, I have convinced Garrosh that he is unfit to lead.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HGG2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(),_Creature->GetGUID()); } else @@ -364,27 +391,27 @@ bool GossipSelect_npc_greatmother_geyah(Player *player, Creature *_Creature, uin switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: - player->ADD_GOSSIP_ITEM( 0, "You raised all of the orcs here, Greatmother?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SGG1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 2: - player->ADD_GOSSIP_ITEM( 0, "Do you believe that?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SGG2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 3: - player->ADD_GOSSIP_ITEM( 0, "What can be done? I have tried many different things. I have done my best to help the people of Nagrand. Each time I have approached Garrosh, he has dismissed me.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SGG3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 4: - player->ADD_GOSSIP_ITEM( 0, "Left? How can you choose to leave?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SGG4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 5: - player->ADD_GOSSIP_ITEM( 0, "What is this duty?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SGG5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 6: - player->ADD_GOSSIP_ITEM( 0, "Is there anything I can do for you, Greatmother?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SGG6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 7: @@ -393,23 +420,23 @@ bool GossipSelect_npc_greatmother_geyah(Player *player, Creature *_Creature, uin break; case GOSSIP_ACTION_INFO_DEF + 10: - player->ADD_GOSSIP_ITEM( 0, "I have done all that I could, Greatmother. I thank you for your kind words.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SGG7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 11: - player->ADD_GOSSIP_ITEM( 0, "Greatmother, you are the mother of Durotan?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SGG8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 12: - player->ADD_GOSSIP_ITEM( 0, "Greatmother, I never had the honor. Durotan died long before my time, but his heroics are known to all on my world. The orcs of Azeroth reside in a place known as Durotar, named after your son. And ... (You take a moment to breathe and think through what you are about to tell the Greatmother.)", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SGG9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 13: - player->ADD_GOSSIP_ITEM( 0, "It is my Warchief, Greatmother. The leader of my people. From my world. He ... He is the son of Durotan. He is your grandchild.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SGG10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 14: - player->ADD_GOSSIP_ITEM( 0, "I will return to Azeroth at once, Greatmother.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 15); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SGG11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 15); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 15: @@ -424,13 +451,22 @@ bool GossipSelect_npc_greatmother_geyah(Player *player, Creature *_Creature, uin ## npc_lantresor_of_the_blade ######*/ +#define GOSSIP_HLB "I have killed many of your ogres, Lantresor. I have no fear." +#define GOSSIP_SLB1 "Should I know? You look like an orc to me." +#define GOSSIP_SLB2 "And the other half?" +#define GOSSIP_SLB3 "I have heard of your kind, but I never thought to see the day when I would meet a half-breed." +#define GOSSIP_SLB4 "My apologies. I did not mean to offend. I am here on behalf of my people." +#define GOSSIP_SLB5 "My people ask that you pull back your Boulderfist ogres and cease all attacks on our territories. In return, we will also pull back our forces." +#define GOSSIP_SLB6 "We will fight you until the end, then, Lantresor. We will not stand idly by as you pillage our towns and kill our people." +#define GOSSIP_SLB7 "What do I need to do?" + bool GossipHello_npc_lantresor_of_the_blade(Player *player, Creature *_Creature) { if (_Creature->isQuestGiver()) player->PrepareQuestMenu( _Creature->GetGUID() ); if (player->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "I have killed many of your ogres, Lantresor. I have no fear.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HLB, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(9361, _Creature->GetGUID()); @@ -442,31 +478,31 @@ bool GossipSelect_npc_lantresor_of_the_blade(Player *player, Creature *_Creature switch (action) { case GOSSIP_ACTION_INFO_DEF: - player->ADD_GOSSIP_ITEM( 0, "Should I know? You look like an orc to me.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SLB1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(9362, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM( 0, "And the other half?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SLB2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->SEND_GOSSIP_MENU(9363, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM( 0, "I have heard of your kind, but I never thought to see the day when I would meet a half-breed.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SLB3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); player->SEND_GOSSIP_MENU(9364, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM( 0, "My apologies. I did not mean to offend. I am here on behalf of my people.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SLB4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); player->SEND_GOSSIP_MENU(9365, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM( 0, "My people ask that you pull back your Boulderfist ogres and cease all attacks on our territories. In return, we will also pull back our forces.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SLB5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); player->SEND_GOSSIP_MENU(9366, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM( 0, "We will fight you until the end, then, Lantresor. We will not stand idly by as you pillage our towns and kill our people.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SLB6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); player->SEND_GOSSIP_MENU(9367, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+6: - player->ADD_GOSSIP_ITEM( 0, "What do I need to do?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SLB7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); player->SEND_GOSSIP_MENU(9368, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+7: @@ -481,7 +517,7 @@ bool GossipSelect_npc_lantresor_of_the_blade(Player *player, Creature *_Creature } /*###### -## npc_creditmarker_visist_with_ancestors (Quest 10085) +## npc_creditmarker_visist_with_ancestors ######*/ struct TRINITY_DLL_DECL npc_creditmarker_visit_with_ancestorsAI : public ScriptedAI @@ -575,7 +611,7 @@ struct TRINITY_DLL_DECL mob_sparrowhawkAI : public ScriptedAI fleeing = false; Player *player = (Player *)Unit::GetUnit((*m_creature), PlayerGUID); - if(player && m_creature->IsWithinDistInMap(player, 30)/* && m_creature->CanFreeMove()*/) + if(player && m_creature->IsWithinDistInMap(player, 30)) { if(!fleeing) { diff --git a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp index 34fb3d3b507..9b888365a4e 100644 --- a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp +++ b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp @@ -37,12 +37,12 @@ EndContentData */ ## npc_manaforge_control_console ######*/ -#define EMOTE_START "Warning! Emergency shutdown process initiated by $N. Shutdown will complete in two minutes." -#define EMOTE_60 "Emergency shutdown will complete in one minute." -#define EMOTE_30 "Emergency shutdown will complete in thirty seconds." -#define EMOTE_10 "Emergency shutdown will complete in ten seconds." -#define EMOTE_COMPLETE "Emergency shutdown complete." -#define EMOTE_ABORT "Emergency shutdown aborted." +#define EMOTE_START -1000296 +#define EMOTE_60 -1000297 +#define EMOTE_30 -1000298 +#define EMOTE_10 -1000299 +#define EMOTE_COMPLETE -1000300 +#define EMOTE_ABORT -1000301 #define ENTRY_BNAAR_C_CONSOLE 20209 #define ENTRY_CORUU_C_CONSOLE 20417 @@ -95,7 +95,7 @@ struct TRINITY_DLL_DECL npc_manaforge_control_consoleAI : public ScriptedAI void JustDied(Unit* killer) { - DoTextEmote(EMOTE_ABORT, NULL); + DoScriptText(EMOTE_ABORT, m_creature); if( someplayer ) { @@ -227,32 +227,32 @@ struct TRINITY_DLL_DECL npc_manaforge_control_consoleAI : public ScriptedAI case 1: if( someplayer ) { - Unit* u = Unit::GetUnit((*m_creature),someplayer); - if( u && u->GetTypeId() == TYPEID_PLAYER ) DoTextEmote(EMOTE_START, u); + Unit* u = Unit::GetUnit((*m_creature), someplayer); + if( u && u->GetTypeId() == TYPEID_PLAYER ) DoScriptText(EMOTE_START, m_creature, u); } Event_Timer = 60000; Wave = true; ++Phase; break; case 2: - DoTextEmote(EMOTE_60, NULL); + DoScriptText(EMOTE_60, m_creature); Event_Timer = 30000; ++Phase; break; case 3: - DoTextEmote(EMOTE_30, NULL); + DoScriptText(EMOTE_30, m_creature); Event_Timer = 20000; DoFinalSpawnForCreature(m_creature); ++Phase; break; case 4: - DoTextEmote(EMOTE_10, NULL); + DoScriptText(EMOTE_10, m_creature); Event_Timer = 10000; Wave = false; ++Phase; break; case 5: - DoTextEmote(EMOTE_COMPLETE, NULL); + DoScriptText(EMOTE_COMPLETE, m_creature); if( someplayer ) { Unit* u = Unit::GetUnit((*m_creature),someplayer); @@ -488,7 +488,7 @@ struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI return true; } - debug_log("SD2: npc_commander_dawnforge event already in progress, need to wait."); + debug_log("TSCR: npc_commander_dawnforge event already in progress, need to wait."); return false; } @@ -707,7 +707,7 @@ bool GossipSelect_npc_protectorate_nether_drake(Player *player, Creature *_Creat #define SPELL_PHASE_DISTRUPTOR 35780 #define GOSSIP_ITEM "I need a new phase distruptor, Professor" -#define WHISPER_DABIRI "Saeed is currently engaged or awaiting orders to engage. You may check directly east of me and see if Saeed is ready for you. If he is not present then he is off fighting another battle. I recommend that you wait for him to return before attacking Dimensius." +#define WHISPER_DABIRI -1000302 #define QUEST_DIMENSIUS 10439 #define QUEST_ON_NETHERY_WINGS 10438 @@ -739,7 +739,7 @@ bool GossipSelect_npc_professor_dabiri(Player *player, Creature *_Creature, uint bool QuestAccept_npc_professor_dabiri(Player *player, Creature *creature, Quest const *quest ) { if(quest->GetQuestId() == QUEST_DIMENSIUS) - creature->Whisper(WHISPER_DABIRI, player->GetGUID(), false); + DoScriptText(WHISPER_DABIRI, creature, player); return true; } @@ -748,6 +748,8 @@ bool QuestAccept_npc_professor_dabiri(Player *player, Creature *creature, Quest ## npc_veronia ######*/ +#define GOSSIP_HV "Fly me to Manaforge Coruu please" + bool GossipHello_npc_veronia(Player *player, Creature *_Creature) { if (_Creature->isQuestGiver()) @@ -755,7 +757,7 @@ bool GossipHello_npc_veronia(Player *player, Creature *_Creature) //Behind Enemy Lines if (player->GetQuestStatus(10652) && !player->GetQuestRewardStatus(10652)) - player->ADD_GOSSIP_ITEM(0, "Fly me to Manaforge Coruu please", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(0, GOSSIP_HV, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); @@ -777,7 +779,7 @@ bool GossipSelect_npc_veronia(Player *player, Creature *_Creature, uint32 sender ######*/ #define SUMMONED_MOB 19595 -#define EMOTE_WEAK "is very weak" +#define EMOTE_WEAK -1000303 // Spells #define SPELL_PHASE_SLIP 36574 @@ -789,10 +791,10 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI { mob_phase_hunterAI(Creature *c) : ScriptedAI(c) {Reset();} - + bool Weak; - bool Materialize; - bool Drained; + bool Materialize; + bool Drained; int WeakPercent; uint64 PlayerGUID; @@ -804,8 +806,8 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI void Reset() { Weak = false; - Materialize = false; - Drained = false; + Materialize = false; + Drained = false; WeakPercent = 25 + (rand()%16); // 25-40 PlayerGUID = 0; @@ -814,73 +816,75 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI void Aggro(Unit *who) { - PlayerGUID = who->GetGUID(); + if(Player *player = who->GetCharmerOrOwnerPlayerOrPlayerItself()) + PlayerGUID = player->GetGUID(); } - void SpellHit(Unit *caster, const SpellEntry *spell) - { - DoCast(m_creature, SPELL_DE_MATERIALIZE); - } + void SpellHit(Unit *caster, const SpellEntry *spell) + { + DoCast(m_creature, SPELL_DE_MATERIALIZE); + } void UpdateAI(const uint32 diff) { - if(!Materialize) - { - DoCast(m_creature, SPELL_MATERIALIZE); - Materialize = true; - } + if(!Materialize) + { + DoCast(m_creature, SPELL_MATERIALIZE); + Materialize = true; + } + + if(m_creature->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || m_creature->hasUnitState(UNIT_STAT_ROOT)) // if the mob is rooted/slowed by spells eg.: Entangling Roots, Frost Nova, Hamstring, Crippling Poison, etc. => remove it + DoCast(m_creature, SPELL_PHASE_SLIP); - if(m_creature->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || m_creature->hasUnitState(UNIT_STAT_ROOT)) // if the mob is rooted/slowed by spells eg.: Entangling Roots, Frost Nova, Hamstring, Crippling Poison, etc. => remove it - DoCast(m_creature, SPELL_PHASE_SLIP); - if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) return; - - if(ManaBurnTimer < diff) // cast Mana Burn - { + + if(ManaBurnTimer < diff) // cast Mana Burn + { if(m_creature->getVictim()->GetCreateMana() > 0) - { + { DoCast(m_creature->getVictim(), SPELL_MANA_BURN); - ManaBurnTimer = 8000 + (rand()%10 * 1000); // 8-18 sec cd - } - }else ManaBurnTimer -= diff; - + ManaBurnTimer = 8000 + (rand()%10 * 1000); // 8-18 sec cd + } + }else ManaBurnTimer -= diff; + if(PlayerGUID) // start: support for quest 10190 - { + { Unit* target = Unit::GetUnit((*m_creature), PlayerGUID); - - if(target && !Weak && m_creature->GetHealth() < (m_creature->GetMaxHealth() / 100 * WeakPercent) && ((Player*)target)->GetQuestStatus(10190) == QUEST_STATUS_INCOMPLETE) + + if(target && !Weak && m_creature->GetHealth() < (m_creature->GetMaxHealth() / 100 * WeakPercent) + && ((Player*)target)->GetQuestStatus(10190) == QUEST_STATUS_INCOMPLETE) { - DoTextEmote(EMOTE_WEAK, 0); + DoScriptText(EMOTE_WEAK, m_creature); Weak = true; } if(Weak && !Drained && m_creature->HasAura(34219, 0)) { Drained = true; - + Health = m_creature->GetHealth(); // get the normal mob's data Level = m_creature->getLevel(); - - m_creature->AttackStop(); // delete the normal mob - m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - m_creature->RemoveCorpse(); - - Creature* DrainedPhaseHunter = NULL; - - if(!DrainedPhaseHunter) - DrainedPhaseHunter = m_creature->SummonCreature(SUMMONED_MOB, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); // summon the mob - - if(DrainedPhaseHunter) - { - DrainedPhaseHunter->SetLevel(Level); // set the summoned mob's data - DrainedPhaseHunter->SetHealth(Health); - DrainedPhaseHunter->AddThreat(target, 10000.0f); - DrainedPhaseHunter->AI()->AttackStart(target); - } - } - }// end: support for quest 10190 - DoMeleeAttackIfReady(); + m_creature->AttackStop(); // delete the normal mob + m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->RemoveCorpse(); + + Creature* DrainedPhaseHunter = NULL; + + if(!DrainedPhaseHunter) + DrainedPhaseHunter = m_creature->SummonCreature(SUMMONED_MOB, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); // summon the mob + + if(DrainedPhaseHunter) + { + DrainedPhaseHunter->SetLevel(Level); // set the summoned mob's data + DrainedPhaseHunter->SetHealth(Health); + DrainedPhaseHunter->AddThreat(target, 10000.0f); + DrainedPhaseHunter->AI()->AttackStart(target); + } + } + }// end: support for quest 10190 + + DoMeleeAttackIfReady(); } }; @@ -894,11 +898,11 @@ CreatureAI* GetAI_mob_phase_hunter(Creature *_Creature) ######*/ #define Q_ALMABTRIEB 10337 -#define N_THADELL 20464 +#define N_THADELL 20464 #define SPAWN_FIRST 20512 -#define SPAWN_SECOND 19881 -#define SAY_THADELL_1 "Bessy, is that you?" -#define SAY_THADELL_2 "Thank you for bringing back my Bessy, $N. I couldn't live without her!" +#define SPAWN_SECOND 19881 +#define SAY_THADELL_1 -1000304 +#define SAY_THADELL_2 -1000305 struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI { @@ -942,13 +946,13 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI ((Player*)player)->GroupEventHappens(Q_ALMABTRIEB, m_creature); Completed = true; } - {Unit* Thadell = FindCreature(N_THADELL, 30); + {Unit* Thadell = FindCreature(N_THADELL, 30, m_creature); if(Thadell) - ((Creature*)Thadell)->Say(SAY_THADELL_1, LANG_UNIVERSAL, NULL);}break; + DoScriptText(SAY_THADELL_1, m_creature);}break; case 13: - {Unit* Thadell = FindCreature(N_THADELL, 30); + {Unit* Thadell = FindCreature(N_THADELL, 30, m_creature); if(Thadell) - ((Creature*)Thadell)->Say(SAY_THADELL_2, LANG_UNIVERSAL, NULL);}break; + DoScriptText(SAY_THADELL_2, m_creature, player);}break; } } @@ -962,6 +966,7 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI void Reset() { Completed = false; + m_creature->setFaction(35); } void UpdateAI(const uint32 diff) diff --git a/src/bindings/scripts/scripts/zone/orgrimmar/orgrimmar.cpp b/src/bindings/scripts/scripts/zone/orgrimmar/orgrimmar.cpp index 55b3a3a17df..8c70e1bd501 100644 --- a/src/bindings/scripts/scripts/zone/orgrimmar/orgrimmar.cpp +++ b/src/bindings/scripts/scripts/zone/orgrimmar/orgrimmar.cpp @@ -35,13 +35,15 @@ EndContentData */ #define QUEST_5727 5727 +#define GOSSIP_HNF "You may speak frankly, Neeru..." +#define GOSSIP_SNF "[PH] ..." bool GossipHello_npc_neeru_fireblade(Player *player, Creature *_Creature) { if (_Creature->isQuestGiver()) player->PrepareQuestMenu( _Creature->GetGUID() ); if (player->GetQuestStatus(QUEST_5727) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(0, "You may speak frankly, Neeru...", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_HNF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(4513, _Creature->GetGUID()); return true; @@ -52,7 +54,7 @@ bool GossipSelect_npc_neeru_fireblade(Player *player, Creature *_Creature, uint3 switch (action) { case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(0, "[PH] ...", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM(0, GOSSIP_SNF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); player->SEND_GOSSIP_MENU(4513, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: @@ -150,6 +152,14 @@ bool ReciveEmote_npc_shenthul(Player *player, Creature *_Creature, uint32 emote) #define SPELL_CHAIN_LIGHTNING 16033 #define SPELL_SHOCK 16034 +#define GOSSIP_HTW "Please share your wisdom with me, Warchief." +#define GOSSIP_STW1 "What discoveries?" +#define GOSSIP_STW2 "Usurper?" +#define GOSSIP_STW3 "With all due respect, Warchief - why not allow them to be destroyed? Does this not strengthen our position?" +#define GOSSIP_STW4 "I... I did not think of it that way, Warchief." +#define GOSSIP_STW5 "I live only to serve, Warchief! My life is empty and meaningless without your guidance." +#define GOSSIP_STW6 "Of course, Warchief!" + //TODO: verify abilities/timers struct TRINITY_DLL_DECL npc_thrall_warchiefAI : public ScriptedAI { @@ -197,7 +207,7 @@ bool GossipHello_npc_thrall_warchief(Player *player, Creature *_Creature) player->PrepareQuestMenu( _Creature->GetGUID() ); if (player->GetQuestStatus(QUEST_6566) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(0, "Please share your wisdom with me, Warchief.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_HTW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); return true; @@ -208,27 +218,27 @@ bool GossipSelect_npc_thrall_warchief(Player *player, Creature *_Creature, uint3 switch (action) { case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(0, "What discoveries?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM(0, GOSSIP_STW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); player->SEND_GOSSIP_MENU(5733, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(0, "Usurper?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + player->ADD_GOSSIP_ITEM(0, GOSSIP_STW2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); player->SEND_GOSSIP_MENU(5734, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(0, "With all due respect, Warchief - why not allow them to be destroyed? Does this not strengthen our position?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + player->ADD_GOSSIP_ITEM(0, GOSSIP_STW3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); player->SEND_GOSSIP_MENU(5735, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(0, "I... I did not think of it that way, Warchief.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + player->ADD_GOSSIP_ITEM(0, GOSSIP_STW4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); player->SEND_GOSSIP_MENU(5736, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM(0, "I live only to serve, Warchief! My life is empty and meaningless without your guidance.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + player->ADD_GOSSIP_ITEM(0, GOSSIP_STW5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); player->SEND_GOSSIP_MENU(5737, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+6: - player->ADD_GOSSIP_ITEM(0, "Of course, Warchief!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); + player->ADD_GOSSIP_ITEM(0, GOSSIP_STW6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); player->SEND_GOSSIP_MENU(5738, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+7: diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp index 949d447dcaa..003c7d5bfec 100644 --- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp +++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp @@ -23,53 +23,31 @@ EndScriptData */ #include "precompiled.h" -//-------------------------------------- -//Spells -#define SPELL_SUNDER_ARMOR 33661 +#define SAY_AGGRO -1000387 +#define SAY_EARTHQUAKE_1 -1000388 +#define SAY_EARTHQUAKE_2 -1000389 +#define SAY_OVERRUN_1 -1000390 +#define SAY_OVERRUN_2 -1000391 +#define SAY_SLAY_1 -1000392 +#define SAY_SLAY_2 -1000393 +#define SAY_SLAY_3 -1000394 +#define SAY_DEATH -1000395 +#define SPELL_EARTHQUAKE 32686 +#define SPELL_SUNDER_ARMOR 33661 #define SPELL_CHAIN_LIGHTNING 33665 - #define SPELL_OVERRUN 32636 -#define SAY_OVERRUN_1 "Trajectory locked." -#define SOUND_OVERRUN_1 11347 -#define SAY_OVERRUN_2 "Engage maximum speed." -#define SOUND_OVERRUN_2 11348 - #define SPELL_ENRAGE 33653 - #define SPELL_MARK_DEATH 37128 -#define SPELL_EARTHQUAKE 32686 -#define SAY_EARTHQUAKE_1 "Tectonic disruption commencing." -#define SOUND_EARTHQUAKE_1 11345 -#define SAY_EARTHQUAKE_2 "Magnitude set. Release." -#define SOUND_EARTHQUAKE_2 11346 -//--------------------------------------- -//Aggro -#define SAY_AGGRO "Do not proceed. You will be eliminated!" -#define SOUND_AGGRO 11344 -//--------------------------------------- -//Slay -#define SAY_SLAY_1 "Threat level zero." -#define SOUND_SLAY_1 11349 -#define SAY_SLAY_2 "Directive accomplished." -#define SOUND_SLAY_2 11350 -#define SAY_SLAY_3 "Target exterminated." -#define SOUND_SLAY_3 11351 -//--------------------------------------- -//Death -#define SAY_DEATH "System failure in five... four..." -#define SOUND_DEATH 11352 - struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI { boss_doomwalkerAI(Creature *c) : ScriptedAI(c) {Reset();} - uint32 Chain_Timer; - uint32 Enrage_Timer; + uint32 Enrage_Timer; uint32 Overrun_Timer; - uint32 Quake_Timer; + uint32 Quake_Timer; uint32 Armor_Timer; bool InEnrage; @@ -82,7 +60,7 @@ struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI Quake_Timer = 25000 + rand()%10000; Overrun_Timer = 30000 + rand()%15000; - InEnrage = false; + InEnrage = false; } void KilledUnit(Unit* Victim) @@ -92,114 +70,98 @@ struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI switch(rand()%3) { - case 0: - DoYell(SAY_SLAY_1, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_SLAY_1); - break; - case 1: - DoYell(SAY_SLAY_2, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_SLAY_2); - break; - case 2: - DoYell(SAY_SLAY_3, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_SLAY_3); - break; + case 0: DoScriptText(SAY_SLAY_1, m_creature); break; + case 1: DoScriptText(SAY_SLAY_2, m_creature); break; + case 2: DoScriptText(SAY_SLAY_3, m_creature); break; } + + DoCast(m_creature->getVictim(), SPELL_MARK_DEATH); } void JustDied(Unit* Killer) { - DoYell(SAY_DEATH, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_DEATH); + DoScriptText(SAY_DEATH, m_creature); } void Aggro(Unit *who) { - DoYell(SAY_AGGRO, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_AGGRO); + DoScriptText(SAY_AGGRO, m_creature); } void UpdateAI(const uint32 diff) { - if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) return; - //if (m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) + //Spell Enrage, when hp <= 20% gain enrage + if (((m_creature->GetHealth()*100)/ m_creature->GetMaxHealth()) <= 20) { - //Spell Enrage - if (((m_creature->GetHealth()*100)/ m_creature->GetMaxHealth()) <= 20)//when hp <= 20% gain enrage - { - if(Enrage_Timer < diff) - { - DoCast(m_creature,SPELL_ENRAGE); - Enrage_Timer = 6000; - InEnrage = true; - }else Enrage_Timer -= diff; - } - - //Spell Overrun - if (Overrun_Timer < diff) - { - switch(rand()%2) - { - case 0: - DoYell(SAY_OVERRUN_1, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_OVERRUN_1); - break; - case 1: - DoYell(SAY_OVERRUN_2, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_OVERRUN_2); - break; - } - DoCast(m_creature->getVictim(),SPELL_OVERRUN); - Overrun_Timer = 25000 + rand()%15000; - - }else Overrun_Timer -= diff; - - //Spell Earthquake - if (Quake_Timer < diff) + if(Enrage_Timer < diff) { - if (rand()%2) - return; - - switch(rand()%2) - { - case 0: - DoYell(SAY_EARTHQUAKE_1, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_EARTHQUAKE_1); - break; - case 1: - DoYell(SAY_EARTHQUAKE_2, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(m_creature, SOUND_EARTHQUAKE_2); - break; - } - if(InEnrage) - { - m_creature->RemoveAura(SPELL_ENRAGE, 0);//remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead - } - DoCast(m_creature,SPELL_EARTHQUAKE); - Quake_Timer = 30000 + rand()%25000; - }else Quake_Timer -= diff; - - //Spell Chain Lightning - if (Chain_Timer < diff) + DoCast(m_creature,SPELL_ENRAGE); + Enrage_Timer = 6000; + InEnrage = true; + }else Enrage_Timer -= diff; + } + + //Spell Overrun + if (Overrun_Timer < diff) + { + switch(rand()%2) { - DoCast(m_creature->getVictim(),SPELL_CHAIN_LIGHTNING); - Chain_Timer = 15000 + rand()%25000; - }else Chain_Timer -= diff; + case 0: DoScriptText(SAY_OVERRUN_1, m_creature); break; + case 1: DoScriptText(SAY_OVERRUN_2, m_creature); break; + } + + DoCast(m_creature->getVictim(),SPELL_OVERRUN); + Overrun_Timer = 25000 + rand()%15000; + }else Overrun_Timer -= diff; + + //Spell Earthquake + if (Quake_Timer < diff) + { + if (rand()%2) + return; - //Spell Sunder Armor - if (Armor_Timer < diff) + switch(rand()%2) { - DoCast(m_creature->getVictim(),SPELL_SUNDER_ARMOR); - Armor_Timer = 15000 + rand()%15000; - }else Armor_Timer -= diff; + case 0: DoScriptText(SAY_EARTHQUAKE_1, m_creature); break; + case 1: DoScriptText(SAY_EARTHQUAKE_2, m_creature); break; + } - DoMeleeAttackIfReady(); - } + //remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead + if (InEnrage) + m_creature->RemoveAura(SPELL_ENRAGE, 0); + + DoCast(m_creature,SPELL_EARTHQUAKE); + Quake_Timer = 30000 + rand()%25000; + }else Quake_Timer -= diff; + + //Spell Chain Lightning + if (Chain_Timer < diff) + { + Unit* target = NULL; + target = SelectUnit(SELECT_TARGET_RANDOM,1); + + if (!target) + target = m_creature->getVictim(); + + if (target) + DoCast(target,SPELL_CHAIN_LIGHTNING); + + Chain_Timer = 10000 + rand()%25000; + }else Chain_Timer -= diff; + + //Spell Sunder Armor + if (Armor_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_SUNDER_ARMOR); + Armor_Timer = 10000 + rand()%15000; + }else Armor_Timer -= diff; + + DoMeleeAttackIfReady(); } -}; +}; CreatureAI* GetAI_boss_doomwalker(Creature *_Creature) { @@ -210,7 +172,7 @@ void AddSC_boss_doomwalker() { Script *newscript; newscript = new Script; - newscript->Name="boss_doomwalker"; + newscript->Name = "boss_doomwalker"; newscript->GetAI = &GetAI_boss_doomwalker; newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp index 38f84f5ca7a..83244ff7b78 100644 --- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp +++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Shadowmoon_Valley SD%Complete: 100 -SDComment: Quest support: 10519, 10583, 10601, 10814, 10804, 10854, 11082, 10451. Vendor Drake Dealer Hurlunk. +SDComment: Quest support: 10519, 10583, 10601, 10814, 10804, 10854, 10458, 10481, 10480, 11082, 10781, 10451. Vendor Drake Dealer Hurlunk. SDCategory: Shadowmoon Valley EndScriptData */ @@ -30,7 +30,13 @@ npc_murkblood_overseer npc_neltharaku npc_karynaku npc_oronok_tornheart +npc_overlord_morghor npc_earthmender_wilda +mob_torloth_the_magnificent +mob_illidari_spawn +npc_lord_illidan_stormrage +go_crystal_prison +npc_enraged_spirit EndContentData */ #include "precompiled.h" @@ -44,7 +50,7 @@ EndContentData */ #define SPELL_JUST_EATEN 38502 #define SPELL_NETHER_BREATH 38467 -#define SAY_JUST_EATEN "Thank you, mortal." +#define SAY_JUST_EATEN -1000222 struct TRINITY_DLL_DECL mob_mature_netherwing_drakeAI : public ScriptedAI { @@ -120,7 +126,7 @@ struct TRINITY_DLL_DECL mob_mature_netherwing_drakeAI : public ScriptedAI IsEating = false; DoCast(m_creature, SPELL_JUST_EATEN); m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - DoSay(SAY_JUST_EATEN, LANG_DRACONIC, NULL); + DoScriptText(SAY_JUST_EATEN, m_creature); if(PlayerGUID) { Player* plr = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID)); @@ -194,27 +200,6 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI void Aggro(Unit* who) { } - Creature* SelectCreatureInGrid(uint32 entry, float range) - { - Creature* pCreature = NULL; - - // Time for some omg mind blowing code to search for creature - CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); - Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); - - Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck creature_check(*m_creature, entry, true, range); - Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pCreature, creature_check); - - TypeContainerVisitor<Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck>, GridTypeMapContainer> creature_searcher(searcher); - - CellLock<GridReadGuard> cell_lock(cell, pair); - cell_lock->Visit(cell_lock, creature_searcher,*(m_creature->GetMap())); - - return pCreature; - } - void SpellHit(Unit* caster, const SpellEntry* spell) { if(!caster) @@ -228,7 +213,7 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI m_creature->setFaction(FACTION_FRIENDLY); DoCast(caster, SPELL_FORCE_OF_NELTHARAKU, true); - Creature* Dragonmaw = SelectCreatureInGrid(CREATURE_DRAGONMAW_SUBJUGATOR, 50); + Unit* Dragonmaw = FindCreature(CREATURE_DRAGONMAW_SUBJUGATOR, 50, m_creature); if(Dragonmaw) { @@ -288,7 +273,7 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI float dx, dy, dz; - Creature* EscapeDummy = SelectCreatureInGrid(CREATURE_ESCAPE_DUMMY, 30); + Unit* EscapeDummy = FindCreature(CREATURE_ESCAPE_DUMMY, 30, m_creature); if(EscapeDummy) EscapeDummy->GetPosition(dx, dy, dz); else @@ -416,12 +401,15 @@ bool GossipSelect_npc_drake_dealer_hurlunk(Player *player, Creature *_Creature, ## npc_flanis_swiftwing_and_kagrosh ######*/ +#define GOSSIP_HSK1 "Take Flanis's Pack" +#define GOSSIP_HSK2 "Take Kagrosh's Pack" + bool GossipHello_npcs_flanis_swiftwing_and_kagrosh(Player *player, Creature *_Creature) { if (player->GetQuestStatus(10583) == QUEST_STATUS_INCOMPLETE && !player->HasItemCount(30658,1,true)) - player->ADD_GOSSIP_ITEM( 0, "Take Flanis's Pack", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HSK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); if (player->GetQuestStatus(10601) == QUEST_STATUS_INCOMPLETE && !player->HasItemCount(30659,1,true)) - player->ADD_GOSSIP_ITEM( 0, "Take Kagrosh's Pack", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HSK2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); @@ -459,10 +447,17 @@ bool GossipSelect_npcs_flanis_swiftwing_and_kagrosh(Player *player, Creature *_C #define QUEST_11082 11082 +#define GOSSIP_HMO "I am here for you, overseer." +#define GOSSIP_SMO1 "How dare you question an overseer of the Dragonmaw!" +#define GOSSIP_SMO2 "Who speaks of me? What are you talking about, broken?" +#define GOSSIP_SMO3 "Continue please." +#define GOSSIP_SMO4 "Who are these bidders?" +#define GOSSIP_SMO5 "Well... yes." + bool GossipHello_npc_murkblood_overseer(Player *player, Creature *_Creature) { if (player->GetQuestStatus(QUEST_11082) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "I am here for you, overseer.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HMO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(10940, _Creature->GetGUID()); return true; @@ -473,27 +468,27 @@ bool GossipSelect_npc_murkblood_overseer(Player *player, Creature *_Creature, ui switch (action) { case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(0, "How dare you question an overseer of the Dragonmaw!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM(0, GOSSIP_SMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); //correct id not known player->SEND_GOSSIP_MENU(10940, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(0, "Who speaks of me? What are you talking about, broken?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + player->ADD_GOSSIP_ITEM(0, GOSSIP_SMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); //correct id not known player->SEND_GOSSIP_MENU(10940, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(0, "Continue please.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + player->ADD_GOSSIP_ITEM(0, GOSSIP_SMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); //correct id not known player->SEND_GOSSIP_MENU(10940, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(0, "Who are these bidders?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + player->ADD_GOSSIP_ITEM(0, GOSSIP_SMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); //correct id not known player->SEND_GOSSIP_MENU(10940, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM(0, "Well... yes.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + player->ADD_GOSSIP_ITEM(0, GOSSIP_SMO5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); //correct id not known player->SEND_GOSSIP_MENU(10940, _Creature->GetGUID()); break; @@ -511,13 +506,18 @@ bool GossipSelect_npc_murkblood_overseer(Player *player, Creature *_Creature, ui ## npc_neltharaku ######*/ +#define GOSSIP_HN "I am listening, dragon" +#define GOSSIP_SN1 "But you are dragons! How could orcs do this to you?" +#define GOSSIP_SN2 "Your mate?" +#define GOSSIP_SN3 "I have battled many beasts, dragon. I will help you." + bool GossipHello_npc_neltharaku(Player *player, Creature *_Creature) { if (_Creature->isQuestGiver()) player->PrepareQuestMenu( _Creature->GetGUID() ); if (player->GetQuestStatus(10814) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "I am listening, dragon", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(10613, _Creature->GetGUID()); @@ -529,15 +529,15 @@ bool GossipSelect_npc_neltharaku(Player *player, Creature *_Creature, uint32 sen switch (action) { case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM( 0, "But you are dragons! How could orcs do this to you?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); player->SEND_GOSSIP_MENU(10614, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM( 0, "Your mate?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); player->SEND_GOSSIP_MENU(10615, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM( 0, "I have battled many beasts, dragon. I will help you.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); player->SEND_GOSSIP_MENU(10616, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+4: @@ -629,7 +629,7 @@ bool QuestAccept_npc_karynaku(Player* player, Creature* creature, Quest const* q nodes.resize(2); nodes[0] = 161; // From Karynaku nodes[1] = 162; // To Mordenai - error_log("SD2: Player %s started quest 10870 which has disabled taxi node, need to be fixed in core", player->GetName()); + error_log("TSCR: Player %s started quest 10870 which has disabled taxi node, need to be fixed in core", player->GetName()); //player->ActivateTaxiPathTo(nodes, 20811); } @@ -637,402 +637,199 @@ bool QuestAccept_npc_karynaku(Player* player, Creature* creature, Quest const* q } /*#### -# quest_lord_illidan_stormrage +# npc_overlord_morghor ####*/ + #define QUEST_LORD_ILLIDAN_STORMRAGE 11108 -#define LORD_ILLIDAN_STORMRAGE 22083 + +#define C_ILLIDAN 22083 +#define C_YARZILL 23141 #define SPELL_ONE 39990 // Red Lightning Bolt #define SPELL_TWO 41528 // Mark of Stormrage #define SPELL_THREE 40216 // Dragonaw Faction #define SPELL_FOUR 42016 // Dragonaw Trasform -#define OVERLORD_SAY_1 "Come, $N. Lord Stormrage awaits." -#define OVERLORD_SAY_2 "Lord Illidan will be here shortly." -#define OVERLORD_SAY_3 "Lord Illidan, this is the Dragonmaw that I, and others, have told you about. He will lead us to victory!" -#define OVERLORD_SAY_4 "But... My lord, I do not understand. $N... He is the orc that has..." -#define OVERLORD_SAY_5 "It will be done, my lord." -#define OVERLORD_SAY_6 "So you thought to make a fool of Mor'ghor, eh? Before you are delivered to Lord Illidan, you will feel pain that you could not know to exist. I will take pleasure in exacting my own vengeance." - -#define OVERLORD_YELL_1 "Warriors of Dragonmaw, gather 'round! One among you has attained the rank of highlord! Bow your heads in reverence! Show your respect and allegiance to Highlord $N!" -#define OVERLORD_YELL_2 "All hail Lord Illidan!" - -#define LORD_ILLIDAN_SAY_1 "What is the meaning of this, Mor'ghor?" -#define LORD_ILLIDAN_SAY_2 "SILENCE!" -#define LORD_ILLIDAN_SAY_3 "Blathering idiot. You incomprehensibly incompetent buffoon..." -#define LORD_ILLIDAN_SAY_4 "THIS is your hero?" -#define LORD_ILLIDAN_SAY_5 "You have been deceived, imbecile." -#define LORD_ILLIDAN_SAY_6 "This... whole... operation... HAS BEEN COMPROMISED!" -#define LORD_ILLIDAN_SAY_7 "I expect to see this insect's carcass in pieces in my lair within the hour. Fail and you will suffer a fate so much worse than death." - -#define YARZILL_THE_MERC_SAY "You will not harm the boy, Mor'ghor! Quickly, $N, climb on my back!" - -#define GOSSIP_FLY "Lets Do! <MISSING TEXT>" - -bool GossipHello_npc_yarzill_fly(Player *player, Creature *_Creature) -{ - if (player->GetQuestStatus(QUEST_LORD_ILLIDAN_STORMRAGE) == QUEST_STATUS_COMPLETE) - { - player->ADD_GOSSIP_ITEM(0, GOSSIP_FLY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(3961,_Creature->GetGUID()); - return true; - }else{ - return false; - } -} - -bool GossipSelect_npc_yarzill_fly(Player *player, Creature *_Creature, uint32 sender, uint32 action) -{ - if (action == GOSSIP_ACTION_INFO_DEF + 1) - { - std::vector<uint32> nodes; - nodes.resize(2); - nodes[0] = 173; - nodes[1] = 174; - error_log("SD2: Player %s started quest 11108 which has disabled taxi node, need to be fixed in core", player->GetName()); - //player->ActivateTaxiPathTo(nodes, 23468); - return true; - } - return false; -} - -struct TRINITY_DLL_DECL Yarzill_The_MercAI : public ScriptedAI -{ - Yarzill_The_MercAI(Creature *c) : ScriptedAI(c) {Reset();} +#define OVERLORD_SAY_1 -1000206 +#define OVERLORD_SAY_2 -1000207 +#define OVERLORD_SAY_3 -1000208 +#define OVERLORD_SAY_4 -1000209 +#define OVERLORD_SAY_5 -1000210 +#define OVERLORD_SAY_6 -1000211 -void Reset(){} +#define OVERLORD_YELL_1 -1000212 +#define OVERLORD_YELL_2 -1000213 -void Aggro(Unit *who){} +#define LORD_ILLIDAN_SAY_1 -1000214 +#define LORD_ILLIDAN_SAY_2 -1000215 +#define LORD_ILLIDAN_SAY_3 -1000216 +#define LORD_ILLIDAN_SAY_4 -1000217 +#define LORD_ILLIDAN_SAY_5 -1000218 +#define LORD_ILLIDAN_SAY_6 -1000219 +#define LORD_ILLIDAN_SAY_7 -1000220 -void DoSpeach(Unit *target) -{ -DoSay(YARZILL_THE_MERC_SAY,LANG_UNIVERSAL,target); -} -}; +#define YARZILL_THE_MERC_SAY -1000221 -struct TRINITY_DLL_DECL Lord_IllidanAI : public ScriptedAI +struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI { -Lord_IllidanAI(Creature *c) : ScriptedAI(c) {Reset();} - -void Reset(){} - -void Aggro(Unit *who){} - -void DoSpeach(int phase) -{ - switch(phase) - { - case 1: - DoSay(LORD_ILLIDAN_SAY_1,LANG_UNIVERSAL,NULL); - break; - case 2: - DoSay(LORD_ILLIDAN_SAY_2,LANG_UNIVERSAL,NULL); - break; - case 3: - DoSay(LORD_ILLIDAN_SAY_3,LANG_UNIVERSAL,NULL); - break; - case 4: - DoSay(LORD_ILLIDAN_SAY_4,LANG_UNIVERSAL,NULL); - break; - case 5: - DoSay(LORD_ILLIDAN_SAY_5,LANG_UNIVERSAL,NULL); - break; - case 6: - DoSay(LORD_ILLIDAN_SAY_6,LANG_UNIVERSAL,NULL); - break; - case 7: - DoSay(LORD_ILLIDAN_SAY_7,LANG_UNIVERSAL,NULL); - break; - case 0: - default: - break; - } -} -}; - -struct TRINITY_DLL_DECL Overlord_MorghorAI : public ScriptedAI -{ - Overlord_MorghorAI(Creature *c) : ScriptedAI(c) - { - Lord = NULL; - Yarzill = NULL; - Reset(); - } - - Unit* m_player; - Unit* PlayerCheck; - - uint32 SpeachTimer; - uint32 SpeachNum; + npc_overlord_morghorAI(Creature *c) : ScriptedAI(c) {Reset();} uint64 PlayerGUID; - uint64 YazillGUID; + uint64 IllidanGUID; - bool DoingSpeach; - bool Failed; + uint32 ConversationTimer; + uint32 Step; - Creature* Lord; - Creature* Yarzill; + bool Event; void Reset() { - if (Lord) - { - Lord->SetUInt64Value(UNIT_FIELD_TARGET, 0); - Lord->SetVisibility(VISIBILITY_OFF); - Lord->setDeathState(JUST_DIED); - } + PlayerGUID = 0; + IllidanGUID = 0; - if (Yarzill) - { - Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, 0); - } + ConversationTimer = 0; + Step = 0; - m_creature->Relocate(-5085.77, 577.231, 86.6719, 2.32608); - m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 2); - m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - m_player = NULL; - PlayerCheck = NULL; - PlayerGUID = 0; - YazillGUID = 0; - Lord = NULL; - Yarzill = NULL; - DoingSpeach = false; - Failed = false; - SpeachNum = 0; - SpeachTimer = 0; + Event = false; } - void BeginSpeach(Unit* target) + void Aggro(Unit* who){} + + void StartEvent() { m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - DoSay(OVERLORD_SAY_1,LANG_UNIVERSAL,target); - m_player = target; - PlayerCheck = NULL; - PlayerGUID = target->GetGUID(); - SpeachTimer = 4200; - SpeachNum = 0; - DoingSpeach = true; + m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + Unit* Illidan = m_creature->SummonCreature(C_ILLIDAN, -5107.83, 602.584, 85.2393, 4.92598, TEMPSUMMON_CORPSE_DESPAWN, 0); + IllidanGUID = Illidan->GetGUID(); + Illidan->SetVisibility(VISIBILITY_OFF); + if(PlayerGUID) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + DoScriptText(OVERLORD_SAY_1, m_creature, player); + } + ConversationTimer = 4200; + Step = 0; + Event = true; } - void Aggro(Unit *who){} - - void MoveInLineOfSight(Unit *who) + uint32 NextStep(uint32 Step) { - if (!who) - return; + Unit* plr = Unit::GetUnit((*m_creature), PlayerGUID); - if (DoingSpeach) + Unit* Illi = Unit::GetUnit((*m_creature), IllidanGUID); + + switch(Step) { - if (who->GetEntry() == 23141 && m_creature->IsWithinDistInMap(who, 15)) + case 0: return 0; break; + case 1: m_creature->GetMotionMaster()->MovePoint(0, -5104.41, 595.297, 85.6838); return 9000; break; + case 2: DoScriptText(OVERLORD_YELL_1, m_creature, plr); return 4500; break; + case 3: m_creature->SetInFront(plr); return 3200; break; + case 4: DoScriptText(OVERLORD_SAY_2, m_creature, plr); return 2000; break; + case 5: Illi->SetVisibility(VISIBILITY_ON); + Illi->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); return 350; break; + case 6: + Illi->CastSpell(Illi, SPELL_ONE, true); + Illi->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->GetGUID()); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, IllidanGUID); + return 2000; break; + case 7: DoScriptText(OVERLORD_YELL_2, m_creature); return 4500; break; + case 8: m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); return 2500; break; + case 9: DoScriptText(OVERLORD_SAY_3, m_creature); return 6500; break; + case 10: DoScriptText(LORD_ILLIDAN_SAY_1, Illi); return 5000; break; + case 11: DoScriptText(OVERLORD_SAY_4, m_creature, plr); return 6000; break; + case 12: DoScriptText(LORD_ILLIDAN_SAY_2, Illi); return 5500; break; + case 13: DoScriptText(LORD_ILLIDAN_SAY_3, Illi); return 4000; break; + case 14: Illi->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); return 1500; break; + case 15: DoScriptText(LORD_ILLIDAN_SAY_4, Illi); return 1500; break; + case 16: + if (plr) { - if (!YazillGUID) - { - YazillGUID = who->GetGUID(); - } - } + Illi->CastSpell(plr, SPELL_TWO, true); + plr->RemoveAurasDueToSpell(SPELL_THREE); + plr->RemoveAurasDueToSpell(SPELL_FOUR); + return 5000; + }else{ + ((Player*)plr)->FailQuest(QUEST_LORD_ILLIDAN_STORMRAGE); Step = 30; return 100; + }break; + case 17: DoScriptText(LORD_ILLIDAN_SAY_5, Illi); return 5000; break; + case 18: DoScriptText(LORD_ILLIDAN_SAY_6, Illi); return 5000; break; + case 19: DoScriptText(LORD_ILLIDAN_SAY_7, Illi); return 5000; break; + case 20: + Illi->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + Illi->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING); + return 500; break; + case 21: DoScriptText(OVERLORD_SAY_5, m_creature); return 500; break; + case 22: + Illi->SetVisibility(VISIBILITY_OFF); + Illi->setDeathState(JUST_DIED); + return 1000; break; + case 23: m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); return 2000; break; + case 24: m_creature->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); return 5000; break; + case 25: DoScriptText(OVERLORD_SAY_6, m_creature); return 2000; break; + case 26: + if(plr) + ((Player*)plr)->GroupEventHappens(QUEST_LORD_ILLIDAN_STORMRAGE, m_creature); + return 6000; break; + case 27: + { + Unit* Yarzill = FindCreature(C_YARZILL, 50, m_creature); + if (Yarzill) + Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); + return 500; }break; + case 28: + plr->RemoveAurasDueToSpell(SPELL_TWO); + plr->RemoveAurasDueToSpell(41519); + plr->CastSpell(plr, SPELL_THREE, true); + plr->CastSpell(plr, SPELL_FOUR, true); + return 1000; break; + case 29: + { + Unit* Yarzill = FindCreature(C_YARZILL, 50, m_creature); + if(Yarzill) + DoScriptText(YARZILL_THE_MERC_SAY, Yarzill, plr); + return 5000; }break; + case 30: + { + Unit* Yarzill = FindCreature(C_YARZILL, 50, m_creature); + if (Yarzill) + Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, 0); + return 5000; }break; + case 31: + { + Unit* Yarzill = FindCreature(C_YARZILL, 50, m_creature); + if (Yarzill) + Yarzill->CastSpell(plr, 41540, true); + return 1000;}break; + case 32: m_creature->GetMotionMaster()->MovePoint(0, -5085.77, 577.231, 86.6719); return 5000; break; + case 33: Reset(); return 100; break; + + default : return 9999999; } } void UpdateAI(const uint32 diff) { - //Speach - if (DoingSpeach) + if(ConversationTimer < diff) { - if (SpeachTimer < diff) + if(Event && IllidanGUID && PlayerGUID) { - if (YazillGUID && !Yarzill) - Yarzill = ((Creature*)Unit::GetUnit((*m_creature), YazillGUID)); - - if (!m_creature->IsWithinDistInMap(m_player, 50) && ((Player*)m_player)->GetQuestStatus(QUEST_LORD_ILLIDAN_STORMRAGE) == QUEST_STATUS_INCOMPLETE) - { - ((Player*)m_player)->FailQuest(QUEST_LORD_ILLIDAN_STORMRAGE); - SpeachNum = 30; - } - - switch (SpeachNum) - { - // Overlord Movement - case 0: - m_creature->GetMotionMaster()->MovePoint(0, -5104.41, 595.297, 85.6838); - SpeachTimer = 9000; SpeachNum++; break; - // Overlord Yell 1 - case 1: - m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SHOUT); - DoYell(OVERLORD_YELL_1,LANG_UNIVERSAL,m_player); - SpeachTimer = 4500; SpeachNum++; break; - // Overlord Angle - case 2: - m_creature->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); - SpeachTimer = 3200; SpeachNum++; break; - // Overlord Say 2 - case 3: - DoSay(OVERLORD_SAY_2,LANG_UNIVERSAL,NULL); - SpeachTimer = 2000; SpeachNum++; break; - // Summon Illidan - case 4: - Lord = m_creature->SummonCreature(LORD_ILLIDAN_STORMRAGE, -5107.83, 602.584, 85.2393, 4.92598, TEMPSUMMON_CORPSE_DESPAWN, 0); - Lord->LoadCreaturesAddon(); - SpeachTimer = 350; SpeachNum++; break; - // Illidan Cast Red Bolt - case 5: - Lord->CastSpell(Lord, SPELL_ONE, true); - Lord->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->GetGUID()); - m_creature->SetUInt64Value(UNIT_FIELD_TARGET, Lord->GetGUID()); - SpeachTimer = 2000; SpeachNum++; break; - // Overlord Yell 2 - case 6: - DoYell(OVERLORD_YELL_2,LANG_UNIVERSAL,NULL); - SpeachTimer = 4500; SpeachNum++; break; - // Overlord Kneel - case 7: - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1,8); - SpeachTimer = 2500; SpeachNum++; break; - // Overlord Say 3 - case 8: - DoSay(OVERLORD_SAY_3,LANG_UNIVERSAL,NULL); - SpeachTimer = 6500; SpeachNum++; break; - // Illidan Say 1 - case 9: - ((Lord_IllidanAI*)Lord->AI())->DoSpeach(1); - SpeachTimer = 5000; SpeachNum++; break; - // Overlord Say 4 - case 10: - DoSay(OVERLORD_SAY_4,LANG_UNIVERSAL,m_player); - SpeachTimer = 6000; SpeachNum++; break; - // Illidan Say 2 - case 11: - ((Lord_IllidanAI*)Lord->AI())->DoSpeach(2); - SpeachTimer = 5500; SpeachNum++; break; - // Illidan Say 3 - case 12: - ((Lord_IllidanAI*)Lord->AI())->DoSpeach(3); - SpeachTimer = 4000; SpeachNum++; break; - // Illidan Angle - case 13: - Lord->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); - SpeachTimer = 1500; SpeachNum++; break; - // Illidan Say 4 - case 14: - ((Lord_IllidanAI*)Lord->AI())->DoSpeach(4); - SpeachTimer = 1500; SpeachNum++; break; - // Illidan Cast - case 15: - PlayerCheck = Unit::GetUnit(*Lord, PlayerGUID); - if (PlayerCheck) - { - Lord->CastSpell(m_player, SPELL_TWO, true); - m_player->RemoveAurasDueToSpell(SPELL_THREE); - m_player->RemoveAurasDueToSpell(SPELL_FOUR); - SpeachTimer = 5000; SpeachNum++; - } - else - { - ((Player*)m_player)->FailQuest(QUEST_LORD_ILLIDAN_STORMRAGE); - SpeachTimer = 100; SpeachNum = 30; - } - break; - // Illidan Say 5 - case 16: - ((Lord_IllidanAI*)Lord->AI())->DoSpeach(5); - SpeachTimer = 5000; SpeachNum++; break; - // Illidan Say 6 - case 17: - ((Lord_IllidanAI*)Lord->AI())->DoSpeach(6); - SpeachTimer = 5000; SpeachNum++; break; - // Illidan Say 7 - case 18: - ((Lord_IllidanAI*)Lord->AI())->DoSpeach(7); - SpeachTimer = 5000; SpeachNum++; break; - // Illidan Fly - case 19: - Lord->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - Lord->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING); - SpeachTimer = 500; SpeachNum++; break; - // Overlord Say 5 - case 20: - DoSay(OVERLORD_SAY_5,LANG_UNIVERSAL,NULL); - SpeachTimer = 500; SpeachNum++; break; - // Illidan Despawn - case 21: - Lord->SetVisibility(VISIBILITY_OFF); - Lord->setDeathState(JUST_DIED); - Lord = NULL; - SpeachTimer = 1000; SpeachNum++; break; - // Overlord Stand Up - case 22: - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - SpeachTimer = 2000; SpeachNum++; break; - // Overlord Angle - case 23: - m_creature->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); - SpeachTimer = 5000; SpeachNum++; break; - // Overlord Say 6 - case 24: - DoSay(OVERLORD_SAY_6,LANG_UNIVERSAL,NULL); - SpeachTimer = 2000; SpeachNum++; break; - // Complete Quest - case 25: - ((Player*)m_player)->CompleteQuest(QUEST_LORD_ILLIDAN_STORMRAGE); - SpeachTimer = 6000; SpeachNum++; break; - // Goblin Angle - case 26: - if (Yarzill) - Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); - SpeachTimer = 500; SpeachNum++; break; - // Cast Again Dragonaw Illusion - case 27: - m_player->RemoveAurasDueToSpell(SPELL_TWO); - m_player->RemoveAurasDueToSpell(41519); - m_player->CastSpell(m_player, SPELL_THREE, true); - m_player->CastSpell(m_player, SPELL_FOUR, true); - SpeachTimer = 1000; SpeachNum++; break; - // Goblin - case 28: - if (Yarzill) - ((Yarzill_The_MercAI*)Yarzill->AI())->DoSpeach(m_player); - SpeachTimer = 5000; SpeachNum++; break; - // Goblin Off - case 29: - if (Yarzill) - Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, 0); - SpeachTimer = 5000; SpeachNum++; break; - // Overlord Go Back - case 30: - m_creature->GetMotionMaster()->MovePoint(0, -5085.77, 577.231, 86.6719); - SpeachTimer = 5000; SpeachNum++; break; - // Reset - case 31: - Reset(); - break; - default: break; - } - }else SpeachTimer -= diff; - } + ConversationTimer = NextStep(++Step); + } + }else ConversationTimer -= diff; } }; -CreatureAI* GetAI_Overlord_Morghor(Creature *_Creature) +CreatureAI* GetAI_npc_overlord_morghorAI(Creature *_Creature) { -return new Overlord_MorghorAI(_Creature); +return new npc_overlord_morghorAI(_Creature); } -CreatureAI* GetAI_Lord_Illidan(Creature *_Creature) -{ -return new Lord_IllidanAI(_Creature); -} - -CreatureAI* GetAI_Yarzill_The_Merc(Creature *_Creature) -{ -return new Yarzill_The_MercAI(_Creature); -} -bool QuestAccept_Overlord_Morghor(Player *player, Creature *_Creature, const Quest *_Quest ) +bool QuestAccept_npc_overlord_morghor(Player *player, Creature *_Creature, const Quest *_Quest ) { if(_Quest->GetQuestId() == QUEST_LORD_ILLIDAN_STORMRAGE) { - ((Overlord_MorghorAI*)_Creature->AI())->BeginSpeach((Unit*)player); + ((npc_overlord_morghorAI*)_Creature->AI())->PlayerGUID = player->GetGUID(); + ((npc_overlord_morghorAI*)_Creature->AI())->StartEvent(); return true; } return false; @@ -1042,42 +839,44 @@ bool QuestAccept_Overlord_Morghor(Player *player, Creature *_Creature, const Que # npc_earthmender_wilda ####*/ -#define SAY_START "I sense the tortured spirits, $N. They are this way, come quickly!" -#define SAY_AGGRO1 "Watch out!" -#define SAY_AGGRO2 "Naga attackers! Defend yourself!" -#define ASSASSIN_SAY_AGGRO1 "Kill them all!" -#define ASSASSIN_SAY_AGGRO2 "You will never essscape Coilssskarrr..." -#define SAY_PROGRESS1 "Grant me protection $N, i must break trough their foul magic!" -#define SAY_PROGRESS2 "The naga of Coilskar are exceptionally cruel to their prisoners. It is a miracle that I survived inside that watery prison for as long as I did. Earthmother be praised." -#define SAY_PROGRESS3 "Now we must find the exit." -#define SAY_PROGRESS4 "Lady Vashj must answer for these atrocities. She must be brought to justice!" -#define SAY_PROGRESS5 "The tumultuous nature of the great waterways of Azeroth and Draenor are a direct result of tormented water spirits." -#define SAY_PROGRESS6 "It shouldn't be much further, $N. The exit is just up ahead." -#define SAY_END "Thank you, $N. Please return to my brethren at the Altar of Damnation, near the Hand of Gul'dan, and tell them that Wilda is safe. May the Earthmother watch over you..." - - -#define QUEST_ESCAPE_FROM_COILSKAR_CISTERN 10451 -#define NPC_COILSKAR_ASSASSIN 21044 +#define SAY_START -1000223 +#define SAY_AGGRO1 -1000224 +#define SAY_AGGRO2 -1000225 +#define ASSASSIN_SAY_AGGRO1 -1000226 +#define ASSASSIN_SAY_AGGRO2 -1000227 +#define SAY_PROGRESS1 -1000228 +#define SAY_PROGRESS2 -1000229 +#define SAY_PROGRESS3 -1000230 +#define SAY_PROGRESS4 -1000231 +#define SAY_PROGRESS5 -1000232 +#define SAY_PROGRESS6 -1000233 +#define SAY_END -1000234 + +#define QUEST_ESCAPE_FROM_COILSKAR_CISTERN 10451 +#define NPC_COILSKAR_ASSASSIN 21044 struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI { npc_earthmender_wildaAI(Creature *c) : npc_escortAI(c) {Reset();} - void Aggro(Unit *who) - { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + bool Completed; - if(who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_COILSKAR_ASSASSIN) - DoSay(SAY_AGGRO2, LANG_UNIVERSAL, player); - else DoSay(SAY_AGGRO1, LANG_UNIVERSAL, player); - } + void Aggro(Unit *who) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - void Reset() - { - m_creature->setFaction(1726); - } + if(who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_COILSKAR_ASSASSIN) + DoScriptText(SAY_AGGRO2, m_creature, player); + else DoScriptText(SAY_AGGRO1, m_creature, player); + } - void WaypointReached(uint32 i) + void Reset() + { + m_creature->setFaction(1726); + Completed = false; + } + + void WaypointReached(uint32 i) { Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); @@ -1086,120 +885,92 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI switch(i) { - case 0: - DoSay(SAY_START, LANG_UNIVERSAL, player); - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_TALK); - break; - case 13: - DoSay(SAY_PROGRESS1, LANG_UNIVERSAL, player); - SummonAssassin(); - break; - case 14: - SummonAssassin(); break; - case 15: - DoSay(SAY_PROGRESS3, LANG_UNIVERSAL, player); break; + case 0: DoScriptText(SAY_START, m_creature, player); break; + case 13: DoScriptText(SAY_PROGRESS1, m_creature, player); + SummonAssassin(); + break; + case 14: SummonAssassin(); break; + case 15: DoScriptText(SAY_PROGRESS3, m_creature, player); break; case 19: - switch(rand()%3) - { - case 0: - DoSay(SAY_PROGRESS2, LANG_UNIVERSAL, player); break; - case 1: - DoSay(SAY_PROGRESS4, LANG_UNIVERSAL, player); break; - case 2: - DoSay(SAY_PROGRESS5, LANG_UNIVERSAL, player); break; - } - break; - case 20: - SummonAssassin(); break; + switch(rand()%3) + { + case 0: DoScriptText(SAY_PROGRESS2, m_creature, player); break; + case 1: DoScriptText(SAY_PROGRESS4, m_creature, player); break; + case 2: DoScriptText(SAY_PROGRESS5, m_creature, player); break; + } + break; + case 20: SummonAssassin(); break; case 26: - switch(rand()%3) - { - case 0: - DoSay(SAY_PROGRESS2, LANG_UNIVERSAL, player); break; - case 1: - DoSay(SAY_PROGRESS4, LANG_UNIVERSAL, player); break; - case 2: - DoSay(SAY_PROGRESS5, LANG_UNIVERSAL, player); break; - } - break; - case 27: - SummonAssassin(); break; + switch(rand()%3) + { + case 0: DoScriptText(SAY_PROGRESS2, m_creature, player); break; + case 1: DoScriptText(SAY_PROGRESS4, m_creature, player); break; + case 2: DoScriptText(SAY_PROGRESS5, m_creature, player); break; + } + break; + case 27: SummonAssassin(); break; case 33: - switch(rand()%3) - { - case 0: - DoSay(SAY_PROGRESS2, LANG_UNIVERSAL, player); break; - case 1: - DoSay(SAY_PROGRESS4, LANG_UNIVERSAL, player); break; - case 2: - DoSay(SAY_PROGRESS5, LANG_UNIVERSAL, player); break; - } - break; - case 34: - SummonAssassin(); break; + switch(rand()%3) + { + case 0: DoScriptText(SAY_PROGRESS2, m_creature, player); break; + case 1: DoScriptText(SAY_PROGRESS4, m_creature, player); break; + case 2: DoScriptText(SAY_PROGRESS5, m_creature, player); break; + } + break; + case 34: SummonAssassin(); break; case 37: - switch(rand()%3) - { - case 0: - DoSay(SAY_PROGRESS2, LANG_UNIVERSAL, player); break; - case 1: - DoSay(SAY_PROGRESS4, LANG_UNIVERSAL, player); break; - case 2: - DoSay(SAY_PROGRESS5, LANG_UNIVERSAL, player); break; - } - break; - case 38: - SummonAssassin(); break; - case 39: - DoSay(SAY_PROGRESS6, LANG_UNIVERSAL, player); break; + switch(rand()%3) + { + case 0: DoScriptText(SAY_PROGRESS2, m_creature, player); break; + case 1: DoScriptText(SAY_PROGRESS4, m_creature, player); break; + case 2: DoScriptText(SAY_PROGRESS5, m_creature, player); break; + } + break; + case 38: SummonAssassin(); break; + case 39: DoScriptText(SAY_PROGRESS6, m_creature, player); break; case 43: - switch(rand()%3) - { - case 0: - DoSay(SAY_PROGRESS2, LANG_UNIVERSAL, player); break; - case 1: - DoSay(SAY_PROGRESS4, LANG_UNIVERSAL, player); break; - case 2: - DoSay(SAY_PROGRESS5, LANG_UNIVERSAL, player); break; - } - break; - case 44: - SummonAssassin(); break; - case 50: - DoSay(SAY_END, LANG_UNIVERSAL, player); - ((Player*)player)->GroupEventHappens(QUEST_ESCAPE_FROM_COILSKAR_CISTERN, m_creature); - break; + switch(rand()%3) + { + case 0: DoScriptText(SAY_PROGRESS2, m_creature, player); break; + case 1: DoScriptText(SAY_PROGRESS4, m_creature, player); break; + case 2: DoScriptText(SAY_PROGRESS5, m_creature, player); break; + } + break; + case 44: SummonAssassin(); break; + case 50: + DoScriptText(SAY_END, m_creature, player); + ((Player*)player)->GroupEventHappens(QUEST_ESCAPE_FROM_COILSKAR_CISTERN, m_creature); + Completed = true; + break; } } void SummonAssassin() { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - Creature* CoilskarAssassin = m_creature->SummonCreature(NPC_COILSKAR_ASSASSIN, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0); - if( CoilskarAssassin ) + Unit* CoilskarAssassin = m_creature->SummonCreature(NPC_COILSKAR_ASSASSIN, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0); + if( CoilskarAssassin ) + { + switch(rand()%2) { - switch(rand()%2) - { - case 0: - CoilskarAssassin->Say(ASSASSIN_SAY_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break; - case 1: - CoilskarAssassin->Say(ASSASSIN_SAY_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break; - } - CoilskarAssassin->AI()->AttackStart(m_creature); - } - else error_log("SD2 ERROR: Coilskar Assassin couldn't be summmoned"); + case 0: DoScriptText(ASSASSIN_SAY_AGGRO1, CoilskarAssassin, player); break; + case 1: DoScriptText(ASSASSIN_SAY_AGGRO2, CoilskarAssassin, player); break; + } + ((Creature*)CoilskarAssassin)->AI()->AttackStart(m_creature); + } + else error_log("TSCR ERROR: Coilskar Assassin couldn't be summmoned"); } void JustDied(Unit* killer) - { - if (PlayerGUID) { - Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); - if (player) - ((Player*)player)->FailQuest(QUEST_ESCAPE_FROM_COILSKAR_CISTERN); - } - } + if (PlayerGUID && !Completed) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + if (player) + ((Player*)player)->FailQuest(QUEST_ESCAPE_FROM_COILSKAR_CISTERN); + } + } void UpdateAI(const uint32 diff) { @@ -1277,6 +1048,713 @@ bool QuestAccept_npc_earthmender_wilda(Player* player, Creature* creature, Quest return true; } +/*##### +# Quest: Battle of the crimson watch +#####*/ + +/* ContentData +Battle of the crimson watch - creatures, gameobjects and defines +mob_illidari_spawn : Adds that are summoned in the Crimson Watch battle. +mob_torloth_the_magnificent : Final creature that players have to face before quest is completed +npc_lord_illidan_stormrage : Creature that controls the event. +go_crystal_prison : GameObject that begins the event and hands out quest +EndContentData */ + +#define END_TEXT -1000366 + +#define QUEST_BATTLE_OF_THE_CRIMSON_WATCH 10781 +#define EVENT_AREA_RADIUS 65 //65yds +#define EVENT_COOLDOWN 30000 //in ms. appear after event completed or failed (should be = Adds despawn time) + +struct TorlothCinematic +{ + int32 TextId; + uint32 Creature, Timer; +}; + +// Creature 0 - Torloth, 1 - Illidan +static TorlothCinematic TorlothAnim[]= +{ + {-1000367, 0, 2000}, + {-1000368, 1, 7000}, + {-1000369, 0, 3000}, + {NULL, 0, 2000}, // Torloth stand + {-1000370, 0, 1000}, + {NULL, 0, 3000}, + {NULL, 0, NULL} +}; + +struct Location +{ + float x, y, z, o; +}; + +//Cordinates for Spawns +static Location SpawnLocation[]= +{ + //Cords used for: + {-4615.8556, 1342.2532, 139.9, 1.612},//Illidari Soldier + {-4598.9365, 1377.3182, 139.9, 3.917},//Illidari Soldier + {-4598.4697, 1360.8999, 139.9, 2.427},//Illidari Soldier + {-4589.3599, 1369.1061, 139.9, 3.165},//Illidari Soldier + {-4608.3477, 1386.0076, 139.9, 4.108},//Illidari Soldier + {-4633.1889, 1359.8033, 139.9, 0.949},//Illidari Soldier + {-4623.5791, 1351.4574, 139.9, 0.971},//Illidari Soldier + {-4607.2988, 1351.6099, 139.9, 2.416},//Illidari Soldier + {-4633.7764, 1376.0417, 139.9, 5.608},//Illidari Soldier + {-4600.2461, 1369.1240, 139.9, 3.056},//Illidari Mind Breaker + {-4631.7808, 1367.9459, 139.9, 0.020},//Illidari Mind Breaker + {-4600.2461, 1369.1240, 139.9, 3.056},//Illidari Highlord + {-4631.7808, 1367.9459, 139.9, 0.020},//Illidari Highlord + {-4615.5586, 1353.0031, 139.9, 1.540},//Illidari Highlord + {-4616.4736, 1384.2170, 139.9, 4.971},//Illidari Highlord + {-4627.1240, 1378.8752, 139.9, 2.544} //Torloth The Magnificent +}; + +struct WaveData +{ + uint8 SpawnCount, UsedSpawnPoint; + uint32 CreatureId, SpawnTimer,YellTimer; + int32 WaveTextId; +}; + +static WaveData WavesInfo[]= +{ + {9, 0, 22075, 10000, 7000, -1000371}, //Illidari Soldier + {2, 9, 22074, 10000, 7000, -1000372}, //Illidari Mind Breaker + {4, 11, 19797, 10000, 7000, -1000373}, //Illidari Highlord + {1, 15, 22076, 10000, 7000, -1000374} //Torloth The Magnificent +}; + +struct SpawnSpells +{ + uint32 Timer1, Timer2, SpellId; +}; + +static SpawnSpells SpawnCast[]= +{ + {10000, 15000, 35871}, // Illidari Soldier Cast - Spellbreaker + {10000, 10000, 38985}, // Illidari Mind Breake Cast - Focused Bursts + {35000, 35000, 22884}, // Illidari Mind Breake Cast - Psychic Scream + {20000, 20000, 17194}, // Illidari Mind Breake Cast - Mind Blast + {8000, 15000, 38010}, // Illidari Highlord Cast - Curse of Flames + {12000, 20000, 16102}, // Illidari Highlord Cast - Flamestrike + {10000, 15000, 15284}, // Torloth the Magnificent Cast - Cleave + {18000, 20000, 39082}, // Torloth the Magnificent Cast - Shadowfury + {25000, 28000, 33961} // Torloth the Magnificent Cast - Spell Reflection +}; + +/*###### +# mob_illidari_spawn +######*/ + +struct TRINITY_DLL_DECL mob_illidari_spawnAI : public ScriptedAI +{ + mob_illidari_spawnAI(Creature* c) : ScriptedAI(c) {Reset();} + + uint64 LordIllidanGUID; + uint32 SpellTimer1, SpellTimer2, SpellTimer3; + bool Timers; + + void Reset() + { + LordIllidanGUID = 0; + Timers = false; + } + + void Aggro(Unit* who) {} + void JustDied(Unit* slayer); + + void UpdateAI(const uint32 diff) + { + if(!m_creature->getVictim() || !m_creature->SelectHostilTarget()) + return; + + if(!Timers) + { + if(m_creature->GetEntry() == 22075)//Illidari Soldier + { + SpellTimer1 = SpawnCast[0].Timer1 + (rand()%4 * 1000); + } + if(m_creature->GetEntry() == 22074)//Illidari Mind Breaker + { + SpellTimer1 = SpawnCast[1].Timer1 + (rand()%10 * 1000); + SpellTimer2 = SpawnCast[2].Timer1 + (rand()%4 * 1000); + SpellTimer3 = SpawnCast[3].Timer1 + (rand()%4 * 1000); + } + if(m_creature->GetEntry() == 19797)// Illidari Highlord + { + SpellTimer1 = SpawnCast[4].Timer1 + (rand()%4 * 1000); + SpellTimer2 = SpawnCast[5].Timer1 + (rand()%4 * 1000); + } + Timers = true; + } + //Illidari Soldier + if(m_creature->GetEntry() == 22075) + { + if(SpellTimer1 < diff) + { + DoCast(m_creature->getVictim(), SpawnCast[0].SpellId);//Spellbreaker + SpellTimer1 = SpawnCast[0].Timer2 + (rand()%5 * 1000); + }else SpellTimer1 -= diff; + } + //Illidari Mind Breaker + if(m_creature->GetEntry() == 22074) + { + if(SpellTimer1 < diff) + { + if(Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if(target->GetTypeId() == TYPEID_PLAYER) + { + DoCast(target, SpawnCast[1].SpellId); //Focused Bursts + SpellTimer1 = SpawnCast[1].Timer2 + (rand()%5 * 1000); + }else SpellTimer1 = 2000; + } + }else SpellTimer1 -= diff; + + if(SpellTimer2 < diff) + { + DoCast(m_creature->getVictim(), SpawnCast[2].SpellId);//Psychic Scream + SpellTimer2 = SpawnCast[2].Timer2 + (rand()%13 * 1000); + }else SpellTimer2 -= diff; + + if(SpellTimer3 < diff) + { + DoCast(m_creature->getVictim(), SpawnCast[3].SpellId);//Mind Blast + SpellTimer3 = SpawnCast[3].Timer2 + (rand()%8 * 1000); + }else SpellTimer3 -= diff; + } + //Illidari Highlord + if(m_creature->GetEntry() == 19797) + { + if(SpellTimer1 < diff) + { + DoCast(m_creature->getVictim(), SpawnCast[4].SpellId);//Curse Of Flames + SpellTimer1 = SpawnCast[4].Timer2 + (rand()%10 * 1000); + }else SpellTimer1 -= diff; + + if(SpellTimer2 < diff) + { + DoCast(m_creature->getVictim(), SpawnCast[5].SpellId);//Flamestrike + SpellTimer2 = SpawnCast[5].Timer2 + (rand()%7 * 13000); + }else SpellTimer2 -= diff; + } + + DoMeleeAttackIfReady(); + } +}; + +/*###### +# mob_torloth_the_magnificent +#####*/ + +struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI +{ + mob_torloth_the_magnificentAI(Creature* c) : ScriptedAI(c) {Reset();} + + uint32 AnimationTimer, SpellTimer1, SpellTimer2, SpellTimer3; + + uint8 AnimationCount; + + uint64 LordIllidanGUID; + uint64 AggroTargetGUID; + + bool Timers; + + void Reset() + { + AnimationTimer = 4000; + AnimationCount = 0; + LordIllidanGUID = 0; + AggroTargetGUID = 0; + Timers = false; + + m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); + } + + void Aggro(Unit* who){} + + void HandleAnimation() + { + Creature* pCreature = m_creature; + + if(TorlothAnim[AnimationCount].Creature == 1) + { + pCreature = ((Creature*)Unit::GetUnit(*m_creature, LordIllidanGUID)); + + if(!pCreature) + return; + } + + if(TorlothAnim[AnimationCount].TextId) + DoScriptText(TorlothAnim[AnimationCount].TextId, pCreature); + + AnimationTimer = TorlothAnim[AnimationCount].Timer; + + switch(AnimationCount) + { + case 0: + m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1,8); + break; + case 3: + m_creature->RemoveFlag(UNIT_FIELD_BYTES_1,8); + break; + case 5: + if(Player* AggroTarget = ((Player*)Unit::GetUnit((*m_creature), AggroTargetGUID))) + { + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, AggroTarget->GetGUID()); + m_creature->AddThreat(AggroTarget, 1); + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_POINT); + } + break; + case 6: + if(Player* AggroTarget = ((Player*)Unit::GetUnit((*m_creature), AggroTargetGUID))) + { + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + m_creature->clearUnitState(UNIT_STAT_ROOT); + + float x, y, z; + AggroTarget->GetPosition(x,y,z); + m_creature->GetMotionMaster()->MovePoint(0,x,y,z); + } + break; + } + ++AnimationCount; + } + + void UpdateAI(const uint32 diff) + { + if(AnimationTimer) + { + if(AnimationTimer <= diff) + { + HandleAnimation(); + }else AnimationTimer -= diff; + } + + if(AnimationCount < 6) + { + m_creature->CombatStop(); + }else if(!Timers) + { + + SpellTimer1 = SpawnCast[6].Timer1; + SpellTimer2 = SpawnCast[7].Timer1; + SpellTimer3 = SpawnCast[8].Timer1; + Timers = true; + } + + if(Timers) + { + if(SpellTimer1 < diff) + { + DoCast(m_creature->getVictim(), SpawnCast[6].SpellId);//Cleave + SpellTimer1 = SpawnCast[6].Timer2 + (rand()%10 * 1000); + }else SpellTimer1 -= diff; + + if(SpellTimer2 < diff) + { + DoCast(m_creature->getVictim(), SpawnCast[7].SpellId);//Shadowfury + SpellTimer2 = SpawnCast[7].Timer2 + (rand()%5 * 1000); + }else SpellTimer2 -= diff; + + if(SpellTimer3 < diff) + { + DoCast(m_creature, SpawnCast[8].SpellId); + SpellTimer3 = SpawnCast[8].Timer2 + (rand()%7 * 1000);//Spell Reflection + }else SpellTimer3 -= diff; + } + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* slayer) + { + if(slayer) + switch(slayer->GetTypeId()) + { + case TYPEID_UNIT: + if(((Creature*)slayer)->isPet() && ((Pet*)slayer)->GetOwner()->GetTypeId() == TYPEID_PLAYER) + ((Player*)((Pet*)slayer->GetOwner()))->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, m_creature); + break; + + case TYPEID_PLAYER: + ((Player*)slayer)->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, m_creature); + break; + } + + if(Creature* LordIllidan = ((Creature*)Unit::GetUnit(*m_creature, LordIllidanGUID))) + { + DoScriptText(END_TEXT, LordIllidan, slayer); + LordIllidan->AI()->EnterEvadeMode(); + } + } +}; + +/*##### +# npc_lord_illidan_stormrage +#####*/ + +struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI +{ + npc_lord_illidan_stormrageAI(Creature* c) : ScriptedAI(c) {Reset();} + + uint64 PlayerGUID; + + uint32 WaveTimer; + uint32 AnnounceTimer; + + int8 LiveCount; + uint8 WaveCount; + + bool EventStarted; + bool Announced; + bool Failed; + + void Reset() + { + PlayerGUID = 0; + + WaveTimer = 10000; + AnnounceTimer = 7000; + LiveCount = 0; + WaveCount = 0; + + EventStarted = false; + Announced = false; + Failed = false; + + m_creature->SetVisibility(VISIBILITY_OFF); + } + + void Aggro(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} + void AttackStart(Unit* who) {} + + void SummonNextWave() + { + uint8 count = WavesInfo[WaveCount].SpawnCount; + uint8 locIndex = WavesInfo[WaveCount].UsedSpawnPoint; + srand(time(NULL));//initializing random seed + uint8 FelguardCount = 0; + uint8 DreadlordCount = 0; + + for(uint8 i = 0; i < count; ++i) + { + Creature* Spawn = NULL; + float X = SpawnLocation[locIndex + i].x; + float Y = SpawnLocation[locIndex + i].y; + float Z = SpawnLocation[locIndex + i].z; + float O = SpawnLocation[locIndex + i].o; + Spawn = m_creature->SummonCreature(WavesInfo[WaveCount].CreatureId, X, Y, Z, O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + ++LiveCount; + + if(Spawn) + { + Spawn->LoadCreaturesAddon(); + + if(WaveCount == 0)//1 Wave + { + if(rand()%3 == 1 && FelguardCount<2) + { + Spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID,18654); + ++FelguardCount; + } + else if(DreadlordCount < 3) + { + Spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID,19991); + ++DreadlordCount; + } + else if(FelguardCount<2) + { + Spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID,18654); + ++FelguardCount; + } + } + + if(WaveCount < 3)//1-3 Wave + { + if(PlayerGUID) + { + if(Player* pTarget = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID))) + { + float x, y, z; + pTarget->GetPosition(x,y,z); + Spawn->GetMotionMaster()->MovePoint(0,x, y, z); + } + } + ((mob_illidari_spawnAI*)Spawn->AI())->LordIllidanGUID = m_creature->GetGUID(); + } + + if(WavesInfo[WaveCount].CreatureId == 22076) // Torloth + { + ((mob_torloth_the_magnificentAI*)Spawn->AI())->LordIllidanGUID = m_creature->GetGUID(); + if(PlayerGUID) + ((mob_torloth_the_magnificentAI*)Spawn->AI())->AggroTargetGUID = PlayerGUID; + } + } + } + ++WaveCount; + WaveTimer = WavesInfo[WaveCount].SpawnTimer; + AnnounceTimer = WavesInfo[WaveCount].YellTimer; + } + + void CheckEventFail() + { + Player* pPlayer = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID)); + + if(!pPlayer) + return; + + if(Group *EventGroup = pPlayer->GetGroup()) + { + Player* GroupMember; + + uint8 GroupMemberCount = 0; + uint8 DeadMemberCount = 0; + uint8 FailedMemberCount = 0; + + const Group::MemberSlotList members = EventGroup->GetMemberSlots(); + + for(Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) + { + GroupMember = ((Player*)Unit::GetUnit((*m_creature), itr->guid)); + if(GroupMember && !GroupMember->IsWithinDistInMap(m_creature, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE) + { + GroupMember->FailQuest(QUEST_BATTLE_OF_THE_CRIMSON_WATCH); + GroupMember->SetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, QUEST_STATUS_NONE); + ++FailedMemberCount; + } + ++GroupMemberCount; + + if(GroupMember->isDead()) + { + ++DeadMemberCount; + } + } + + if(GroupMemberCount == FailedMemberCount) + { + Failed = true; + } + + if(GroupMemberCount == DeadMemberCount) + { + for(Group::member_citerator itr = members.begin(); itr!= members.end(); itr++) + { + GroupMember = ((Player*)Unit::GetUnit((*m_creature), itr->guid)); + + if(GroupMember && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE) + { + GroupMember->FailQuest(QUEST_BATTLE_OF_THE_CRIMSON_WATCH); + GroupMember->SetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, QUEST_STATUS_NONE); + } + } + Failed = true; + } + }else if (pPlayer->isDead() || !pPlayer->IsWithinDistInMap(m_creature, EVENT_AREA_RADIUS)) + { + pPlayer->FailQuest(QUEST_BATTLE_OF_THE_CRIMSON_WATCH); + Failed = true; + } + } + + void LiveCounter() + { + --LiveCount; + if(!LiveCount) + Announced = false; + } + + void UpdateAI(const uint32 diff) + { + if(!PlayerGUID || !EventStarted) + return; + + if(!LiveCount && WaveCount < 4) + { + if(!Announced && AnnounceTimer < diff) + { + DoScriptText(WavesInfo[WaveCount].WaveTextId, m_creature); + Announced = true; + }else AnnounceTimer -= diff; + + if(WaveTimer < diff) + { + SummonNextWave(); + }else WaveTimer -= diff; + } + CheckEventFail(); + + if(Failed) + EnterEvadeMode(); + } +}; + +void mob_illidari_spawnAI::JustDied(Unit *slayer) +{ + m_creature->RemoveCorpse(); + if(Creature* LordIllidan = ((Creature*)Unit::GetUnit(*m_creature, LordIllidanGUID))) + if(LordIllidan) + ((npc_lord_illidan_stormrageAI*)LordIllidan->AI())->LiveCounter(); +} + +/*##### +# go_crystal_prison +######*/ + +bool GOQuestAccept_GO_crystal_prison(Player* plr, GameObject* go, Quest const* quest) +{ + if(quest->GetQuestId() == QUEST_BATTLE_OF_THE_CRIMSON_WATCH ) + { + Unit* Illidan = FindCreature(22083, 50, plr); + + if(Illidan && !(((npc_lord_illidan_stormrageAI*)((Creature*)Illidan)->AI())->EventStarted)) + { + ((npc_lord_illidan_stormrageAI*)((Creature*)Illidan)->AI())->PlayerGUID = plr->GetGUID(); + ((npc_lord_illidan_stormrageAI*)((Creature*)Illidan)->AI())->LiveCount = 0; + ((npc_lord_illidan_stormrageAI*)((Creature*)Illidan)->AI())->EventStarted=true; + } + } + return true; +} + +CreatureAI* GetAI_npc_lord_illidan_stormrage(Creature* c) +{ + return new npc_lord_illidan_stormrageAI(c); +} + +CreatureAI* GetAI_mob_illidari_spawn(Creature* c) +{ + return new mob_illidari_spawnAI(c); +} + +CreatureAI* GetAI_mob_torloth_the_magnificent(Creature* c) +{ + return new mob_torloth_the_magnificentAI(c); +} + +/*#### +# npc_enraged_spirits +####*/ + +/* QUESTS */ +#define QUEST_ENRAGED_SPIRITS_FIRE_EARTH 10458 +#define QUEST_ENRAGED_SPIRITS_AIR 10481 +#define QUEST_ENRAGED_SPIRITS_WATER 10480 + +/* Totem */ +#define ENTRY_TOTEM_OF_SPIRITS 21071 +#define RADIUS_TOTEM_OF_SPIRITS 15 + +/* SPIRITS */ +#define ENTRY_ENRAGED_EARTH_SPIRIT 21050 +#define ENTRY_ENRAGED_FIRE_SPIRIT 21061 +#define ENTRY_ENRAGED_AIR_SPIRIT 21060 +#define ENTRY_ENRAGED_WATER_SPIRIT 21059 + +/* SOULS */ +#define ENTRY_EARTHEN_SOUL 21073 +#define ENTRY_FIERY_SOUL 21097 +#define ENTRY_ENRAGED_AIRY_SOUL 21116 +#define ENTRY_ENRAGED_WATERY_SOUL 21109 // wrong model + +/* SPELL KILLCREDIT - not working!?! - using KilledMonster */ +#define SPELL_EARTHEN_SOUL_CAPTURED_CREDIT 36108 +#define SPELL_FIERY_SOUL_CAPTURED_CREDIT 36117 +#define SPELL_AIRY_SOUL_CAPTURED_CREDIT 36182 +#define SPELL_WATERY_SOUL_CAPTURED_CREDIT 36171 + +/* KilledMonster Workaround */ +#define CREDIT_FIRE 21094 +#define CREDIT_WATER 21095 +#define CREDIT_AIR 21096 +#define CREDIT_EARTH 21092 + +/* Captured Spell/Buff */ +#define SPELL_SOUL_CAPTURED 36115 + +/* Factions */ +#define ENRAGED_SOUL_FRIENDLY 35 +#define ENRAGED_SOUL_HOSTILE 14 + +struct TRINITY_DLL_DECL npc_enraged_spiritAI : public ScriptedAI +{ + npc_enraged_spiritAI(Creature *c) : ScriptedAI(c) {Reset();} + + void Reset() { } + + void Aggro(Unit *who){} + + void JustDied(Unit* killer) + { + // always spawn spirit on death + // if totem around + // move spirit to totem and cast kill count + uint32 entry = 0; + uint32 credit = 0; + + switch(m_creature->GetEntry()) { + case ENTRY_ENRAGED_FIRE_SPIRIT: + entry = ENTRY_FIERY_SOUL; + //credit = SPELL_FIERY_SOUL_CAPTURED_CREDIT; + credit = CREDIT_FIRE; + break; + case ENTRY_ENRAGED_EARTH_SPIRIT: + entry = ENTRY_EARTHEN_SOUL; + //credit = SPELL_EARTHEN_SOUL_CAPTURED_CREDIT; + credit = CREDIT_EARTH; + break; + case ENTRY_ENRAGED_AIR_SPIRIT: + entry = ENTRY_ENRAGED_AIRY_SOUL; + //credit = SPELL_AIRY_SOUL_CAPTURED_CREDIT; + credit = CREDIT_AIR; + break; + case ENTRY_ENRAGED_WATER_SPIRIT: + entry = ENTRY_ENRAGED_WATERY_SOUL; + //credit = SPELL_WATERY_SOUL_CAPTURED_CREDIT; + credit = CREDIT_WATER; + break; + } + + // Spawn Soul on Kill ALWAYS! + Creature* Summoned = NULL; + Unit* totemOspirits = NULL; + + if ( entry != 0 ) + Summoned = DoSpawnCreature(entry, 0, 0, 1, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000); + + // FIND TOTEM, PROCESS QUEST + if (Summoned) + { + totemOspirits = FindCreature(ENTRY_TOTEM_OF_SPIRITS, RADIUS_TOTEM_OF_SPIRITS, m_creature); + if (totemOspirits) + { + Summoned->setFaction(ENRAGED_SOUL_FRIENDLY); + Summoned->GetMotionMaster()->MovePoint(0,totemOspirits->GetPositionX(), totemOspirits->GetPositionY(), Summoned->GetPositionZ()); + + Player* Owner = (Player*)totemOspirits->GetOwner(); + if (Owner) + // DoCast(Owner, credit); -- not working! + Owner->KilledMonster(credit, Summoned->GetGUID()); + DoCast(totemOspirits,SPELL_SOUL_CAPTURED); + } + } + } +}; + +CreatureAI* GetAI_npc_enraged_spirit(Creature *_Creature) +{ +return new npc_enraged_spiritAI(_Creature); +} + +/*##### +# +######*/ + void AddSC_shadowmoon_valley() { Script *newscript; @@ -1333,20 +1811,8 @@ void AddSC_shadowmoon_valley() newscript = new Script; newscript->Name = "npc_overlord_morghor"; - newscript->GetAI = &GetAI_Overlord_Morghor; - newscript->pQuestAccept = &QuestAccept_Overlord_Morghor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lord_illidan_stormrage"; - newscript->GetAI = &GetAI_Lord_Illidan; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_yarzill_the_merc"; - newscript->GetAI = &GetAI_Yarzill_The_Merc; - newscript->pGossipHello = &GossipHello_npc_yarzill_fly; - newscript->pGossipSelect = &GossipSelect_npc_yarzill_fly; + newscript->GetAI = &GetAI_npc_overlord_morghorAI; + newscript->pQuestAccept = &QuestAccept_npc_overlord_morghor; newscript->RegisterSelf(); newscript = new Script; @@ -1354,4 +1820,29 @@ void AddSC_shadowmoon_valley() newscript->GetAI = &GetAI_npc_earthmender_wildaAI; newscript->pQuestAccept = &QuestAccept_npc_earthmender_wilda; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_lord_illidan_stormrage"; + newscript->GetAI = &GetAI_npc_lord_illidan_stormrage; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "go_crystal_prison"; + newscript->pGOQuestAccept = &GOQuestAccept_GO_crystal_prison; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "mob_illidari_spawn"; + newscript->GetAI = &GetAI_mob_illidari_spawn; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "mob_torloth_the_magnificent"; + newscript->GetAI = &GetAI_mob_torloth_the_magnificent; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_enraged_spirit"; + newscript->GetAI = &GetAI_npc_enraged_spirit; + newscript->RegisterSelf(); } diff --git a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp index 839c6ab1fe8..22f71e09be0 100644 --- a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp +++ b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp @@ -225,10 +225,12 @@ bool GossipSelect_npc_shattrathflaskvendors(Player *player, Creature *_Creature, # npc_zephyr ######*/ +#define GOSSIP_HZ "Take me to the Caverns of Time." + bool GossipHello_npc_zephyr(Player *player, Creature *_Creature) { if( player->GetReputationRank(989) >= REP_REVERED ) - player->ADD_GOSSIP_ITEM(0, "Take me to the Caverns of Time.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_HZ, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); @@ -247,28 +249,28 @@ bool GossipSelect_npc_zephyr(Player *player, Creature *_Creature, uint32 sender, # npc_kservant ######*/ -#define SAY1 "Follow me, stranger. This won't take long." -#define WHISP1 "Shattrath was once the draenei capital of this world. Its name means \"dwelling of light.\"" -#define WHISP2 "When the Burning Legion turned the orcs against the draenei, the fiercest battle was fought here. The draenei fought tooth and nail, but in the end the city fell." -#define WHISP3 "The city was left in ruins and darkness... until the Sha'tar arrived." -#define WHISP4 "Let us go into the Lower City. I will warn you that as one of the only safe havens in Outland, Shattrath has attracted droves of refugees from all wars, current and past. " -#define WHISP5 "The Sha'tar, or \"born from light\" are the naaru that came to Outland to fight the demons of the Burning Legion." -#define WHISP6 "They were drawn to the ruins of Shattrath City where a small remnant of the draenei priesthood conducted its rites inside a ruined temple on this very spot." -#define WHISP7 "The priesthood, known as the Aldor, quickly regained its strength as word spread that the naaru had returned and reconstruction soon began. The ruined temple is now used as an infirmary for injured refugees." -#define WHISP8 "It wouldn't be long, however, before the city came under attack once again. This time, the attack came from Illidan's armies. A large regiment of blood elves had been sent by Illidan's ally, Kael'thas Sunstrider, to lay waste to the city." -#define WHISP9 "As the regiment of blood elves crossed this very bridge, the Aldor's exarchs and vindicators lined up to defend the Terrace of Light. But then the unexpected happened. " -#define WHISP10 "The blood elves laid down their weapons in front of the city's defenders; their leader, a blood elf elder known as Voren'thal, stormed into the Terrace of Light and demanded to speak to A'dal." -#define WHISP11 "As the naaru approached him, Voren'thal kneeled before him and uttered the following words: \"I've seen you in a vision, naaru. My race's only hope for survival lies with you. My followers and I are here to serve you.\"" -#define WHISP12 "The defection of Voren'thal and his followers was the largest loss ever incurred by Kael's forces. And these weren't just any blood elves. Many of the best and brightest amongst Kael's scholars and magisters had been swayed by Voren'thal's influence." -#define WHISP13 "The naaru accepted the defectors, who would become known as the Scryers; their dwelling lies in the platform above. Only those initiated with the Scryers are allowed there." -#define WHISP14 "The Aldor are followers of the Light and forgiveness and redemption are values they understand. However, they found hard to forget the deeds of the blood elves while under Kaell's command." -#define WHISP15 "Many of the priesthood had been slain by the same magisters who now vowed to serve the naaru. They were not happy to share the city with their former enemies." -#define WHISP16 "The Aldor's most holy temple and its surrounding dwellings lie on the terrace above. As a holy site, only the initiated are welcome inside." -#define WHISP17 "The attacks against Shattrath continued, but the city did not fall, as you can see. On the contrary, the naaru known as Xi'ri led a successful incursion into Shadowmoon Valley - Illidan's doorstep." -#define WHISP18 "There he continues to wage war on Illidan with the assistance of the Aldor and the Scryers. The two factions have not given up on their old feuds, though." -#define WHISP19 "Such is their animosity that they vie for the honor of being sent to assist the naaru there. Each day, that decision is made here by A'dal. The armies gather here to receive A'dal's blessing before heading to Shadowmoon." -#define WHISP20 "Khadgar should be ready to see you again. Just remember that to serve the Sha'tar you will most likely have to ally with the Aldor or the Scryers. And seeking the favor of one group will cause the others' dislike." -#define WHISP21 "Good luck stranger, and welcome to Shattrath City." +#define SAY1 -1000306 +#define WHISP1 -1000307 +#define WHISP2 -1000308 +#define WHISP3 -1000309 +#define WHISP4 -1000310 +#define WHISP5 -1000311 +#define WHISP6 -1000312 +#define WHISP7 -1000313 +#define WHISP8 -1000314 +#define WHISP9 -1000315 +#define WHISP10 -1000316 +#define WHISP11 -1000317 +#define WHISP12 -1000318 +#define WHISP13 -1000319 +#define WHISP14 -1000320 +#define WHISP15 -1000321 +#define WHISP16 -1000322 +#define WHISP17 -1000323 +#define WHISP18 -1000324 +#define WHISP19 -1000325 +#define WHISP20 -1000326 +#define WHISP21 -1000327 struct TRINITY_DLL_DECL npc_kservantAI : public npc_escortAI { @@ -279,33 +281,34 @@ public: void WaypointReached(uint32 i) { Unit *pTemp = Unit::GetUnit(*m_creature,PlayerGUID); + if( !pTemp ) return; switch(i) { - case 0: DoSay(SAY1, LANG_UNIVERSAL, pTemp); break; - case 4: DoWhisper(WHISP1, pTemp); break; - case 6: DoWhisper(WHISP2, pTemp); break; - case 7: DoWhisper(WHISP3, pTemp); break; - case 8: DoWhisper(WHISP4, pTemp); break; - case 17: DoWhisper(WHISP5, pTemp); break; - case 18: DoWhisper(WHISP6, pTemp); break; - case 19: DoWhisper(WHISP7, pTemp); break; - case 33: DoWhisper(WHISP8, pTemp); break; - case 34: DoWhisper(WHISP9, pTemp); break; - case 35: DoWhisper(WHISP10, pTemp); break; - case 36: DoWhisper(WHISP11, pTemp); break; - case 43: DoWhisper(WHISP12, pTemp); break; - case 44: DoWhisper(WHISP13, pTemp); break; - case 49: DoWhisper(WHISP14, pTemp); break; - case 50: DoWhisper(WHISP15, pTemp); break; - case 51: DoWhisper(WHISP16, pTemp); break; - case 52: DoWhisper(WHISP17, pTemp); break; - case 53: DoWhisper(WHISP18, pTemp); break; - case 54: DoWhisper(WHISP19, pTemp); break; - case 55: DoWhisper(WHISP20, pTemp); break; - case 56: DoWhisper(WHISP21, pTemp); + case 0: DoScriptText(SAY1, m_creature, pTemp); break; + case 4: DoScriptText(WHISP1, m_creature, pTemp); break; + case 6: DoScriptText(WHISP2, m_creature, pTemp); break; + case 7: DoScriptText(WHISP3, m_creature, pTemp); break; + case 8: DoScriptText(WHISP4, m_creature, pTemp); break; + case 17: DoScriptText(WHISP5, m_creature, pTemp); break; + case 18: DoScriptText(WHISP6, m_creature, pTemp); break; + case 19: DoScriptText(WHISP7, m_creature, pTemp); break; + case 33: DoScriptText(WHISP8, m_creature, pTemp); break; + case 34: DoScriptText(WHISP9, m_creature, pTemp); break; + case 35: DoScriptText(WHISP10, m_creature, pTemp); break; + case 36: DoScriptText(WHISP11, m_creature, pTemp); break; + case 43: DoScriptText(WHISP12, m_creature, pTemp); break; + case 44: DoScriptText(WHISP13, m_creature, pTemp); break; + case 49: DoScriptText(WHISP14, m_creature, pTemp); break; + case 50: DoScriptText(WHISP15, m_creature, pTemp); break; + case 51: DoScriptText(WHISP16, m_creature, pTemp); break; + case 52: DoScriptText(WHISP17, m_creature, pTemp); break; + case 53: DoScriptText(WHISP18, m_creature, pTemp); break; + case 54: DoScriptText(WHISP19, m_creature, pTemp); break; + case 55: DoScriptText(WHISP20, m_creature, pTemp); break; + case 56: DoScriptText(WHISP21, m_creature, pTemp); if( PlayerGUID ) { Unit* player = ((Creature*)Unit::GetUnit((*m_creature), PlayerGUID)); @@ -414,12 +417,13 @@ CreatureAI* GetAI_npc_kservantAI(Creature *_Creature) ######*/ #define GOSSIP_BOOK "Ezekiel said that you might have a certain book..." -#define SAY_1 "Time to teach you a lesson in manners, little boy!" -#define SAY_2 "Now I'm gonna give you to the count of '3' to get out of here before I sick the dogs on you." -#define SAY_3 "1..." -#define SAY_4 "2..." -#define SAY_5 "Time to meet your maker!" -#define SAY_GIVEUP "Alright, we give up! Don't hurt us!" + +#define SAY_1 -1000328 +#define SAY_2 -1000329 +#define SAY_3 -1000330 +#define SAY_4 -1000331 +#define SAY_5 -1000332 +#define SAY_GIVEUP -1000333 #define QUEST_WBI 10231 #define NPC_CREEPJACK 19726 @@ -449,13 +453,13 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI Step = 0; m_creature->setFaction(1194); - Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20); + Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); if(Creepjack) { ((Creature*)Creepjack)->AI()->EnterEvadeMode(); Creepjack->setFaction(1194); } - Unit* Malone = FindCreature(NPC_MALONE, 20); + Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); if(Malone) { ((Creature*)Malone)->AI()->EnterEvadeMode(); @@ -470,18 +474,18 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI switch(Step) { case 0:{ m_creature->SetInFront(player); - Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20); + Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); if(Creepjack) Creepjack->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - Unit* Malone = FindCreature(NPC_MALONE, 20); + Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); if(Malone) Malone->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); }return 2000; - case 1: DoSay(SAY_1, LANG_UNIVERSAL, player); return 3000; - case 2: DoSay(SAY_2, LANG_UNIVERSAL, player, true); return 5000; - case 3: DoSay(SAY_3, LANG_UNIVERSAL, player); return 2000; - case 4: DoSay(SAY_4, LANG_UNIVERSAL, player); return 2000; - case 5: DoSay(SAY_5, LANG_UNIVERSAL, player); return 2000; + case 1: DoScriptText(SAY_1, m_creature, player); return 3000; + case 2: DoScriptText(SAY_2, m_creature, player); return 5000; + case 3: DoScriptText(SAY_3, m_creature, player); return 2000; + case 4: DoScriptText(SAY_4, m_creature, player); return 2000; + case 5: DoScriptText(SAY_5, m_creature, player); return 2000; case 6: Attack = true; return 2000; default: return 0; } @@ -494,7 +498,7 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI if(SayTimer < diff) { if(Event) - SayTimer = NextStep(Step++); + SayTimer = NextStep(++Step); }else SayTimer -= diff; if(Attack) @@ -504,14 +508,14 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if(player) { - Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20); + Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); if(Creepjack) { Creepjack->Attack(player, true); Creepjack->setFaction(14); Creepjack->GetMotionMaster()->MoveChase(player); } - Unit* Malone = FindCreature(NPC_MALONE, 20); + Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); if(Malone) { Malone->Attack(player, true); @@ -527,13 +531,13 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI if((m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 1 && !Done) { - Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20); + Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature); if(Creepjack) { ((Creature*)Creepjack)->AI()->EnterEvadeMode(); Creepjack->setFaction(1194); } - Unit* Malone = FindCreature(NPC_MALONE, 20); + Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature); if(Malone) { ((Creature*)Malone)->AI()->EnterEvadeMode(); @@ -541,7 +545,7 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI } m_creature->setFaction(1194); Done = true; - DoSay(SAY_GIVEUP, LANG_UNIVERSAL, NULL); + DoScriptText(SAY_GIVEUP, m_creature, NULL); m_creature->DeleteThreatList(); m_creature->CombatStop(); m_creature->GetMotionMaster()->MoveTargetedHome(); diff --git a/src/bindings/scripts/scripts/zone/silvermoon/silvermoon_city.cpp b/src/bindings/scripts/scripts/zone/silvermoon/silvermoon_city.cpp index 53bc93c46a6..fb15929cda9 100644 --- a/src/bindings/scripts/scripts/zone/silvermoon/silvermoon_city.cpp +++ b/src/bindings/scripts/scripts/zone/silvermoon/silvermoon_city.cpp @@ -31,7 +31,7 @@ EndContentData */ # npc_blood_knight_stillblade #######*/ -#define SAY_HEAL "Thank you, dear Paladin, you just saved my life." +#define SAY_HEAL -1000334 #define QUEST_REDEEMING_THE_DEAD 9685 #define SPELL_SHIMMERING_VESSEL 31225 @@ -82,7 +82,7 @@ struct TRINITY_DLL_DECL npc_blood_knight_stillbladeAI : public ScriptedAI m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); //m_creature->RemoveAllAuras(); - DoSay(SAY_HEAL,LANG_THALASSIAN,NULL); + DoScriptText(SAY_HEAL, m_creature); spellHit = true; } } diff --git a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp index fa03fe37add..3981c63d092 100644 --- a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp +++ b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp @@ -33,6 +33,8 @@ EndContentData */ ## npc_astor_hadren ######*/ +#define GOSSIP_HAH "You're Astor Hadren, right?" +#define GOSSIP_SAH "You've got something I need, Astor. And I'll be taking it now." struct TRINITY_DLL_DECL npc_astor_hadrenAI : public ScriptedAI { npc_astor_hadrenAI(Creature *c) : ScriptedAI(c) {Reset();} @@ -60,7 +62,7 @@ CreatureAI* GetAI_npc_astor_hadren(Creature *_creature) bool GossipHello_npc_astor_hadren(Player *player, Creature *_Creature) { if (player->GetQuestStatus(1886) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "You're Astor Hadren, right?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(623, _Creature->GetGUID()); @@ -72,7 +74,7 @@ bool GossipSelect_npc_astor_hadren(Player *player, Creature *_Creature, uint32 s switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: - player->ADD_GOSSIP_ITEM( 0, "You've got something I need, Astor. And I'll be taking it now.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->SEND_GOSSIP_MENU(624, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 2: @@ -89,20 +91,20 @@ bool GossipSelect_npc_astor_hadren(Player *player, Creature *_Creature, uint32 s ## npc_deathstalker_erland ######*/ -#define SAY_QUESTACCEPT "Let's get to the others, and keep an eye open for those wolves cutside..." -#define SAY_START "Be careful, $N. Those wolves like to hide among the trees." -#define SAY_AGGRO_1 "A Mottled Worg attacks!" -#define SAY_AGGRO_2 "Beware! I am under attack!" -#define SAY_LAST "We're almost there!" +#define SAY_QUESTACCEPT -1000335 +#define SAY_START -1000336 +#define SAY_AGGRO_1 -1000337 +#define SAY_AGGRO_2 -1000338 +#define SAY_LAST -1000339 -#define SAY_THANKS "We made it! Thanks, $N. I couldn't have gotten without you." -#define SAY_RANE "It's good to see you again, Erland. What is your report?" -#define SAY_ANSWER "Masses of wolves are to the east, and whoever lived at Malden's Orchard is gone." -#define SAY_MOVE_QUINN "If I am excused, then I'd like to check on Quinn..." +#define SAY_THANKS -1000340 +#define SAY_RANE -1000341 +#define SAY_ANSWER -1000342 +#define SAY_MOVE_QUINN -1000343 -#define SAY_GREETINGS "Hello, Quinn. How are you faring?" -#define SAY_QUINN "I've been better. Ivar the Foul got the better of me..." -#define SAY_ON_BYE "Try to take better care of yourself, Quinn. You were lucky this time." +#define SAY_GREETINGS -1000344 +#define SAY_QUINN -1000345 +#define SAY_ON_BYE -1000346 #define QUEST_ESCORTING 435 #define NPC_RANE 1950 @@ -121,25 +123,26 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI switch(i) { - case 1: DoSay(SAY_START, LANG_UNIVERSAL, player);break; + case 1: DoScriptText(SAY_START, m_creature, player);break; case 13: - DoSay(SAY_LAST, LANG_UNIVERSAL, player); - ((Player*)player)->GroupEventHappens(QUEST_ESCORTING, m_creature);break; - case 14: DoSay(SAY_THANKS, LANG_UNIVERSAL, player);break; + DoScriptText(SAY_LAST, m_creature, player); + if(player) + ((Player*)player)->GroupEventHappens(QUEST_ESCORTING, m_creature);break; + case 14: DoScriptText(SAY_THANKS, m_creature, player);break; case 15: { - Unit* Rane = FindCreature(NPC_RANE, 20); + Unit* Rane = FindCreature(NPC_RANE, 20, m_creature); if(Rane) - ((Creature*)Rane)->Say(SAY_RANE, LANG_UNIVERSAL, NULL); + DoScriptText(SAY_RANE, Rane); break;} - case 16: DoSay(SAY_ANSWER, LANG_UNIVERSAL, NULL);break; - case 17: DoSay(SAY_MOVE_QUINN, LANG_UNIVERSAL, NULL); break; - case 24: DoSay(SAY_GREETINGS, LANG_UNIVERSAL, NULL);break; + case 16: DoScriptText(SAY_ANSWER, m_creature);break; + case 17: DoScriptText(SAY_MOVE_QUINN, m_creature); break; + case 24: DoScriptText(SAY_GREETINGS, m_creature);break; case 25: { - Unit* Quinn = FindCreature(NPC_QUINN, 20); + Unit* Quinn = FindCreature(NPC_QUINN, 20, m_creature); if(Quinn) - ((Creature*)Quinn)->Say(SAY_QUINN, LANG_GUTTERSPEAK, NULL); + DoScriptText(SAY_QUINN, Quinn); break;} - case 26: DoSay(SAY_ON_BYE, LANG_UNIVERSAL, NULL);break; + case 26: DoScriptText(SAY_ON_BYE, m_creature, NULL);break; } } @@ -150,8 +153,8 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI { switch(rand()%2) { - case 0: DoSay(SAY_AGGRO_1, LANG_UNIVERSAL, who);break; - case 1: DoSay(SAY_AGGRO_2, LANG_UNIVERSAL, who);break; + case 0: DoScriptText(SAY_AGGRO_1, m_creature, who);break; + case 1: DoScriptText(SAY_AGGRO_2, m_creature, who);break; } } @@ -165,7 +168,7 @@ bool QuestAccept_npc_deathstalker_erland(Player* player, Creature* creature, Que { if (quest->GetQuestId() == QUEST_ESCORTING) { - creature->Say(SAY_QUESTACCEPT, LANG_UNIVERSAL, player->GetGUID()); + DoScriptText(SAY_QUESTACCEPT, creature, player); ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); } diff --git a/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp b/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp index a5ea8dd2226..40d3a5c7b9d 100644 --- a/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp +++ b/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp @@ -33,6 +33,12 @@ EndContentData */ ## npc_braug_dimspirit ######*/ +#define GOSSIP_HBD1 "Ysera" +#define GOSSIP_HBD2 "Neltharion" +#define GOSSIP_HBD3 "Nozdormu" +#define GOSSIP_HBD4 "Alexstrasza" +#define GOSSIP_HBD5 "Malygos" + bool GossipHello_npc_braug_dimspirit(Player *player, Creature *_Creature) { if (_Creature->isQuestGiver()) @@ -40,11 +46,11 @@ bool GossipHello_npc_braug_dimspirit(Player *player, Creature *_Creature) if (player->GetQuestStatus(6627) == QUEST_STATUS_INCOMPLETE) { - player->ADD_GOSSIP_ITEM( 0, "Ysera", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->ADD_GOSSIP_ITEM( 0, "Neltharion", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->ADD_GOSSIP_ITEM( 0, "Nozdormu", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->ADD_GOSSIP_ITEM( 0, "Alexstrasza", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->ADD_GOSSIP_ITEM( 0, "Malygos", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HBD1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HBD2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HBD3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HBD4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HBD5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(5820, _Creature->GetGUID()); } @@ -74,9 +80,9 @@ bool GossipSelect_npc_braug_dimspirit(Player *player, Creature *_Creature, uint3 ## npc_kaya_flathoof ######*/ -#define SAY_START "Let's go before they find out I'm free!" -#define SAY_AMBUSH "Look out! We're under attack!" -#define SAY_END "Thank you for helping me. I know my way back from here." +#define SAY_START -1000347 +#define SAY_AMBUSH -1000348 +#define SAY_END -1000349 #define QUEST_PK 6523 #define MOB_GB 11912 @@ -97,13 +103,13 @@ struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI switch(i) { case 22: - DoSay(SAY_AMBUSH, LANG_UNIVERSAL, NULL); + DoScriptText(SAY_AMBUSH, m_creature); m_creature->SummonCreature(MOB_GB, -48.53, -503.34, -46.31, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(MOB_GR, -38.85, -503.77, -45.90, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(MOB_GS, -36.37, -496.23, -45.71, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); break; case 23: m_creature->SetInFront(player); - DoSay(SAY_END, LANG_UNIVERSAL, player, true); + DoScriptText(SAY_END, m_creature, player); if (player && player->GetTypeId() == TYPEID_PLAYER) ((Player*)player)->GroupEventHappens(QUEST_PK, m_creature); break; @@ -140,7 +146,7 @@ bool QuestAccept_npc_kaya_flathoof(Player* player, Creature* creature, Quest con if (quest->GetQuestId() == QUEST_PK) { ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); - creature->Say(SAY_START, LANG_UNIVERSAL, NULL); + DoScriptText(SAY_START, creature); creature->setFaction(113); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); } diff --git a/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp b/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp index 81498a6a7a5..c6ef71f25e5 100644 --- a/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp +++ b/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Stormwind_City SD%Complete: 100 -SDComment: Quest support: 1640, 1447, 4185, 11223 (DB support required for spell 42711). Receive emote General Marcus +SDComment: Quest support: 1640, 1447, 4185, 11223. Receive emote General Marcus SDCategory: Stormwind City EndScriptData */ diff --git a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp index 6cf663616bf..85621b1963f 100644 --- a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp +++ b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp @@ -37,7 +37,7 @@ EndContentData */ ## mob_aquementas ######*/ -#define AGGRO_YELL_AQUE "Who dares awaken Aquementas?" +#define AGGRO_YELL_AQUE -1000350 #define SPELL_AQUA_JET 13586 #define SPELL_FROST_SHOCK 15089 @@ -80,7 +80,7 @@ struct TRINITY_DLL_DECL mob_aquementasAI : public ScriptedAI void Aggro(Unit* who) { - DoYell(AGGRO_YELL_AQUE,LANG_UNIVERSAL,who); + DoScriptText(AGGRO_YELL_AQUE, m_creature, who); } void UpdateAI(const uint32 diff) @@ -397,23 +397,23 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI m_creature->SummonCreature(SPAWN_FIRST, -8350.96, -4445.79, 10.10, 6.20, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(SPAWN_FIRST, -8355.96, -4447.79, 10.10, 6.27, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(SPAWN_FIRST, -8353.96, -4442.79, 10.10, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - m_creature->Say(SAY_CHICKEN_AMB, LANG_UNIVERSAL, NULL); + DoScriptText(SAY_CHICKEN_AMB, m_creature); break; case 56: m_creature->SummonCreature(SPAWN_SECOND_1, -7510.07, -4795.50, 9.35, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(SPAWN_SECOND_2, -7515.07, -4797.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); m_creature->SummonCreature(SPAWN_SECOND_2, -7518.07, -4792.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - m_creature->Say(SAY_CHICKEN_AMB, LANG_UNIVERSAL, NULL); - {Unit* scoff = FindCreature(SPAWN_SECOND_2, 30); + DoScriptText(SAY_CHICKEN_AMB, m_creature); + {Unit* scoff = FindCreature(SPAWN_SECOND_2, 30, m_creature); if(scoff) - ((Creature*)scoff)->Say(SAY_SCOFF, LANG_UNIVERSAL, NULL);}break; + DoScriptText(SAY_SCOFF, scoff);}break; break; case 86: if (player) { - m_creature->Say(SAY_CHICKEN_COMP, LANG_UNIVERSAL, NULL); + DoScriptText(SAY_CHICKEN_COMP, m_creature); ((Player*)player)->GroupEventHappens(Q_OOX17, m_creature); } break; @@ -424,15 +424,11 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI void Aggro(Unit* who) { - switch (rand()%2) { - case 0: - m_creature->Say(SAY_CHICKEN_AGGRO_1, LANG_UNIVERSAL, 0); - break; - case 1: - m_creature->Say(SAY_CHICKEN_AGGRO_2, LANG_UNIVERSAL, 0); - break; - } - + switch (rand()%2) + { + case 0: DoScriptText(SAY_CHICKEN_AGGRO_1, m_creature); break; + case 1: DoScriptText(SAY_CHICKEN_AGGRO_2, m_creature); break; + } } void JustSummoned(Creature* summoned) @@ -466,7 +462,7 @@ bool QuestAccept_npc_OOX17(Player* player, Creature* creature, Quest const* ques creature->SetHealth(creature->GetMaxHealth()); creature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); - creature->Say(SAY_CHICKEN_ACC, LANG_UNIVERSAL, NULL); + DoScriptText(SAY_CHICKEN_ACC, creature); ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); } diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp index 7f649b30495..d46f7cf519f 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: boss_Kaelthas SD%Complete: 60 -SDComment: SQL, phase 2, phase 3, Mind Control, taunt immunity +SDComment: Mind Control, Reset Event if Weapons despawn/reset SDCategory: Tempest Keep, The Eye EndScriptData */ @@ -76,14 +76,14 @@ EndScriptData */ #define SPELL_WEAPON_SPAWN 41236 //Phase 4 spells -#define SPELL_FIREBALL 22088 //wrong but works with CastCustomSpell +#define SPELL_FIREBALL 36805 #define SPELL_PYROBLAST 36819 #define SPELL_FLAME_STRIKE 36735 #define SPELL_FLAME_STRIKE_VIS 36730 #define SPELL_FLAME_STRIKE_DMG 36731 #define SPELL_ARCANE_DISRUPTION 36834 #define SPELL_SHOCK_BARRIER 36815 -#define SPELL_PHOENIX_ANIMATION 36723 +#define SPELL_SUMMON_PHOENIX 36723 #define SPELL_MIND_CONTROL 32830 //Phase 5 spells @@ -282,6 +282,8 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI ScriptedInstance* pInstance; + std::list<uint64> Phoenix; + uint32 Fireball_Timer; uint32 ArcaneDisruption_Timer; uint32 Phoenix_Timer; @@ -292,6 +294,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI uint32 NetherVapor_Timer; uint32 FlameStrike_Timer; uint32 MindControl_Timer; + uint32 Check_Timer; uint32 Phase; uint32 PhaseSubphase; //generic uint32 Phase_Timer; //generic timer @@ -302,6 +305,59 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI bool ChainPyros; uint64 AdvisorGuid[4]; + uint64 WeaponGuid[7]; + + void DeleteLegs() + { + InstanceMap::PlayerList const &playerliste = ((InstanceMap*)m_creature->GetMap())->GetPlayers(); + InstanceMap::PlayerList::const_iterator it; + + Map::PlayerList const &PlayerList = ((InstanceMap*)m_creature->GetMap())->GetPlayers(); + for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + Player* i_pl = i->getSource(); + i_pl->DestroyItemCount(30312, 1, true); + i_pl->DestroyItemCount(30311, 1, true); + i_pl->DestroyItemCount(30317, 1, true); + i_pl->DestroyItemCount(30316, 1, true); + i_pl->DestroyItemCount(30313, 1, true); + i_pl->DestroyItemCount(30314, 1, true); + i_pl->DestroyItemCount(30318, 1, true); + i_pl->DestroyItemCount(30319, 1, true); + i_pl->DestroyItemCount(30320, 1, true); + } + if(pInstance) { + for(uint32 i = 0; i < 7; i++) { + Creature* weapon = (Creature*)(Unit::GetUnit((*m_creature), WeaponGuid[i]));; + delete weapon; + } + } + } + + void CleanPhoenix() + { + CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); + Cell cell(pair); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + + std::list<Creature*> PhoenixList; + + Trinity::AllCreaturesOfEntryInRange check(m_creature, PHOENIX, 50); + Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(PhoenixList, check); + TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher); + + CellLock<GridReadGuard> cell_lock(cell, pair); + cell_lock->Visit(cell_lock, visitor, *(m_creature->GetMap())); + + if(!PhoenixList.empty()) + { + for(std::list<Creature*>::iterator itr = PhoenixList.begin(); itr != PhoenixList.end(); ++itr) + { + (*itr)->RemoveFromWorld(); + } + } + } void Reset() { @@ -315,6 +371,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI GravityLapse_Phase = 0; NetherBeam_Timer = 8000; NetherVapor_Timer = 10000; + Check_Timer = 4000; PyrosCasted = 0; Phase = 0; InGravityLapse = false; @@ -324,8 +381,14 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI if(InCombat) PrepareAdvisors(); + DeleteLegs(); + CleanPhoenix(); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); + if(pInstance) pInstance->SetData(DATA_KAELTHASEVENT, NOT_STARTED); @@ -334,7 +397,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI void PrepareAdvisors() { Creature *pCreature; - for(uint8 i = 0; i < 4; i++) + for(uint8 i = 0; i < 4; ++i) { pCreature = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[i])); if(pCreature) @@ -356,6 +419,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI AdvisorGuid[1] = pInstance->GetData64(DATA_LORDSANGUINAR); AdvisorGuid[2] = pInstance->GetData64(DATA_GRANDASTROMANCERCAPERNIAN); AdvisorGuid[3] = pInstance->GetData64(DATA_MASTERENGINEERTELONICUS); + m_creature->addUnitState(UNIT_STAT_STUNNED); if(!AdvisorGuid[0] || !AdvisorGuid[1] || !AdvisorGuid[2] || !AdvisorGuid[3]) { @@ -400,6 +464,16 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI } } + void JustSummoned(Creature* summoned) + { + if(summoned->GetEntry() == PHOENIX) + { + summoned->setFaction(m_creature->getFaction()); + Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); + summoned->AI()->AttackStart(target); + } + } + void JustDied(Unit* Killer) { m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -407,11 +481,13 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI DoScriptText(SAY_DEATH, m_creature); + DeleteLegs(); + if(pInstance) pInstance->SetData(DATA_KAELTHASEVENT, DONE); Creature *pCreature; - for(uint8 i = 0; i < 4; i++) + for(uint8 i = 0; i < 4; ++i) { pCreature = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[i])); if(pCreature) @@ -437,7 +513,6 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI float attackRadius = m_creature->GetAttackDistance(who); if (Phase >= 4 && m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) { - //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); AttackStart(who); } else if(who->isAlive()) @@ -473,7 +548,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI //start advisor within 7 seconds Phase_Timer = 7000; - PhaseSubphase++; + ++PhaseSubphase; }else Phase_Timer -= diff; break; @@ -493,7 +568,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Advisor->AI()->AttackStart(target); } - PhaseSubphase++; + ++PhaseSubphase; }else Phase_Timer -= diff; break; @@ -507,7 +582,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI //start advisor within 12.5 seconds Phase_Timer = 12500; - PhaseSubphase++; + ++PhaseSubphase; } break; @@ -527,7 +602,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Advisor->AI()->AttackStart(target); } - PhaseSubphase++; + ++PhaseSubphase; }else Phase_Timer -= diff; break; @@ -541,7 +616,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI //start advisor within 7 seconds Phase_Timer = 7000; - PhaseSubphase++; + ++PhaseSubphase; } break; @@ -561,7 +636,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Advisor->AI()->AttackStart(target); } - PhaseSubphase++; + ++PhaseSubphase; }else Phase_Timer -= diff; break; @@ -575,7 +650,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI //start advisor within 8.4 seconds Phase_Timer = 8400; - PhaseSubphase++; + ++PhaseSubphase; } break; @@ -597,7 +672,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Phase_Timer = 3000; - PhaseSubphase++; + ++PhaseSubphase; }else Phase_Timer -= diff; break; @@ -631,20 +706,20 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI //Spawn weapons if (PhaseSubphase == 1) { - Unit* Target = SelectUnit(SELECT_TARGET_RANDOM, 0); - Creature* Weapon; - for (uint32 i = 0; i < 7; i++) + for (uint32 i = 0; i < 7; ++i) { + Unit* Target = SelectUnit(SELECT_TARGET_RANDOM, 0); Weapon = m_creature->SummonCreature(((uint32)KaelthasWeapons[i][0]),KaelthasWeapons[i][1],KaelthasWeapons[i][2],KaelthasWeapons[i][3],0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); if (!Weapon) - error_log("SD2: Kael'thas weapon %i could not be spawned", i); + error_log("STSCR: Kael'thas weapon %i could not be spawned", i); else { Weapon->setFaction(m_creature->getFaction()); Weapon->AI()->AttackStart(Target); Weapon->CastSpell(Weapon, SPELL_WEAPON_SPAWN, false); + WeaponGuid[i] = Weapon->GetGUID(); } } @@ -660,6 +735,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Phase = 3; PhaseSubphase = 0; }else Phase_Timer -= diff; + //missing Resetcheck }break; case 3: @@ -670,11 +746,11 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI Unit* Target = SelectUnit(SELECT_TARGET_RANDOM, 0); Creature* Advisor; - for (uint32 i = 0; i < 4; i++) + for (uint32 i = 0; i < 4; ++i) { Advisor = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[i])); if (!Advisor) - error_log("SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i); + error_log("TSCR: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i); else ((advisorbase_ai*)Advisor->AI())->Revive(Target); } @@ -694,6 +770,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) { + m_creature->clearUnitState(UNIT_STAT_STUNNED); AttackStart(target); } Phase_Timer = 30000; @@ -720,8 +797,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI { //interruptable m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false); - int32 dmg = 20000+rand()%5000; - m_creature->CastCustomSpell(m_creature->getVictim(), SPELL_FIREBALL, &dmg, 0, 0, false); + m_creature->CastSpell(m_creature->getVictim(), SPELL_FIREBALL, false); IsCastingFireball = true; Fireball_Timer = 2500; } @@ -745,7 +821,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI if (FlameStrike_Timer < diff) { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0, 70, true)) DoCast(pUnit, SPELL_FLAME_STRIKE); FlameStrike_Timer = 30000; @@ -754,10 +830,13 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI if (MindControl_Timer < diff) { if (m_creature->getThreatManager().getThreatList().size() >= 2) - for (uint32 i = 0; i < 3; i++) + for (uint32 i = 0; i < 3; i++) { - debug_log("SD2: Kael'Thas mind control not supported."); - //DoCast(pUnit, SPELL_MIND_CONTROL); + + Unit* target =SelectUnit(SELECT_TARGET_RANDOM, 1, 70, true); + if(!target) target = m_creature->getVictim(); + debug_log("TSCR: Kael'Thas mind control not supported."); + DoCast(target, SPELL_MIND_CONTROL); } MindControl_Timer = 60000; @@ -767,18 +846,9 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI //Phoenix_Timer if(Phoenix_Timer < diff) { - DoCast(m_creature, SPELL_PHOENIX_ANIMATION); - Creature *Phoenix = DoSpawnCreature(PHOENIX, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); - - if(Phoenix) - { - Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (target) - Phoenix->AI()->AttackStart(target); - }else error_log("SD2: Kael'Thas Phoenix could not be spawned"); - - switch(rand()%2) - { + DoCast(m_creature, SPELL_SUMMON_PHOENIX); + switch(rand()%2) + { case 0: DoScriptText(SAY_SUMMON_PHOENIX1, m_creature); break; case 1: DoScriptText(SAY_SUMMON_PHOENIX2, m_creature); break; } @@ -814,26 +884,28 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI DoCast(m_creature, SPELL_SHOCK_BARRIER); ChainPyros = true; PyrosCasted = 0; + Check_Timer = 0; ShockBarrier_Timer = 60000; }else ShockBarrier_Timer -= diff; //Chain Pyros (3 of them max) - if (ChainPyros && !m_creature->IsNonMeleeSpellCasted(false)) - { - if (PyrosCasted < 3) + if (ChainPyros){ + if (PyrosCasted < 3 && Check_Timer < diff) { DoCast(m_creature->getVictim(), SPELL_PYROBLAST); - PyrosCasted++; + ++PyrosCasted; - }else - { + Check_Timer = 4400; + }else Check_Timer -= diff; + if(PyrosCasted > 3) + { ChainPyros = false; Fireball_Timer = 2500; ArcaneDisruption_Timer = 60000; } } - } + }else Check_Timer -= 4100; if (Phase == 5) { @@ -844,6 +916,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI DoCast(m_creature, SPELL_EXPLODE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Phase = 6; + DoStartMovement(m_creature->getVictim()); AttackStart(m_creature->getVictim()); }else Phase_Timer -= diff; } @@ -909,7 +982,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI } } GravityLapse_Timer = 10000; - GravityLapse_Phase++; + ++GravityLapse_Phase; break; case 2: @@ -918,7 +991,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI DoCast(m_creature, SPELL_NETHER_VAPOR); GravityLapse_Timer = 20000; - GravityLapse_Phase++; + ++GravityLapse_Phase; break; case 3: @@ -940,6 +1013,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI InGravityLapse = false; GravityLapse_Timer = 60000; GravityLapse_Phase = 0; + DoStartMovement(m_creature->getVictim()); AttackStart(m_creature->getVictim()); DoResetThreat(); break; @@ -952,7 +1026,6 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI if(ShockBarrier_Timer < diff) { DoCast(m_creature, SPELL_SHOCK_BARRIER); - ShockBarrier_Timer = 20000; }else ShockBarrier_Timer -= diff; @@ -1024,7 +1097,7 @@ struct TRINITY_DLL_DECL boss_thaladred_the_darkenerAI : public advisorbase_ai //Gaze_Timer if(Gaze_Timer < diff) { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0, 100, true)) { DoResetThreat(); m_creature->AddThreat(target, 5000000.0f); @@ -1349,93 +1422,112 @@ struct TRINITY_DLL_DECL mob_kael_flamestrikeAI : public ScriptedAI //Phoenix AI struct TRINITY_DLL_DECL mob_phoenix_tkAI : public ScriptedAI { - mob_phoenix_tkAI(Creature *c) : ScriptedAI(c) {Reset();} - - uint32 Cycle_Timer; - - void Reset() - { - Cycle_Timer = 2000; - m_creature->CastSpell(m_creature,SPELL_BURN,true); - } - - void Aggro(Unit *who) { } - - void JustDied(Unit* killer) - { - //is this spell in use anylonger? - //m_creature->CastSpell(m_creature,SPELL_EMBER_BLAST,true); - m_creature->SummonCreature(PHOENIX_EGG,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,16000); - } - - void UpdateAI(const uint32 diff) - { - if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) - return; - - if (Cycle_Timer < diff) - { - //spell Burn should possible do this, but it doesn't, so do this for now. - uint32 dmg = urand(4500,5500); - if (m_creature->GetHealth() > dmg) - m_creature->SetHealth(uint32(m_creature->GetHealth()-dmg)); - Cycle_Timer = 2000; - }else Cycle_Timer -= diff; - - DoMeleeAttackIfReady(); - } + mob_phoenix_tkAI(Creature *c) : ScriptedAI(c) {Reset();} + + uint32 Cycle_Timer; + uint8 SummonEgg; + + void Reset() + { + Cycle_Timer = 2000; + SummonEgg = 0; + m_creature->CastSpell(m_creature,SPELL_BURN,true); + } + + void Aggro(Unit *who) { } + + void DamageTaken(Unit* pKiller, uint32 &damage) + { + if(m_creature->GetHealth() < damage && SummonEgg < 2){ + damage = 0; + SummonEgg = 1; + } + } + + void UpdateAI(const uint32 diff) + { + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + return; + + if(SummonEgg < 2){ + if (Cycle_Timer < diff) + { + //spell Burn should possible do this, but it doesn't, so do this for now. + uint32 dmg = urand(4500,5500); + if (m_creature->GetHealth() > dmg) + m_creature->SetHealth(uint32(m_creature->GetHealth()-dmg)); + Cycle_Timer = 2000; + }else Cycle_Timer -= diff; + }else { + if(Cycle_Timer < diff){ + m_creature->SummonCreature(PHOENIX_EGG,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,16000); + m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->RemoveCorpse(); + }else Cycle_Timer -= diff; + } + + if(SummonEgg == 1){ //hack die animation + m_creature->RemoveAllAuras(); + DoStartNoMovement(m_creature->getVictim()); + m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, PLAYER_STATE_DEAD); + SummonEgg = 2; + Cycle_Timer = 1000; + } + if(SummonEgg < 2)DoMeleeAttackIfReady(); + } }; - + //Phoenix Egg AI struct TRINITY_DLL_DECL mob_phoenix_egg_tkAI : public ScriptedAI { - mob_phoenix_egg_tkAI(Creature *c) : ScriptedAI(c) {Reset();} - - uint32 Rebirth_Timer; - - void Reset() - { - Rebirth_Timer = 15000; - } - - //ignore any - void MoveInLineOfSight(Unit* who) { return; } - - void AttackStart(Unit* who) - { - if (m_creature->Attack(who, false)) - { - m_creature->SetInCombatWith(who); - who->SetInCombatWith(m_creature); - - if (!InCombat) - { - InCombat = true; - Aggro(who); - } - DoStartNoMovement(who); - } - } - - void Aggro(Unit *who) { } - - void JustSummoned(Creature* summoned) - { - summoned->AddThreat(m_creature->getVictim(), 0.0f); - summoned->CastSpell(summoned,SPELL_REBIRTH,false); - } - - void UpdateAI(const uint32 diff) - { - if (!Rebirth_Timer) - return; - - if (Rebirth_Timer <= diff) - { - m_creature->SummonCreature(PHOENIX,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation(),TEMPSUMMON_CORPSE_DESPAWN,5000); - Rebirth_Timer = 0; - }else Rebirth_Timer -= diff; - } + mob_phoenix_egg_tkAI(Creature *c) : ScriptedAI(c) {Reset();} + + uint32 Rebirth_Timer; + bool summoned; + + void Reset(){ + Rebirth_Timer = 15000; + summoned = false; + } + + //ignore any + void MoveInLineOfSight(Unit* who) { return; } + + void AttackStart(Unit* who) + { + if (m_creature->Attack(who, false)) + { + m_creature->SetInCombatWith(who); + who->SetInCombatWith(m_creature); + + if (!InCombat) + { + InCombat = true; + Aggro(who); + } + DoStartNoMovement(who); + } + } + + void Aggro(Unit *who) { } + + void JustSummoned(Creature* summoned) + { + summoned->AddThreat(m_creature->getVictim(), 0.0f); + summoned->CastSpell(summoned,SPELL_REBIRTH,false); + } + + void UpdateAI(const uint32 diff) + { + if (Rebirth_Timer < diff) + { + if(!summoned){ + Creature* Phoenix = m_creature->SummonCreature(PHOENIX,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(),m_creature->GetOrientation(),TEMPSUMMON_CORPSE_DESPAWN,5000); + summoned = true; + } + m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + }else Rebirth_Timer -= diff; + } }; CreatureAI* GetAI_boss_kaelthas(Creature *_Creature) diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_void_reaver.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_void_reaver.cpp index c7e832fd172..256ffbae949 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_void_reaver.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_void_reaver.cpp @@ -128,7 +128,7 @@ struct TRINITY_DLL_DECL boss_void_reaverAI : public ScriptedAI target = *(target_list.begin()+rand()%target_list.size()); if (target) - m_creature->CastSpell(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), SPELL_ARCANE_ORB, true); + m_creature->CastSpell(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), SPELL_ARCANE_ORB, false); ArcaneOrb_Timer = 3000; }else ArcaneOrb_Timer -= diff; diff --git a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp index 81268dd5cea..4e4c5409911 100644 --- a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp +++ b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp @@ -38,7 +38,7 @@ EndContentData */ ## mob_unkor_the_ruthless ######*/ -#define SAY_SUBMIT "I give up! Please don't kill me!" +#define SAY_SUBMIT -1000351 #define FACTION_HOSTILE 45 #define FACTION_FRIENDLY 35 @@ -68,7 +68,7 @@ struct TRINITY_DLL_DECL mob_unkor_the_ruthlessAI : public ScriptedAI void DoNice() { - DoSay(SAY_SUBMIT,LANG_UNIVERSAL,NULL); + DoScriptText(SAY_SUBMIT, m_creature); m_creature->setFaction(FACTION_FRIENDLY); m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, PLAYER_STATE_SIT); m_creature->RemoveAllAuras(); @@ -242,7 +242,8 @@ CreatureAI* GetAI_mob_netherweb_victim(Creature *_Creature) #define GOSSIP_FLOON1 "You owe Sim'salabim money. Hand them over or die!" #define GOSSIP_FLOON2 "Hand over the money or die...again!" -#define SAY_FLOON_ATTACK "I choose the third option: KILLING YOU!" + +#define SAY_FLOON_ATTACK -1000352 #define FACTION_HOSTILE_FL 1738 #define FACTION_FRIENDLY_FL 35 @@ -320,7 +321,7 @@ bool GossipSelect_npc_floon(Player *player, Creature *_Creature, uint32 sender, { player->CLOSE_GOSSIP_MENU(); _Creature->setFaction(FACTION_HOSTILE_FL); - ((npc_floonAI*)_Creature->AI())->DoSay(SAY_FLOON_ATTACK,LANG_UNIVERSAL,player); + DoScriptText(SAY_FLOON_ATTACK, _Creature, player); ((npc_floonAI*)_Creature->AI())->AttackStart(player); } return true; @@ -359,10 +360,10 @@ bool GossipSelect_npc_skyguard_handler_deesak(Player *player, Creature *_Creatur ## npc_isla_starmane ######*/ -#define SAY_PROGRESS_1 "Ok let's get out of here!" -#define SAY_PROGRESS_2 "You sure you're ready? Take a moment." -#define SAY_PROGRESS_3 "Alright, let's do this!" -#define SAY_PROGRESS_4 "Ok, I think I can make it on my own from here. Thank you so much for breaking me out of there!" +#define SAY_PROGRESS_1 -1000353 +#define SAY_PROGRESS_2 -1000354 +#define SAY_PROGRESS_3 -1000355 +#define SAY_PROGRESS_4 -1000356 #define QUEST_EFTW_H 10052 #define QUEST_EFTW_A 10051 @@ -386,14 +387,14 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI { case 0: { - GameObject* Cage = FindGameObject(GO_CAGE, 99); + GameObject* Cage = FindGameObject(GO_CAGE, 10, m_creature); if(Cage) Cage->SetGoState(0); }break; - case 2: DoSay(SAY_PROGRESS_1, LANG_UNIVERSAL, player); break; - case 5: DoSay(SAY_PROGRESS_2, LANG_UNIVERSAL, player); break; - case 6: DoSay(SAY_PROGRESS_3, LANG_UNIVERSAL, player); break; - case 29:DoSay(SAY_PROGRESS_4, LANG_UNIVERSAL, player); + case 2: DoScriptText(SAY_PROGRESS_1, m_creature, player); break; + case 5: DoScriptText(SAY_PROGRESS_2, m_creature, player); break; + case 6: DoScriptText(SAY_PROGRESS_3, m_creature, player); break; + case 29:DoScriptText(SAY_PROGRESS_4, m_creature, player); if (player) { if(((Player*)player)->GetTeam() == ALLIANCE) @@ -411,6 +412,7 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI void Reset() { Completed = false; + m_creature->setFaction(1660); } void Aggro(Unit* who){} diff --git a/src/bindings/scripts/scripts/zone/thunder_bluff/thunder_bluff.cpp b/src/bindings/scripts/scripts/zone/thunder_bluff/thunder_bluff.cpp index 7bd1c540a76..d8b5eafaddb 100644 --- a/src/bindings/scripts/scripts/zone/thunder_bluff/thunder_bluff.cpp +++ b/src/bindings/scripts/scripts/zone/thunder_bluff/thunder_bluff.cpp @@ -33,6 +33,7 @@ EndScriptData */ #define SPELL_THUNDERCLAP 23931 #define SPELL_UPPERCUT 22916 +#define GOSSIP_HCB "I know this is rather silly but a young ward who is a bit shy would like your hoofprint." //TODO: verify abilities/timers struct TRINITY_DLL_DECL npc_cairne_bloodhoofAI : public ScriptedAI { @@ -106,7 +107,7 @@ bool GossipHello_npc_cairne_bloodhoof(Player *player, Creature *_Creature) player->PrepareQuestMenu( _Creature->GetGUID() ); if( player->GetQuestStatus(925) == QUEST_STATUS_INCOMPLETE ) - player->ADD_GOSSIP_ITEM( 0, "I know this is rather silly but a young ward who is a bit shy would like your hoofprint.", GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO ); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HCB, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO ); player->SEND_GOSSIP_MENU(7013, _Creature->GetGUID() ); diff --git a/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp b/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp index 935aeea6c4c..d2685d31b9f 100644 --- a/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp +++ b/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp @@ -44,6 +44,7 @@ struct TRINITY_DLL_DECL npc_calvin_montagueAI : public ScriptedAI void Reset() { m_creature->setFaction(FACTION_FRIENDLY); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); } void Aggro(Unit* who) { } @@ -73,6 +74,7 @@ bool QuestAccept_npc_calvin_montague(Player* player, Creature* creature, Quest c if( quest->GetQuestId() == QUEST_590 ) { creature->setFaction(FACTION_HOSTILE); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); ((npc_calvin_montagueAI*)creature->AI())->AttackStart(player); } return true; diff --git a/src/bindings/scripts/scripts/zone/undercity/undercity.cpp b/src/bindings/scripts/scripts/zone/undercity/undercity.cpp index a5ba4abfd9a..4761af1c7bd 100644 --- a/src/bindings/scripts/scripts/zone/undercity/undercity.cpp +++ b/src/bindings/scripts/scripts/zone/undercity/undercity.cpp @@ -33,8 +33,8 @@ EndContentData */ ## npc_lady_sylvanas_windrunner ######*/ -#define SAY_LAMENT_END "Belore..." -#define EMOTE_LAMENT_END "kneels down and pick up the amulet." +#define SAY_LAMENT_END -1000357 +#define EMOTE_LAMENT_END -1000358 #define SOUND_CREDIT 10896 #define ENTRY_HIGHBORNE_LAMENTER 21628 @@ -51,6 +51,7 @@ float HighborneLoc[4][3]= {1289.66, 309.66, 1.52}, {1292.51, 310.50, 1.99}, }; + #define HIGHBORNE_LOC_Y -61.00 #define HIGHBORNE_LOC_Y_NEW -55.50 @@ -85,9 +86,9 @@ struct TRINITY_DLL_DECL npc_lady_sylvanas_windrunnerAI : public ScriptedAI { if( Unit* target = Unit::GetUnit(*summoned,targetGUID) ) { - target->SendMonsterMove(target->GetPositionX(),target->GetPositionY(),myZ+15.0,0,0,0); - target->Relocate(target->GetPositionX(),target->GetPositionY(),myZ+15.0); - summoned->CastSpell(target,SPELL_RIBBON_OF_SOULS,false); + target->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), myZ+15.0,0,0,0); + target->Relocate(target->GetPositionX(), target->GetPositionY(), myZ+15.0); + summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false); } summoned->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); @@ -105,14 +106,14 @@ struct TRINITY_DLL_DECL npc_lady_sylvanas_windrunnerAI : public ScriptedAI float raY = myY; float raZ = myZ; - m_creature->GetRandomPoint(myX,myY,myZ,20.0,raX,raY,raZ); - m_creature->SummonCreature(ENTRY_HIGHBORNE_BUNNY,raX,raY,myZ,0,TEMPSUMMON_TIMED_DESPAWN,3000); + m_creature->GetRandomPoint(myX, myY, myZ, 20.0, raX, raY, raZ); + m_creature->SummonCreature(ENTRY_HIGHBORNE_BUNNY, raX, raY, myZ, 0, TEMPSUMMON_TIMED_DESPAWN, 3000); LamentEvent_Timer = 2000; - if( !m_creature->HasAura(SPELL_SYLVANAS_CAST,0) ) + if( !m_creature->HasAura(SPELL_SYLVANAS_CAST, 0)) { - DoSay(SAY_LAMENT_END,LANG_UNIVERSAL,NULL); - DoTextEmote(EMOTE_LAMENT_END,NULL); + DoScriptText(SAY_LAMENT_END, m_creature); + DoScriptText(EMOTE_LAMENT_END, m_creature); LamentEvent = false; } }else LamentEvent_Timer -= diff; @@ -137,7 +138,7 @@ bool ChooseReward_npc_lady_sylvanas_windrunner(Player *player, Creature *_Creatu ((npc_lady_sylvanas_windrunnerAI*)_Creature->AI())->DoPlaySoundToSet(_Creature,SOUND_CREDIT); _Creature->CastSpell(_Creature,SPELL_SYLVANAS_CAST,false); - for( uint8 i = 0; i < 4; i++ ) + for( uint8 i = 0; i < 4; ++i) _Creature->SummonCreature(ENTRY_HIGHBORNE_LAMENTER, HighborneLoc[i][0], HighborneLoc[i][1], HIGHBORNE_LOC_Y, HighborneLoc[i][2], TEMPSUMMON_TIMED_DESPAWN, 160000); } @@ -200,6 +201,10 @@ CreatureAI* GetAI_npc_highborne_lamenter(Creature *_Creature) #define SPELL_MARK_OF_SHAME 6767 +#define GOSSIP_HPF1 "Gul'dan" +#define GOSSIP_HPF2 "Kel'Thuzad" +#define GOSSIP_HPF3 "Ner'zhul" + bool GossipHello_npc_parqual_fintallas(Player *player, Creature *_Creature) { if (_Creature->isQuestGiver()) @@ -207,9 +212,9 @@ bool GossipHello_npc_parqual_fintallas(Player *player, Creature *_Creature) if (player->GetQuestStatus(6628) == QUEST_STATUS_INCOMPLETE && !player->HasAura(SPELL_MARK_OF_SHAME,0) ) { - player->ADD_GOSSIP_ITEM( 0, "Gul'dan", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->ADD_GOSSIP_ITEM( 0, "Kel'Thuzad", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->ADD_GOSSIP_ITEM( 0, "Ner'zhul", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HPF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HPF2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HPF3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); player->SEND_GOSSIP_MENU(5822, _Creature->GetGUID()); } else diff --git a/src/bindings/scripts/scripts/zone/western_plaguelands/western_plaguelands.cpp b/src/bindings/scripts/scripts/zone/western_plaguelands/western_plaguelands.cpp index ed1f415bb95..48146e0231e 100644 --- a/src/bindings/scripts/scripts/zone/western_plaguelands/western_plaguelands.cpp +++ b/src/bindings/scripts/scripts/zone/western_plaguelands/western_plaguelands.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Western_Plaguelands SD%Complete: 90 -SDComment: Quest support: 5216,5219,5222,5225,5229,5231,5233,5235. To obtain Vitreous Focuser (could use more spesifics about gossip items) +SDComment: Quest support: 5216, 5219, 5222, 5225, 5229, 5231, 5233, 5235. To obtain Vitreous Focuser (could use more spesifics about gossip items) SDCategory: Western Plaguelands EndScriptData */ @@ -32,6 +32,13 @@ EndContentData */ ## npcs_dithers_and_arbington ######*/ +#define GOSSIP_HDA1 "What does the Felstone Field Cauldron need?" +#define GOSSIP_HDA2 "What does the Dalson's Tears Cauldron need?" +#define GOSSIP_HDA3 "What does the Writhing Haunt Cauldron need?" +#define GOSSIP_HDA4 "What does the Gahrron's Withering Cauldron need?" + +#define GOSSIP_SDA1 "Thanks, i need a Vitreous Focuser" + bool GossipHello_npcs_dithers_and_arbington(Player *player, Creature *_Creature) { if(_Creature->isQuestGiver()) @@ -41,10 +48,10 @@ bool GossipHello_npcs_dithers_and_arbington(Player *player, Creature *_Creature) if(player->GetQuestRewardStatus(5237) || player->GetQuestRewardStatus(5238)) { - player->ADD_GOSSIP_ITEM(0, "What does the Felstone Field Cauldron need?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->ADD_GOSSIP_ITEM(0, "What does the Dalson's Tears Cauldron need?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->ADD_GOSSIP_ITEM(0, "What does the Writhing Haunt Cauldron need?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - player->ADD_GOSSIP_ITEM(0, "What does the Gahrron's Withering Cauldron need?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + player->ADD_GOSSIP_ITEM(0, GOSSIP_HDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_HDA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM(0, GOSSIP_HDA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + player->ADD_GOSSIP_ITEM(0, GOSSIP_HDA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); player->SEND_GOSSIP_MENU(3985, _Creature->GetGUID()); }else player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); @@ -60,19 +67,19 @@ bool GossipSelect_npcs_dithers_and_arbington(Player *player, Creature *_Creature player->SEND_VENDORLIST( _Creature->GetGUID() ); break; case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(0, "Thanks, i need a Vitreous Focuser", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + player->ADD_GOSSIP_ITEM(0, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); player->SEND_GOSSIP_MENU(3980, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(0, "Thanks, i need a Vitreous Focuser", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + player->ADD_GOSSIP_ITEM(0, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); player->SEND_GOSSIP_MENU(3981, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(0, "Thanks, i need a Vitreous Focuser", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + player->ADD_GOSSIP_ITEM(0, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); player->SEND_GOSSIP_MENU(3982, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(0, "Thanks, i need a Vitreous Focuser", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + player->ADD_GOSSIP_ITEM(0, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); player->SEND_GOSSIP_MENU(3983, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+5: diff --git a/src/bindings/scripts/scripts/zone/winterspring/winterspring.cpp b/src/bindings/scripts/scripts/zone/winterspring/winterspring.cpp index 08ead2eb1de..9f1932ecc02 100644 --- a/src/bindings/scripts/scripts/zone/winterspring/winterspring.cpp +++ b/src/bindings/scripts/scripts/zone/winterspring/winterspring.cpp @@ -33,13 +33,21 @@ EndContentData */ ## npc_lorax ######*/ +#define GOSSIP_HL "Talk to me" + +#define GOSSIP_SL1 "What do you do here?" +#define GOSSIP_SL2 "I can help you" +#define GOSSIP_SL3 "What deal?" +#define GOSSIP_SL4 "Then what happened?" +#define GOSSIP_SL5 "He is not safe, i'll make sure of that." + bool GossipHello_npc_lorax(Player *player, Creature *_Creature) { if (_Creature->isQuestGiver()) player->PrepareQuestMenu( _Creature->GetGUID() ); if (player->GetQuestStatus(5126) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM( 0, "Talk to me", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); @@ -51,23 +59,23 @@ bool GossipSelect_npc_lorax(Player *player, Creature *_Creature, uint32 sender, switch (action) { case GOSSIP_ACTION_INFO_DEF: - player->ADD_GOSSIP_ITEM( 0, "What do you do here?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(3759, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM( 0, "I can help you", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->SEND_GOSSIP_MENU(3760, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM( 0, "What deal?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SL3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); player->SEND_GOSSIP_MENU(3761, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM( 0, "Then what happened?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SL4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); player->SEND_GOSSIP_MENU(3762, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM( 0, "He is not safe, i'll make sure of that.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + player->ADD_GOSSIP_ITEM( 0, GOSSIP_SL5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); player->SEND_GOSSIP_MENU(3763, _Creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+5: @@ -107,6 +115,8 @@ bool GossipSelect_npc_rivern_frostwind(Player *player, Creature *_Creature, uint ## npc_witch_doctor_mauari ######*/ +#define GOSSIP_HWDM "I'd like you to make me a new Cache of Mau'ari please." + bool GossipHello_npc_witch_doctor_mauari(Player *player, Creature *_Creature) { if(_Creature->isQuestGiver()) @@ -114,7 +124,7 @@ bool GossipHello_npc_witch_doctor_mauari(Player *player, Creature *_Creature) if(player->GetQuestRewardStatus(975)) { - player->ADD_GOSSIP_ITEM(0, "I'd like you to make me a new Cache of Mau'ari please.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(0, GOSSIP_HWDM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(3377, _Creature->GetGUID()); }else player->SEND_GOSSIP_MENU(3375, _Creature->GetGUID()); diff --git a/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp b/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp index 72c283f9f32..2275efbb586 100644 --- a/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp +++ b/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp @@ -38,7 +38,7 @@ EndContentData */ #define GOSSIP_ITEM_BLESS_ASH "Grant me your mark, wise ancient." #define GOSSIP_ITEM_BLESS_KEL "Grant me your mark, mighty ancient." -#define GOSSIP_REWARD_BLESS "You have my blessing" +#define GOSSIP_REWARD_BLESS -1000359 //#define TEXT_BLESSINGS "<You need higher standing with Cenarion Expedition to recive a blessing.>" bool GossipHello_npcs_ashyen_and_keleth(Player *player, Creature *_Creature ) @@ -69,19 +69,19 @@ bool GossipSelect_npcs_ashyen_and_keleth(Player *player, Creature *_Creature, ui { //mark of lore case REP_FRIENDLY: _Creature->CastSpell(player, 31808, true); - _Creature->Say(GOSSIP_REWARD_BLESS, LANG_UNIVERSAL, 0); + DoScriptText(GOSSIP_REWARD_BLESS, _Creature); break; case REP_HONORED: _Creature->CastSpell(player, 31810, true); - _Creature->Say(GOSSIP_REWARD_BLESS, LANG_UNIVERSAL, 0); + DoScriptText(GOSSIP_REWARD_BLESS, _Creature); break; case REP_REVERED: _Creature->CastSpell(player, 31811, true); - _Creature->Say(GOSSIP_REWARD_BLESS, LANG_UNIVERSAL, 0); + DoScriptText(GOSSIP_REWARD_BLESS, _Creature); break; case REP_EXALTED: _Creature->CastSpell(player, 31815, true); - _Creature->Say(GOSSIP_REWARD_BLESS, LANG_UNIVERSAL, 0); + DoScriptText(GOSSIP_REWARD_BLESS, _Creature); break; } } @@ -92,19 +92,19 @@ bool GossipSelect_npcs_ashyen_and_keleth(Player *player, Creature *_Creature, ui { case REP_FRIENDLY: _Creature->CastSpell(player, 31807, true); - _Creature->Say(GOSSIP_REWARD_BLESS, LANG_UNIVERSAL, 0); + DoScriptText(GOSSIP_REWARD_BLESS, _Creature); break; case REP_HONORED: _Creature->CastSpell(player, 31812, true); - _Creature->Say(GOSSIP_REWARD_BLESS, LANG_UNIVERSAL, 0); + DoScriptText(GOSSIP_REWARD_BLESS, _Creature); break; case REP_REVERED: _Creature->CastSpell(player, 31813, true); - _Creature->Say(GOSSIP_REWARD_BLESS, LANG_UNIVERSAL, 0); + DoScriptText(GOSSIP_REWARD_BLESS, _Creature); break; case REP_EXALTED: _Creature->CastSpell(player, 31814, true); - _Creature->Say(GOSSIP_REWARD_BLESS, LANG_UNIVERSAL, 0); + DoScriptText(GOSSIP_REWARD_BLESS, _Creature); break; } } @@ -255,12 +255,12 @@ bool GossipSelect_npc_mortog_steamhead(Player *player, Creature *_Creature, uint ## npc_kayra_longmane ######*/ -#define SAY_PROGRESS_1 "Is the way clear? Let's get out while we can, $N." -#define SAY_PROGRESS_2 "Looks like we won't get away so easy. Get ready!" -#define SAY_PROGRESS_3 "Let's keep moving. We're not safe here!" -#define SAY_PROGRESS_4 "Look out, $N! Enemies ahead!" -#define SAY_PROGRESS_5 "We're almost to the refuge! Let's go." -#define SAY_PROGRESS_6 "I can see my fellow druids from here. Thank you, $N. I'm sure Ysiel will reward you for your actions!" +#define SAY_PROGRESS_1 -1000360 +#define SAY_PROGRESS_2 -1000361 +#define SAY_PROGRESS_3 -1000362 +#define SAY_PROGRESS_4 -1000363 +#define SAY_PROGRESS_5 -1000364 +#define SAY_PROGRESS_6 -1000365 #define QUEST_EFU 9752 #define MOB_AMBUSH 18042 @@ -274,6 +274,7 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI void Reset() { Completed = false; + m_creature->setFaction(1660); } void Aggro(Unit* who){} @@ -290,21 +291,21 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI switch(i) { - case 0: DoSay(SAY_PROGRESS_1, LANG_UNIVERSAL, player); break; - case 5: DoSay(SAY_PROGRESS_2, LANG_UNIVERSAL, player); + case 0: DoScriptText(SAY_PROGRESS_1, m_creature, player); break; + case 5: DoScriptText(SAY_PROGRESS_2, m_creature, player); m_creature->SummonCreature(MOB_AMBUSH, -922.24, 5357.98, 17.93, 5.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); m_creature->SummonCreature(MOB_AMBUSH, -922.24, 5357.98, 17.93, 5.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); break; - case 6: DoSay(SAY_PROGRESS_3, LANG_UNIVERSAL, player); + case 6: DoScriptText(SAY_PROGRESS_3, m_creature, player); m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 18: DoSay(SAY_PROGRESS_4, LANG_UNIVERSAL, player); + case 18: DoScriptText(SAY_PROGRESS_4, m_creature, player); m_creature->SummonCreature(MOB_AMBUSH, -671.86, 5379.81, 22.12, 5.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); m_creature->SummonCreature(MOB_AMBUSH, -671.86, 5379.81, 22.12, 5.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); break; case 19: m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - DoSay(SAY_PROGRESS_5, LANG_UNIVERSAL, player); break; - case 26: DoSay(SAY_PROGRESS_6, LANG_UNIVERSAL, player); + DoScriptText(SAY_PROGRESS_5, m_creature, player); break; + case 26: DoScriptText(SAY_PROGRESS_6, m_creature, player); Completed = true; if(player) ((Player*)player)->GroupEventHappens(QUEST_EFU, m_creature); diff --git a/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp b/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp index 54e27bbf7ce..4a199759691 100644 --- a/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp +++ b/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp @@ -395,7 +395,7 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI if(Mangle_Timer < diff) { - if(!m_creature->getVictim()->HasAura(SPELL_MANGLEEFFECT, 0)) + if(m_creature->getVictim() && !m_creature->getVictim()->HasAura(SPELL_MANGLEEFFECT, 0)) { DoCast(m_creature->getVictim(), SPELL_MANGLE); Mangle_Timer = 1000; diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp index 14f3702354d..a440ba4a575 100644 --- a/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp +++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp @@ -131,7 +131,8 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI void UpdateAI(const uint32 diff) { - if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + Unit *victim = m_creature->SelectHostilTarget(); + if(!victim) return; if( m_creature->getVictim() && m_creature->isAlive()) @@ -234,11 +235,11 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI }else Fear_Timer -=diff; //Mortal Strike if target below 50% hp - if (m_creature->getVictim()->GetHealth() < m_creature->getVictim()->GetMaxHealth()*0.5) + if (victim && victim->GetHealth() < victim->GetMaxHealth()*0.5) { if (MortalStrike_Timer < diff) { - DoCast(m_creature->getVictim(),SPELL_MORTAL_STRIKE); + DoCast(victim,SPELL_MORTAL_STRIKE); MortalStrike_Timer = 15000; }else MortalStrike_Timer -= diff; } diff --git a/src/game/AuctionHouse.cpp b/src/game/AuctionHouse.cpp index 71a8bb495b4..c200c9751a6 100644 --- a/src/game/AuctionHouse.cpp +++ b/src/game/AuctionHouse.cpp @@ -28,6 +28,7 @@ #include "UpdateMask.h" #include "AuctionHouseObject.h" #include "Util.h" +#include "AuctionHouseBot.h" //please DO NOT use iterator++, because it is slower than ++iterator!!! //post-incrementation is always slower than pre-incrementation ! @@ -171,7 +172,10 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPri std::ostringstream msgAuctionOutbiddedSubject; msgAuctionOutbiddedSubject << auction->item_template << ":0:" << AUCTION_OUTBIDDED; - if (oldBidder) + if (oldBidder && !_player) + oldBidder->GetSession()->SendAuctionBidderNotification( auction->location, auction->Id, AHBplayerGUID, newPrice, objmgr.GetAuctionOutBid(auction->bid), auction->item_template); + + if (oldBidder && _player) oldBidder->GetSession()->SendAuctionBidderNotification( auction->location, auction->Id, _player->GetGUID(), newPrice, objmgr.GetAuctionOutBid(auction->bid), auction->item_template); WorldSession::SendMailTo(oldBidder, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->location, auction->bidder, msgAuctionOutbiddedSubject.str(), 0, NULL, auction->bid, 0, MAIL_CHECK_MASK_NONE); diff --git a/src/game/AuctionHouseBot.cpp b/src/game/AuctionHouseBot.cpp new file mode 100644 index 00000000000..f05d31abb41 --- /dev/null +++ b/src/game/AuctionHouseBot.cpp @@ -0,0 +1,1198 @@ +#include "AuctionHouseBot.h" +#include "Bag.h" +#include "Config/ConfigEnv.h" +#include "Database/DatabaseEnv.h" +#include "Item.h" +#include "Log.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "World.h" +#include "WorldSession.h" +#include "time.h" +#include <vector> +#include <iostream> + +using namespace std; + +static bool debug_Out = sConfig.GetIntDefault("AuctionHouseBot.DEBUG", 0); + +static vector<uint32> npcItems; +static vector<uint32> lootItems; +static vector<uint32> whiteTradeGoods; +static vector<uint32> greenTradeGoods; +static vector<uint32> blueTradeGoods; +static vector<uint32> purpleTradeGoods; +static vector<uint32> whiteItems; +static vector<uint32> greenItems; +static vector<uint32> blueItems; +static vector<uint32> purpleItems; + +static bool AHBSeller = 0; +static bool AHBBuyer = 0; + +static bool Vendor_Items = 0; +static bool Loot_Items = 0; +static bool Other_Items = 0; + +static bool No_Bind = 0; +static bool Bind_When_Picked_Up = 0; +static bool Bind_When_Equipped = 0; +static bool Bind_When_Use = 0; +static bool Bind_Quest_Item = 0; + +static AHBConfig AllianceConfig = AHBConfig(2); +static AHBConfig HordeConfig = AHBConfig(6); +static AHBConfig NeutralConfig = AHBConfig(7); +time_t _lastrun_a; +time_t _lastrun_h; +time_t _lastrun_n; + +/////////////////////////////////////////////////////////////////////////////// +// +/////////////////////////////////////////////////////////////////////////////// +static inline uint32 minValue(uint32 a, uint32 b) +{ + return a <= b ? a : b; +} + +/////////////////////////////////////////////////////////////////////////////// +// +/////////////////////////////////////////////////////////////////////////////// +static void addNewAuctions(Player *AHBplayer, AHBConfig *config) +{ + if (!AHBSeller) + return; + AuctionHouseObject* auctionHouse = objmgr.GetAuctionsMap(config->GetAHID()); + uint32 items = 0; + uint32 minItems = config->GetMinItems(); + uint32 maxItems = config->GetMaxItems(); + uint32 auctions = auctionHouse->Getcount(); + + if (auctions >= minItems) + return; + if (auctions <= maxItems) + { + if ((maxItems - auctions) > ItemsPerCycle) + items = ItemsPerCycle; + else + items = (maxItems - auctions); + } + uint32 wtgbin = config->GetPercents(AHB_WHITE_TG); + uint32 gtgbin = config->GetPercents(AHB_GREEN_TG); + uint32 btgbin = config->GetPercents(AHB_BLUE_TG); + uint32 ptgbin = config->GetPercents(AHB_PURPLE_TG); + uint32 wibin = config->GetPercents(AHB_WHITE_I); + uint32 gibin = config->GetPercents(AHB_GREEN_I); + uint32 bibin = config->GetPercents(AHB_BLUE_I); + uint32 pibin = config->GetPercents(AHB_PURPLE_I); + uint32 total = wtgbin + gtgbin + btgbin + ptgbin + wibin + gibin + bibin + pibin; + + uint32 pItems = 0; + uint32 bItems = 0; + uint32 gItems = 0; + uint32 wItems = 0; + uint32 pTGoods = 0; + uint32 bTGoods = 0; + uint32 gTGoods = 0; + uint32 wTGoods = 0; + for (AuctionHouseObject::AuctionEntryMap::iterator itr = auctionHouse->GetAuctionsBegin();itr != auctionHouse->GetAuctionsEnd();++itr) + { + AuctionEntry *Aentry = itr->second; + Item *item = objmgr.GetAItem(Aentry->item_guidlow); + if( item ) + { + ItemPrototype const *prototype = item->GetProto(); + if( prototype ) + { + switch (prototype->Quality) + { + case 0: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + wTGoods = wTGoods + 1; + else + wItems = wItems + 1; + break; + + case 1: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + wTGoods = wTGoods + 1; + else + wItems = wItems + 1; + break; + + case 2: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + gTGoods = gTGoods + 1; + else + gItems = gItems + 1; + break; + + case 3: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + bTGoods = bTGoods + 1; + else + bItems = bItems + 1; + break; + + case 4: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + pTGoods = pTGoods + 1; + else + pItems = pItems + 1; + break; + } + } + } + } + // only insert a few at a time, so as not to peg the processor + for (uint32 cnt = 1;cnt <= items;cnt++) + { + uint32 itemID = 0; + while (itemID == 0) + { + uint32 choice = urand(1, 8); + switch (choice) + { + case 1: + { + if ((purpleItems.size() > 0) && (pItems < pibin)) + { + itemID = purpleItems[urand(0, purpleItems.size() - 1)]; + pItems = pItems + 1; + break; + } + } + case 2: + { + if ((blueItems.size() > 0) && (bItems < bibin)) + { + itemID = blueItems[urand(0, blueItems.size() - 1)]; + bItems = bItems + 1; + break; + } + } + case 3: + { + if ((greenItems.size() > 0) && (gItems < gibin)) + { + itemID = greenItems[urand(0, greenItems.size() - 1)]; + gItems = gItems + 1; + break; + } + } + case 4: + { + if ((whiteItems.size() > 0) && (wItems < wibin)) + { + itemID = whiteItems[urand(0, whiteItems.size() - 1)]; + wItems = wItems + 1; + break; + } + } + case 5: + { + if ((purpleTradeGoods.size() > 0) && (pTGoods < ptgbin)) + { + itemID = purpleTradeGoods[urand(0, purpleTradeGoods.size() - 1)]; + pTGoods = pTGoods + 1; + break; + } + } + case 6: + { + if ((blueTradeGoods.size() > 0) && (bTGoods < btgbin)) + { + itemID = blueTradeGoods[urand(0, blueTradeGoods.size() - 1)]; + bTGoods = bTGoods + 1; + break; + } + } + case 7: + { + if ((greenTradeGoods.size() > 0) && (gTGoods < gtgbin)) + { + itemID = greenTradeGoods[urand(0, greenTradeGoods.size() - 1)]; + gTGoods = gTGoods + 1; + break; + } + } + case 8: + { + if ((whiteTradeGoods.size() > 0) && (wTGoods < wtgbin)) + { + itemID = whiteTradeGoods[urand(0, whiteTradeGoods.size() - 1)]; + wTGoods = wTGoods + 1; + break; + } + } + default: + { + break; + } + } + } + + ItemPrototype const* prototype = objmgr.GetItemPrototype(itemID); + if (prototype == NULL) + { + sLog.outString("AuctionHouseBot: Huh?!?! prototype == NULL"); + continue; + } + + Item* item = Item::CreateItem(itemID, 1, AHBplayer); + item->AddToUpdateQueueOf(AHBplayer); + if (item == NULL) + { + sLog.outString("AuctionHouseBot: Item::CreateItem() returned NULL"); + break; + } + + uint32 randomPropertyId = Item::GenerateItemRandomPropertyId(itemID); + if (randomPropertyId != 0) + item->SetItemRandomProperties(randomPropertyId); + + uint32 buyoutPrice; + uint32 bidPrice = 0; + uint32 stackCount = urand(1, item->GetMaxStackCount()); + + switch (SellMethod) + { + case 0: + buyoutPrice = prototype->SellPrice * item->GetCount(); + break; + case 1: + buyoutPrice = prototype->BuyPrice * item->GetCount(); + break; + default: + buyoutPrice = 0; + break; + } + + switch (prototype->Quality) + { + case 1: + if (config->GetMaxStack(AHB_WHITE) != 0) + { + stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_WHITE))); + } + buyoutPrice *= urand(config->GetMinPrice(AHB_WHITE), config->GetMaxPrice(AHB_WHITE)) * stackCount; + buyoutPrice /= 100; + bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_WHITE), config->GetMaxBidPrice(AHB_WHITE)); + bidPrice /= 100; + break; + + case 2: + if (config->GetMaxStack(AHB_GREEN) != 0) + { + stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_GREEN))); + } + buyoutPrice *= urand(config->GetMinPrice(AHB_GREEN), config->GetMaxPrice(AHB_GREEN)) * stackCount; + buyoutPrice /= 100; + bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_GREEN), config->GetMaxBidPrice(AHB_GREEN)); + bidPrice /= 100; + break; + + case 3: + if (config->GetMaxStack(AHB_BLUE) != 0) + { + stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_BLUE))); + } + buyoutPrice *= urand(config->GetMinPrice(AHB_BLUE), config->GetMaxPrice(AHB_BLUE)) * stackCount; + buyoutPrice /= 100; + bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_BLUE), config->GetMaxBidPrice(AHB_BLUE)); + bidPrice /= 100; + break; + + case 4: + if (config->GetMaxStack(AHB_PURPLE) != 0) + { + stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_PURPLE))); + } + buyoutPrice *= urand(config->GetMinPrice(AHB_PURPLE), config->GetMaxPrice(AHB_PURPLE)) * stackCount; + buyoutPrice /= 100; + bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_PURPLE), config->GetMaxBidPrice(AHB_PURPLE)); + bidPrice /= 100; + break; + } + + item->SetCount(stackCount); + + AuctionEntry* auctionEntry = new AuctionEntry; + auctionEntry->Id = objmgr.GenerateAuctionID(); + auctionEntry->auctioneer = 0; + auctionEntry->item_guidlow = item->GetGUIDLow(); + auctionEntry->item_template = item->GetEntry(); + auctionEntry->owner = AHBplayer->GetGUIDLow(); + auctionEntry->startbid = bidPrice; + auctionEntry->buyout = buyoutPrice; + auctionEntry->bidder = 0; + auctionEntry->bid = 0; + auctionEntry->deposit = 0; + auctionEntry->location = config->GetAHID(); + auctionEntry->time = (time_t) (urand(config->GetMinTime(), config->GetMaxTime()) * 60 * 60 + time(NULL)); + item->SaveToDB(); + item->RemoveFromUpdateQueueOf(AHBplayer); + objmgr.AddAItem(item); + auctionHouse->AddAuction(auctionEntry); + + CharacterDatabase.PExecute("INSERT INTO `auctionhouse` (`id`," + "`auctioneerguid`,`itemguid`,`item_template`," + "`itemowner`,`buyoutprice`,`time`,`buyguid`," + "`lastbid`,`startbid`,`deposit`,`location`) " + "VALUES ('%u', '%u', '%u', '%u', '%u', '%u', " + "'" I64FMTD "', '%u', '%u', '%u', '%u', '%u')", + auctionEntry->Id, + auctionEntry->auctioneer, + auctionEntry->item_guidlow, + auctionEntry->item_template, + auctionEntry->owner, + auctionEntry->buyout, + (uint64) auctionEntry->time, + auctionEntry->bidder, + auctionEntry->bid, + auctionEntry->startbid, + auctionEntry->deposit, + auctionEntry->location); + } +} + +static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, WorldSession *session) +{ + if (!AHBBuyer) + return; + + // Fetches content of selected AH + AuctionHouseObject* auctionHouse = objmgr.GetAuctionsMap(config->GetAHID()); + AuctionHouseObject::AuctionEntryMap::iterator itr; + + itr = auctionHouse->GetAuctionsBegin(); + vector<uint32> possibleBids; + + while (itr != auctionHouse->GetAuctionsEnd()) + { + AuctionHouseObject::AuctionEntryMap::iterator tmp = itr; + ++itr; + // Check if the auction is ours + // if it is, we skip this iteration. + if(tmp->second->owner == AHBplayerGUID) + { + continue; + } + // Check that we haven't bidded in this auction already. + if(tmp->second->bidder != AHBplayerGUID) + { + uint32 tmpdata = tmp->second->Id; + possibleBids.push_back(tmpdata); + } + } + + // Do we have anything to bid? If not, stop here. + if(possibleBids.empty()) + { + return; + } + + // Choose random auction from possible auctions + uint32 auctionID = possibleBids[urand(0, possibleBids.size() - 1)]; + + // from auctionhouse.cpp, creates auction pointer & player pointer + AuctionEntry* auction = auctionHouse->GetAuction(auctionID); + + // get exact item information + Item *pItem = objmgr.GetAItem(auction->item_guidlow); + if (!pItem) + { + sLog.outError("Item doesn't exists, perhaps bought already?"); + return; + } + + // get item prototype + ItemPrototype const* prototype = objmgr.GetItemPrototype(auction->item_template); + + // check which price we have to use, startbid or if it is bidded already + if(debug_Out) + {sLog.outError("Auction Number: %u", auction->Id);} + if(debug_Out) + {sLog.outError("Item Template: %u", auction->item_template);} + if(debug_Out) + {sLog.outError("Buy Price: %u", prototype->BuyPrice);} + if(debug_Out) + {sLog.outError("Sell Price: %u", prototype->SellPrice);} + if(debug_Out) + {sLog.outError("Quality: %u", prototype->Quality);} + uint32 currentprice; + if(auction->bid) + { + currentprice = auction->bid; + if(debug_Out) + {sLog.outError("Current Price: %u", auction->bid);} + } + else + { + currentprice = auction->startbid; + if(debug_Out) + {sLog.outError("Current Price: %u", auction->startbid);} + } + uint32 bidprice; + + // Prepare portion from maximum bid + uint32 tmprate2 = urand(0, 100); + double tmprate = static_cast<double>(tmprate2); + if(debug_Out) + {sLog.outError("tmprate: %f", tmprate);} + double bidrate = tmprate / 100; + if(debug_Out) + {sLog.outError("bidrate: %f", bidrate);} + long double bidMax = 0; + + // check that bid has acceptable value and take bid based on vendorprice, stacksize and quality + switch (BuyMethod) + { + case 0: + switch (prototype->Quality) + { + case 0: + if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY)) + { + bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY); + } + break; + case 1: + if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE)) + { + bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE); + } + break; + case 2: + if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN)) + { + bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN); + } + break; + case 3: + if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE)) + { + bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE); + } + break; + case 4: + if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE)) + { + bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE); + } + break; + default: + // quality is something it shouldn't be, let's get out of here + if(debug_Out) + {sLog.outError("bidMax(fail): %f", bidMax);} + return; + break; + } + break; + case 1: + switch (prototype->Quality) + { + case 0: + if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY)) + { + bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY); + } + break; + case 1: + if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE)) + { + bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE); + } + break; + case 2: + if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN)) + { + bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN); + } + break; + case 3: + if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE)) + { + bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE); + } + break; + case 4: + if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE)) + { + bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE); + } + break; + default: + // quality is something it shouldn't be, let's get out of here + if(debug_Out) + {sLog.outError("bidMax(fail): %f", bidMax);} + return; + break; + } + break; + default: + bidMax = 0; + break; + } + if(debug_Out) + {sLog.outError("bidMax(succeed): %f", bidMax);} + + // check some special items, and do recalculating to their prices + switch (prototype->Class) + { + // ammo + case 6: + bidMax = 0; + break; + default: + break; + } + + if(bidMax == 0) + { + // quality check failed to get bidmax, let's get out of here + return; + } + + // Calculate our bid + long double bidvalue = currentprice + ( (bidMax - currentprice) * bidrate); + if(debug_Out) + {sLog.outError("bidvalue: %f", bidvalue);} + // Convert to uint32 + bidprice = static_cast<uint32>(bidvalue); + if(debug_Out) + {sLog.outError("bidprice: %u", bidprice);} + + // Check our bid is high enough to be valid. If not, correct it to minimum. + if((currentprice + objmgr.GetAuctionOutBid(currentprice)) > bidprice) + { + bidprice = currentprice + objmgr.GetAuctionOutBid(currentprice); + if(debug_Out) + {sLog.outError("bidprice(>): %u", bidprice);} + } + + // Check wether we do normal bid, or buyout + if ((bidprice < auction->buyout) || (auction->buyout == 0)) + { + + if (auction->bidder > 0) + { + if ( auction->bidder == AHBplayer->GetGUIDLow() ) + { + //pl->ModifyMoney( -int32(price - auction->bid)); + } + else + { + // mail to last bidder and return money + session->SendAuctionOutbiddedMail( auction , bidprice ); + //pl->ModifyMoney( -int32(price) ); + } + } + + auction->bidder = AHBplayer->GetGUIDLow(); + auction->bid = bidprice; + + // Saving auction into database + CharacterDatabase.PExecute("UPDATE auctionhouse SET buyguid = '%u',lastbid = '%u' WHERE id = '%u'", auction->bidder, auction->bid, auction->Id); + } + else + { + //buyout + if (AHBplayer->GetGUIDLow() == auction->bidder ) + { + //pl->ModifyMoney(-int32(auction->buyout - auction->bid)); + } + else + { + //pl->ModifyMoney(-int32(auction->buyout)); + if ( auction->bidder ) + { + session->SendAuctionOutbiddedMail( auction, auction->buyout ); + } + } + auction->bidder = AHBplayer->GetGUIDLow(); + auction->bid = auction->buyout; + + // Send mails to buyer & seller + objmgr.SendAuctionSuccessfulMail( auction ); + objmgr.SendAuctionWonMail( auction ); + + // Remove item from auctionhouse + objmgr.RemoveAItem(auction->item_guidlow); + // Remove auction + auctionHouse->RemoveAuction(auction->Id); + // Remove from database + CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE id = '%u'",auction->Id); + + delete auction; + } +} +/////////////////////////////////////////////////////////////////////////////// +// +/////////////////////////////////////////////////////////////////////////////// +void AuctionHouseBot() +{ + time_t _newrun = time(NULL); + if ((!AHBSeller) && (!AHBBuyer)) + return; + + WorldSession _session(AHBplayerAccount, NULL, 0, true, 0, LOCALE_enUS); + Player _AHBplayer(&_session); + _AHBplayer.MinimalLoadFromDB(NULL, AHBplayerGUID); + ObjectAccessor::Instance().AddObject(&_AHBplayer); + + if(sConfig.GetIntDefault("AllowTwoSide.Interaction.Auction",0) == 0) + { + addNewAuctions(&_AHBplayer, &AllianceConfig); + if (((_newrun - _lastrun_a) > (AllianceConfig.GetBiddingInterval() * 60)) && (AllianceConfig.GetBidsPerInterval() > 0)) + { + uint32 bids = AllianceConfig.GetBidsPerInterval(); + for (uint32 count = 1;count <= bids;count++) + { + addNewAuctionBuyerBotBid(&_AHBplayer, &AllianceConfig, &_session); + _lastrun_a = _newrun; + } + } + addNewAuctions(&_AHBplayer, &HordeConfig); + if (((_newrun - _lastrun_h) > (HordeConfig.GetBiddingInterval() *60)) && (HordeConfig.GetBidsPerInterval() > 0)) + { + uint32 bids = HordeConfig.GetBidsPerInterval(); + for (uint32 count = 1;count <= bids;count++) + { + addNewAuctionBuyerBotBid(&_AHBplayer, &HordeConfig, &_session); + _lastrun_h = _newrun; + } + } + } + addNewAuctions(&_AHBplayer, &NeutralConfig); + if (((_newrun - _lastrun_n) > (NeutralConfig.GetBiddingInterval() * 60)) && (NeutralConfig.GetBidsPerInterval() > 0)) + { + uint32 bids = NeutralConfig.GetBidsPerInterval(); + for (uint32 count = 1;count <= bids;count++) + { + addNewAuctionBuyerBotBid(&_AHBplayer, &NeutralConfig, &_session); + _lastrun_n = _newrun; + } + } + ObjectAccessor::Instance().RemoveObject(&_AHBplayer); +} +/////////////////////////////////////////////////////////////////////////////// +// +/////////////////////////////////////////////////////////////////////////////// +void AuctionHouseBotInit() +{ + AHBSeller = sConfig.GetBoolDefault("AuctionHouseBot.EnableSeller", 0); + AHBBuyer = sConfig.GetBoolDefault("AuctionHouseBot.EnableBuyer", 0); + No_Bind = sConfig.GetBoolDefault("AuctionHouseBot.No_Bind", 1); + Bind_When_Picked_Up = sConfig.GetBoolDefault("AuctionHouseBot.Bind_When_Picked_Up", 0); + Bind_When_Equipped = sConfig.GetBoolDefault("AuctionHouseBot.Bind_When_Equipped", 1); + Bind_When_Use = sConfig.GetBoolDefault("AuctionHouseBot.Bind_When_Use", 1); + Bind_Quest_Item = sConfig.GetBoolDefault("AuctionHouseBot.Bind_Quest_Item", 0); + + if(sConfig.GetBoolDefault("AllowTwoSide.Interaction.Auction",0) == 0) + { + AuctionHouseBotLoadValues(&AllianceConfig); + AuctionHouseBotLoadValues(&HordeConfig); + } + AuctionHouseBotLoadValues(&NeutralConfig); + + if (AHBSeller) + { + Vendor_Items = sConfig.GetBoolDefault("AuctionHouseBot.VendorItems", 0); + Loot_Items = sConfig.GetBoolDefault("AuctionHouseBot.LootItems", 1); + Other_Items = sConfig.GetBoolDefault("AuctionHouseBot.OtherItems", 0); + + QueryResult* results = (QueryResult*) NULL; + char npcQuery[] = "SELECT distinct `item` FROM `npc_vendor`"; + results = WorldDatabase.PQuery(npcQuery); + if (results != NULL) + { + do + { + Field* fields = results->Fetch(); + npcItems.push_back(fields[0].GetUInt32()); + + } while (results->NextRow()); + + delete results; + } + else + { + sLog.outString("AuctionHouseBot: \"%s\" failed", npcQuery); + } + + char lootQuery[] = "SELECT `item` FROM `creature_loot_template` UNION " + "SELECT `item` FROM `disenchant_loot_template` UNION " + "SELECT `item` FROM `fishing_loot_template` UNION " + "SELECT `item` FROM `gameobject_loot_template` UNION " + "SELECT `item` FROM `item_loot_template` UNION " + "SELECT `item` FROM `pickpocketing_loot_template` UNION " + "SELECT `item` FROM `prospecting_loot_template` UNION " + "SELECT `item` FROM `skinning_loot_template`"; + + results = WorldDatabase.PQuery(lootQuery); + if (results != NULL) + { + do + { + Field* fields = results->Fetch(); + lootItems.push_back(fields[0].GetUInt32()); + + } while (results->NextRow()); + + delete results; + } + else + { + sLog.outString("AuctionHouseBot: \"%s\" failed", lootQuery); + } + + for (uint32 itemID = 0; itemID < sItemStorage.MaxEntry; itemID++) + { + ItemPrototype const* prototype = objmgr.GetItemPrototype(itemID); + + if (prototype == NULL) + continue; + + switch (prototype->Bonding) + { + case 0: + if (!No_Bind) + continue; + break; + case 1: + if (!Bind_When_Picked_Up) + continue; + break; + case 2: + if (!Bind_When_Equipped) + continue; + break; + case 3: + if (!Bind_When_Use) + continue; + break; + case 4: + if (!Bind_Quest_Item) + continue; + break; + default: + continue; + break; + } + + switch (SellMethod) + { + case 0: + if (prototype->SellPrice == 0) + continue; + break; + case 1: + if (prototype->BuyPrice == 0) + continue; + break; + default: + continue; + break; + } + + if ((prototype->Quality < 1) || (prototype->Quality > 4)) + continue; + + if (Vendor_Items == 0) + { + bool isVendorItem = false; + + for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorItem); i++) + { + if (itemID == npcItems[i]) + isVendorItem = true; + } + + if (isVendorItem) + continue; + } + + if (Loot_Items == 0) + { + bool isLootItem = false; + + for (unsigned int i = 0; (i < lootItems.size()) && (!isLootItem); i++) + { + if (itemID == lootItems[i]) + isLootItem = true; + } + + if (isLootItem) + continue; + } + + if (Other_Items == 0) + { + bool isVendorItem = false; + bool isLootItem = false; + + for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorItem); i++) + { + if (itemID == npcItems[i]) + isVendorItem = true; + } + for (unsigned int i = 0; (i < lootItems.size()) && (!isLootItem); i++) + { + if (itemID == lootItems[i]) + isLootItem = true; + } + if ((!isLootItem) && (!isVendorItem)) + continue; + } + + switch (prototype->Quality) + { + case 1: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + whiteTradeGoods.push_back(itemID); + else + whiteItems.push_back(itemID); + break; + + case 2: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + greenTradeGoods.push_back(itemID); + else + greenItems.push_back(itemID); + break; + + case 3: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + blueTradeGoods.push_back(itemID); + else + blueItems.push_back(itemID); + break; + + case 4: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + purpleTradeGoods.push_back(itemID); + else + purpleItems.push_back(itemID); + break; + } + } + + if ((whiteTradeGoods.size() == 0) && + (greenTradeGoods.size() == 0) && + (blueTradeGoods.size() == 0) && + (purpleTradeGoods.size() == 0) && + (whiteItems.size() == 0) && + (greenItems.size() == 0) && + (blueItems.size() == 0) && + (purpleItems.size() == 0)) + { + sLog.outString("AuctionHouseBot: No items"); + AHBSeller = 0; + } + + sLog.outString("AuctionHouseBot:"); + sLog.outString("loaded %d white trade goods", whiteTradeGoods.size()); + sLog.outString("loaded %d green trade goods", greenTradeGoods.size()); + sLog.outString("loaded %d blue trade goods", blueTradeGoods.size()); + sLog.outString("loaded %d purple trade goods", purpleTradeGoods.size()); + sLog.outString("loaded %d white items", whiteItems.size()); + sLog.outString("loaded %d green items", greenItems.size()); + sLog.outString("loaded %d blue items", blueItems.size()); + sLog.outString("loaded %d purple items", purpleItems.size()); + } + sLog.outString("AuctionHouseBot by Paradox (original by ChrisK) has been loaded."); + sLog.outString("AuctionHouseBot now includes AHBuyer by Kerbe and Paradox"); + +} +void AuctionHouseBotCommands(uint32 command, uint32 ahMapID, uint32 col, char* args) +{ + AHBConfig *config; + switch (ahMapID) + { + case 2: + config = &AllianceConfig; + break; + case 6: + config = &HordeConfig; + break; + case 7: + config = &NeutralConfig; + break; + } + std::string color; + switch (col) + { + case AHB_GREY: + color = "grey"; + break; + case AHB_WHITE: + color = "white"; + break; + case AHB_GREEN: + color = "green"; + break; + case AHB_BLUE: + color = "blue"; + break; + case AHB_PURPLE: + color = "purple"; + break; + default: + break; + } + switch (command) + { + case 0: //ahexpire + { + AuctionHouseObject* auctionHouse = objmgr.GetAuctionsMap(ahMapID); + + AuctionHouseObject::AuctionEntryMap::iterator itr; + itr = auctionHouse->GetAuctionsBegin(); + + while (itr != auctionHouse->GetAuctionsEnd()) + { + if (itr->second->owner == AHBplayerGUID) + itr->second->time = sWorld.GetGameTime(); + + ++itr; + } + }break; + case 1: //min items + { + char * param1 = strtok(args, " "); + uint32 minItems = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET minitems = '%u' WHERE auctionhouse = '%u'", minItems, ahMapID); + config->SetMinItems(minItems); + }break; + case 2: //max items + { + char * param1 = strtok(args, " "); + uint32 maxItems = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxitems = '%u' WHERE auctionhouse = '%u'", maxItems, ahMapID); + config->SetMaxItems(maxItems); + }break; + case 3: //min time + { + char * param1 = strtok(args, " "); + uint32 minTime = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET mintime = '%u' WHERE auctionhouse = '%u'", minTime, ahMapID); + config->SetMinTime(minTime); + }break; + case 4: //max time + { + char * param1 = strtok(args, " "); + uint32 maxTime = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxtime = '%u' WHERE auctionhouse = '%u'", maxTime, ahMapID); + config->SetMaxTime(maxTime); + }break; + case 5: //percentages + { + char * param1 = strtok(args, " "); + char * param2 = strtok(NULL, " "); + char * param3 = strtok(NULL, " "); + char * param4 = strtok(NULL, " "); + char * param5 = strtok(NULL, " "); + char * param6 = strtok(NULL, " "); + char * param7 = strtok(NULL, " "); + char * param8 = strtok(NULL, " "); + uint32 wtg = (uint32) strtoul(param1, NULL, 0); + uint32 gtg = (uint32) strtoul(param2, NULL, 0); + uint32 btg = (uint32) strtoul(param3, NULL, 0); + uint32 ptg = (uint32) strtoul(param4, NULL, 0); + uint32 wi = (uint32) strtoul(param5, NULL, 0); + uint32 gi = (uint32) strtoul(param6, NULL, 0); + uint32 bi = (uint32) strtoul(param7, NULL, 0); + uint32 pi = (uint32) strtoul(param8, NULL, 0); + + CharacterDatabase.BeginTransaction(); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentwhitetradegoods = '%u' WHERE auctionhouse = '%u'", wtg, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentgreentradegoods = '%u' WHERE auctionhouse = '%u'", gtg, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentbluetradegoods = '%u' WHERE auctionhouse = '%u'", btg, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentpurpletradegoods = '%u' WHERE auctionhouse = '%u'", ptg, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentwhiteitems = '%u' WHERE auctionhouse = '%u'", wi, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentgreenitems = '%u' WHERE auctionhouse = '%u'", gi, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentblueitems = '%u' WHERE auctionhouse = '%u'", bi, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentpurpleitems = '%u' WHERE auctionhouse = '%u'", pi, ahMapID); + CharacterDatabase.CommitTransaction(); + config->SetPercentages(wtg, gtg, btg, ptg, wi, gi, bi, pi); + }break; + case 6: //min prices + { + char * param1 = strtok(args, " "); + uint32 minPrice = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET minprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), minPrice, ahMapID); + config->SetMinPrice(col, minPrice); + }break; + case 7: //max prices + { + char * param1 = strtok(args, " "); + uint32 maxPrice = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), maxPrice, ahMapID); + config->SetMaxPrice(col, maxPrice); + }break; + case 8: //min bid price + { + char * param1 = strtok(args, " "); + uint32 minBidPrice = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET minbidprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), minBidPrice, ahMapID); + config->SetMinBidPrice(col, minBidPrice); + }break; + case 9: //max bid price + { + char * param1 = strtok(args, " "); + uint32 maxBidPrice = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxbidprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), maxBidPrice, ahMapID); + config->SetMaxBidPrice(col, maxBidPrice); + }break; + case 10: //max stacks + { + char * param1 = strtok(args, " "); + uint32 maxStack = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxstack%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), maxStack, ahMapID); + config->SetMaxStack(col, maxStack); + }break; + case 11: //buyer bid prices + { + char * param1 = strtok(args, " "); + uint32 buyerPrice = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET buyerprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), buyerPrice, ahMapID); + config->SetBuyerPrice(col, buyerPrice); + }break; + case 12: //buyer bidding interval + { + char * param1 = strtok(args, " "); + uint32 bidInterval = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET buyerbiddinginterval = '%u' WHERE auctionhouse = '%u'", bidInterval, ahMapID); + config->SetBiddingInterval(bidInterval); + }break; + case 13: //buyer bids per interval + { + char * param1 = strtok(args, " "); + uint32 bidsPerInterval = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET buyerbidsperinterval = '%u' WHERE auctionhouse = '%u'", bidsPerInterval, ahMapID); + config->SetBidsPerInterval(bidsPerInterval); + }break; + default: + break; + } +} +void AuctionHouseBotLoadValues(AHBConfig *config) +{ + if (AHBSeller) + { + //load min and max items + config->SetMinItems(CharacterDatabase.PQuery("SELECT minitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxItems(CharacterDatabase.PQuery("SELECT maxitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("minItems = %u", config->GetMinItems()); + sLog.outError("maxItems = %u", config->GetMaxItems());} + //load min and max auction times + config->SetMinTime(CharacterDatabase.PQuery("SELECT mintime FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxTime(CharacterDatabase.PQuery("SELECT maxtime FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("minTime = %u", config->GetMinTime()); + sLog.outError("maxTime = %u", config->GetMaxTime());} + //load percentages + uint32 wtg = CharacterDatabase.PQuery("SELECT percentwhitetradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 gtg = CharacterDatabase.PQuery("SELECT percentgreentradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 btg = CharacterDatabase.PQuery("SELECT percentbluetradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 ptg = CharacterDatabase.PQuery("SELECT percentpurpletradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 wi = CharacterDatabase.PQuery("SELECT percentwhiteitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 gi = CharacterDatabase.PQuery("SELECT percentgreenitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 bi = CharacterDatabase.PQuery("SELECT percentblueitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 pi = CharacterDatabase.PQuery("SELECT percentpurpleitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + config->SetPercentages(wtg, gtg, btg, ptg, wi, gi, bi, pi); + if(debug_Out) + {sLog.outError("percentWhiteTradeGoods = %u", config->GetPercentages(AHB_WHITE_TG)); + sLog.outError("percentGreenTradeGoods = %u", config->GetPercentages(AHB_GREEN_TG)); + sLog.outError("percentBlueTradeGoods = %u", config->GetPercentages(AHB_BLUE_TG)); + sLog.outError("percentPurpleTradeGoods = %u", config->GetPercentages(AHB_PURPLE_TG)); + sLog.outError("percentWhiteItems = %u", config->GetPercentages(AHB_WHITE_I)); + sLog.outError("percentGreenItems = %u", config->GetPercentages(AHB_GREEN_I)); + sLog.outError("percentBlueItems = %u", config->GetPercentages(AHB_BLUE_I)); + sLog.outError("percentPurpleItems = %u", config->GetPercentages(AHB_PURPLE_I));} + //load min and max prices + config->SetMinPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT minpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT maxpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("minPriceWhite = %u", config->GetMinPrice(AHB_WHITE)); + sLog.outError("maxPriceWhite = %u", config->GetMaxPrice(AHB_WHITE));} + config->SetMinPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT minpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT maxpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("minPriceGreen = %u", config->GetMinPrice(AHB_GREEN)); + sLog.outError("maxPriceGreen = %u", config->GetMaxPrice(AHB_GREEN));} + config->SetMinPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT minpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT maxpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("minPriceBlue = %u", config->GetMinPrice(AHB_BLUE)); + sLog.outError("maxPriceBlue = %u", config->GetMaxPrice(AHB_BLUE));} + config->SetMinPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT minpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT maxpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("minPricePurple = %u", config->GetMinPrice(AHB_PURPLE)); + sLog.outError("maxPricePurple = %u", config->GetMaxPrice(AHB_PURPLE));} + //load min and max bid prices + config->SetMinBidPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT minbidpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError(",minBidPriceWhite = %u", config->GetMinBidPrice(AHB_WHITE));} + config->SetMaxBidPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT maxbidpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("maxBidPriceWhite = %u", config->GetMaxBidPrice(AHB_WHITE));} + config->SetMinBidPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT minbidpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("minBidPriceGreen = %u", config->GetMinBidPrice(AHB_GREEN));} + config->SetMaxBidPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT maxbidpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("maxBidPriceGreen = %u", config->GetMaxBidPrice(AHB_GREEN));} + config->SetMinBidPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT minbidpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("minBidPriceBlue = %u", config->GetMinBidPrice(AHB_BLUE));} + config->SetMaxBidPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT maxbidpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("maxBidPriceBlue = %u", config->GetMinBidPrice(AHB_BLUE));} + config->SetMinBidPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT minbidpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("minBidPricePurple = %u", config->GetMinBidPrice(AHB_PURPLE));} + config->SetMaxBidPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT maxbidpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("maxBidPricePurple = %u", config->GetMaxBidPrice(AHB_PURPLE));} + //load max stacks + config->SetMaxStack(AHB_WHITE, CharacterDatabase.PQuery("SELECT maxstackwhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("maxStackWhite = %u", config->GetMaxStack(AHB_WHITE));} + config->SetMaxStack(AHB_GREEN, CharacterDatabase.PQuery("SELECT maxstackgreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("maxStackGreen = %u", config->GetMaxStack(AHB_GREEN));} + config->SetMaxStack(AHB_BLUE, CharacterDatabase.PQuery("SELECT maxstackblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("maxStackBlue = %u", config->GetMaxStack(AHB_BLUE));} + config->SetMaxStack(AHB_PURPLE, CharacterDatabase.PQuery("SELECT maxstackpurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("maxStackPurple = %u", config->GetMaxStack(AHB_PURPLE));} + } + if (AHBBuyer) + { + //load buyer bid prices + config->SetBuyerPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT buyerpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetBuyerPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT buyerpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetBuyerPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT buyerpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetBuyerPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT buyerpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetBuyerPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT buyerpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("buyerPriceGrey = %u", config->GetBuyerPrice(AHB_GREY)); + sLog.outError("buyerPriceWhite = %u", config->GetBuyerPrice(AHB_WHITE)); + sLog.outError("buyerPriceGreen = %u", config->GetBuyerPrice(AHB_GREEN)); + sLog.outError("buyerPriceBlue = %u", config->GetBuyerPrice(AHB_BLUE)); + sLog.outError("buyerPricePurple = %u", config->GetBuyerPrice(AHB_PURPLE));} + //load bidding interval + config->SetBiddingInterval(CharacterDatabase.PQuery("SELECT buyerbiddinginterval FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("buyerBiddingInterval = %u", config->GetBiddingInterval());} + //load bids per interval + config->SetBidsPerInterval(CharacterDatabase.PQuery("SELECT buyerbidsperinterval FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if(debug_Out) + {sLog.outError("buyerBidsPerInterval = %u", config->GetBidsPerInterval());} + } +} diff --git a/src/game/AuctionHouseBot.h b/src/game/AuctionHouseBot.h new file mode 100644 index 00000000000..71b14d17a4a --- /dev/null +++ b/src/game/AuctionHouseBot.h @@ -0,0 +1,687 @@ +#ifndef AUCTION_HOUSE_BOT_H +#define AUCTION_HOUSE_BOT_H +#include "Common.h" +#include "Log.h" +#include "Config/ConfigEnv.h" +#define AHB_GREY 0 +#define AHB_WHITE 1 +#define AHB_GREEN 2 +#define AHB_BLUE 3 +#define AHB_PURPLE 4 +#define AHB_GREY_TG 0 +#define AHB_WHITE_TG 1 +#define AHB_GREEN_TG 2 +#define AHB_BLUE_TG 3 +#define AHB_PURPLE_TG 4 +#define AHB_GREY_I 5 +#define AHB_WHITE_I 6 +#define AHB_GREEN_I 7 +#define AHB_BLUE_I 8 +#define AHB_PURPLE_I 9 +#define AHBplayerAccount sConfig.GetIntDefault("AuctionHouseBot.Account", 0) +#define AHBplayerGUID sConfig.GetIntDefault("AuctionHouseBot.GUID", 0) +#define ItemsPerCycle sConfig.GetIntDefault("AuctionHouseBot.ItemsPerCycle", 200) +#define SellMethod sConfig.GetIntDefault("AuctionHouseBot.UseBuyPriceForSeller", 1) +#define BuyMethod sConfig.GetIntDefault("AuctionHouseBot.UseBuyPriceForBuyer", 0) + +class AHBConfig +{ + private: + uint32 AHID; + uint32 minItems; + uint32 maxItems; + uint32 minTime; + uint32 maxTime; + uint32 percentWhiteTradeGoods; + uint32 percentGreenTradeGoods; + uint32 percentBlueTradeGoods; + uint32 percentPurpleTradeGoods; + uint32 percentWhiteItems; + uint32 percentGreenItems; + uint32 percentBlueItems; + uint32 percentPurpleItems; + uint32 minPriceWhite; + uint32 maxPriceWhite; + uint32 minBidPriceWhite; + uint32 maxBidPriceWhite; + uint32 maxStackWhite; + uint32 minPriceGreen; + uint32 maxPriceGreen; + uint32 minBidPriceGreen; + uint32 maxBidPriceGreen; + uint32 maxStackGreen; + uint32 minPriceBlue; + uint32 maxPriceBlue; + uint32 minBidPriceBlue; + uint32 maxBidPriceBlue; + uint32 maxStackBlue; + uint32 minPricePurple; + uint32 maxPricePurple; + uint32 minBidPricePurple; + uint32 maxBidPricePurple; + uint32 maxStackPurple; + + uint32 buyerPriceGrey; + uint32 buyerPriceWhite; + uint32 buyerPriceGreen; + uint32 buyerPriceBlue; + uint32 buyerPricePurple; + uint32 buyerBiddingInterval; + uint32 buyerBidsPerInterval; + + uint32 wtgp; + uint32 gtgp; + uint32 btgp; + uint32 ptgp; + uint32 wip; + uint32 gip; + uint32 bip; + uint32 pip; + public: + AHBConfig(uint32 ahid) + { + AHID = ahid; + } + AHBConfig() + { + } + uint32 GetAHID() + { + return AHID; + } + void SetMinItems(uint32 value) + { + minItems = value; + } + uint32 GetMinItems() + { + if ((minItems == 0) && (maxItems)) + return maxItems; + else if ((maxItems) && (minItems > maxItems)) + return maxItems; + else + return minItems; + } + void SetMaxItems(uint32 value) + { + maxItems = value; + CalculatePercents(); + } + uint32 GetMaxItems() + { + return maxItems; + } + void SetMinTime(uint32 value) + { + minTime = value; + } + uint32 GetMinTime() + { + if (minTime < 1) + return 1; + else if ((maxTime) && (minTime > maxTime)) + return maxTime; + else + return minTime; + } + void SetMaxTime(uint32 value) + { + maxTime = value; + } + uint32 GetMaxTime() + { + return maxTime; + } + void SetPercentages(uint32 wtg, uint32 gtg, uint32 btg, uint32 ptg, uint32 wi, uint32 gi, uint32 bi, uint32 pi) + { + uint32 totalPercent = wtg + gtg + btg + ptg + wi + gi + bi + pi; + + if (totalPercent == 0) + { + maxItems = 0; + } + else if (totalPercent != 100) + { + double scale = (double) 100 / (double) totalPercent; + + wtg = (uint32) (scale * (double) pi); + gtg = (uint32) (scale * (double) gtg); + btg = (uint32) (scale * (double) btg); + ptg = (uint32) (scale * (double) ptg); + wi = (uint32) (scale * (double) wi); + gi = (uint32) (scale * (double) gi); + bi = (uint32) (scale * (double) bi); + pi = 100 - wtg - gtg - btg - ptg - wi - gi - bi; + + } + percentWhiteTradeGoods = wtg; + percentGreenTradeGoods = gtg; + percentBlueTradeGoods = btg; + percentPurpleTradeGoods = ptg; + percentWhiteItems = wi; + percentGreenItems = gi; + percentBlueItems = bi; + percentPurpleItems = pi; + CalculatePercents(); + } + uint32 GetPercentages(uint32 color) + { + switch(color) + { + case AHB_GREY_TG: + return 0; + break; + case AHB_WHITE_TG: + return percentWhiteTradeGoods; + break; + case AHB_GREEN_TG: + return percentGreenTradeGoods; + break; + case AHB_BLUE_TG: + return percentBlueTradeGoods; + break; + case AHB_PURPLE_TG: + return percentPurpleTradeGoods; + break; + case AHB_GREY_I: + return 0; + break; + case AHB_WHITE_I: + return percentWhiteItems; + break; + case AHB_GREEN_I: + return percentGreenItems; + break; + case AHB_BLUE_I: + return percentBlueItems; + break; + case AHB_PURPLE_I: + return percentPurpleItems; + break; + default: + return 0; + break; + } + } + void SetMinPrice(uint32 color, uint32 value) + { + switch(color) + { + case AHB_GREY: + break; + case AHB_WHITE: + minPriceWhite = value; + break; + case AHB_GREEN: + minPriceGreen = value; + break; + case AHB_BLUE: + minPriceBlue = value; + break; + case AHB_PURPLE: + minPricePurple = value; + break; + default: + break; + } + } + uint32 GetMinPrice(uint32 color) + { + switch(color) + { + case AHB_GREY: + { + return 0; + break; + } + case AHB_WHITE: + { + if (minPriceWhite == 0) + return 150; + else if (minPriceWhite > maxPriceWhite) + return maxPriceWhite; + else + return minPriceWhite; + break; + } + case AHB_GREEN: + { + if (minPriceGreen == 0) + return 200; + else if (minPriceGreen > maxPriceGreen) + return maxPriceGreen; + else + return minPriceGreen; + break; + } + case AHB_BLUE: + { + if (minPriceBlue == 0) + return 250; + else if (minPriceBlue > maxPriceBlue) + return maxPriceBlue; + else + return minPriceBlue; + break; + } + case AHB_PURPLE: + { + if (minPricePurple == 0) + return 300; + else if (minPricePurple > maxPricePurple) + return maxPricePurple; + else + return minPricePurple; + break; + } + default: + { + return 0; + break; + } + } + } + void SetMaxPrice(uint32 color, uint32 value) + { + switch(color) + { + case AHB_GREY: + break; + case AHB_WHITE: + maxPriceWhite = value; + break; + case AHB_GREEN: + maxPriceGreen = value; + break; + case AHB_BLUE: + maxPriceBlue = value; + break; + case AHB_PURPLE: + maxPricePurple = value; + break; + default: + break; + } + } + uint32 GetMaxPrice(uint32 color) + { + switch(color) + { + case AHB_GREY: + { + return 0; + break; + } + case AHB_WHITE: + { + if (maxPriceWhite == 0) + return 250; + else + return maxPriceWhite; + break; + } + case AHB_GREEN: + { + if (maxPriceGreen == 0) + return 300; + else + return maxPriceGreen; + break; + } + case AHB_BLUE: + { + if (maxPriceBlue == 0) + return 350; + else + return maxPriceBlue; + break; + } + case AHB_PURPLE: + { + if (maxPricePurple == 0) + return 450; + else + return maxPricePurple; + break; + } + default: + { + return 0; + break; + } + } + } + void SetMinBidPrice(uint32 color, uint32 value) + { + switch(color) + { + case AHB_GREY: + break; + case AHB_WHITE: + minBidPriceWhite = value; + break; + case AHB_GREEN: + minBidPriceGreen = value; + break; + case AHB_BLUE: + minBidPriceBlue = value; + break; + case AHB_PURPLE: + minBidPricePurple = value; + break; + default: + break; + } + } + uint32 GetMinBidPrice(uint32 color) + { + switch(color) + { + case AHB_GREY: + { + return 0; + break; + } + case AHB_WHITE: + { + if (minBidPriceWhite > 100) + return 100; + else + return minBidPriceWhite; + break; + } + case AHB_GREEN: + { + if (minBidPriceGreen > 100) + return 100; + else + return minBidPriceGreen; + break; + } + case AHB_BLUE: + { + if (minBidPriceBlue > 100) + return 100; + else + return minBidPriceBlue; + break; + } + case AHB_PURPLE: + { + if (minBidPricePurple > 100) + return 100; + else + return minBidPricePurple; + break; + } + default: + { + return 0; + break; + } + } + } + void SetMaxBidPrice(uint32 color, uint32 value) + { + switch(color) + { + case AHB_GREY: + break; + case AHB_WHITE: + maxBidPriceWhite = value; + break; + case AHB_GREEN: + maxBidPriceGreen = value; + break; + case AHB_BLUE: + maxBidPriceBlue = value; + break; + case AHB_PURPLE: + maxBidPricePurple = value; + break; + default: + break; + } + } + uint32 GetMaxBidPrice(uint32 color) + { + switch(color) + { + case AHB_GREY: + { + return 0; + break; + } + case AHB_WHITE: + { + if (maxBidPriceWhite > 100) + return 100; + else + return maxBidPriceWhite; + break; + } + case AHB_GREEN: + { + if (maxBidPriceGreen > 100) + return 100; + else + return maxBidPriceGreen; + break; + } + case AHB_BLUE: + { + if (maxBidPriceBlue > 100) + return 100; + else + return maxBidPriceBlue; + break; + } + case AHB_PURPLE: + { + if (maxBidPricePurple > 100) + return 100; + else + return maxBidPricePurple; + break; + } + default: + { + return 0; + break; + } + } + } + void SetMaxStack(uint32 color, uint32 value) + { + switch(color) + { + case AHB_GREY: + break; + case AHB_WHITE: + maxStackWhite = value; + break; + case AHB_GREEN: + maxStackGreen = value; + break; + case AHB_BLUE: + maxStackBlue = value; + break; + case AHB_PURPLE: + maxStackPurple = value; + break; + default: + break; + } + } + uint32 GetMaxStack(uint32 color) + { + switch(color) + { + case AHB_GREY: + { + return 0; + break; + } + case AHB_WHITE: + { + return maxStackWhite; + break; + } + case AHB_GREEN: + { + return maxStackGreen; + break; + } + case AHB_BLUE: + { + return maxStackBlue; + break; + } + case AHB_PURPLE: + { + return maxStackPurple; + break; + } + default: + { + return 0; + break; + } + } + } + void SetBuyerPrice(uint32 color, uint32 value) + { + switch(color) + { + case AHB_GREY: + buyerPriceGrey = value; + break; + case AHB_WHITE: + buyerPriceWhite = value; + break; + case AHB_GREEN: + buyerPriceGreen = value; + break; + case AHB_BLUE: + buyerPriceBlue = value; + break; + case AHB_PURPLE: + buyerPricePurple = value; + break; + default: + break; + } + } + uint32 GetBuyerPrice(uint32 color) + { + switch(color) + { + case AHB_GREY: + return buyerPriceGrey; + break; + case AHB_WHITE: + return buyerPriceWhite; + break; + case AHB_GREEN: + return buyerPriceGreen; + break; + case AHB_BLUE: + return buyerPriceBlue; + break; + case AHB_PURPLE: + return buyerPricePurple; + break; + default: + return 0; + break; + } + } + void SetBiddingInterval(uint32 value) + { + buyerBiddingInterval = value; + } + uint32 GetBiddingInterval() + { + return buyerBiddingInterval; + } + void CalculatePercents() + { + wtgp = (uint32) (((double)percentWhiteTradeGoods / 100.0) * maxItems); + gtgp = (uint32) (((double)percentGreenTradeGoods / 100.0) * maxItems); + btgp = (uint32) (((double)percentBlueTradeGoods / 100.0) * maxItems); + ptgp = (uint32) (((double)percentPurpleTradeGoods / 100.0) * maxItems); + wip = (uint32) (((double)percentWhiteItems / 100.0) * maxItems); + gip = (uint32) (((double)percentGreenItems / 100.0) * maxItems); + bip = (uint32) (((double)percentBlueItems / 100.0) * maxItems); + pip = (uint32) (((double)percentPurpleItems / 100.0) * maxItems); + uint32 total = wtgp + gtgp + btgp + ptgp + wip + gip + bip + pip; + if (total != maxItems) + { + wtgp = (uint32) (maxItems * (double) wtgp); + gtgp = (uint32) (maxItems * (double) gtgp); + btgp = (uint32) (maxItems * (double) btgp); + ptgp = (uint32) (maxItems * (double) ptgp); + wip = (uint32) (maxItems * (double) wip); + gip = (uint32) (maxItems * (double) gip); + bip = (uint32) (maxItems * (double) bip); + pip = (maxItems - (wtgp + gtgp + btgp + ptgp + wip + gip + bip)); + total = wtgp + gtgp + btgp + ptgp + wip + gip + bip + pip; + } + //sLog.outString("%u %u %u %u %u %u %u %u", wtgp, gtgp, btgp, ptgp, wip, gip, bip, pip); + } + uint32 GetPercents(uint32 color) + { + switch(color) + { + case AHB_GREY_TG: + return 0; + break; + case AHB_WHITE_TG: + return wtgp; + break; + case AHB_GREEN_TG: + return gtgp; + break; + case AHB_BLUE_TG: + return btgp; + break; + case AHB_PURPLE_TG: + return ptgp; + break; + case AHB_GREY_I: + return 0; + break; + case AHB_WHITE_I: + return wip; + break; + case AHB_GREEN_I: + return gip; + break; + case AHB_BLUE_I: + return bip; + break; + case AHB_PURPLE_I: + return pip; + break; + default: + return 0; + break; + } + } + void SetBidsPerInterval(uint32 value) + { + buyerBidsPerInterval = value; + } + uint32 GetBidsPerInterval() + { + return buyerBidsPerInterval; + } + ~AHBConfig() + { + } +}; +void AuctionHouseBot(); +void AuctionHouseBotInit(); +void AuctionHouseBotLoadValues(AHBConfig*); +void AuctionHouseBotCommands(uint32, uint32, uint32, char*); +#endif diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt index db1e31f2414..8cee1325205 100644 --- a/src/game/CMakeLists.txt +++ b/src/game/CMakeLists.txt @@ -13,6 +13,8 @@ SET(game_STAT_SRCS ArenaTeam.h ArenaTeamHandler.cpp AuctionHouse.cpp + AuctionHouseBot.cpp + AuctionHouseBot.h AuctionHouseObject.h Bag.cpp Bag.h diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index fc25216a55e..d6cdde47a8c 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -616,6 +616,7 @@ ChatCommand * ChatHandler::getCommandTable() { "cometome", SEC_ADMINISTRATOR, false, &ChatHandler::HandleComeToMeCommand, "", NULL }, { "damage", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDamageCommand, "", NULL }, { "combatstop", SEC_GAMEMASTER, false, &ChatHandler::HandleCombatStopCommand, "", NULL }, + { "ahbotoptions", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotOptionsCommand, "", NULL }, { "flusharenapoints", SEC_ADMINISTRATOR, false, &ChatHandler::HandleFlushArenaPointsCommand, "", NULL }, { "chardelete", SEC_CONSOLE, true, &ChatHandler::HandleCharacterDeleteCommand, "", NULL }, { "sendmessage", SEC_ADMINISTRATOR, true, &ChatHandler::HandleSendMessageCommand, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index 1b7224c3f0d..90936c9ac91 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -100,6 +100,7 @@ class ChatHandler bool HandleAccountSetPasswordCommand(const char* args); bool HandleHelpCommand(const char* args); + bool HandleAHBotOptionsCommand(const char * args); bool HandleCommandsCommand(const char* args); bool HandleStartCommand(const char* args); bool HandleDismountCommand(const char* args); diff --git a/src/game/Creature.h b/src/game/Creature.h index 1ae41b86776..563a9ddb80c 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -630,6 +630,7 @@ class TRINITY_DLL_SPEC Creature : public Unit bool IsFormationLeader() {return (GetDBTableGUIDLow() && GetDBTableGUIDLow() == m_formationID);} uint32 GetFormationID(){return m_formationID;} + Unit *SelectHostilTarget(); protected: bool CreateFromProto(uint32 guidlow,uint32 Entry,uint32 team, const CreatureData *data = NULL); bool InitEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL); diff --git a/src/game/DestinationHolderImp.h b/src/game/DestinationHolderImp.h index f799c8613e7..f30768e7993 100644 --- a/src/game/DestinationHolderImp.h +++ b/src/game/DestinationHolderImp.h @@ -96,14 +96,12 @@ DestinationHolder<TRAVELLER>::StartTravel(TRAVELLER &traveller, bool sendMove) else //Walking on the ground dist = sqrt((dx*dx) + (dy*dy)); + float speed; if(traveller.GetTraveller().hasUnitState(UNIT_STAT_CHARGING)) - i_totalTravelTime = 1000; + speed = 0.025f; // assume it is 25 yard per second else - { - float speed = traveller.Speed(); - speed *= 0.001f; // speed is in seconds so convert from second to millisecond - i_totalTravelTime = static_cast<uint32>(dist/speed); - } + speed = traveller.Speed() * 0.001f; // speed is in seconds so convert from second to millisecond + i_totalTravelTime = static_cast<uint32>(dist/speed); i_timeElapsed = 0; if(sendMove) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index b896164cade..7e7228f5885 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -52,6 +52,379 @@ #include "BattleGroundMgr.h" #include "InstanceSaveMgr.h" #include "InstanceData.h" +#include "AuctionHouseBot.h" + +bool ChatHandler::HandleAHBotOptionsCommand(const char* args) +{ + uint32 ahMapID = 0; + char * opt = strtok((char*)args, " "); + char * ahMapIdStr = strtok(NULL, " "); + if (ahMapIdStr) + { + ahMapID = (uint32) strtoul(ahMapIdStr, NULL, 0); + } + if (!opt) + { + PSendSysMessage("Syntax is: ahbotoptions $option $ahMapID (2, 6 or 7) $parameter"); + PSendSysMessage("Try ahbotoptions help to see a list of options."); + return false; + } + int l = strlen(opt); + + if (strncmp(opt,"help",l) == 0) + { + PSendSysMessage("AHBot commands:"); + PSendSysMessage("ahexpire"); + PSendSysMessage("minitems"); + PSendSysMessage("maxitems"); + PSendSysMessage("mintime"); + PSendSysMessage("maxtime"); + PSendSysMessage("percentages"); + PSendSysMessage("minprice"); + PSendSysMessage("maxprice"); + PSendSysMessage("minbidprice"); + PSendSysMessage("maxbidprice"); + PSendSysMessage("maxstack"); + PSendSysMessage("buyerprice"); + PSendSysMessage("bidinterval"); + PSendSysMessage("bidsperinterval"); + return true; + } + else if (strncmp(opt,"ahexpire",l) == 0) + { + if (!ahMapIdStr) + { + PSendSysMessage("Syntax is: ahbotoptions ahexpire $ahMapID (2, 6 or 7)"); + return false; + } + AuctionHouseBotCommands(0, ahMapID, NULL, NULL); + } + else if (strncmp(opt,"minitems",l) == 0) + { + char * param1 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1)) + { + PSendSysMessage("Syntax is: ahbotoptions minitems $ahMapID (2, 6 or 7) $minItems"); + return false; + } + AuctionHouseBotCommands(1, ahMapID, NULL, param1); + } + else if (strncmp(opt,"maxitems",l) == 0) + { + char * param1 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1)) + { + PSendSysMessage("Syntax is: ahbotoptions maxitems $ahMapID (2, 6 or 7) $maxItems"); + return false; + } + AuctionHouseBotCommands(2, ahMapID, NULL, param1); + } + else if (strncmp(opt,"mintime",l) == 0) + { + char * param1 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1)) + { + PSendSysMessage("Syntax is: ahbotoptions mintime $ahMapID (2, 6 or 7) $mintime"); + return false; + } + AuctionHouseBotCommands(3, ahMapID, NULL, param1); + } + else if (strncmp(opt,"maxtime",l) == 0) + { + char * param1 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1)) + { + PSendSysMessage("Syntax is: ahbotoptions maxtime $ahMapID (2, 6 or 7) $maxtime"); + return false; + } + AuctionHouseBotCommands(4, ahMapID, NULL, param1); + } + else if (strncmp(opt,"percentages",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + char * param3 = strtok(NULL, " "); + char * param4 = strtok(NULL, " "); + char * param5 = strtok(NULL, " "); + char * param6 = strtok(NULL, " "); + char * param7 = strtok(NULL, " "); + char * param8 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1) || (!param2) || (!param3) || (!param4) || (!param5) || (!param6) || (!param7) || (!param8)) + { + PSendSysMessage("Syntax is: ahbotoptions percentages $ahMapID (2, 6 or 7) $1 $2 $3 $4 $5 $6 $7 $8"); + PSendSysMessage("1 WhiteTradeGoods 2 GreenTradeGoods 3 BlueTradeGoods 4 PurpleTradeGoods"); + PSendSysMessage("5 WhiteItems 6 GreenItems 7 BlueItems 8 PurpleItems"); + PSendSysMessage("The total must add up to 100%"); + return false; + } + uint32 wtg = (uint32) strtoul(param1, NULL, 0); + uint32 gtg = (uint32) strtoul(param2, NULL, 0); + uint32 btg = (uint32) strtoul(param3, NULL, 0); + uint32 ptg = (uint32) strtoul(param4, NULL, 0); + uint32 wi = (uint32) strtoul(param5, NULL, 0); + uint32 gi = (uint32) strtoul(param6, NULL, 0); + uint32 bi = (uint32) strtoul(param7, NULL, 0); + uint32 pi = (uint32) strtoul(param8, NULL, 0); + uint32 totalPercent = wtg + gtg + btg + ptg + wi + gi + bi + pi; + if ((totalPercent == 0) || (totalPercent != 100)) + { + PSendSysMessage("Syntax is: ahbotoptions percentages $ahMapID (2, 6 or 7) $1 $2 $3 $4 $5 $6 $7 $8"); + PSendSysMessage("1 WhiteTradeGoods 2 GreenTradeGoods 3 BlueTradeGoods 4 PurpleTradeGoods"); + PSendSysMessage("5 WhiteItems 6 GreenItems 7 BlueItems 8 PurpleItems"); + PSendSysMessage("The total must add up to 100%"); + return false; + } + char param[100]; + param[0] = '\0'; + strcat(param, param1); + strcat(param, " "); + strcat(param, param2); + strcat(param, " "); + strcat(param, param3); + strcat(param, " "); + strcat(param, param4); + strcat(param, " "); + strcat(param, param5); + strcat(param, " "); + strcat(param, param6); + strcat(param, " "); + strcat(param, param7); + strcat(param, " "); + strcat(param, param8); + AuctionHouseBotCommands(5, ahMapID, NULL, param); + } + else if (strncmp(opt,"minprice",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1) || (!param2)) + { + PSendSysMessage("Syntax is: ahbotoptions minprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price"); + return false; + } + if (strncmp(param1,"white",l) == 0) + { + AuctionHouseBotCommands(6, ahMapID, AHB_WHITE, param2); + } + else if (strncmp(param1,"green",l) == 0) + { + AuctionHouseBotCommands(6, ahMapID, AHB_GREEN, param2); + } + else if (strncmp(param1,"blue",l) == 0) + { + AuctionHouseBotCommands(6, ahMapID, AHB_BLUE, param2); + } + else if (strncmp(param1,"purple",l) == 0) + { + AuctionHouseBotCommands(6, ahMapID, AHB_PURPLE, param2); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions minprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price"); + return false; + } + } + else if (strncmp(opt,"maxprice",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1) || (!param2)) + { + PSendSysMessage("Syntax is: ahbotoptions maxprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price"); + return false; + } + if (strncmp(param1,"white",l) == 0) + { + AuctionHouseBotCommands(7, ahMapID, AHB_WHITE, param2); + } + else if (strncmp(param1,"green",l) == 0) + { + AuctionHouseBotCommands(7, ahMapID, AHB_GREEN, param2); + } + else if (strncmp(param1,"blue",l) == 0) + { + AuctionHouseBotCommands(7, ahMapID, AHB_BLUE, param2); + } + else if (strncmp(param1,"purple",l) == 0) + { + AuctionHouseBotCommands(7, ahMapID, AHB_PURPLE, param2); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions maxprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price"); + return false; + } + } + else if (strncmp(opt,"minbidprice",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1) || (!param2)) + { + PSendSysMessage("Syntax is: ahbotoptions minbidprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price"); + return false; + } + uint32 minBidPrice = (uint32) strtoul(param2, NULL, 0); + if ((minBidPrice < 1) || (minBidPrice > 100)) + { + PSendSysMessage("The min bid price multiplier must be between 1 and 100"); + return false; + } + if (strncmp(param1,"white",l) == 0) + { + AuctionHouseBotCommands(8, ahMapID, AHB_WHITE, param2); + } + else if (strncmp(param1,"green",l) == 0) + { + AuctionHouseBotCommands(8, ahMapID, AHB_GREEN, param2); + } + else if (strncmp(param1,"blue",l) == 0) + { + AuctionHouseBotCommands(8, ahMapID, AHB_BLUE, param2); + } + else if (strncmp(param1,"purple",l) == 0) + { + AuctionHouseBotCommands(8, ahMapID, AHB_PURPLE, param2); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions minbidprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price"); + return false; + } + } + else if (strncmp(opt,"maxbidprice",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1) || (!param2)) + { + PSendSysMessage("Syntax is: ahbotoptions maxbidprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price"); + return false; + } + uint32 maxBidPrice = (uint32) strtoul(param2, NULL, 0); + if ((maxBidPrice < 1) || (maxBidPrice > 100)) + { + PSendSysMessage("The max bid price multiplier must be between 1 and 100"); + return false; + } + if (strncmp(param1,"white",l) == 0) + { + AuctionHouseBotCommands(9, ahMapID, AHB_WHITE, param2); + } + else if (strncmp(param1,"green",l) == 0) + { + AuctionHouseBotCommands(9, ahMapID, AHB_GREEN, param2); + } + else if (strncmp(param1,"blue",l) == 0) + { + AuctionHouseBotCommands(9, ahMapID, AHB_BLUE, param2); + } + else if (strncmp(param1,"purple",l) == 0) + { + AuctionHouseBotCommands(9, ahMapID, AHB_PURPLE, param2); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions max bidprice $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $price"); + return false; + } + } + else if (strncmp(opt,"maxstack",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1) || (!param2)) + { + PSendSysMessage("Syntax is: ahbotoptions maxstack $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $value"); + return false; + } + uint32 maxStack = (uint32) strtoul(param2, NULL, 0); + if (maxStack < 0) + { + PSendSysMessage("maxstack can't be a negative number."); + return false; + } + if (strncmp(param1,"white",l) == 0) + { + AuctionHouseBotCommands(10, ahMapID, AHB_WHITE, param2); + } + else if (strncmp(param1,"green",l) == 0) + { + AuctionHouseBotCommands(10, ahMapID, AHB_GREEN, param2); + } + else if (strncmp(param1,"blue",l) == 0) + { + AuctionHouseBotCommands(10, ahMapID, AHB_BLUE, param2); + } + else if (strncmp(param1,"purple",l) == 0) + { + AuctionHouseBotCommands(10, ahMapID, AHB_PURPLE, param2); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions maxstack $ahMapID (2, 6 or 7) $color (white, green, blue or purple) $value"); + return false; + } + } + else if (strncmp(opt,"buyerprice",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1) || (!param2)) + { + PSendSysMessage("Syntax is: ahbotoptions buyerprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue or purple) $price"); + return false; + } + if (strncmp(param1,"white",l) == 0) + { + AuctionHouseBotCommands(11, ahMapID, AHB_WHITE, param2); + } + else if (strncmp(param1,"green",l) == 0) + { + AuctionHouseBotCommands(11, ahMapID, AHB_GREEN, param2); + } + else if (strncmp(param1,"blue",l) == 0) + { + AuctionHouseBotCommands(11, ahMapID, AHB_BLUE, param2); + } + else if (strncmp(param1,"purple",l) == 0) + { + AuctionHouseBotCommands(11, ahMapID, AHB_PURPLE, param2); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions buyerprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue or purple) $price"); + return false; + } + } + else if (strncmp(opt,"bidinterval",l) == 0) + { + char * param1 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1)) + { + PSendSysMessage("Syntax is: ahbotoptions bidinterval $ahMapID (2, 6 or 7) $interval(in minutes)"); + return false; + } + AuctionHouseBotCommands(12, ahMapID, NULL, param1); + } + else if (strncmp(opt,"bidsperinterval",l) == 0) + { + char * param1 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1)) + { + PSendSysMessage("Syntax is: ahbotoptions bidsperinterval $ahMapID (2, 6 or 7) $bids"); + return false; + } + AuctionHouseBotCommands(13, ahMapID, NULL, param1); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions $option $ahMapID (2, 6 or 7) $parameter"); + PSendSysMessage("Try ahbotoptions help to see a list of options."); + return false; + } + return true; +} //reload commands bool ChatHandler::HandleReloadCommand(const char* arg) @@ -716,7 +1089,7 @@ bool ChatHandler::HandleLoadScriptsCommand(const char* args) { if(!LoadScriptingModule(args)) return true; - sWorld.SendWorldText(LANG_SCRIPTS_RELOADED); + sWorld.SendGMText(LANG_SCRIPTS_RELOADED); return true; } diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index 00211094d4e..48bf94c4411 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -30,6 +30,7 @@ #include "Unit.h" #include "Language.h" #include "Database/DBCStores.h" +#include "AuctionHouseBot.h" void MailItem::deleteItem( bool inDB ) { @@ -348,7 +349,14 @@ void WorldSession::HandleReturnToSender(WorldPacket & recv_data ) } } - SendReturnToSender(MAIL_NORMAL, GetAccountId(), m->receiver, m->sender, m->subject, m->itemTextId, &mi, m->money, m->mailTemplateId); + if (m->sender == AHBplayerGUID) + { + SendReturnToSender(MAIL_CREATURE, GetAccountId(), m->receiver, m->sender, m->subject, m->itemTextId, &mi, m->money, m->mailTemplateId); + } + else + { + SendReturnToSender(MAIL_NORMAL, GetAccountId(), m->receiver, m->sender, m->subject, m->itemTextId, &mi, m->money, m->mailTemplateId); + } delete m; //we can deallocate old mail pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, 0); @@ -765,6 +773,14 @@ void WorldSession::HandleMsgQueryNextMailtime(WorldPacket & /*recv_data*/ ) void WorldSession::SendMailTo(Player* receiver, uint8 messageType, uint8 stationery, uint32 sender_guidlow_or_entry, uint32 receiver_guidlow, std::string subject, uint32 itemTextId, MailItemsInfo* mi, uint32 money, uint32 COD, uint32 checked, uint32 deliver_delay, uint16 mailTemplateId) { + if (receiver_guidlow == AHBplayerGUID) + { + if(messageType == MAIL_AUCTION && mi) // auction mail with items + { + mi->deleteIncludedItems(true); + } + return; + } uint32 mailId = objmgr.GenerateMailID(); time_t deliver_time = time(NULL) + deliver_delay; diff --git a/src/game/Map.cpp b/src/game/Map.cpp index d9971518bf3..7bf4c3fa83e 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -797,6 +797,10 @@ void Map::Update(const uint32 &t_diff) void Map::Remove(Player *player, bool remove) { + player->DestroyForNearbyPlayers(); + player->m_IsInNotifyList = false; + player->m_Notified = false; + // this may be called during Map::Update // after decrement+unlink, ++m_mapRefIter will continue correctly // when the first element of the list is being removed @@ -835,7 +839,7 @@ void Map::Remove(Player *player, bool remove) SendRemoveTransports(player); //UpdateObjectsVisibilityFor(player,cell,p); - AddUnitToNotify(player); + //AddUnitToNotify(player); if( remove ) DeleteFromWorld(player); @@ -1638,14 +1642,6 @@ void Map::RemoveAllObjectsInRemoveList() //sLog.outDebug("Object remover 2 check."); } -bool Map::CanUnload(const uint32 &diff) -{ - if(!m_unloadTimer) return false; - if(m_unloadTimer < diff) return true; - m_unloadTimer -= diff; - return false; -} - uint32 Map::GetPlayersCountExceptGMs() const { uint32 count = 0; diff --git a/src/game/Map.h b/src/game/Map.h index 9c06ac3fa47..bcdf3ec8f6a 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -133,7 +133,15 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O virtual ~Map(); // currently unused for normal maps - virtual bool CanUnload(const uint32& diff); + bool CanUnload(uint32 diff) + { + if(!m_unloadTimer) + return false; + if(m_unloadTimer <= diff) + return true; + m_unloadTimer -= diff; + return false; + } virtual bool Add(Player *); virtual void Remove(Player *, bool); diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index edf58fd762e..fd23991392a 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -500,6 +500,10 @@ void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data ) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); + // remove mounts this fix bug where getting pet from stable while mounted deletes pet. + if(GetPlayer()->IsMounted()) + GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED); + SendStablePet(npcGUID); } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 46d10e37b12..533b9e68ac2 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1735,7 +1735,15 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati ResetContestedPvP(); - DestroyForNearbyPlayers(); + /*DestroyForNearbyPlayers(); + { + UpdateData data; + for(ClientGUIDs::iterator i = m_clientGUIDs.begin(); i != m_clientGUIDs.end(); ++i) + data.AddOutOfRangeGUID(*i); + WorldPacket packet; + data.BuildPacket(&packet); + GetSession()->SendPacket(&packet); + }*/ m_clientGUIDs.clear(); // remove player from battleground on far teleport (when changing maps) @@ -18745,8 +18753,7 @@ void Player::SetClientControl(Unit* target, uint8 allowMove) void Player::UpdateZoneDependentAuras( uint32 newZone ) { // remove new continent flight forms - if( !isGameMaster() && - GetVirtualMapForMapAndZone(GetMapId(),newZone) != 530) + if(!CanFlyInMap(GetVirtualMapForMapAndZone(GetMapId(),newZone))) { RemoveSpellsCausingAura(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED); RemoveSpellsCausingAura(SPELL_AURA_FLY); @@ -19211,3 +19218,55 @@ void Player::UpdateCharmedAI() Attack(target, true); } } + +bool Player::CanFlyInMap(const uint32 mapID) const +{ + // we return false if the map doesn't even exist + MapEntry const *entry = sMapStore.LookupEntry(mapID); + if(!entry) + { + sLog.outDebug("Unknown mapID handed to Player::CanFlyInMap; disallowing flying."); + return false; + } + + // GMs can always fly + if( isGameMaster() ) + { + return true; + } + + // check whether we can fly here depending on map/config + switch(mapID) + { + // kalimdor/eastern kingdoms + case 0: + case 1: + { + return sWorld.getConfig(CONFIG_FLYING_MOUNTS_AZEROTH); + } + // outland + case 530: + { + return sWorld.getConfig(CONFIG_FLYING_MOUNTS_OUTLAND); + } + // all other maps + default: + { + return sWorld.getConfig(CONFIG_FLYING_MOUNTS_OTHERS); + } + } +} + +// this is just a dummy function that does the same as CanFlyInMap, but based on area ID +bool Player::CanFlyInArea(const uint32 areaID) const +{ + // we return false if the area doesn't even exist + AreaTableEntry const *entry = sAreaStore.LookupEntry(areaID); + if(!entry) + { + sLog.outDebug("Unknown areaID handed to Player::CanFlyInArea; disallowing flying."); + return false; + } + + return CanFlyInMap(entry->mapid); +} diff --git a/src/game/Player.h b/src/game/Player.h index cdf2005f111..90a0f29ab81 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2036,6 +2036,10 @@ class TRINITY_DLL_SPEC Player : public Unit uint32 GetOldPetSpell() const { return m_oldpetspell; } void SetOldPetSpell(uint32 petspell) { m_oldpetspell = petspell; } + // check if player can fly in map/area according to config + bool CanFlyInMap(const uint32 mapID) const; + bool CanFlyInArea(const uint32 areaID) const; + /*********************************************************/ /*** INSTANCE SYSTEM ***/ /*********************************************************/ diff --git a/src/game/PointMovementGenerator.cpp b/src/game/PointMovementGenerator.cpp index 31b696bcd3b..bb37d7b9479 100644 --- a/src/game/PointMovementGenerator.cpp +++ b/src/game/PointMovementGenerator.cpp @@ -57,7 +57,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff) if(i_destinationHolder.HasArrived()) { - unit.StopMoving(); + //unit.StopMoving(); if(!unit.hasUnitState(UNIT_STAT_CHARGING)) MovementInform(unit); return false; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index aa0d24ffdb8..fb5662bfd7b 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2114,7 +2114,7 @@ void Spell::prepare(SpellCastTargets * targets, Aura* triggeredByAura) } } -void Spell::cancel() +void Spell::cancel(bool report) { if(m_spellState == SPELL_STATE_FINISHED) return; @@ -2144,7 +2144,7 @@ void Spell::cancel() m_caster->RemoveAurasDueToCasterSpell(m_spellInfo->Id, m_caster->GetGUID()); SendChannelUpdate(0); SendInterrupted(0); - SendCastResult(SPELL_FAILED_INTERRUPTED); + SendCastResult(report ? SPELL_FAILED_INTERRUPTED : SPELL_FAILED_DONT_REPORT); } break; default: @@ -3440,7 +3440,8 @@ uint8 Spell::CanCast(bool strict) // check correctness positive/negative cast target (pet cast real check and cheating check) if(IsPositiveSpell(m_spellInfo->Id)) { - if(m_caster->IsHostileTo(target)) + //dispel positivity is dependant on target, don't check it + if(m_caster->IsHostileTo(target) && !IsDispel(m_spellInfo)) return SPELL_FAILED_BAD_TARGETS; } else @@ -3683,6 +3684,12 @@ uint8 Spell::CanCast(bool strict) if(m_targets.getUnitTarget() && !m_caster->IsFriendlyTo(m_targets.getUnitTarget()) && !m_caster->HasInArc( M_PI, target )) return SPELL_FAILED_UNIT_NOT_INFRONT; } + else if (m_spellInfo->Id == 19938) // Awaken Peon + { + Unit *unit = m_targets.getUnitTarget(); + if(!unit || !unit->HasAura(17743, 0)) + return SPELL_FAILED_BAD_TARGETS; + } break; } case SPELL_EFFECT_SCHOOL_DAMAGE: @@ -4165,14 +4172,11 @@ uint8 Spell::CanCast(bool strict) case SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED: case SPELL_AURA_FLY: { - // not allow cast fly spells at old maps by players (all spells is self target) if(m_caster->GetTypeId()==TYPEID_PLAYER) { - if( !((Player*)m_caster)->isGameMaster() && - GetVirtualMapForMapAndZone(m_caster->GetMapId(),m_caster->GetZoneId()) != 530) + if(!((Player*)m_caster)->CanFlyInMap(GetVirtualMapForMapAndZone(m_caster->GetMapId(),m_caster->GetZoneId()))) return SPELL_FAILED_NOT_HERE; } - break; } case SPELL_AURA_PERIODIC_MANA_LEECH: diff --git a/src/game/Spell.h b/src/game/Spell.h index 474336edab8..9debbf7efd9 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -323,7 +323,7 @@ class Spell ~Spell(); void prepare(SpellCastTargets * targets, Aura* triggeredByAura = NULL); - void cancel(); + void cancel(bool report = true); void update(uint32 difftime); void cast(bool skipCheck = false); void finish(bool ok = true); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index ab35c5f3d76..fa1b957c243 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -3579,7 +3579,8 @@ void Spell::EffectSummonGuardian(uint32 i) } // trigger - if(!m_originalCaster || m_originalCaster->GetTypeId() != TYPEID_PLAYER /*m_spellInfo->Id == 40276*/) + if(!m_originalCaster || m_originalCaster->GetTypeId() != TYPEID_PLAYER + && !((Creature*)m_originalCaster)->isTotem()/*m_spellInfo->Id == 40276*/) { EffectSummonWild(i); return; @@ -3591,20 +3592,20 @@ void Spell::EffectSummonGuardian(uint32 i) // Search old Guardian only for players (if casted spell not have duration or cooldown) // FIXME: some guardians have control spell applied and controlled by player and anyway player can't summon in this time // so this code hack in fact - if( m_caster->GetTypeId() == TYPEID_PLAYER && (duration <= 0 || GetSpellRecoveryTime(m_spellInfo)==0) ) - if(((Player*)m_caster)->HasGuardianWithEntry(pet_entry)) + if( m_originalCaster->GetTypeId() == TYPEID_PLAYER && (duration <= 0 || GetSpellRecoveryTime(m_spellInfo)==0) ) + if(((Player*)m_originalCaster)->HasGuardianWithEntry(pet_entry)) return; // find old guardian, ignore summon // in another case summon new - uint32 level = m_caster->getLevel(); + uint32 level = m_originalCaster->getLevel(); // level of pet summoned using engineering item based at engineering skill level - if(m_caster->GetTypeId()==TYPEID_PLAYER && m_CastItem) + if(m_originalCaster->GetTypeId()==TYPEID_PLAYER && m_CastItem) { ItemPrototype const *proto = m_CastItem->GetProto(); if(proto && proto->RequiredSkill == SKILL_ENGINERING) { - uint16 skill202 = ((Player*)m_caster)->GetSkillValue(SKILL_ENGINERING); + uint16 skill202 = ((Player*)m_originalCaster)->GetSkillValue(SKILL_ENGINERING); if(skill202) { level = skill202/5; @@ -3667,14 +3668,14 @@ void Spell::EffectSummonGuardian(uint32 i) if(duration > 0) spawnCreature->SetDuration(duration); - spawnCreature->SetOwnerGUID(m_caster->GetGUID()); + spawnCreature->SetOwnerGUID(m_originalCaster->GetGUID()); spawnCreature->setPowerType(POWER_MANA); spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS , 0); - spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction()); + spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_originalCaster->getFaction()); spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS,0); spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP,0); - spawnCreature->SetCreatorGUID(m_caster->GetGUID()); + spawnCreature->SetCreatorGUID(m_originalCaster->GetGUID()); spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); spawnCreature->InitStatsForLevel(level); @@ -3682,8 +3683,8 @@ void Spell::EffectSummonGuardian(uint32 i) spawnCreature->AIM_Initialize(); - if(m_caster->GetTypeId()==TYPEID_PLAYER) - ((Player*)m_caster)->AddGuardian(spawnCreature); + if(m_originalCaster->GetTypeId()==TYPEID_PLAYER) + ((Player*)m_originalCaster)->AddGuardian(spawnCreature); map->Add((Creature*)spawnCreature); } @@ -5881,6 +5882,10 @@ void Spell::EffectSendTaxi(uint32 i) case 34905: //Stealth Flight mountid = 6851; break; + case 41533: //Fly of the Netherwing + case 41540: //Fly of the Netherwing + mountid = 23468; + break; } ((Player*)unitTarget)->ActivateTaxiPathTo(nodes,mountid); diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 2ebb273ed19..258ab662d00 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -504,6 +504,8 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex) return true; case 28441: // not positive dummy spell case 37675: // Chaos Blast + case 41519: // Mark of Stormrage + case 34877: // Custodian of Time return false; } @@ -2181,6 +2183,7 @@ void SpellMgr::LoadSpellCustomAttr() case 37790: //Spread Shot case 46771: //Flame Sear case 45248: //Shadow Blades + case 41303: // Soul Drain spellInfo->MaxAffectedTargets = 3; break; case 38310: //Multi-Shot diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 04a9f2c621f..6f645406dc6 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -382,16 +382,22 @@ inline bool IsAreaAuraEffect(uint32 effect) return true; return false; } - -inline bool IsDispelSpell(SpellEntry const *spellInfo) +inline bool IsDispel(SpellEntry const *spellInfo) { //spellsteal is also dispel if (spellInfo->Effect[0] == SPELL_EFFECT_DISPEL || - spellInfo->Effect[0] == SPELL_EFFECT_STEAL_BENEFICIAL_BUFF || spellInfo->Effect[1] == SPELL_EFFECT_DISPEL || + spellInfo->Effect[2] == SPELL_EFFECT_DISPEL) + return true; + return false; +} +inline bool IsDispelSpell(SpellEntry const *spellInfo) +{ + //spellsteal is also dispel + if (spellInfo->Effect[0] == SPELL_EFFECT_STEAL_BENEFICIAL_BUFF || spellInfo->Effect[1] == SPELL_EFFECT_STEAL_BENEFICIAL_BUFF || - spellInfo->Effect[2] == SPELL_EFFECT_DISPEL || - spellInfo->Effect[2] == SPELL_EFFECT_STEAL_BENEFICIAL_BUFF) + spellInfo->Effect[2] == SPELL_EFFECT_STEAL_BENEFICIAL_BUFF + ||IsDispel(spellInfo)) return true; return false; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6d2eb1ec4cc..9d9b1fdc101 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -258,8 +258,21 @@ Unit::~Unit() if(m_charmInfo) delete m_charmInfo; - RemoveAllAuras(); - assert(m_Auras.begin() == m_Auras.end()); + if(m_uint32Values) + { + sLog.outDetail("Deconstruct Unit Entry = %u", GetEntry()); + /*for(int i = 0; i < TOTAL_AURAS; ++i) + { + if(m_modAuras[i].begin() != m_modAuras[i].end()) + sLog.outError("Unit %u has mod auras during deconstruction", GetEntry()); + } + if(m_scAuras.begin() != m_scAuras.end()) + sLog.outError("Unit %u has sc auras during deconstruction", GetEntry()); + if(m_interruptableAuras.begin() != m_interruptableAuras.end()) + sLog.outError("Unit %u has interruptable auras during deconstruction", GetEntry()); + if(m_ccAuras.begin() != m_ccAuras.end()) + sLog.outError("Unit %u has cc auras during deconstruction", GetEntry());*/ + } } void Unit::Update( uint32 p_time ) @@ -614,11 +627,16 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa } } } - } - + } + if (damagetype != NODAMAGE) + { + // interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras) + pVictim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DAMAGE, spellProto ? spellProto->Id : 0); + pVictim->RemoveSpellbyDamageTaken(damage, spellProto ? spellProto->Id : 0); + } - if(!damage) //when will zero damage? need interrupt aura? + if(!damage) { // Rage from physical damage received . if(cleanDamage && cleanDamage->damage && (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL) && pVictim->GetTypeId() == TYPEID_PLAYER && (pVictim->getPowerType() == POWER_RAGE)) @@ -790,9 +808,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (damagetype != NODAMAGE && damage)// && pVictim->GetTypeId() == TYPEID_PLAYER) { - pVictim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DAMAGE, spellProto ? spellProto->Id : 0); - pVictim->RemoveSpellbyDamageTaken(damage, spellProto ? spellProto->Id : 0); - /*const SpellEntry *se = i->second->GetSpellProto(); next = i; ++next; if (spellProto && spellProto->Id == se->Id) // Not drop auras added by self @@ -4640,7 +4655,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) // Statue unsummoned at aura remove Totem* statue = NULL; - bool caster_channeled = false; + bool channeled = false; if(IsChanneledSpell(AurSpellInfo)) { if(!caster) // can be already located for IsSingleTargetSpell case @@ -4650,8 +4665,25 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) { if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE) statue = ((Totem*)caster); - else - caster_channeled = caster==this; + + // stop caster chanelling state + else if(caster->m_currentSpells[CURRENT_CHANNELED_SPELL] + //prevent recurential call + && caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED) + { + if (caster==this || !IsAreaOfEffectSpell(AurSpellInfo)) + { + // remove auras only for non-aoe spells or when chanelled aura is removed + // because aoe spells don't require aura on target to continue + if (AurSpellInfo->EffectApplyAuraName[Aur->GetEffIndex()]!=SPELL_AURA_PERIODIC_DUMMY + && AurSpellInfo->EffectApplyAuraName[Aur->GetEffIndex()]!= SPELL_AURA_DUMMY) + //don't stop channeling of scripted spells (this is actually a hack) + { + caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel(false); + channeled = true; + } + } + } } } @@ -4662,13 +4694,6 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) Aur->SetStackAmount(0); Aur->_RemoveAura(); - delete Aur; - - if(caster_channeled) - RemoveAurasAtChanneledTarget (AurSpellInfo); - - if(statue) - statue->UnSummon(); if(mode != AURA_REMOVE_BY_STACK) { @@ -4684,6 +4709,19 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) } } + delete Aur; + + if(channeled) + { + //if target is not caster remove auras also on caster + if (caster!=this) + caster->RemoveAurasAtChanneledTarget (AurSpellInfo, caster); + RemoveAurasAtChanneledTarget (AurSpellInfo, caster); + } + + if(statue) + statue->UnSummon(); + // only way correctly remove all auras from list if( m_Auras.empty() ) i = m_Auras.end(); @@ -10368,18 +10406,17 @@ void Unit::TauntFadeOut(Unit *taunter) //====================================================================== -bool Unit::SelectHostilTarget() +Unit* Creature::SelectHostilTarget() { //function provides main threat functionality //next-victim-selection algorithm and evade mode are called //threat list sorting etc. - assert(GetTypeId()== TYPEID_UNIT); Unit* target = NULL; //This function only useful once AI has been initialized - if (!((Creature*)this)->AI()) - return false; + if (!AI()) + return NULL; if(!m_ThreatManager.isThreatListEmpty()) { @@ -10395,36 +10432,36 @@ bool Unit::SelectHostilTarget() { if(!hasUnitState(UNIT_STAT_STUNNED)) SetInFront(target); - ((Creature*)this)->AI()->AttackStart(target); - return true; + AI()->AttackStart(target); + return getVictim(); } // no target but something prevent go to evade mode if( !isInCombat() /*|| HasAuraType(SPELL_AURA_MOD_TAUNT)*/ ) - return false; + return NULL; // last case when creature don't must go to evade mode: // it in combat but attacker not make any damage and not enter to aggro radius to have record in threat list // for example at owner command to pet attack some far away creature // Note: creature not have targeted movement generator but have attacker in this case - if( GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE ) + /*if( GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE ) { for(AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr) { if( (*itr)->IsInMap(this) && canAttack(*itr) && (*itr)->isInAccessiblePlaceFor((Creature*)this) ) return false; } - } + }*/ // search nearby enemy before enter evade mode - if(((Creature*)this)->HasReactState(REACT_AGGRESSIVE)) + if(HasReactState(REACT_AGGRESSIVE)) { - if(Unit *target = ((Creature*)this)->SelectNearestTarget()) + if(target = SelectNearestTarget()) { - if(!((Creature*)this)->IsOutOfThreatArea(target)) + if(!IsOutOfThreatArea(target)) { - ((Creature*)this)->AI()->AttackStart(target); - return true; + AI()->AttackStart(target); + return getVictim(); } } } @@ -10435,16 +10472,16 @@ bool Unit::SelectHostilTarget() for(Unit::AuraList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr) if((*itr)->IsPermanent()) { - ((Creature*)this)->AI()->EnterEvadeMode(); + AI()->EnterEvadeMode(); break; } - return false; + return NULL; } // enter in evade mode in other case - ((Creature*)this)->AI()->EnterEvadeMode(); + AI()->EnterEvadeMode(); - return false; + return NULL; } //====================================================================== @@ -12548,23 +12585,23 @@ bool Unit::HandleMeandingAuraProc( Aura* triggeredByAura ) return true; } -void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo) +void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo, Unit * caster) { - uint64 target_guid = GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT); +/* uint64 target_guid = GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT); if(target_guid == GetGUID()) return; if(!IS_UNIT_GUID(target_guid)) return; - Unit* target = ObjectAccessor::GetUnit(*this, target_guid); - if(!target) + Unit* target = ObjectAccessor::GetUnit(*this, target_guid);*/ + if(!caster) return; - for (AuraMap::iterator iter = target->GetAuras().begin(); iter != target->GetAuras().end(); ) + for (AuraMap::iterator iter = GetAuras().begin(); iter != GetAuras().end(); ) { - if (iter->second->GetId() == spellInfo->Id && iter->second->GetCasterGUID()==GetGUID()) - target->RemoveAura(iter); + if (iter->second->GetId() == spellInfo->Id && iter->second->GetCasterGUID() == caster->GetGUID()) + RemoveAura(iter); else ++iter; } diff --git a/src/game/Unit.h b/src/game/Unit.h index 9b39254ee1e..83cb1900506 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -356,7 +356,7 @@ enum UnitState UNIT_STAT_STUNNED = 0x00000008, UNIT_STAT_ROAMING = 0x00000010, UNIT_STAT_CHASE = 0x00000020, - UNIT_STAT_SEARCHING = 0x00000040, + //UNIT_STAT_SEARCHING = 0x00000040, UNIT_STAT_FLEEING = 0x00000080, UNIT_STAT_IN_FLIGHT = 0x00000100, // player is in flight mode UNIT_STAT_FOLLOW = 0x00000200, @@ -368,9 +368,9 @@ enum UnitState UNIT_STAT_CASTING = 0x00008000, UNIT_STAT_POSSESSED = 0x00010000, UNIT_STAT_CHARGING = 0x00020000, - UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FOLLOW), + UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE), UNIT_STAT_LOST_CONTROL = (UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_CHARGING), - UNIT_STAT_SIGHTLESS = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING), + UNIT_STAT_SIGHTLESS = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CHASE), UNIT_STAT_CANNOT_AUTOATTACK = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CASTING), UNIT_STAT_ALL_STATE = 0xffffffff //(UNIT_STAT_STOPPED | UNIT_STAT_MOVING | UNIT_STAT_IN_COMBAT | UNIT_STAT_IN_FLIGHT) }; @@ -1110,7 +1110,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler); void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer); void RemoveAurasDueToSpellByCancel(uint32 spellId); - void RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo); + void RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo, Unit * caster); void RemoveNotOwnSingleTargetAuras(); void RemoveSpellsCausingAura(AuraType auraType); @@ -1238,7 +1238,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void AddThreat(Unit* pVictim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL); float ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL); void DeleteThreatList(); - bool SelectHostilTarget(); + //bool SelectHostilTarget(); void TauntApply(Unit* pVictim); void TauntFadeOut(Unit *taunter); ThreatManager& getThreatManager() { return m_ThreatManager; } @@ -1419,8 +1419,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject AuraMap m_Auras; - std::list<Aura *> m_scAuras; // casted singlecast auras - typedef std::list<uint64> DynObjectGUIDs; DynObjectGUIDs m_dynObjGUIDs; @@ -1430,9 +1428,11 @@ class TRINITY_DLL_SPEC Unit : public WorldObject uint32 m_removedAuras; AuraList m_modAuras[TOTAL_AURAS]; - uint32 m_interruptMask; + AuraList m_scAuras; // casted singlecast auras AuraList m_interruptableAuras; AuraList m_ccAuras; + uint32 m_interruptMask; + float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END]; float m_weaponDamage[MAX_ATTACK][2]; bool m_canModifyStats; @@ -1450,6 +1450,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject uint32 m_reactiveTimer[MAX_REACTIVE]; + ThreatManager m_ThreatManager; private: void SendAttackStop(Unit* victim); // only from AttackStop(Unit*) //void SendAttackStart(Unit* pVictim); // only from Unit::AttackStart(Unit*) @@ -1469,7 +1470,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject Diminishing m_Diminishing; // Manage all Units threatening us - ThreatManager m_ThreatManager; +// ThreatManager m_ThreatManager; // Manage all Units that are threatened by us HostilRefManager m_HostilRefManager; diff --git a/src/game/World.cpp b/src/game/World.cpp index 89a0b75cd36..e84894bdb27 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -50,6 +50,7 @@ #include "BattleGroundMgr.h" #include "OutdoorPvPMgr.h" #include "TemporarySummon.h" +#include "AuctionHouseBot.h" #include "WaypointMovementGenerator.h" #include "VMapFactory.h" #include "GlobalEvents.h" @@ -1374,6 +1375,9 @@ void World::SetInitialWorldSettings() uint32 nextGameEvent = gameeventmgr.Initialize(); m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event + sLog.outString("Initialize AuctionHouseBot..."); + AuctionHouseBotInit(); + sLog.outString( "WORLD: World initialized" ); } @@ -1484,7 +1488,8 @@ void World::Update(time_t diff) /// <ul><li> Handle auctions when the timer has passed if (m_timers[WUPDATE_AUCTIONS].Passed()) { - m_timers[WUPDATE_AUCTIONS].Reset(); + AuctionHouseBot(); + m_timers[WUPDATE_AUCTIONS].Reset(); ///- Update mails (return old mails with item, or delete them) //(tested... works on win) @@ -2996,7 +3001,7 @@ void World::UpdateMaxSessionCounters() void World::LoadDBVersion() { - QueryResult* result = WorldDatabase.Query("SELECT version FROM db_version LIMIT 1"); + QueryResult* result = WorldDatabase.Query("SELECT db_version FROM version LIMIT 1"); if(result) { Field* fields = result->Fetch(); diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index c3ec18ae1b7..e043bbe9659 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -255,7 +255,7 @@ void WorldSession::LogoutPlayer(bool Save) // Remove any possession of this player on logout _player->RemoveCharmedOrPossessedBy(NULL); - _player->DestroyForNearbyPlayers(); + //_player->DestroyForNearbyPlayers(); if (uint64 lguid = GetPlayer()->GetLootGUID()) DoLootRelease(lguid); diff --git a/src/tools/genrevision/genrevision.cpp b/src/tools/genrevision/genrevision.cpp index f9abc71b47a..99c407c33d9 100644 --- a/src/tools/genrevision/genrevision.cpp +++ b/src/tools/genrevision/genrevision.cpp @@ -87,6 +87,7 @@ void extractDataFromHG(FILE* EntriesFile, std::string path, bool url, RawData& d { thash_str[i] = hash_str[i]; } + thash_str[12] = '\0'; strcpy(data.hash_str,thash_str); strcpy(data.rev_str,revision_str); diff --git a/src/trinitycore/Master.cpp b/src/trinitycore/Master.cpp index ed526f497c3..75fea010337 100644 --- a/src/trinitycore/Master.cpp +++ b/src/trinitycore/Master.cpp @@ -458,6 +458,9 @@ bool Master::_StartDB() ///- Clean the database before starting clearOnlineAccounts(); + ///- Insert version info into DB + WorldDatabase.PExecute("UPDATE `version` SET `core_version` = '%s', `core_revision` = '%s'", _FULLVERSION, _REVISION); + sWorld.LoadDBVersion(); sLog.outString("Using %s", sWorld.GetDBVersion()); diff --git a/src/trinitycore/trinitycore.conf.dist b/src/trinitycore/trinitycore.conf.dist index 27253cc875b..827d5c238e7 100644 --- a/src/trinitycore/trinitycore.conf.dist +++ b/src/trinitycore/trinitycore.conf.dist @@ -1,7 +1,7 @@ ########################################## # Trinity Core worldd configuration file # ########################################## -ConfVersion=2008080101 +ConfVersion=2009010301 ################################################################################################################### # CONNECTIONS AND DIRECTORIES @@ -1171,6 +1171,79 @@ Network.OutUBuff = 65536 Network.TcpNodelay = 1 ################################################################################################################### +# AUCTION HOUSE BOT SETTINGS +# +# AuctionHouseBot.EnableSeller +# Enable/Disable the part of AHBot that puts items up for auction +# Default 0 (disabled) +# +# AuctionHouseBot.EnableBuyer +# Enable/Disable the part of AHBot that buys items from players +# Default 0 (disabled) +# +# Auction House Bot character data +# AuctionHouseBot.Account is the account number (in realmd->account table) of the player you want to run as the auction bot. +# AuctionHouseBot.GUID is the GUID (in characters->characters table) of the player you want to run as the auction bot. +# Default: 0 (Auction House Bot disabled) +# +# AuctionHouseBot.VendorItems +# Include items that can be bought from vendors. +# Default 0 +# +# AuctionHouseBot.LootItems +# Include items that can be looted or fished for. +# Default 1 +# +# AuctionHouseBot.OtherItems +# Include misc. items. +# Default 0 +# +# AuctionHouseBot.Bonding_types +# Indicates which bonding types to allow seller to put up for auction +# No_Bind +# Default 1 +# Bind_When_Picked_Up +# Default 0 +# Bind_When_Equipped +# Default 1 +# Bind_When_Use +# Default 1 +# Bind_Quest_Item +# Default 0 +# +# AuctionHouseBot.ItemsPerCycle +# Number of Items to Add/Remove from the AH during mass operations +# Default 200 +# +# AuctionHouseBot.UseBuyPriceForSeller +# Should the Seller use BuyPrice or SellPrice to determine Bid Prices +# Default 0 (use SellPrice) +# +# AuctionHouseBot.UseBuyPriceForBuyer +# Should the Buyer use BuyPrice or SellPrice to determine Bid Prices +# Default 0 (use SellPrice) +# +# All other settings have been moved to sql +# +################################################################################################################### + +AuctionHouseBot.EnableSeller = 0 +AuctionHouseBot.EnableBuyer = 0 +AuctionHouseBot.Account = 0 +AuctionHouseBot.GUID = 0 +AuctionHouseBot.VendorItems = 0 +AuctionHouseBot.LootItems = 1 +AuctionHouseBot.OtherItems = 0 +AuctionHouseBot.No_Bind = 1 +AuctionHouseBot.Bind_When_Picked_Up = 0 +AuctionHouseBot.Bind_When_Equipped = 1 +AuctionHouseBot.Bind_When_Use = 1 +AuctionHouseBot.Bind_Quest_Item = 0 +AuctionHouseBot.ItemsPerCycle = 200 +AuctionHouseBot.UseBuyPriceForSeller = 0 +AuctionHouseBot.UseBuyPriceForBuyer = 0 + +################################################################################################################### # CONSOLE AND REMOTE ACCESS # # Console.Enable |