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

Public Member Functions

 npc_sayge ()
 
bool OnGossipHello (Player *player, Creature *creature) override
 
void SendAction (Player *player, Creature *creature, uint32 action)
 
bool OnGossipSelect (Player *player, Creature *creature, uint32 sender, uint32 action) override
 
- Public Member Functions inherited from CreatureScript
bool IsDatabaseBound () const override
 
virtual bool OnGossipSelectCode (Player *, Creature *, uint32, uint32, char const *)
 
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 CreatureAI * GetAI (Creature *) const
 
virtual void OnFfaPvpStateUpdate (Creature *, bool)
 
- Public Member Functions inherited from ScriptObject
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
std::string const & GetName () const
 
uint16 GetTotalAvailableHooks ()
 
- Public Member Functions inherited from UpdatableScript< Creature >
virtual void OnUpdate (Creature *, uint32)
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ npc_sayge()

npc_sayge::npc_sayge ( )
inline
1509: CreatureScript("npc_sayge") { }
Definition CreatureScript.h:25

Member Function Documentation

◆ OnGossipHello()

bool npc_sayge::OnGossipHello ( Player *  player,
Creature *  creature 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

1512 {
1513 if (creature->IsQuestGiver())
1514 player->PrepareQuestMenu(creature->GetGUID());
1515
1516 if (player->HasSpellCooldown(SPELL_INT) ||
1517 player->HasSpellCooldown(SPELL_ARM) ||
1518 player->HasSpellCooldown(SPELL_DMG) ||
1519 player->HasSpellCooldown(SPELL_RES) ||
1520 player->HasSpellCooldown(SPELL_STR) ||
1521 player->HasSpellCooldown(SPELL_AGI) ||
1522 player->HasSpellCooldown(SPELL_STM) ||
1523 player->HasSpellCooldown(SPELL_SPI))
1524 {
1525 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1526 }
1527 else
1528 {
1530 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1531 }
1532
1533 return true;
1534 }
void AddGossipItemFor(Player *player, uint32 icon, std::string const &text, uint32 sender, uint32 action)
Definition ScriptedGossip.cpp:28
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
Definition ScriptedGossip.cpp:45
@ GOSSIP_SENDER_MAIN
Definition ScriptedGossip.h:70
@ GOSSIP_ACTION_INFO_DEF
Definition ScriptedGossip.h:68
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
bool HasSpellCooldown(uint32 spell_id) const override
Definition Player.cpp:16726
void PrepareQuestMenu(ObjectGuid guid)
Definition PlayerQuest.cpp:40
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition PlayerGossip.cpp:409
bool IsQuestGiver() const
Definition Unit.h:806
@ SPELL_DMG
Definition npcs_special.cpp:1461
@ SPELL_STM
Definition npcs_special.cpp:1466
@ SPELL_AGI
Definition npcs_special.cpp:1468
@ SPELL_ARM
Definition npcs_special.cpp:1463
@ SPELL_INT
Definition npcs_special.cpp:1465
@ SPELL_RES
Definition npcs_special.cpp:1462
@ SPELL_STR
Definition npcs_special.cpp:1467
@ SPELL_SPI
Definition npcs_special.cpp:1464
@ GOSSIP_MENU_SAYGE_HELLO
Definition npcs_special.cpp:1475

References AddGossipItemFor(), Player::GetGossipTextId(), Object::GetGUID(), GOSSIP_ACTION_INFO_DEF, GOSSIP_MENU_SAYGE_HELLO, GOSSIP_SENDER_MAIN, Player::HasSpellCooldown(), Unit::IsQuestGiver(), Player::PrepareQuestMenu(), SendGossipMenuFor(), SPELL_AGI, SPELL_ARM, SPELL_DMG, SPELL_INT, SPELL_RES, SPELL_SPI, SPELL_STM, and SPELL_STR.

◆ OnGossipSelect()

bool npc_sayge::OnGossipSelect ( Player *  player,
Creature *  creature,
uint32  sender,
uint32  action 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

1583 {
1584 ClearGossipMenuFor(player);
1585 switch (sender)
1586 {
1587 case GOSSIP_SENDER_MAIN:
1588 SendAction(player, creature, action);
1589 break;
1590 case GOSSIP_SENDER_MAIN + 1:
1591 creature->CastSpell(player, SPELL_DMG, false);
1593 SendAction(player, creature, action);
1594 break;
1595 case GOSSIP_SENDER_MAIN + 2:
1596 creature->CastSpell(player, SPELL_RES, false);
1598 SendAction(player, creature, action);
1599 break;
1600 case GOSSIP_SENDER_MAIN + 3:
1601 creature->CastSpell(player, SPELL_ARM, false);
1603 SendAction(player, creature, action);
1604 break;
1605 case GOSSIP_SENDER_MAIN + 4:
1606 creature->CastSpell(player, SPELL_SPI, false);
1608 SendAction(player, creature, action);
1609 break;
1610 case GOSSIP_SENDER_MAIN + 5:
1611 creature->CastSpell(player, SPELL_INT, false);
1613 SendAction(player, creature, action);
1614 break;
1615 case GOSSIP_SENDER_MAIN + 6:
1616 creature->CastSpell(player, SPELL_STM, false);
1618 SendAction(player, creature, action);
1619 break;
1620 case GOSSIP_SENDER_MAIN + 7:
1621 creature->CastSpell(player, SPELL_STR, false);
1623 SendAction(player, creature, action);
1624 break;
1625 case GOSSIP_SENDER_MAIN + 8:
1626 creature->CastSpell(player, SPELL_AGI, false);
1628 SendAction(player, creature, action);
1629 break;
1630 }
1631 return true;
1632 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53
constexpr auto HOUR
Definition Common.h:48
void ClearGossipMenuFor(Player *player)
Definition ScriptedGossip.cpp:22
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Player.cpp:11267
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:1372
void SendAction(Player *player, Creature *creature, uint32 action)
Definition npcs_special.cpp:1536

References Player::AddSpellCooldown(), Unit::CastSpell(), ClearGossipMenuFor(), GOSSIP_SENDER_MAIN, HOUR, IN_MILLISECONDS, SPELL_AGI, SPELL_ARM, SPELL_DMG, SPELL_INT, SPELL_RES, SPELL_SPI, SPELL_STM, and SPELL_STR.

◆ SendAction()

void npc_sayge::SendAction ( Player *  player,
Creature *  creature,
uint32  action 
)
inline
1537 {
1538 switch (action)
1539 {
1540 case GOSSIP_ACTION_INFO_DEF + 1:
1545 SendGossipMenuFor(player, NPC_TEXT_SAYGE_1, creature->GetGUID());
1546 break;
1547 case GOSSIP_ACTION_INFO_DEF + 2: // Slay
1551 SendGossipMenuFor(player, NPC_TEXT_SAYGE_SLAY, creature->GetGUID());
1552 break;
1553 case GOSSIP_ACTION_INFO_DEF + 3: // Turn over
1558 break;
1559 case GOSSIP_ACTION_INFO_DEF + 4: // Confiscate
1564 break;
1565 case GOSSIP_ACTION_INFO_DEF + 5: // Let him go
1566 AddGossipItemFor(player, GOSSIP_MENU_SAYGE_LET_GO, 0, GOSSIP_SENDER_MAIN + 5, GOSSIP_ACTION_INFO_DEF); // Take credit, keep gold
1567 AddGossipItemFor(player, GOSSIP_MENU_SAYGE_LET_GO, 1, GOSSIP_SENDER_MAIN + 4, GOSSIP_ACTION_INFO_DEF); // Take credit, share gold
1569 SendGossipMenuFor(player, NPC_TEXT_SAYGE_LET_GO, creature->GetGUID());
1570 break;
1571 case GOSSIP_ACTION_INFO_DEF: // End
1573 SendGossipMenuFor(player, NPC_TEXT_SAYGE_END, creature->GetGUID());
1574 break;
1575 case GOSSIP_ACTION_INFO_DEF + 6: // End - Take fortune
1576 creature->CastSpell(player, SPELL_FORTUNE, false);
1578 break;
1579 }
1580 }
@ SPELL_FORTUNE
Definition npcs_special.cpp:1469
@ GOSSIP_MENU_SAYGE_SLAY
Definition npcs_special.cpp:1483
@ NPC_TEXT_SAYGE_1
Definition npcs_special.cpp:1480
@ GOSSIP_MENU_SAYGE_CONFISCATE
Definition npcs_special.cpp:1491
@ NPC_TEXT_SAYGE_LET_GO
Definition npcs_special.cpp:1496
@ NPC_TEXT_SAYGE_SLAY
Definition npcs_special.cpp:1484
@ NPC_TEXT_SAYGE_CONFISCATE
Definition npcs_special.cpp:1492
@ GOSSIP_MENU_SAYGE_1
Definition npcs_special.cpp:1479
@ NPC_TEXT_SAYGE_END_FORTUNE
Definition npcs_special.cpp:1503
@ GOSSIP_MENU_SAYGE_TURN_OVER
Definition npcs_special.cpp:1487
@ NPC_TEXT_SAYGE_END
Definition npcs_special.cpp:1500
@ GOSSIP_MENU_SAYGE_END
Definition npcs_special.cpp:1499
@ GOSSIP_MENU_SAYGE_LET_GO
Definition npcs_special.cpp:1495
@ NPC_TEXT_SAYGE_TURN_OVER
Definition npcs_special.cpp:1488

References AddGossipItemFor(), Unit::CastSpell(), Object::GetGUID(), GOSSIP_ACTION_INFO_DEF, GOSSIP_MENU_SAYGE_1, GOSSIP_MENU_SAYGE_CONFISCATE, GOSSIP_MENU_SAYGE_END, GOSSIP_MENU_SAYGE_LET_GO, GOSSIP_MENU_SAYGE_SLAY, GOSSIP_MENU_SAYGE_TURN_OVER, GOSSIP_SENDER_MAIN, NPC_TEXT_SAYGE_1, NPC_TEXT_SAYGE_CONFISCATE, NPC_TEXT_SAYGE_END, NPC_TEXT_SAYGE_END_FORTUNE, NPC_TEXT_SAYGE_LET_GO, NPC_TEXT_SAYGE_SLAY, NPC_TEXT_SAYGE_TURN_OVER, SendGossipMenuFor(), and SPELL_FORTUNE.


The documentation for this class was generated from the following file: