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 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)
 

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_sayge()

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

Member Function Documentation

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

1557 {
1558 if (creature->IsQuestGiver())
1559 player->PrepareQuestMenu(creature->GetGUID());
1560
1561 if (player->HasSpellCooldown(SPELL_INT) ||
1562 player->HasSpellCooldown(SPELL_ARM) ||
1563 player->HasSpellCooldown(SPELL_DMG) ||
1564 player->HasSpellCooldown(SPELL_RES) ||
1565 player->HasSpellCooldown(SPELL_STR) ||
1566 player->HasSpellCooldown(SPELL_AGI) ||
1567 player->HasSpellCooldown(SPELL_STM) ||
1568 player->HasSpellCooldown(SPELL_SPI))
1569 {
1570 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1571 }
1572 else
1573 {
1575 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1576 }
1577
1578 return true;
1579 }
@ SPELL_DMG
Definition: npcs_special.cpp:1506
@ SPELL_STM
Definition: npcs_special.cpp:1511
@ SPELL_AGI
Definition: npcs_special.cpp:1513
@ SPELL_ARM
Definition: npcs_special.cpp:1508
@ SPELL_INT
Definition: npcs_special.cpp:1510
@ SPELL_RES
Definition: npcs_special.cpp:1507
@ SPELL_STR
Definition: npcs_special.cpp:1512
@ SPELL_SPI
Definition: npcs_special.cpp:1509
@ GOSSIP_MENU_SAYGE_HELLO
Definition: npcs_special.cpp:1520
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
bool HasSpellCooldown(uint32 spell_id) const override
Definition: Player.cpp:16364
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

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.

1628 {
1629 ClearGossipMenuFor(player);
1630 switch (sender)
1631 {
1632 case GOSSIP_SENDER_MAIN:
1633 SendAction(player, creature, action);
1634 break;
1635 case GOSSIP_SENDER_MAIN + 1:
1636 creature->CastSpell(player, SPELL_DMG, false);
1638 SendAction(player, creature, action);
1639 break;
1640 case GOSSIP_SENDER_MAIN + 2:
1641 creature->CastSpell(player, SPELL_RES, false);
1643 SendAction(player, creature, action);
1644 break;
1645 case GOSSIP_SENDER_MAIN + 3:
1646 creature->CastSpell(player, SPELL_ARM, false);
1648 SendAction(player, creature, action);
1649 break;
1650 case GOSSIP_SENDER_MAIN + 4:
1651 creature->CastSpell(player, SPELL_SPI, false);
1653 SendAction(player, creature, action);
1654 break;
1655 case GOSSIP_SENDER_MAIN + 5:
1656 creature->CastSpell(player, SPELL_INT, false);
1658 SendAction(player, creature, action);
1659 break;
1660 case GOSSIP_SENDER_MAIN + 6:
1661 creature->CastSpell(player, SPELL_STM, false);
1663 SendAction(player, creature, action);
1664 break;
1665 case GOSSIP_SENDER_MAIN + 7:
1666 creature->CastSpell(player, SPELL_STR, false);
1668 SendAction(player, creature, action);
1669 break;
1670 case GOSSIP_SENDER_MAIN + 8:
1671 creature->CastSpell(player, SPELL_AGI, false);
1673 SendAction(player, creature, action);
1674 break;
1675 }
1676 return true;
1677 }
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:11120
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
void SendAction(Player *player, Creature *creature, uint32 action)
Definition: npcs_special.cpp:1581

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
1582 {
1583 switch (action)
1584 {
1585 case GOSSIP_ACTION_INFO_DEF + 1:
1590 SendGossipMenuFor(player, NPC_TEXT_SAYGE_1, creature->GetGUID());
1591 break;
1592 case GOSSIP_ACTION_INFO_DEF + 2: // Slay
1596 SendGossipMenuFor(player, NPC_TEXT_SAYGE_SLAY, creature->GetGUID());
1597 break;
1598 case GOSSIP_ACTION_INFO_DEF + 3: // Turn over
1603 break;
1604 case GOSSIP_ACTION_INFO_DEF + 4: // Confiscate
1609 break;
1610 case GOSSIP_ACTION_INFO_DEF + 5: // Let him go
1611 AddGossipItemFor(player, GOSSIP_MENU_SAYGE_LET_GO, 0, GOSSIP_SENDER_MAIN + 5, GOSSIP_ACTION_INFO_DEF); // Take credit, keep gold
1612 AddGossipItemFor(player, GOSSIP_MENU_SAYGE_LET_GO, 1, GOSSIP_SENDER_MAIN + 4, GOSSIP_ACTION_INFO_DEF); // Take credit, share gold
1614 SendGossipMenuFor(player, NPC_TEXT_SAYGE_LET_GO, creature->GetGUID());
1615 break;
1616 case GOSSIP_ACTION_INFO_DEF: // End
1618 SendGossipMenuFor(player, NPC_TEXT_SAYGE_END, creature->GetGUID());
1619 break;
1620 case GOSSIP_ACTION_INFO_DEF + 6: // End - Take fortune
1621 creature->CastSpell(player, SPELL_FORTUNE, false);
1623 break;
1624 }
1625 }
@ SPELL_FORTUNE
Definition: npcs_special.cpp:1514
@ GOSSIP_MENU_SAYGE_SLAY
Definition: npcs_special.cpp:1528
@ NPC_TEXT_SAYGE_1
Definition: npcs_special.cpp:1525
@ GOSSIP_MENU_SAYGE_CONFISCATE
Definition: npcs_special.cpp:1536
@ NPC_TEXT_SAYGE_LET_GO
Definition: npcs_special.cpp:1541
@ NPC_TEXT_SAYGE_SLAY
Definition: npcs_special.cpp:1529
@ NPC_TEXT_SAYGE_CONFISCATE
Definition: npcs_special.cpp:1537
@ GOSSIP_MENU_SAYGE_1
Definition: npcs_special.cpp:1524
@ NPC_TEXT_SAYGE_END_FORTUNE
Definition: npcs_special.cpp:1548
@ GOSSIP_MENU_SAYGE_TURN_OVER
Definition: npcs_special.cpp:1532
@ NPC_TEXT_SAYGE_END
Definition: npcs_special.cpp:1545
@ GOSSIP_MENU_SAYGE_END
Definition: npcs_special.cpp:1544
@ GOSSIP_MENU_SAYGE_LET_GO
Definition: npcs_special.cpp:1540
@ NPC_TEXT_SAYGE_TURN_OVER
Definition: npcs_special.cpp:1533

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.