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

Classes

struct  npc_zulaman_hostageAI
 

Public Member Functions

 npc_zulaman_hostage ()
 
CreatureAIGetAI (Creature *creature) const override
 
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
 
- Public Member Functions inherited from UpdatableScript< Creature >
virtual void OnUpdate (Creature *, uint32)
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ npc_zulaman_hostage()

npc_zulaman_hostage::npc_zulaman_hostage ( )
inline
458: CreatureScript("npc_zulaman_hostage") { }
Definition: ScriptMgr.h:718

Member Function Documentation

◆ GetAI()

CreatureAI * npc_zulaman_hostage::GetAI ( Creature creature) const
inlineoverridevirtual

Reimplemented from CreatureScript.

488 {
489 return GetZulAmanAI<npc_zulaman_hostageAI>(creature);
490 }

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

493 {
495 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
496 return true;
497 }
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
@ GOSSIP_ICON_CHAT
Definition: GossipDef.h:60
#define GOSSIP_HOSTAGE1
Definition: zulaman.cpp:450
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:405

References AddGossipItemFor(), Player::GetGossipTextId(), Object::GetGUID(), GOSSIP_ACTION_INFO_DEF, GOSSIP_HOSTAGE1, GOSSIP_ICON_CHAT, GOSSIP_SENDER_MAIN, and SendGossipMenuFor().

◆ OnGossipSelect()

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

Reimplemented from CreatureScript.

500 {
501 ClearGossipMenuFor(player);
502
503 if (action == GOSSIP_ACTION_INFO_DEF + 1)
504 CloseGossipMenuFor(player);
505
506 if (!creature->HasNpcFlag(UNIT_NPC_FLAG_GOSSIP))
507 return true;
508
510
511 InstanceScript* instance = creature->GetInstanceScript();
512 if (instance)
513 {
514 //uint8 progress = instance->GetData(DATA_CHESTLOOTED);
515 instance->SetData(DATA_CHESTLOOTED, 0);
516 float x, y, z;
517 creature->GetPosition(x, y, z);
518 uint32 entry = creature->GetEntry();
519 for (uint8 i = 0; i < 4; ++i)
520 {
521 if (HostageEntry[i] == entry)
522 {
523 creature->SummonGameObject(ChestEntry[i], x - 2, y, z, 0, 0, 0, 0, 0, 0);
524 break;
525 }
526 }
527 }
528
529 return true;
530 }
std::uint8_t uint8
Definition: Define.h:110
std::uint32_t uint32
Definition: Define.h:108
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
void CloseGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:56
@ UNIT_NPC_FLAG_GOSSIP
Definition: Unit.h:516
static uint32 HostageEntry[]
Definition: zulaman.cpp:452
static uint32 ChestEntry[]
Definition: zulaman.cpp:453
@ DATA_CHESTLOOTED
Definition: zulaman.h:34
uint32 GetEntry() const
Definition: Object.h:109
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1194
GameObject * SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
Definition: Object.cpp:2317
void GetPosition(float &x, float &y) const
Definition: Position.h:122
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:1684
bool HasNpcFlag(NPCFlags flags) const
Definition: Unit.h:1682
Definition: InstanceScript.h:140
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:53

References ChestEntry, ClearGossipMenuFor(), CloseGossipMenuFor(), DATA_CHESTLOOTED, Object::GetEntry(), WorldObject::GetInstanceScript(), Position::GetPosition(), GOSSIP_ACTION_INFO_DEF, Unit::HasNpcFlag(), HostageEntry, Unit::RemoveNpcFlag(), ZoneScript::SetData(), WorldObject::SummonGameObject(), and UNIT_NPC_FLAG_GOSSIP.