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

npc_sayge::npc_sayge ( )
inline
1535: CreatureScript("npc_sayge") { }
Definition: ScriptMgr.h:719

Member Function Documentation

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

1538 {
1539 if (creature->IsQuestGiver())
1540 player->PrepareQuestMenu(creature->GetGUID());
1541
1542 if (player->HasSpellCooldown(SPELL_INT) ||
1543 player->HasSpellCooldown(SPELL_ARM) ||
1544 player->HasSpellCooldown(SPELL_DMG) ||
1545 player->HasSpellCooldown(SPELL_RES) ||
1546 player->HasSpellCooldown(SPELL_STR) ||
1547 player->HasSpellCooldown(SPELL_AGI) ||
1548 player->HasSpellCooldown(SPELL_STM) ||
1549 player->HasSpellCooldown(SPELL_SPI))
1550 {
1551 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1552 }
1553 else
1554 {
1556 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1557 }
1558
1559 return true;
1560 }
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
@ SPELL_DMG
Definition: npcs_special.cpp:1487
@ SPELL_STM
Definition: npcs_special.cpp:1492
@ SPELL_AGI
Definition: npcs_special.cpp:1494
@ SPELL_ARM
Definition: npcs_special.cpp:1489
@ SPELL_INT
Definition: npcs_special.cpp:1491
@ SPELL_RES
Definition: npcs_special.cpp:1488
@ SPELL_STR
Definition: npcs_special.cpp:1493
@ SPELL_SPI
Definition: npcs_special.cpp:1490
@ GOSSIP_MENU_SAYGE_HELLO
Definition: npcs_special.cpp:1501
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
bool HasSpellCooldown(uint32 spell_id) const override
Definition: Player.cpp:16214
void PrepareQuestMenu(ObjectGuid guid)
Definition: PlayerQuest.cpp:38
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:405
bool IsQuestGiver() const
Definition: Unit.h:1653

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.

1609 {
1610 ClearGossipMenuFor(player);
1611 switch (sender)
1612 {
1613 case GOSSIP_SENDER_MAIN:
1614 SendAction(player, creature, action);
1615 break;
1616 case GOSSIP_SENDER_MAIN + 1:
1617 creature->CastSpell(player, SPELL_DMG, false);
1619 SendAction(player, creature, action);
1620 break;
1621 case GOSSIP_SENDER_MAIN + 2:
1622 creature->CastSpell(player, SPELL_RES, false);
1624 SendAction(player, creature, action);
1625 break;
1626 case GOSSIP_SENDER_MAIN + 3:
1627 creature->CastSpell(player, SPELL_ARM, false);
1629 SendAction(player, creature, action);
1630 break;
1631 case GOSSIP_SENDER_MAIN + 4:
1632 creature->CastSpell(player, SPELL_SPI, false);
1634 SendAction(player, creature, action);
1635 break;
1636 case GOSSIP_SENDER_MAIN + 5:
1637 creature->CastSpell(player, SPELL_INT, false);
1639 SendAction(player, creature, action);
1640 break;
1641 case GOSSIP_SENDER_MAIN + 6:
1642 creature->CastSpell(player, SPELL_STM, false);
1644 SendAction(player, creature, action);
1645 break;
1646 case GOSSIP_SENDER_MAIN + 7:
1647 creature->CastSpell(player, SPELL_STR, false);
1649 SendAction(player, creature, action);
1650 break;
1651 case GOSSIP_SENDER_MAIN + 8:
1652 creature->CastSpell(player, SPELL_AGI, false);
1654 SendAction(player, creature, action);
1655 break;
1656 }
1657 return true;
1658 }
constexpr auto IN_MILLISECONDS
Definition: Common.h:62
constexpr auto HOUR
Definition: Common.h:57
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:10983
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:1169
void SendAction(Player *player, Creature *creature, uint32 action)
Definition: npcs_special.cpp:1562

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
1563 {
1564 switch (action)
1565 {
1566 case GOSSIP_ACTION_INFO_DEF + 1:
1571 SendGossipMenuFor(player, NPC_TEXT_SAYGE_1, creature->GetGUID());
1572 break;
1573 case GOSSIP_ACTION_INFO_DEF + 2: // Slay
1577 SendGossipMenuFor(player, NPC_TEXT_SAYGE_SLAY, creature->GetGUID());
1578 break;
1579 case GOSSIP_ACTION_INFO_DEF + 3: // Turn over
1584 break;
1585 case GOSSIP_ACTION_INFO_DEF + 4: // Confiscate
1590 break;
1591 case GOSSIP_ACTION_INFO_DEF + 5: // Let him go
1592 AddGossipItemFor(player, GOSSIP_MENU_SAYGE_LET_GO, 0, GOSSIP_SENDER_MAIN + 5, GOSSIP_ACTION_INFO_DEF); // Take credit, keep gold
1593 AddGossipItemFor(player, GOSSIP_MENU_SAYGE_LET_GO, 1, GOSSIP_SENDER_MAIN + 4, GOSSIP_ACTION_INFO_DEF); // Take credit, share gold
1595 SendGossipMenuFor(player, NPC_TEXT_SAYGE_LET_GO, creature->GetGUID());
1596 break;
1597 case GOSSIP_ACTION_INFO_DEF: // End
1599 SendGossipMenuFor(player, NPC_TEXT_SAYGE_END, creature->GetGUID());
1600 break;
1601 case GOSSIP_ACTION_INFO_DEF + 6: // End - Take fortune
1602 creature->CastSpell(player, SPELL_FORTUNE, false);
1604 break;
1605 }
1606 }
@ SPELL_FORTUNE
Definition: npcs_special.cpp:1495
@ GOSSIP_MENU_SAYGE_SLAY
Definition: npcs_special.cpp:1509
@ NPC_TEXT_SAYGE_1
Definition: npcs_special.cpp:1506
@ GOSSIP_MENU_SAYGE_CONFISCATE
Definition: npcs_special.cpp:1517
@ NPC_TEXT_SAYGE_LET_GO
Definition: npcs_special.cpp:1522
@ NPC_TEXT_SAYGE_SLAY
Definition: npcs_special.cpp:1510
@ NPC_TEXT_SAYGE_CONFISCATE
Definition: npcs_special.cpp:1518
@ GOSSIP_MENU_SAYGE_1
Definition: npcs_special.cpp:1505
@ NPC_TEXT_SAYGE_END_FORTUNE
Definition: npcs_special.cpp:1529
@ GOSSIP_MENU_SAYGE_TURN_OVER
Definition: npcs_special.cpp:1513
@ NPC_TEXT_SAYGE_END
Definition: npcs_special.cpp:1526
@ GOSSIP_MENU_SAYGE_END
Definition: npcs_special.cpp:1525
@ GOSSIP_MENU_SAYGE_LET_GO
Definition: npcs_special.cpp:1521
@ NPC_TEXT_SAYGE_TURN_OVER
Definition: npcs_special.cpp:1514

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.