aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Outland
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-05-01 18:19:36 -0300
committerfunjoker <funjoker109@gmail.com>2020-05-03 03:04:32 +0200
commit6604849716bc73d82a4cdbf8c66bb188086ceae4 (patch)
treebd293ee1fdac3baf8bef0a55aa854fe8bf793bc2 /src/server/scripts/Outland
parente3489c48ee6929018618322571adbb8dc59e11b1 (diff)
Core/Scripts: unified scripted gossip/quest api
- Changed self-accessor on GameObjectAI to "me", like UnitAI - Moved all related functions to AI, now Unit and GameObject have the same function names with identical behaviour - Remove "OnUpdate" from CreatureScript/GameObjectScript, was never used and we already have AI Update method - Quest methods no longer return a bool, the return value was used to call the AI version if the ScriptMgr one returned false - Implemented GameObjectAI::Destroyed hook (was never called), implemented Damaged method - Rename OnStateChanged to OnLootStateChanged to reflect when it's really called, and created a new hook OnStateChanged that only gets called on GOState change - Since the functions are now only getting called from AI, made GetAI methods full virtual. (CanSpawn method is anyways going to be used on creatures with AI) (cherry picked from commit f913f3bb8977c127d200d5d4a608ab434b21bbcd)
Diffstat (limited to 'src/server/scripts/Outland')
-rw-r--r--src/server/scripts/Outland/BlackTemple/black_temple.h6
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp3
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp3
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp24
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp26
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp21
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h6
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp30
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h6
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp34
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h6
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h6
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp22
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp25
-rw-r--r--src/server/scripts/Outland/zone_blades_edge_mountains.cpp129
-rw-r--r--src/server/scripts/Outland/zone_hellfire_peninsula.cpp39
-rw-r--r--src/server/scripts/Outland/zone_nagrand.cpp194
-rw-r--r--src/server/scripts/Outland/zone_netherstorm.cpp78
-rw-r--r--src/server/scripts/Outland/zone_shadowmoon_valley.cpp62
-rw-r--r--src/server/scripts/Outland/zone_shattrath_city.cpp238
-rw-r--r--src/server/scripts/Outland/zone_terokkar_forest.cpp234
-rw-r--r--src/server/scripts/Outland/zone_zangarmarsh.cpp267
22 files changed, 827 insertions, 632 deletions
diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.h b/src/server/scripts/Outland/BlackTemple/black_temple.h
index e5790d6ee16..2213c65373d 100644
--- a/src/server/scripts/Outland/BlackTemple/black_temple.h
+++ b/src/server/scripts/Outland/BlackTemple/black_temple.h
@@ -141,10 +141,10 @@ enum BlackTempleMisc
ACTION_OPEN_DOOR = 4
};
-template<typename AI>
-inline AI* GetBlackTempleAI(Creature* creature)
+template<class AI, class T>
+inline AI* GetBlackTempleAI(T* obj)
{
- return GetInstanceAI<AI>(creature, BTScriptName);
+ return GetInstanceAI<AI>(obj, BTScriptName);
}
#endif // BLACK_TEMPLE_H_
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index c92e304152c..44f9f9069ee 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -1060,7 +1060,7 @@ public:
_isTeleportToMinions = false;
}
- void sGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
{
if (gossipListId == GOSSIP_START_INTRO)
{
@@ -1079,6 +1079,7 @@ public:
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
CloseGossipMenuFor(player);
}
+ return false;
}
bool CanAIAttack(Unit const* who) const override
diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
index dc5d479bf58..279749dfd9f 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
@@ -550,13 +550,14 @@ public:
shade->AI()->EnterEvadeMode(EVADE_REASON_OTHER);
}
- void sGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
{
if (gossipListId == 0)
{
CloseGossipMenuFor(player);
_events.ScheduleEvent(EVENT_SHADE_START, Milliseconds(500));
}
+ return false;
}
private:
diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
index a56f6892442..35ff1fd862c 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
@@ -16,6 +16,7 @@
*/
#include "ScriptMgr.h"
+#include "GameObjectAI.h"
#include "black_temple.h"
#include "GameObject.h"
#include "InstanceScript.h"
@@ -175,16 +176,29 @@ class go_najentus_spine : public GameObjectScript
public:
go_najentus_spine() : GameObjectScript("go_najentus_spine") { }
- bool OnGossipHello(Player* player, GameObject* go) override
+ struct go_najentus_spineAI : public GameObjectAI
{
- if (InstanceScript* instance = go->GetInstanceScript())
+ go_najentus_spineAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
+
+ InstanceScript* instance;
+
+ bool GossipHello(Player* player, bool /*reportUse*/) override
+ {
if (Creature* najentus = instance->GetCreature(DATA_HIGH_WARLORD_NAJENTUS))
+ {
if (ENSURE_AI(boss_najentus::boss_najentusAI, najentus->AI())->RemoveImpalingSpine())
{
- go->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
- go->Delete();
+ me->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
+ me->Delete();
}
- return true;
+ }
+ return true;
+ }
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return GetBlackTempleAI<go_najentus_spineAI>(go);
}
};
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
index a1d2969c6f7..f4d74f49f83 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
@@ -29,6 +29,7 @@ EndScriptData */
#include "MotionMaster.h"
#include "Player.h"
#include "ScriptedCreature.h"
+#include "GameObjectAI.h"
#include "serpent_shrine.h"
#include "TemporarySummon.h"
@@ -437,21 +438,32 @@ class go_strange_pool : public GameObjectScript
public:
go_strange_pool() : GameObjectScript("go_strange_pool") { }
- bool OnGossipHello(Player* player, GameObject* go) override
+ struct go_strange_poolAI : public GameObjectAI
{
- // 25%
- if (InstanceScript* instanceScript = go->GetInstanceScript())
+ go_strange_poolAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
+
+ InstanceScript* instance;
+
+ bool GossipHello(Player* player, bool /*reportUse*/) override
+ {
+ // 25%
if (!urand(0, 3))
{
- if (instanceScript->GetData(DATA_STRANGE_POOL) == NOT_STARTED)
+ if (instance->GetData(DATA_STRANGE_POOL) == NOT_STARTED)
{
- go->CastSpell(player, 54587);
- instanceScript->SetData(DATA_STRANGE_POOL, IN_PROGRESS);
+ me->CastSpell(player, 54587);
+ instance->SetData(DATA_STRANGE_POOL, IN_PROGRESS);
}
return true;
}
- return false;
+ return false;
+ }
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return GetSerpentshrineCavernAI<go_strange_poolAI>(go);
}
};
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
index 0cb7eafa2d3..7a60b41ecec 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
@@ -30,6 +30,7 @@ EndScriptData */
#include "Player.h"
#include "serpent_shrine.h"
#include "TemporarySummon.h"
+#include "GameObjectAI.h"
#define MAX_ENCOUNTER 6
@@ -66,17 +67,23 @@ class go_bridge_console : public GameObjectScript
public:
go_bridge_console() : GameObjectScript("go_bridge_console") { }
- bool OnGossipHello(Player* /*player*/, GameObject* go) override
+ struct go_bridge_consoleAI : public GameObjectAI
{
- InstanceScript* instance = go->GetInstanceScript();
+ go_bridge_consoleAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
- if (!instance)
- return false;
+ InstanceScript* instance;
- if (instance)
- instance->SetData(DATA_CONTROL_CONSOLE, DONE);
+ bool GossipHello(Player* /*player*/, bool /*reportUse*/) override
+ {
+ if (instance)
+ instance->SetData(DATA_CONTROL_CONSOLE, DONE);
+ return true;
+ }
+ };
- return true;
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return GetSerpentshrineCavernAI<go_bridge_consoleAI>(go);
}
};
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h
index f457957f799..b7ad1f73512 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h
@@ -59,10 +59,10 @@ enum SSDataTypes
DATA_TRASH = 25,
};
-template<typename AI>
-inline AI* GetSerpentshrineCavernAI(Creature* creature)
+template <class AI, class T>
+inline AI* GetSerpentshrineCavernAI(T* obj)
{
- return GetInstanceAI<AI>(creature, SSCScriptName);
+ return GetInstanceAI<AI>(obj, SSCScriptName);
}
#endif
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
index b8b8c3f3f9c..3569426d8d1 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
@@ -18,6 +18,7 @@
#include "ScriptMgr.h"
#include "Creature.h"
#include "GameObject.h"
+#include "GameObjectAI.h"
#include "InstanceScript.h"
#include "Log.h"
#include "steam_vault.h"
@@ -27,22 +28,29 @@ class go_main_chambers_access_panel : public GameObjectScript
public:
go_main_chambers_access_panel() : GameObjectScript("go_main_chambers_access_panel") { }
- bool OnGossipHello(Player* /*player*/, GameObject* go) override
+ struct go_main_chambers_access_panelAI : public GameObjectAI
{
- InstanceScript* instance = go->GetInstanceScript();
- if (!instance)
- return false;
+ go_main_chambers_access_panelAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
- if (go->GetEntry() == GO_ACCESS_PANEL_HYDRO && (instance->GetBossState(DATA_HYDROMANCER_THESPIA) == DONE || instance->GetBossState(DATA_HYDROMANCER_THESPIA) == SPECIAL))
- instance->SetBossState(DATA_HYDROMANCER_THESPIA, SPECIAL);
+ InstanceScript* instance;
- if (go->GetEntry() == GO_ACCESS_PANEL_MEK && (instance->GetBossState(DATA_MEKGINEER_STEAMRIGGER) == DONE || instance->GetBossState(DATA_MEKGINEER_STEAMRIGGER) == SPECIAL))
- instance->SetBossState(DATA_MEKGINEER_STEAMRIGGER, SPECIAL);
+ bool GossipHello(Player* /*player*/, bool /*reportUse*/) override
+ {
+ if (me->GetEntry() == GO_ACCESS_PANEL_HYDRO && (instance->GetBossState(DATA_HYDROMANCER_THESPIA) == DONE || instance->GetBossState(DATA_HYDROMANCER_THESPIA) == SPECIAL))
+ instance->SetBossState(DATA_HYDROMANCER_THESPIA, SPECIAL);
+
+ if (me->GetEntry() == GO_ACCESS_PANEL_MEK && (instance->GetBossState(DATA_MEKGINEER_STEAMRIGGER) == DONE || instance->GetBossState(DATA_MEKGINEER_STEAMRIGGER) == SPECIAL))
+ instance->SetBossState(DATA_MEKGINEER_STEAMRIGGER, SPECIAL);
- go->AddFlag(GO_FLAG_NOT_SELECTABLE);
- go->SetGoState(GO_STATE_ACTIVE);
+ me->AddFlag(GO_FLAG_NOT_SELECTABLE);
+ me->SetGoState(GO_STATE_ACTIVE);
+ return true;
+ }
+ };
- return true;
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return GetSteamVaultAI<go_main_chambers_access_panelAI>(go);
}
};
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h
index 7e1802ef59a..22846f6ac82 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h
@@ -51,10 +51,10 @@ enum SVGameObjectIds
GO_ACCESS_PANEL_MEK = 184126
};
-template<typename AI>
-inline AI* GetSteamVaultAI(Creature* creature)
+template<class AI, class T>
+inline AI* GetSteamVaultAI(T* obj)
{
- return GetInstanceAI<AI>(creature, SteamVaultScriptName);
+ return GetInstanceAI<AI>(obj, SteamVaultScriptName);
}
#endif
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp
index 38dd69499ad..2379950f294 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp
@@ -27,6 +27,7 @@
#include "Player.h"
#include "ScriptedGossip.h"
#include "ScriptedCreature.h"
+#include "GameObjectAI.h"
#include "SpellAuraEffects.h"
#include "SpellInfo.h"
#include "SpellScript.h"
@@ -655,25 +656,32 @@ class go_ahune_ice_stone : public GameObjectScript
public:
go_ahune_ice_stone() : GameObjectScript("go_ahune_ice_stone") { }
- bool OnGossipSelect(Player* player, GameObject* go, uint32 /*sender*/, uint32 /*action*/)
+ struct go_ahune_ice_stoneAI : public GameObjectAI
{
- InstanceScript* instance = go->GetInstanceScript();
- if (!instance)
- return false;
+ go_ahune_ice_stoneAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
- ClearGossipMenuFor(player);
+ InstanceScript* instance;
- if (Creature* ahuneBunny = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_AHUNE_BUNNY)))
+ bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/)
{
- ahuneBunny->AI()->DoAction(ACTION_START_EVENT);
- ahuneBunny->SetInCombatWithZone();
+ ClearGossipMenuFor(player);
+
+ if (Creature* ahuneBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_AHUNE_BUNNY)))
+ {
+ ahuneBunny->AI()->DoAction(ACTION_START_EVENT);
+ ahuneBunny->SetInCombatWithZone();
+ }
+ if (Creature* luma = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_LUMA_SKYMOTHER)))
+ luma->CastSpell(player, SPELL_SUMMONING_RHYME_AURA, true);
+ CloseGossipMenuFor(player);
+ me->Delete();
+ return true;
}
- if (Creature* luma = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_LUMA_SKYMOTHER)))
- luma->CastSpell(player, SPELL_SUMMONING_RHYME_AURA, true);
- CloseGossipMenuFor(player);
- go->Delete();
+ };
- return true;
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return GetSlavePensAI<go_ahune_ice_stoneAI>(go);
}
};
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h
index 4b388803e0a..398225c4d01 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h
@@ -68,10 +68,10 @@ enum SPGameObjectIds
GO_ICE_STONE = 187882
};
-template<typename AI>
-inline AI* GetSlavePensAI(Creature* creature)
+template<class AI, class T>
+inline AI* GetSlavePensAI(T* obj)
{
- return GetInstanceAI<AI>(creature, SPScriptName);
+ return GetInstanceAI<AI>(obj, SPScriptName);
}
#endif // SLAVE_PENS_H
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h
index e59b5b6ca83..e3fd9704a0b 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h
@@ -82,10 +82,10 @@ enum BFActionIds
ACTION_PREPARE_BROGGOK = 3
};
-template<typename AI>
-inline AI* GetBloodFurnaceAI(Creature* creature)
+template<class AI, class T>
+inline AI* GetBloodFurnaceAI(T* obj)
{
- return GetInstanceAI<AI>(creature, BFScriptName);
+ return GetInstanceAI<AI>(obj, BFScriptName);
}
#endif // BLOOD_FURNACE_H_
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
index bdaa36fc778..789472f2a29 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
@@ -21,6 +21,7 @@
#include "InstanceScript.h"
#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
+#include "GameObjectAI.h"
#include "SpellAuraEffects.h"
#include "SpellInfo.h"
#include "SpellScript.h"
@@ -131,18 +132,29 @@ class go_broggok_lever : public GameObjectScript
public:
go_broggok_lever() : GameObjectScript("go_broggok_lever") { }
- bool OnGossipHello(Player* /*player*/, GameObject* go) override
+ struct go_broggok_leverAI : public GameObjectAI
{
- if (InstanceScript* instance = go->GetInstanceScript())
+ go_broggok_leverAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
+
+ InstanceScript* instance;
+
+ bool GossipHello(Player* /*player*/, bool /*reportUse*/) override
+ {
if (instance->GetBossState(DATA_BROGGOK) != DONE && instance->GetBossState(DATA_BROGGOK) != IN_PROGRESS)
{
instance->SetBossState(DATA_BROGGOK, IN_PROGRESS);
- if (Creature* broggok = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_BROGGOK)))
+ if (Creature* broggok = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BROGGOK)))
broggok->AI()->DoAction(ACTION_PREPARE_BROGGOK);
}
- go->UseDoorOrButton();
- return false;
+ me->UseDoorOrButton();
+ return false;
+ }
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return GetBloodFurnaceAI<go_broggok_leverAI>(go);
}
};
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
index 64d5407f312..e61d5186fbf 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
@@ -27,6 +27,7 @@
#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "PassiveAI.h"
+#include "GameObjectAI.h"
enum Yells
{
@@ -467,16 +468,26 @@ class go_manticron_cube : public GameObjectScript
public:
go_manticron_cube() : GameObjectScript("go_manticron_cube") { }
- bool OnGossipHello(Player* player, GameObject* /*go*/) override
+ struct go_manticron_cubeAI : public GameObjectAI
{
- if (player->HasAura(SPELL_MIND_EXHAUSTION) || player->HasAura(SPELL_SHADOW_GRASP))
- return true;
+ go_manticron_cubeAI(GameObject* go) : GameObjectAI(go) { }
+
+ bool GossipHello(Player* player, bool /*reportUse*/) override
+ {
+ if (player->HasAura(SPELL_MIND_EXHAUSTION) || player->HasAura(SPELL_SHADOW_GRASP))
+ return true;
+
+ if (Creature* trigger = player->FindNearestCreature(NPC_HELFIRE_RAID_TRIGGER, 10.0f))
+ trigger->CastSpell((Unit*)nullptr, SPELL_SHADOW_GRASP_VISUAL);
- if (Creature* trigger = player->FindNearestCreature(NPC_HELFIRE_RAID_TRIGGER, 10.0f))
- trigger->CastSpell((Unit*)nullptr, SPELL_SHADOW_GRASP_VISUAL);
+ player->CastSpell((Unit*)nullptr, SPELL_SHADOW_GRASP, true);
+ return true;
+ }
+ };
- player->CastSpell((Unit*)nullptr, SPELL_SHADOW_GRASP, true);
- return true;
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return new go_manticron_cubeAI(go);
}
};
diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
index a365e5cfda3..97e7e8e9460 100644
--- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
+++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
@@ -37,6 +37,7 @@ EndContentData */
#include "ObjectAccessor.h"
#include "Player.h"
#include "ScriptedCreature.h"
+#include "GameObjectAI.h"
#include "ScriptedGossip.h"
#include "SpellInfo.h"
#include "SpellScript.h"
@@ -298,42 +299,52 @@ class go_legion_obelisk : public GameObjectScript
public:
go_legion_obelisk() : GameObjectScript("go_legion_obelisk") { }
- bool OnGossipHello(Player* player, GameObject* go) override
+ struct go_legion_obeliskAI : public GameObjectAI
{
- if (player->GetQuestStatus(QUEST_YOURE_FIRED) == QUEST_STATUS_INCOMPLETE)
+ go_legion_obeliskAI(GameObject* go) : GameObjectAI(go) { }
+
+ bool GossipHello(Player* player, bool /*reportUse*/) override
{
- switch (go->GetEntry())
+ if (player->GetQuestStatus(QUEST_YOURE_FIRED) == QUEST_STATUS_INCOMPLETE)
{
- case GO_LEGION_OBELISK_ONE:
- obelisk_one = true;
- break;
- case GO_LEGION_OBELISK_TWO:
- obelisk_two = true;
- break;
- case GO_LEGION_OBELISK_THREE:
- obelisk_three = true;
- break;
- case GO_LEGION_OBELISK_FOUR:
- obelisk_four = true;
- break;
- case GO_LEGION_OBELISK_FIVE:
- obelisk_five = true;
- break;
- }
+ switch (me->GetEntry())
+ {
+ case GO_LEGION_OBELISK_ONE:
+ obelisk_one = true;
+ break;
+ case GO_LEGION_OBELISK_TWO:
+ obelisk_two = true;
+ break;
+ case GO_LEGION_OBELISK_THREE:
+ obelisk_three = true;
+ break;
+ case GO_LEGION_OBELISK_FOUR:
+ obelisk_four = true;
+ break;
+ case GO_LEGION_OBELISK_FIVE:
+ obelisk_five = true;
+ break;
+ }
- if (obelisk_one == true && obelisk_two == true && obelisk_three == true && obelisk_four == true && obelisk_five == true)
- {
- go->SummonCreature(NPC_DOOMCRYER, 2943.40f, 4778.20f, 284.49f, 0.94f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
- //reset global var
- obelisk_one = false;
- obelisk_two = false;
- obelisk_three = false;
- obelisk_four = false;
- obelisk_five = false;
+ if (obelisk_one == true && obelisk_two == true && obelisk_three == true && obelisk_four == true && obelisk_five == true)
+ {
+ me->SummonCreature(NPC_DOOMCRYER, 2943.40f, 4778.20f, 284.49f, 0.94f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
+ //reset global var
+ obelisk_one = false;
+ obelisk_two = false;
+ obelisk_three = false;
+ obelisk_four = false;
+ obelisk_five = false;
+ }
}
+
+ return true;
}
+ };
- return true;
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return new go_legion_obeliskAI(go);
}
};
@@ -875,14 +886,24 @@ class go_simon_cluster : public GameObjectScript
public:
go_simon_cluster() : GameObjectScript("go_simon_cluster") { }
- bool OnGossipHello(Player* player, GameObject* go) override
+ struct go_simon_clusterAI : public GameObjectAI
{
- if (Creature* bunny = go->FindNearestCreature(NPC_SIMON_BUNNY, 12.0f, true))
- bunny->AI()->SetData(go->GetEntry(), 0);
+ go_simon_clusterAI(GameObject* go) : GameObjectAI(go) { }
- player->CastSpell(player, go->GetGOInfo()->goober.spell, true);
- go->AddUse();
- return true;
+ bool GossipHello(Player* player, bool /*reportUse*/) override
+ {
+ if (Creature* bunny = me->FindNearestCreature(NPC_SIMON_BUNNY, 12.0f, true))
+ bunny->AI()->SetData(me->GetEntry(), 0);
+
+ player->CastSpell(player, me->GetGOInfo()->goober.spell, true);
+ me->AddUse();
+ return true;
+ }
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return new go_simon_clusterAI(go);
}
};
@@ -901,27 +922,37 @@ class go_apexis_relic : public GameObjectScript
public:
go_apexis_relic() : GameObjectScript("go_apexis_relic") { }
- bool OnGossipHello(Player* player, GameObject* go) override
+ struct go_apexis_relicAI : public GameObjectAI
{
- player->PrepareGossipMenu(go, go->GetGOInfo()->questgiver.gossipID);
- player->SendPreparedGossip(go);
- return true;
- }
+ go_apexis_relicAI(GameObject* go) : GameObjectAI(go) { }
- bool OnGossipSelect(Player* player, GameObject* go, uint32 /*sender*/, uint32 /*action*/) override
- {
- CloseGossipMenuFor(player);
+ bool GossipHello(Player* player, bool /*reportUse*/) override
+ {
+ player->PrepareGossipMenu(me, me->GetGOInfo()->questgiver.gossipID);
+ player->SendPreparedGossip(me);
+ return true;
+ }
- bool large = (go->GetEntry() == GO_APEXIS_MONUMENT);
- if (player->HasItemCount(ITEM_APEXIS_SHARD, large ? 35 : 1))
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override
{
- player->CastSpell(player, large ? SPELL_TAKE_REAGENTS_GROUP : SPELL_TAKE_REAGENTS_SOLO, false);
+ CloseGossipMenuFor(player);
+
+ bool large = (me->GetEntry() == GO_APEXIS_MONUMENT);
+ if (player->HasItemCount(ITEM_APEXIS_SHARD, large ? 35 : 1))
+ {
+ player->CastSpell(player, large ? SPELL_TAKE_REAGENTS_GROUP : SPELL_TAKE_REAGENTS_SOLO, false);
+
+ if (Creature* bunny = player->SummonCreature(NPC_SIMON_BUNNY, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()))
+ bunny->AI()->SetGUID(player->GetGUID(), large);
+ }
- if (Creature* bunny = player->SummonCreature(NPC_SIMON_BUNNY, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ()))
- bunny->AI()->SetGUID(player->GetGUID(), large);
+ return true;
}
+ };
- return true;
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return new go_apexis_relicAI(go);
}
};
diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
index 7e3afcbc225..72001b3a07e 100644
--- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
+++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
@@ -277,7 +277,7 @@ public:
summoned->AI()->AttackStart(me);
}
- void sQuestAccept(Player* player, Quest const* quest) override
+ void QuestAccept(Player* player, Quest const* quest) override
{
if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH)
{
@@ -517,15 +517,6 @@ class npc_colonel_jules : public CreatureScript
public:
npc_colonel_jules() : CreatureScript("npc_colonel_jules") { }
- bool OnGossipHello(Player* player, Creature* creature) override
- {
- if (ENSURE_AI(npc_colonel_jules::npc_colonel_julesAI, creature->AI())->success)
- player->KilledMonsterCredit(NPC_COLONEL_JULES, ObjectGuid::Empty);
-
- SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
- return true;
- }
-
struct npc_colonel_julesAI : public ScriptedAI
{
npc_colonel_julesAI(Creature* creature) : ScriptedAI(creature), summons(me)
@@ -641,6 +632,15 @@ public:
}
}
+ bool GossipHello(Player* player) override
+ {
+ if (success)
+ player->KilledMonsterCredit(NPC_COLONEL_JULES, ObjectGuid::Empty);
+
+ SendGossipMenuFor(player, player->GetGossipTextId(me), me->GetGUID());
+ return true;
+ }
+
private:
EventMap events;
SummonList summons;
@@ -686,7 +686,7 @@ public:
me->RemoveUnitFlag(UNIT_FLAG_PACIFIED);
}
- void sGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
{
ClearGossipMenuFor(player);
switch (gossipListId)
@@ -699,6 +699,7 @@ public:
default:
break;
}
+ return false;
}
void DoAction(int32 action) override
@@ -942,14 +943,6 @@ class npc_magister_aledis : public CreatureScript
public:
npc_magister_aledis() : CreatureScript("npc_magister_aledis") { }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 /*action*/) override
- {
- CloseGossipMenuFor(player);
- creature->StopMoving();
- ENSURE_AI(npc_magister_aledis::npc_magister_aledisAI, creature->AI())->StartFight(player);
- return true;
- }
-
struct npc_magister_aledisAI : public ScriptedAI
{
npc_magister_aledisAI(Creature* creature) : ScriptedAI(creature) { }
@@ -1030,6 +1023,14 @@ public:
DoMeleeAttackIfReady();
}
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override
+ {
+ CloseGossipMenuFor(player);
+ me->StopMoving();
+ StartFight(player);
+ return true;
+ }
+
private:
EventMap _events;
ObjectGuid _playerGUID;
diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp
index 2f662558c93..c51dfa286ad 100644
--- a/src/server/scripts/Outland/zone_nagrand.cpp
+++ b/src/server/scripts/Outland/zone_nagrand.cpp
@@ -30,6 +30,7 @@ EndContentData */
#include "ScriptMgr.h"
#include "GameObject.h"
#include "MotionMaster.h"
+#include "GameObjectAI.h"
#include "Player.h"
#include "QuestDef.h"
#include "ScriptedEscortAI.h"
@@ -72,30 +73,6 @@ class npc_maghar_captive : public CreatureScript
public:
npc_maghar_captive() : CreatureScript("npc_maghar_captive") { }
- bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest) override
- {
- if (quest->GetQuestId() == QUEST_TOTEM_KARDASH_H)
- {
- if (npc_maghar_captiveAI* EscortAI = dynamic_cast<npc_maghar_captiveAI*>(creature->AI()))
- {
- creature->SetStandState(UNIT_STAND_STATE_STAND);
- creature->SetFaction(232);
- EscortAI->Start(true, false, player->GetGUID(), quest);
- creature->AI()->Talk(SAY_MAG_START);
-
- creature->SummonCreature(NPC_MURK_RAIDER, m_afAmbushA[0]+2.5f, m_afAmbushA[1]-2.5f, m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- creature->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushA[0]-2.5f, m_afAmbushA[1]+2.5f, m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- creature->SummonCreature(NPC_MURK_BRUTE, m_afAmbushA[0], m_afAmbushA[1], m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- }
- }
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new npc_maghar_captiveAI(creature);
- }
-
struct npc_maghar_captiveAI : public npc_escortAI
{
npc_maghar_captiveAI(Creature* creature) : npc_escortAI(creature) { Reset(); }
@@ -217,7 +194,28 @@ public:
DoMeleeAttackIfReady();
}
+
+ void QuestAccept(Player* player, Quest const* quest) override
+ {
+ if (quest->GetQuestId() == QUEST_TOTEM_KARDASH_H)
+ {
+ me->SetStandState(UNIT_STAND_STATE_STAND);
+ me->SetFaction(232);
+ Start(true, false, player->GetGUID(), quest);
+ Talk(SAY_MAG_START);
+
+ me->SummonCreature(NPC_MURK_RAIDER, m_afAmbushA[0] + 2.5f, m_afAmbushA[1] - 2.5f, m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ me->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushA[0] - 2.5f, m_afAmbushA[1] + 2.5f, m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ me->SummonCreature(NPC_MURK_BRUTE, m_afAmbushA[0], m_afAmbushA[1], m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ }
+ }
};
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_maghar_captiveAI(creature);
+ }
+
};
/*######
@@ -291,42 +289,52 @@ enum CorkiData
class go_corkis_prison : public GameObjectScript
{
public:
- go_corkis_prison() : GameObjectScript("go_corkis_prison") { }
+ go_corkis_prison() : GameObjectScript("go_corkis_prison") { }
- bool OnGossipHello(Player* player, GameObject* go) override
- {
- go->SetGoState(GO_STATE_READY);
- if (go->GetEntry() == GO_CORKIS_PRISON)
- {
- if (Creature* corki = go->FindNearestCreature(NPC_CORKI, 25, true))
- {
- corki->GetMotionMaster()->MovePoint(1, go->GetPositionX()+5, go->GetPositionY(), go->GetPositionZ());
- if (player)
- player->KilledMonsterCredit(NPC_CORKI_CREDIT_1);
- }
- }
+ struct go_corkis_prisonAI : public GameObjectAI
+ {
+ go_corkis_prisonAI(GameObject* go) : GameObjectAI(go) { }
- if (go->GetEntry() == GO_CORKIS_PRISON_2)
- {
- if (Creature* corki = go->FindNearestCreature(NPC_CORKI_2, 25, true))
- {
- corki->GetMotionMaster()->MovePoint(1, go->GetPositionX()-5, go->GetPositionY(), go->GetPositionZ());
- if (player)
- player->KilledMonsterCredit(NPC_CORKI_2);
- }
- }
+ bool GossipHello(Player* player, bool /*reportUse*/) override
+ {
+ me->SetGoState(GO_STATE_READY);
+ if (me->GetEntry() == GO_CORKIS_PRISON)
+ {
+ if (Creature* corki = me->FindNearestCreature(NPC_CORKI, 25, true))
+ {
+ corki->GetMotionMaster()->MovePoint(1, me->GetPositionX() + 5, me->GetPositionY(), me->GetPositionZ());
+ if (player)
+ player->KilledMonsterCredit(NPC_CORKI_CREDIT_1);
+ }
+ }
- if (go->GetEntry() == GO_CORKIS_PRISON_3)
- {
- if (Creature* corki = go->FindNearestCreature(NPC_CORKI_3, 25, true))
- {
- corki->GetMotionMaster()->MovePoint(1, go->GetPositionX()+4, go->GetPositionY(), go->GetPositionZ());
- if (player)
- player->KilledMonsterCredit(NPC_CORKI_CREDIT_3);
- }
- }
- return true;
- }
+ if (me->GetEntry() == GO_CORKIS_PRISON_2)
+ {
+ if (Creature* corki = me->FindNearestCreature(NPC_CORKI_2, 25, true))
+ {
+ corki->GetMotionMaster()->MovePoint(1, me->GetPositionX() - 5, me->GetPositionY(), me->GetPositionZ());
+ if (player)
+ player->KilledMonsterCredit(NPC_CORKI_2);
+ }
+ }
+
+ if (me->GetEntry() == GO_CORKIS_PRISON_3)
+ {
+ if (Creature* corki = me->FindNearestCreature(NPC_CORKI_3, 25, true))
+ {
+ corki->GetMotionMaster()->MovePoint(1, me->GetPositionX() + 4, me->GetPositionY(), me->GetPositionZ());
+ if (player)
+ player->KilledMonsterCredit(NPC_CORKI_CREDIT_3);
+ }
+ }
+ return true;
+ }
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return new go_corkis_prisonAI(go);
+ }
};
class npc_corki : public CreatureScript
@@ -426,30 +434,6 @@ class npc_kurenai_captive : public CreatureScript
public:
npc_kurenai_captive() : CreatureScript("npc_kurenai_captive") { }
- bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest) override
- {
- if (quest->GetQuestId() == QUEST_TOTEM_KARDASH_A)
- {
- if (npc_kurenai_captiveAI* EscortAI = dynamic_cast<npc_kurenai_captiveAI*>(creature->AI()))
- {
- creature->SetStandState(UNIT_STAND_STATE_STAND);
- creature->SetFaction(231);
- EscortAI->Start(true, false, player->GetGUID(), quest);
- creature->AI()->Talk(SAY_KUR_START);
-
- creature->SummonCreature(NPC_KUR_MURK_RAIDER, kurenaiAmbushA[0]+2.5f, kurenaiAmbushA[1]-2.5f, kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- creature->SummonCreature(NPC_KUR_MURK_BRUTE, kurenaiAmbushA[0]-2.5f, kurenaiAmbushA[1]+2.5f, kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- creature->SummonCreature(NPC_KUR_MURK_SCAVENGER, kurenaiAmbushA[0], kurenaiAmbushA[1], kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- }
- }
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new npc_kurenai_captiveAI(creature);
- }
-
struct npc_kurenai_captiveAI : public npc_escortAI
{
npc_kurenai_captiveAI(Creature* creature) : npc_escortAI(creature)
@@ -585,7 +569,27 @@ public:
DoMeleeAttackIfReady();
}
+
+ void QuestAccept(Player* player, Quest const* quest) override
+ {
+ if (quest->GetQuestId() == QUEST_TOTEM_KARDASH_A)
+ {
+ me->SetStandState(UNIT_STAND_STATE_STAND);
+ me->SetFaction(231);
+ Start(true, false, player->GetGUID(), quest);
+ Talk(SAY_KUR_START);
+
+ me->SummonCreature(NPC_KUR_MURK_RAIDER, kurenaiAmbushA[0] + 2.5f, kurenaiAmbushA[1] - 2.5f, kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ me->SummonCreature(NPC_KUR_MURK_BRUTE, kurenaiAmbushA[0] - 2.5f, kurenaiAmbushA[1] + 2.5f, kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ me->SummonCreature(NPC_KUR_MURK_SCAVENGER, kurenaiAmbushA[0], kurenaiAmbushA[1], kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ }
+ }
};
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_kurenai_captiveAI(creature);
+ }
};
/*######
@@ -605,20 +609,30 @@ class go_warmaul_prison : public GameObjectScript
public:
go_warmaul_prison() : GameObjectScript("go_warmaul_prison") { }
- bool OnGossipHello(Player* player, GameObject* go) override
+ struct go_warmaul_prisonAI : public GameObjectAI
{
- go->UseDoorOrButton();
- if (player->GetQuestStatus(QUEST_FINDING_THE_SURVIVORS) != QUEST_STATUS_INCOMPLETE)
- return false;
+ go_warmaul_prisonAI(GameObject* go) : GameObjectAI(go) { }
- if (Creature* prisoner = go->FindNearestCreature(NPC_MAGHAR_PRISONER, 5.0f))
+ bool GossipHello(Player* player, bool /*reportUse*/) override
{
- player->KilledMonsterCredit(NPC_MAGHAR_PRISONER);
+ me->UseDoorOrButton();
+ if (player->GetQuestStatus(QUEST_FINDING_THE_SURVIVORS) != QUEST_STATUS_INCOMPLETE)
+ return false;
+
+ if (Creature* prisoner = me->FindNearestCreature(NPC_MAGHAR_PRISONER, 5.0f))
+ {
+ player->KilledMonsterCredit(NPC_MAGHAR_PRISONER);
- prisoner->AI()->Talk(SAY_FREE, player);
- prisoner->DespawnOrUnsummon(6000);
+ prisoner->AI()->Talk(SAY_FREE, player);
+ prisoner->DespawnOrUnsummon(6000);
+ }
+ return true;
}
- return true;
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return new go_warmaul_prisonAI(go);
}
};
diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp
index cc10c1d619c..c4560a9d633 100644
--- a/src/server/scripts/Outland/zone_netherstorm.cpp
+++ b/src/server/scripts/Outland/zone_netherstorm.cpp
@@ -33,6 +33,7 @@ EndContentData */
#include "GameObject.h"
#include "Log.h"
#include "ObjectAccessor.h"
+#include "GameObjectAI.h"
#include "Player.h"
#include "QuestDef.h"
#include "ScriptedEscortAI.h"
@@ -494,22 +495,6 @@ class npc_bessy : public CreatureScript
public:
npc_bessy() : CreatureScript("npc_bessy") { }
- bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override
- {
- if (quest->GetQuestId() == Q_ALMABTRIEB)
- {
- creature->SetFaction(113);
- creature->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
- ENSURE_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID());
- }
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new npc_bessyAI(creature);
- }
-
struct npc_bessyAI : public npc_escortAI
{
npc_bessyAI(Creature* creature) : npc_escortAI(creature) { }
@@ -558,7 +543,22 @@ public:
{
me->RestoreFaction();
}
+
+ void QuestAccept(Player* player, Quest const* quest) override
+ {
+ if (quest->GetQuestId() == Q_ALMABTRIEB)
+ {
+ me->SetFaction(113);
+ me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
+ Start(true, false, player->GetGUID());
+ }
+ }
};
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_bessyAI(creature);
+ }
};
/*######
@@ -576,11 +576,6 @@ class npc_maxx_a_million_escort : public CreatureScript
public:
npc_maxx_a_million_escort() : CreatureScript("npc_maxx_a_million_escort") { }
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new npc_maxx_a_million_escortAI(creature);
- }
-
struct npc_maxx_a_million_escortAI : public npc_escortAI
{
npc_maxx_a_million_escortAI(Creature* creature) : npc_escortAI(creature)
@@ -656,19 +651,20 @@ public:
}
DoMeleeAttackIfReady();
}
- };
- bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest) override
- {
- if (quest->GetQuestId() == QUEST_MARK_V_IS_ALIVE)
+ void QuestAccept(Player* player, Quest const* quest) override
{
- if (npc_maxx_a_million_escortAI* pEscortAI = CAST_AI(npc_maxx_a_million_escort::npc_maxx_a_million_escortAI, creature->AI()))
+ if (quest->GetQuestId() == QUEST_MARK_V_IS_ALIVE)
{
- creature->SetFaction(113);
- pEscortAI->Start(false, false, player->GetGUID());
+ me->SetFaction(113);
+ Start(false, false, player->GetGUID());
}
}
- return true;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_maxx_a_million_escortAI(creature);
}
};
@@ -687,16 +683,26 @@ class go_captain_tyralius_prison : public GameObjectScript
public:
go_captain_tyralius_prison() : GameObjectScript("go_captain_tyralius_prison") { }
- bool OnGossipHello(Player* player, GameObject* go) override
+ struct go_captain_tyralius_prisonAI : public GameObjectAI
{
- go->UseDoorOrButton();
- if (Creature* tyralius = go->FindNearestCreature(NPC_CAPTAIN_TYRALIUS, 1.0f))
+ go_captain_tyralius_prisonAI(GameObject* go) : GameObjectAI(go) { }
+
+ bool GossipHello(Player* player, bool /*reportUse*/) override
{
- player->KilledMonsterCredit(NPC_CAPTAIN_TYRALIUS);
- tyralius->AI()->Talk(SAY_FREE);
- tyralius->DespawnOrUnsummon(8000);
+ me->UseDoorOrButton();
+ if (Creature* tyralius = me->FindNearestCreature(NPC_CAPTAIN_TYRALIUS, 1.0f))
+ {
+ player->KilledMonsterCredit(NPC_CAPTAIN_TYRALIUS);
+ tyralius->AI()->Talk(SAY_FREE);
+ tyralius->DespawnOrUnsummon(8000);
+ }
+ return true;
}
- return true;
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return new go_captain_tyralius_prisonAI(go);
}
};
diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
index af98238d5b5..19b79b6ee4c 100644
--- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
@@ -37,6 +37,7 @@ EndContentData */
#include "ScriptMgr.h"
#include "GameObject.h"
+#include "GameObjectAI.h"
#include "Group.h"
#include "MotionMaster.h"
#include "ObjectAccessor.h"
@@ -597,24 +598,6 @@ class npc_earthmender_wilda : public CreatureScript
public:
npc_earthmender_wilda() : CreatureScript("npc_earthmender_wilda") { }
- bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest) override
- {
- if (quest->GetQuestId() == QUEST_ESCAPE_COILSCAR)
- {
- creature->AI()->Talk(SAY_WIL_START, player);
- creature->SetFaction(FACTION_EARTHEN);
-
- if (npc_earthmender_wildaAI* pEscortAI = CAST_AI(npc_earthmender_wilda::npc_earthmender_wildaAI, creature->AI()))
- pEscortAI->Start(false, false, player->GetGUID(), quest);
- }
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new npc_earthmender_wildaAI(creature);
- }
-
struct npc_earthmender_wildaAI : public npc_escortAI
{
npc_earthmender_wildaAI(Creature* creature) : npc_escortAI(creature)
@@ -744,7 +727,24 @@ public:
m_uiHealingTimer -= uiDiff;
}
}
+
+ void QuestAccept(Player* player, Quest const* quest) override
+ {
+ if (quest->GetQuestId() == QUEST_ESCAPE_COILSCAR)
+ {
+ Talk(SAY_WIL_START, player);
+ me->SetFaction(FACTION_EARTHEN);
+
+ Start(false, false, player->GetGUID(), quest);
+ }
+ }
};
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_earthmender_wildaAI(creature);
+ }
+
};
/*#####
@@ -1350,20 +1350,28 @@ class go_crystal_prison : public GameObjectScript
public:
go_crystal_prison() : GameObjectScript("go_crystal_prison") { }
- bool OnQuestAccept(Player* player, GameObject* /*go*/, Quest const* quest) override
+ struct go_crystal_prisonAI : GameObjectAI
{
- if (quest->GetQuestId() == QUEST_BATTLE_OF_THE_CRIMSON_WATCH)
- {
- Creature* Illidan = player->FindNearestCreature(22083, 50);
+ go_crystal_prisonAI(GameObject* go) : GameObjectAI(go) { }
- if (Illidan && !ENSURE_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->EventStarted)
+ void QuestAccept(Player* player, Quest const* quest) override
+ {
+ if (quest->GetQuestId() == QUEST_BATTLE_OF_THE_CRIMSON_WATCH)
{
- ENSURE_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->PlayerGUID = player->GetGUID();
- ENSURE_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->LiveCount = 0;
- ENSURE_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->EventStarted = true;
+ Creature* illidan = player->FindNearestCreature(22083, 50);
+ if (illidan && !ENSURE_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, illidan->AI())->EventStarted)
+ {
+ ENSURE_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, illidan->AI())->PlayerGUID = player->GetGUID();
+ ENSURE_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, illidan->AI())->LiveCount = 0;
+ ENSURE_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, illidan->AI())->EventStarted = true;
+ }
}
}
- return true;
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return new go_crystal_prisonAI(go);
}
};
diff --git a/src/server/scripts/Outland/zone_shattrath_city.cpp b/src/server/scripts/Outland/zone_shattrath_city.cpp
index c76e803c168..5334f567a89 100644
--- a/src/server/scripts/Outland/zone_shattrath_city.cpp
+++ b/src/server/scripts/Outland/zone_shattrath_city.cpp
@@ -56,39 +56,6 @@ class npc_raliq_the_drunk : public CreatureScript
public:
npc_raliq_the_drunk() : CreatureScript("npc_raliq_the_drunk") { }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
- {
- ClearGossipMenuFor(player);
- if (action == GOSSIP_ACTION_INFO_DEF+1)
- {
- CloseGossipMenuFor(player);
- creature->SetFaction(FACTION_OGRE_HOSTILE);
- creature->AI()->Talk(SAY_RALIQ_ATTACK, player);
- creature->AI()->AttackStart(player);
- }
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature) override
- {
- if (player->GetQuestStatus(CRACKIN_SOME_SKULLS) == QUEST_STATUS_INCOMPLETE)
- {
- AddGossipItemFor(player, MENU_ID_COLLECT_A_DEBT, OPTION_ID_COLLECT_A_DEBT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- SendGossipMenuFor(player, NPC_TEXT_WUT_YOU_WANT, creature->GetGUID());
- }
- else
- {
- ClearGossipMenuFor(player);
- SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
- }
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new npc_raliq_the_drunkAI(creature);
- }
-
struct npc_raliq_the_drunkAI : public ScriptedAI
{
npc_raliq_the_drunkAI(Creature* creature) : ScriptedAI(creature)
@@ -122,7 +89,41 @@ public:
DoMeleeAttackIfReady();
}
+
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
+ {
+ uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
+ ClearGossipMenuFor(player);
+ if (action == GOSSIP_ACTION_INFO_DEF + 1)
+ {
+ CloseGossipMenuFor(player);
+ me->SetFaction(FACTION_OGRE_HOSTILE);
+ Talk(SAY_RALIQ_ATTACK, player);
+ AttackStart(player);
+ }
+ return true;
+ }
+
+ bool GossipHello(Player* player) override
+ {
+ if (player->GetQuestStatus(CRACKIN_SOME_SKULLS) == QUEST_STATUS_INCOMPLETE)
+ {
+ AddGossipItemFor(player, MENU_ID_COLLECT_A_DEBT, OPTION_ID_COLLECT_A_DEBT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ SendGossipMenuFor(player, NPC_TEXT_WUT_YOU_WANT, me->GetGUID());
+ }
+ else
+ {
+ ClearGossipMenuFor(player);
+ SendGossipMenuFor(player, player->GetGossipTextId(me), me->GetGUID());
+ }
+ return true;
+ }
};
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_raliq_the_drunkAI(creature);
+ }
};
/*######
@@ -146,40 +147,6 @@ class npc_salsalabim : public CreatureScript
public:
npc_salsalabim() : CreatureScript("npc_salsalabim") { }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
- {
- ClearGossipMenuFor(player);
- if (action == GOSSIP_ACTION_INFO_DEF+1)
- {
- CloseGossipMenuFor(player);
- creature->SetFaction(FACTION_DEMON_HOSTILE);
- creature->AI()->Talk(SAY_DEMONIC_AGGRO, player);
- creature->AI()->AttackStart(player);
- }
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature) override
- {
- if (player->GetQuestStatus(PATIENCE_AND_UNDERSTANDING) == QUEST_STATUS_INCOMPLETE)
- {
- AddGossipItemFor(player, MENU_ID_ALTRUIS_SENT_ME, OPTION_ID_ALTRUIS_SENT_ME, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- SendGossipMenuFor(player, NPC_TEXT_SAL_GROWLS_AT_YOU, creature->GetGUID());
- }
- else
- {
- if (creature->IsQuestGiver())
- player->PrepareQuestMenu(creature->GetGUID());
- SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
- }
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new npc_salsalabimAI(creature);
- }
-
struct npc_salsalabimAI : public ScriptedAI
{
npc_salsalabimAI(Creature* creature) : ScriptedAI(creature)
@@ -223,7 +190,42 @@ public:
DoMeleeAttackIfReady();
}
+
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
+ {
+ uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
+ ClearGossipMenuFor(player);
+ if (action == GOSSIP_ACTION_INFO_DEF + 1)
+ {
+ CloseGossipMenuFor(player);
+ me->SetFaction(FACTION_DEMON_HOSTILE);
+ Talk(SAY_DEMONIC_AGGRO, player);
+ AttackStart(player);
+ }
+ return true;
+ }
+
+ bool GossipHello(Player* player) override
+ {
+ if (player->GetQuestStatus(PATIENCE_AND_UNDERSTANDING) == QUEST_STATUS_INCOMPLETE)
+ {
+ AddGossipItemFor(player, MENU_ID_ALTRUIS_SENT_ME, OPTION_ID_ALTRUIS_SENT_ME, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ SendGossipMenuFor(player, NPC_TEXT_SAL_GROWLS_AT_YOU, me->GetGUID());
+ }
+ else
+ {
+ if (me->IsQuestGiver())
+ player->PrepareQuestMenu(me->GetGUID());
+ SendGossipMenuFor(player, player->GetGossipTextId(me), me->GetGUID());
+ }
+ return true;
+ }
};
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_salsalabimAI(creature);
+ }
};
/*
@@ -255,46 +257,57 @@ class npc_shattrathflaskvendors : public CreatureScript
public:
npc_shattrathflaskvendors() : CreatureScript("npc_shattrathflaskvendors") { }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
+ struct npc_shattrathflaskvendorsAI : public ScriptedAI
{
- ClearGossipMenuFor(player);
- if (action == GOSSIP_ACTION_TRADE)
- player->GetSession()->SendListInventory(creature->GetGUID());
+ npc_shattrathflaskvendorsAI(Creature* creature) : ScriptedAI(creature) { }
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature) override
- {
- if (creature->GetEntry() == HALDOR_THE_COMPULSIVE)
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
{
- // Aldor vendor
- if (creature->IsVendor() && (player->GetReputationRank(ALDOR_REPUTATION) == REP_EXALTED) && (player->GetReputationRank(THE_SHA_TAR_REPUTATION) == REP_EXALTED) && (player->GetReputationRank(CENARION_EXPEDITION_REP) == REP_EXALTED))
- {
- AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
- SendGossipMenuFor(player, NPC_TEXT_WELCOME_NAME, creature->GetGUID());
- }
- else
- {
- SendGossipMenuFor(player, NPC_TEXT_EXALTED_ALDOR, creature->GetGUID());
- }
+ uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
+ ClearGossipMenuFor(player);
+ if (action == GOSSIP_ACTION_TRADE)
+ player->GetSession()->SendListInventory(me->GetGUID());
+
+ return true;
}
- if (creature->GetEntry() == ARCANIST_XORITH)
+ bool GossipHello(Player* player) override
{
- // Scryers vendor
- if (creature->IsVendor() && (player->GetReputationRank(SCRYERS_REPUTATION) == REP_EXALTED) && (player->GetReputationRank(THE_SHA_TAR_REPUTATION) == REP_EXALTED) && (player->GetReputationRank(CENARION_EXPEDITION_REP) == REP_EXALTED))
+ if (me->GetEntry() == HALDOR_THE_COMPULSIVE)
{
- AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
- SendGossipMenuFor(player, NPC_TEXT_WELCOME_NAME, creature->GetGUID());
+ // Aldor vendor
+ if (me->IsVendor() && (player->GetReputationRank(ALDOR_REPUTATION) == REP_EXALTED) && (player->GetReputationRank(THE_SHA_TAR_REPUTATION) == REP_EXALTED) && (player->GetReputationRank(CENARION_EXPEDITION_REP) == REP_EXALTED))
+ {
+ AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
+ SendGossipMenuFor(player, NPC_TEXT_WELCOME_NAME, me->GetGUID());
+ }
+ else
+ {
+ SendGossipMenuFor(player, NPC_TEXT_EXALTED_ALDOR, me->GetGUID());
+ }
}
- else
+
+ if (me->GetEntry() == ARCANIST_XORITH)
{
- SendGossipMenuFor(player, NPC_TEXT_EXALTED_SCRYERS, creature->GetGUID());
+ // Scryers vendor
+ if (me->IsVendor() && (player->GetReputationRank(SCRYERS_REPUTATION) == REP_EXALTED) && (player->GetReputationRank(THE_SHA_TAR_REPUTATION) == REP_EXALTED) && (player->GetReputationRank(CENARION_EXPEDITION_REP) == REP_EXALTED))
+ {
+ AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
+ SendGossipMenuFor(player, NPC_TEXT_WELCOME_NAME, me->GetGUID());
+ }
+ else
+ {
+ SendGossipMenuFor(player, NPC_TEXT_EXALTED_SCRYERS, me->GetGUID());
+ }
}
+
+ return true;
}
+ };
- return true;
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_shattrathflaskvendorsAI(creature);
}
};
@@ -315,23 +328,34 @@ class npc_zephyr : public CreatureScript
public:
npc_zephyr() : CreatureScript("npc_zephyr") { }
- bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) override
+ struct npc_zephyrAI : public ScriptedAI
{
- ClearGossipMenuFor(player);
- if (action == GOSSIP_ACTION_INFO_DEF+1)
- player->CastSpell(player, TELEPORT_CAVERNS_OF_TIME, false);
+ npc_zephyrAI(Creature* creature) : ScriptedAI(creature) { }
- return true;
- }
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
+ {
+ uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
+ ClearGossipMenuFor(player);
+ if (action == GOSSIP_ACTION_INFO_DEF + 1)
+ player->CastSpell(player, TELEPORT_CAVERNS_OF_TIME, false);
- bool OnGossipHello(Player* player, Creature* creature) override
- {
- if (player->GetReputationRank(KEEPERS_OF_TIME_REPUTATION) >= REP_REVERED)
- AddGossipItemFor(player, MENU_ID_TAKE_ME_TO_C_O_T, OPTION_ID_TAKE_ME_TO_C_O_T, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+ return true;
+ }
- SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
+ bool GossipHello(Player* player) override
+ {
+ if (player->GetReputationRank(KEEPERS_OF_TIME_REPUTATION) >= REP_REVERED)
+ AddGossipItemFor(player, MENU_ID_TAKE_ME_TO_C_O_T, OPTION_ID_TAKE_ME_TO_C_O_T, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- return true;
+ SendGossipMenuFor(player, player->GetGossipTextId(me), me->GetGUID());
+
+ return true;
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_zephyrAI(creature);
}
};
diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp
index d5521265fe4..50ee9cf0039 100644
--- a/src/server/scripts/Outland/zone_terokkar_forest.cpp
+++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp
@@ -33,6 +33,7 @@ EndContentData */
#include "ScriptMgr.h"
#include "GameObject.h"
+#include "GameObjectAI.h"
#include "Group.h"
#include "Player.h"
#include "ScriptedEscortAI.h"
@@ -327,38 +328,6 @@ class npc_floon : public CreatureScript
public:
npc_floon() : CreatureScript("npc_floon") { }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
- {
- ClearGossipMenuFor(player);
- if (action == GOSSIP_ACTION_INFO_DEF)
- {
- AddGossipItemFor(player, MENU_ID_PAY_UP_OR_DIE, OPTION_ID_PAY_UP_OR_DIE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- SendGossipMenuFor(player, GOSSIP_HE_ALREADY_KILLED_ME, creature->GetGUID());
- }
- if (action == GOSSIP_ACTION_INFO_DEF+1)
- {
- CloseGossipMenuFor(player);
- creature->SetFaction(FACTION_HOSTILE_FLOON);
- creature->AI()->Talk(SAY_FLOON_ATTACK, player);
- creature->AI()->AttackStart(player);
- }
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature) override
- {
- if (player->GetQuestStatus(QUEST_CRACKIN_SOME_SKULLS) == QUEST_STATUS_INCOMPLETE)
- AddGossipItemFor(player, MENU_ID_COLLECT_A_DEBT, OPTION_ID_COLLECT_A_DEBT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
-
- SendGossipMenuFor(player, GOSSIP_FLOON_STRANGE_SOUNDS, creature->GetGUID());
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new npc_floonAI(creature);
- }
-
struct npc_floonAI : public ScriptedAI
{
npc_floonAI(Creature* creature) : ScriptedAI(creature)
@@ -413,7 +382,40 @@ public:
DoMeleeAttackIfReady();
}
+
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
+ {
+ uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
+ ClearGossipMenuFor(player);
+ if (action == GOSSIP_ACTION_INFO_DEF)
+ {
+ AddGossipItemFor(player, MENU_ID_PAY_UP_OR_DIE, OPTION_ID_PAY_UP_OR_DIE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ SendGossipMenuFor(player, GOSSIP_HE_ALREADY_KILLED_ME, me->GetGUID());
+ }
+ if (action == GOSSIP_ACTION_INFO_DEF + 1)
+ {
+ CloseGossipMenuFor(player);
+ me->SetFaction(FACTION_HOSTILE_FLOON);
+ Talk(SAY_FLOON_ATTACK, player);
+ AttackStart(player);
+ }
+ return true;
+ }
+
+ bool GossipHello(Player* player) override
+ {
+ if (player->GetQuestStatus(QUEST_CRACKIN_SOME_SKULLS) == QUEST_STATUS_INCOMPLETE)
+ AddGossipItemFor(player, MENU_ID_COLLECT_A_DEBT, OPTION_ID_COLLECT_A_DEBT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+
+ SendGossipMenuFor(player, GOSSIP_FLOON_STRANGE_SOUNDS, me->GetGUID());
+ return true;
+ }
};
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_floonAI(creature);
+ }
};
/*######
@@ -496,17 +498,16 @@ public:
player->FailQuest(ESCAPE_FROM_FIREWING_POINT_H);
}
}
- };
- bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override
- {
- if (quest->GetQuestId() == ESCAPE_FROM_FIREWING_POINT_H || quest->GetQuestId() == ESCAPE_FROM_FIREWING_POINT_A)
+ void QuestAccept(Player* player, Quest const* quest) override
{
- ENSURE_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID());
- creature->SetFaction(FACTION_ESCORTEE);
+ if (quest->GetQuestId() == ESCAPE_FROM_FIREWING_POINT_H || quest->GetQuestId() == ESCAPE_FROM_FIREWING_POINT_A)
+ {
+ Start(true, false, player->GetGUID());
+ me->SetFaction(FACTION_ESCORTEE);
+ }
}
- return true;
- }
+ };
CreatureAI* GetAI(Creature* creature) const override
{
@@ -537,47 +538,59 @@ class go_skull_pile : public GameObjectScript
public:
go_skull_pile() : GameObjectScript("go_skull_pile") { }
- bool OnGossipSelect(Player* player, GameObject* go, uint32 sender, uint32 action) override
+ struct go_skull_pileAI : public GameObjectAI
{
- ClearGossipMenuFor(player);
- switch (sender)
+ go_skull_pileAI(GameObject* go) : GameObjectAI(go) { }
+
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
{
- case GOSSIP_SENDER_MAIN: SendActionMenu(player, go, action); break;
+ uint32 const sender = player->PlayerTalkClass->GetGossipOptionSender(gossipListId);
+ uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
+ ClearGossipMenuFor(player);
+ switch (sender)
+ {
+ case GOSSIP_SENDER_MAIN: SendActionMenu(player, action); break;
+ }
+ return true;
}
- return true;
- }
- bool OnGossipHello(Player* player, GameObject* go) override
- {
- if ((player->GetQuestStatus(ADVERSARIAL_BLOOD) == QUEST_STATUS_INCOMPLETE) || player->GetQuestRewardStatus(ADVERSARIAL_BLOOD))
+ bool GossipHello(Player* player, bool /*reportUse*/) override
{
- AddGossipItemFor(player, GOSSIP_MENU_ID_SKULL_PILE, OPTION_ID_GEZZARAK_THE_HUNTRESS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- AddGossipItemFor(player, GOSSIP_MENU_ID_SKULL_PILE, OPTION_ID_DARKSCREECHER_AKKARAI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
- AddGossipItemFor(player, GOSSIP_MENU_ID_SKULL_PILE, OPTION_ID_KARROG, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
- AddGossipItemFor(player, GOSSIP_MENU_ID_SKULL_PILE, OPTION_ID_VAKKIZ_THE_WINDRAGER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
- }
+ if ((player->GetQuestStatus(ADVERSARIAL_BLOOD) == QUEST_STATUS_INCOMPLETE) || player->GetQuestRewardStatus(ADVERSARIAL_BLOOD))
+ {
+ AddGossipItemFor(player, GOSSIP_MENU_ID_SKULL_PILE, OPTION_ID_GEZZARAK_THE_HUNTRESS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ AddGossipItemFor(player, GOSSIP_MENU_ID_SKULL_PILE, OPTION_ID_DARKSCREECHER_AKKARAI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
+ AddGossipItemFor(player, GOSSIP_MENU_ID_SKULL_PILE, OPTION_ID_KARROG, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
+ AddGossipItemFor(player, GOSSIP_MENU_ID_SKULL_PILE, OPTION_ID_VAKKIZ_THE_WINDRAGER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
+ }
- SendGossipMenuFor(player, go->GetGOInfo()->questgiver.gossipID, go->GetGUID());
- return true;
- }
+ SendGossipMenuFor(player, me->GetGOInfo()->questgiver.gossipID, me->GetGUID());
+ return true;
+ }
- void SendActionMenu(Player* player, GameObject* /*go*/, uint32 action)
- {
- switch (action)
+ void SendActionMenu(Player* player, uint32 action)
{
- case GOSSIP_ACTION_INFO_DEF + 1:
- player->CastSpell(player, SUMMON_GEZZARAK_THE_HUNTRESS, false);
- break;
- case GOSSIP_ACTION_INFO_DEF + 2:
- player->CastSpell(player, SUMMON_DARKSCREECHER_AKKARAI, false);
- break;
- case GOSSIP_ACTION_INFO_DEF + 3:
- player->CastSpell(player, SUMMON_KARROG, false);
- break;
- case GOSSIP_ACTION_INFO_DEF + 4:
- player->CastSpell(player, SUMMON_VAKKIZ_THE_WINDRAGER, false);
- break;
+ switch (action)
+ {
+ case GOSSIP_ACTION_INFO_DEF + 1:
+ player->CastSpell(player, SUMMON_GEZZARAK_THE_HUNTRESS, false);
+ break;
+ case GOSSIP_ACTION_INFO_DEF + 2:
+ player->CastSpell(player, SUMMON_DARKSCREECHER_AKKARAI, false);
+ break;
+ case GOSSIP_ACTION_INFO_DEF + 3:
+ player->CastSpell(player, SUMMON_KARROG, false);
+ break;
+ case GOSSIP_ACTION_INFO_DEF + 4:
+ player->CastSpell(player, SUMMON_VAKKIZ_THE_WINDRAGER, false);
+ break;
+ }
}
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const override
+ {
+ return new go_skull_pileAI(go);
}
};
@@ -597,26 +610,37 @@ class npc_slim : public CreatureScript
public:
npc_slim() : CreatureScript("npc_slim") { }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
+ struct npc_slimAI : public ScriptedAI
{
- ClearGossipMenuFor(player);
- if (action == GOSSIP_ACTION_TRADE)
- player->GetSession()->SendListInventory(creature->GetGUID());
+ npc_slimAI(Creature* creature) : ScriptedAI(creature) { }
- return true;
- }
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
+ {
+ uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
+ ClearGossipMenuFor(player);
+ if (action == GOSSIP_ACTION_TRADE)
+ player->GetSession()->SendListInventory(me->GetGUID());
- bool OnGossipHello(Player* player, Creature* creature) override
- {
- if (creature->IsVendor() && player->GetReputationRank(FACTION_CONSORTIUM) >= REP_FRIENDLY)
+ return true;
+ }
+
+ bool GossipHello(Player* player) override
{
- AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
- SendGossipMenuFor(player, NPC_TEXT_I_SEE_YOU_ARE_A_FRIEND, creature->GetGUID());
+ if (me->IsVendor() && player->GetReputationRank(FACTION_CONSORTIUM) >= REP_FRIENDLY)
+ {
+ AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
+ SendGossipMenuFor(player, NPC_TEXT_I_SEE_YOU_ARE_A_FRIEND, me->GetGUID());
+ }
+ else
+ SendGossipMenuFor(player, NPC_TEXT_NEITHER_SLIM_NOR_SHADY, me->GetGUID());
+
+ return true;
}
- else
- SendGossipMenuFor(player, NPC_TEXT_NEITHER_SLIM_NOR_SHADY, creature->GetGUID());
+ };
- return true;
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_slimAI(creature);
}
};
@@ -635,26 +659,6 @@ class npc_akuno : public CreatureScript
public:
npc_akuno() : CreatureScript("npc_akuno") { }
- bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override
- {
- if (quest->GetQuestId() == QUEST_ESCAPING_THE_TOMB)
- {
- if (npc_akunoAI* pEscortAI = CAST_AI(npc_akuno::npc_akunoAI, creature->AI()))
- pEscortAI->Start(false, false, player->GetGUID());
-
- if (player->GetTeamId() == TEAM_ALLIANCE)
- creature->SetFaction(FACTION_ESCORT_A_NEUTRAL_PASSIVE);
- else
- creature->SetFaction(FACTION_ESCORT_H_NEUTRAL_PASSIVE);
- }
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new npc_akunoAI(creature);
- }
-
struct npc_akunoAI : public npc_escortAI
{
npc_akunoAI(Creature* creature) : npc_escortAI(creature) { }
@@ -682,7 +686,25 @@ public:
{
summon->AI()->AttackStart(me);
}
+
+ void QuestAccept(Player* player, Quest const* quest) override
+ {
+ if (quest->GetQuestId() == QUEST_ESCAPING_THE_TOMB)
+ {
+ Start(false, false, player->GetGUID());
+
+ if (player->GetTeamId() == TEAM_ALLIANCE)
+ me->SetFaction(FACTION_ESCORT_A_NEUTRAL_PASSIVE);
+ else
+ me->SetFaction(FACTION_ESCORT_H_NEUTRAL_PASSIVE);
+ }
+ }
};
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_akunoAI(creature);
+ }
};
void AddSC_terokkar_forest()
diff --git a/src/server/scripts/Outland/zone_zangarmarsh.cpp b/src/server/scripts/Outland/zone_zangarmarsh.cpp
index d73acd789f9..ced7d46107f 100644
--- a/src/server/scripts/Outland/zone_zangarmarsh.cpp
+++ b/src/server/scripts/Outland/zone_zangarmarsh.cpp
@@ -62,87 +62,94 @@ class npcs_ashyen_and_keleth : public CreatureScript
public:
npcs_ashyen_and_keleth() : CreatureScript("npcs_ashyen_and_keleth") { }
- bool OnGossipHello(Player* player, Creature* creature) override
+ struct npcs_ashyen_and_kelethAI : public ScriptedAI
{
- if (player->GetReputationRank(942) > REP_NEUTRAL)
+ npcs_ashyen_and_kelethAI(Creature* creature) : ScriptedAI(creature) { }
+
+ bool GossipHello(Player* player) override
{
- if (creature->GetEntry() == NPC_ASHYEN)
- AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_ASH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+ if (player->GetReputationRank(942) > REP_NEUTRAL)
+ {
+ if (me->GetEntry() == NPC_ASHYEN)
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_ASH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- if (creature->GetEntry() == NPC_KELETH)
- AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_KEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- }
- SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
+ if (me->GetEntry() == NPC_KELETH)
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_KEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ }
+ SendGossipMenuFor(player, player->GetGossipTextId(me), me->GetGUID());
- return true;
- }
+ return true;
+ }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
- {
- ClearGossipMenuFor(player);
- if (action == GOSSIP_ACTION_INFO_DEF+1)
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
{
- creature->SetPowerType(POWER_MANA);
- creature->SetMaxPower(POWER_MANA, 200); //set a "fake" mana value, we can't depend on database doing it in this case
- creature->SetPower(POWER_MANA, 200);
-
- if (creature->GetEntry() == NPC_ASHYEN) //check which Creature we are dealing with
+ uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
+ ClearGossipMenuFor(player);
+ if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
- uint32 spell = 0;
- switch (player->GetReputationRank(942))
- { //mark of lore
- case REP_FRIENDLY:
- spell = SPELL_BLESS_ASH_FRI;
- break;
- case REP_HONORED:
- spell = SPELL_BLESS_ASH_HON;
- break;
- case REP_REVERED:
- spell = SPELL_BLESS_ASH_REV;
- break;
- case REP_EXALTED:
- spell = SPELL_BLESS_ASH_EXA;
- break;
- default:
- break;
- }
+ me->SetPowerType(POWER_MANA);
+ me->SetMaxPower(POWER_MANA, 200); //set a "fake" mana value, we can't depend on database doing it in this case
+ me->SetPower(POWER_MANA, 200);
- if (spell)
+ if (me->GetEntry() == NPC_ASHYEN) //check which Creature we are dealing with
{
- creature->CastSpell(player, spell, true);
- }
- }
+ uint32 spell = 0;
+ switch (player->GetReputationRank(942))
+ { //mark of lore
+ case REP_FRIENDLY:
+ spell = SPELL_BLESS_ASH_FRI;
+ break;
+ case REP_HONORED:
+ spell = SPELL_BLESS_ASH_HON;
+ break;
+ case REP_REVERED:
+ spell = SPELL_BLESS_ASH_REV;
+ break;
+ case REP_EXALTED:
+ spell = SPELL_BLESS_ASH_EXA;
+ break;
+ default:
+ break;
+ }
- if (creature->GetEntry() == NPC_KELETH)
- {
- uint32 spell = 0;
- switch (player->GetReputationRank(942)) //mark of war
- {
- case REP_FRIENDLY:
- spell = SPELL_BLESS_KEL_FRI;
- break;
- case REP_HONORED:
- spell = SPELL_BLESS_KEL_HON;
- break;
- case REP_REVERED:
- spell = SPELL_BLESS_KEL_REV;
- break;
- case REP_EXALTED:
- spell = SPELL_BLESS_KEL_EXA;
- break;
- default:
- break;
+ if (spell)
+ DoCast(player, spell, true);
}
- if (spell)
+ if (me->GetEntry() == NPC_KELETH)
{
- creature->CastSpell(player, spell, true);
+ uint32 spell = 0;
+ switch (player->GetReputationRank(942)) //mark of war
+ {
+ case REP_FRIENDLY:
+ spell = SPELL_BLESS_KEL_FRI;
+ break;
+ case REP_HONORED:
+ spell = SPELL_BLESS_KEL_HON;
+ break;
+ case REP_REVERED:
+ spell = SPELL_BLESS_KEL_REV;
+ break;
+ case REP_EXALTED:
+ spell = SPELL_BLESS_KEL_EXA;
+ break;
+ default:
+ break;
+ }
+
+ if (spell)
+ DoCast(player, spell, true);
}
+ CloseGossipMenuFor(player);
+ player->TalkedToCreature(me->GetEntry(), me->GetGUID());
}
- CloseGossipMenuFor(player);
- player->TalkedToCreature(creature->GetEntry(), creature->GetGUID());
+ return true;
}
- return true;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npcs_ashyen_and_kelethAI(creature);
}
};
@@ -202,32 +209,33 @@ public:
DoMeleeAttackIfReady();
}
- };
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new npc_cooshcooshAI(creature);
- }
-
- bool OnGossipHello(Player* player, Creature* creature) override
- {
- if (player->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE)
- AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_COOSH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ bool GossipHello(Player* player) override
+ {
+ if (player->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE)
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_COOSH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
- SendGossipMenuFor(player, 9441, creature->GetGUID());
- return true;
- }
+ SendGossipMenuFor(player, 9441, me->GetGUID());
+ return true;
+ }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
- {
- ClearGossipMenuFor(player);
- if (action == GOSSIP_ACTION_INFO_DEF)
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
{
- CloseGossipMenuFor(player);
- creature->SetFaction(FACTION_HOSTILE_CO);
- creature->AI()->AttackStart(player);
+ uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
+ ClearGossipMenuFor(player);
+ if (action == GOSSIP_ACTION_INFO_DEF)
+ {
+ CloseGossipMenuFor(player);
+ me->SetFaction(FACTION_HOSTILE_CO);
+ AttackStart(player);
+ }
+ return true;
}
- return true;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_cooshcooshAI(creature);
}
};
@@ -244,48 +252,58 @@ class npc_elder_kuruti : public CreatureScript
public:
npc_elder_kuruti() : CreatureScript("npc_elder_kuruti") { }
- bool OnGossipHello(Player* player, Creature* creature) override
+ struct npc_elder_kurutiAI : public ScriptedAI
{
- if (player->GetQuestStatus(9803) == QUEST_STATUS_INCOMPLETE)
- AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_KUR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ npc_elder_kurutiAI(Creature* creature) : ScriptedAI(creature) { }
- SendGossipMenuFor(player, 9226, creature->GetGUID());
+ bool GossipHello(Player* player) override
+ {
+ if (player->GetQuestStatus(9803) == QUEST_STATUS_INCOMPLETE)
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_KUR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
- return true;
- }
+ SendGossipMenuFor(player, 9226, me->GetGUID());
+ return true;
+ }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
- {
- ClearGossipMenuFor(player);
- switch (action)
+ bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
{
- case GOSSIP_ACTION_INFO_DEF:
- AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_KUR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- SendGossipMenuFor(player, 9227, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF + 1:
- AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_KUR3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
- SendGossipMenuFor(player, 9229, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF + 2:
+ uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
+ ClearGossipMenuFor(player);
+ switch (action)
{
- if (!player->HasItemCount(24573))
+ case GOSSIP_ACTION_INFO_DEF:
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_KUR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ SendGossipMenuFor(player, 9227, me->GetGUID());
+ break;
+ case GOSSIP_ACTION_INFO_DEF + 1:
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_KUR3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
+ SendGossipMenuFor(player, 9229, me->GetGUID());
+ break;
+ case GOSSIP_ACTION_INFO_DEF + 2:
{
- ItemPosCountVec dest;
- uint32 itemId = 24573;
- InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1, NULL);
- if (msg == EQUIP_ERR_OK)
+ if (!player->HasItemCount(24573))
{
- player->StoreNewItem(dest, itemId, true);
+ ItemPosCountVec dest;
+ uint32 itemId = 24573;
+ InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1, NULL);
+ if (msg == EQUIP_ERR_OK)
+ {
+ player->StoreNewItem(dest, itemId, true);
+ }
+ else
+ player->SendEquipError(msg, NULL, NULL, itemId);
}
- else
- player->SendEquipError(msg, NULL, NULL, itemId);
+ SendGossipMenuFor(player, 9231, me->GetGUID());
+ break;
}
- SendGossipMenuFor(player, 9231, creature->GetGUID());
- break;
}
+ return true;
}
- return true;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_elder_kurutiAI(creature);
}
};
@@ -347,19 +365,16 @@ public:
break;
}
}
- };
- bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override
- {
- if (quest->GetQuestId() == QUEST_ESCAPE_FROM)
+ void QuestAccept(Player* player, Quest const* quest) override
{
- creature->AI()->Talk(SAY_START, player);
-
- if (npc_escortAI* pEscortAI = CAST_AI(npc_kayra_longmane::npc_kayra_longmaneAI, creature->AI()))
- pEscortAI->Start(false, false, player->GetGUID());
+ if (quest->GetQuestId() == QUEST_ESCAPE_FROM)
+ {
+ Talk(SAY_START, player);
+ Start(false, false, player->GetGUID());
+ }
}
- return true;
- }
+ };
CreatureAI* GetAI(Creature* creature) const override
{