AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
npc_wg_demolisher_engineer Class Reference
Inheritance diagram for npc_wg_demolisher_engineer:
CreatureScript ScriptObject UpdatableScript< Creature >

Public Member Functions

 npc_wg_demolisher_engineer ()
 
bool OnGossipHello (Player *player, Creature *creature) override
 
bool OnGossipSelect (Player *player, Creature *creature, uint32, uint32 action) override
 
- Public Member Functions inherited from CreatureScript
bool IsDatabaseBound () const override
 
virtual bool OnGossipHello (Player *, Creature *)
 
virtual bool OnGossipSelect (Player *, Creature *, uint32, uint32)
 
virtual bool OnGossipSelectCode (Player *, Creature *, uint32, uint32, const char *)
 
virtual bool OnQuestAccept (Player *, Creature *, Quest const *)
 
virtual bool OnQuestSelect (Player *, Creature *, Quest const *)
 
virtual bool OnQuestComplete (Player *, Creature *, Quest const *)
 
virtual bool OnQuestReward (Player *, Creature *, Quest const *, uint32)
 
virtual uint32 GetDialogStatus (Player *, Creature *)
 
virtual CreatureAIGetAI (Creature *) const
 
virtual void OnFfaPvpStateUpdate (Creature *, bool)
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 
- Public Member Functions inherited from UpdatableScript< Creature >
virtual void OnUpdate (Creature *, uint32)
 

Private Member Functions

bool canBuild (Creature *creature)
 

Additional Inherited Members

- Protected Member Functions inherited from CreatureScript
 CreatureScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 
- Protected Member Functions inherited from UpdatableScript< Creature >
 UpdatableScript ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_wg_demolisher_engineer()

npc_wg_demolisher_engineer::npc_wg_demolisher_engineer ( )
inline
133: CreatureScript("npc_wg_demolisher_engineer") { }
Definition: CreatureScript.h:25

Member Function Documentation

◆ canBuild()

bool npc_wg_demolisher_engineer::canBuild ( Creature creature)
inlineprivate
194 {
195 Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
196 if (!wintergrasp)
197 return false;
198
199 switch (creature->GetEntry())
200 {
205 default:
206 return false;
207 }
208 }
@ NPC_GOBLIN_MECHANIC
Definition: zone_wintergrasp.cpp:75
@ NPC_GNOMISH_ENGINEER
Definition: zone_wintergrasp.cpp:76
@ BATTLEFIELD_BATTLEID_WG
Definition: Battlefield.h:35
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:77
@ BATTLEFIELD_WG_DATA_VEHICLE_A
Definition: BattlefieldWG.h:96
@ BATTLEFIELD_WG_DATA_MAX_VEHICLE_A
Definition: BattlefieldWG.h:94
@ BATTLEFIELD_WG_DATA_VEHICLE_H
Definition: BattlefieldWG.h:97
@ BATTLEFIELD_WG_DATA_MAX_VEHICLE_H
Definition: BattlefieldWG.h:95
Definition: Battlefield.h:204
uint32 GetData(uint32 dataId) const override
Definition: Battlefield.h:270
uint32 GetEntry() const
Definition: Object.h:115

References BATTLEFIELD_BATTLEID_WG, BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, BATTLEFIELD_WG_DATA_VEHICLE_A, BATTLEFIELD_WG_DATA_VEHICLE_H, Battlefield::GetData(), Object::GetEntry(), NPC_GNOMISH_ENGINEER, NPC_GOBLIN_MECHANIC, and sBattlefieldMgr.

Referenced by OnGossipSelect().

◆ OnGossipHello()

bool npc_wg_demolisher_engineer::OnGossipHello ( Player player,
Creature creature 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

136 {
137 if (creature->IsQuestGiver())
138 {
139 player->PrepareQuestMenu(creature->GetGUID());
140 }
141
142 if (player->HasAura(SPELL_CORPORAL))
143 {
145 }
146 else if (player->HasAura(SPELL_LIEUTENANT))
147 {
151 }
152
153 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
154 return true;
155 }
@ SPELL_CORPORAL
Definition: BattlefieldWG.h:48
@ SPELL_LIEUTENANT
Definition: BattlefieldWG.h:49
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const guid)
Definition: ScriptedGossip.cpp:45
void AddGossipItemFor(Player *player, uint32 icon, std::string const &text, uint32 sender, uint32 action)
Definition: ScriptedGossip.cpp:28
@ GOSSIP_SENDER_MAIN
Definition: ScriptedGossip.h:70
@ GOSSIP_ACTION_INFO_DEF
Definition: ScriptedGossip.h:68
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
void PrepareQuestMenu(ObjectGuid guid)
Definition: PlayerQuest.cpp:39
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:404
bool IsQuestGiver() const
Definition: Unit.h:762
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5698

References AddGossipItemFor(), Player::GetGossipTextId(), Object::GetGUID(), GOSSIP_ACTION_INFO_DEF, GOSSIP_SENDER_MAIN, Unit::HasAura(), Unit::IsQuestGiver(), Player::PrepareQuestMenu(), SendGossipMenuFor(), SPELL_CORPORAL, and SPELL_LIEUTENANT.

◆ OnGossipSelect()

bool npc_wg_demolisher_engineer::OnGossipSelect ( Player player,
Creature creature,
uint32  ,
uint32  action 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

158 {
159 CloseGossipMenuFor(player);
160
161 uint32 spellId = 0;
162 switch (action - GOSSIP_ACTION_INFO_DEF)
163 {
164 case 0:
166 break;
167 case 1:
169 break;
170 case 2:
172 break;
173 }
174
175 if (canBuild(creature))
176 {
177 creature->CastSpell(player, spellId, true);
178 creature->CastSpell(creature, SPELL_ACTIVATE_CONTROL_ARMS, true);
179 }
180 else
181 {
182 WorldPacket data(SMSG_CAST_FAILED, 1 + 4 + 1 + 4);
183 data << uint8(0);
184 data << spellId;
187 player->GetSession()->SendPacket(&data);
188 }
189 return true;
190 }
std::uint8_t uint8
Definition: Define.h:109
std::uint32_t uint32
Definition: Define.h:107
@ SPELL_BUILD_DEMOLISHER_FORCE
Definition: zone_wintergrasp.cpp:58
@ SPELL_ACTIVATE_CONTROL_ARMS
Definition: zone_wintergrasp.cpp:59
@ SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE
Definition: zone_wintergrasp.cpp:56
@ SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE
Definition: zone_wintergrasp.cpp:55
@ SPELL_BUILD_CATAPULT_FORCE
Definition: zone_wintergrasp.cpp:57
@ SPELL_CUSTOM_ERROR_CANT_BUILD_MORE_VEHICLES
Definition: SharedDefines.h:1185
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ SPELL_FAILED_CUSTOM_ERROR
Definition: SharedDefines.h:1121
void CloseGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:56
@ SMSG_CAST_FAILED
Definition: Opcodes.h:334
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2108
WorldSession * GetSession() const
Definition: Player.h:1998
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1167
Definition: WorldPacket.h:26
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:214
bool canBuild(Creature *creature)
Definition: zone_wintergrasp.cpp:193

References canBuild(), Unit::CastSpell(), CloseGossipMenuFor(), Player::GetSession(), Player::GetTeamId(), GOSSIP_ACTION_INFO_DEF, WorldSession::SendPacket(), SMSG_CAST_FAILED, SPELL_ACTIVATE_CONTROL_ARMS, SPELL_BUILD_CATAPULT_FORCE, SPELL_BUILD_DEMOLISHER_FORCE, SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE, SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE, SPELL_CUSTOM_ERROR_CANT_BUILD_MORE_VEHICLES, SPELL_FAILED_CUSTOM_ERROR, and TEAM_ALLIANCE.