mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
Refactor(Core/Gossip): Replacing old macros with new (#1338)
* Correct support new macro
This commit is contained in:
@@ -42,12 +42,12 @@ public:
|
||||
|
||||
EventMap events;
|
||||
|
||||
void Reset()
|
||||
void Reset() override
|
||||
{
|
||||
events.Reset();
|
||||
}
|
||||
|
||||
void DoAction(int32 a)
|
||||
void DoAction(int32 a) override
|
||||
{
|
||||
if (a == 1)
|
||||
if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
events.Update(diff);
|
||||
switch(events.GetEvent())
|
||||
@@ -166,7 +166,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
bool OnGossipHello(Player* player, Creature* creature)
|
||||
bool OnGossipHello(Player* player, Creature* creature) override
|
||||
{
|
||||
if (creature->IsQuestGiver())
|
||||
player->PrepareQuestMenu(creature->GetGUID());
|
||||
@@ -174,22 +174,22 @@ public:
|
||||
if (creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
|
||||
{
|
||||
if (creature->GetEntry() == NPC_JAINA_PART1)
|
||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "What would you have of me, my lady?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
|
||||
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "What would you have of me, my lady?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
|
||||
else
|
||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "What would you have of me, Banshee Queen?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
|
||||
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "What would you have of me, Banshee Queen?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
|
||||
}
|
||||
|
||||
player->SEND_GOSSIP_MENU(15207, creature->GetGUID());
|
||||
SendGossipMenuFor(player, 15207, creature->GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) override
|
||||
{
|
||||
player->PlayerTalkClass->ClearMenus();
|
||||
ClearGossipMenuFor(player);
|
||||
switch(uiAction)
|
||||
{
|
||||
case GOSSIP_ACTION_INFO_DEF+1:
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
CloseGossipMenuFor(player);
|
||||
if (creature->AI())
|
||||
creature->AI()->DoAction(1);
|
||||
break;
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
CreatureAI *GetAI(Creature* creature) const
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_fos_leaderAI(creature);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class npc_hor_leader : public CreatureScript
|
||||
public:
|
||||
npc_hor_leader() : CreatureScript("npc_hor_leader") { }
|
||||
|
||||
bool OnGossipHello(Player* player, Creature* creature)
|
||||
bool OnGossipHello(Player* player, Creature* creature) override
|
||||
{
|
||||
if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
|
||||
return true;
|
||||
@@ -94,24 +94,24 @@ public:
|
||||
{
|
||||
QuestStatus status = player->GetQuestStatus(creature->GetEntry() == NPC_SYLVANAS_PART1 ? QUEST_DELIVRANCE_FROM_THE_PIT_H2 : QUEST_DELIVRANCE_FROM_THE_PIT_A2);
|
||||
if (status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED)
|
||||
player->ADD_GOSSIP_ITEM(0, "Can you remove the sword?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
|
||||
AddGossipItemFor(player, 0, "Can you remove the sword?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
|
||||
|
||||
// once last quest is completed, she offers this shortcut of the starting event
|
||||
status = player->GetQuestStatus(creature->GetEntry() == NPC_SYLVANAS_PART1 ? QUEST_WRATH_OF_THE_LICH_KING_H2 : QUEST_WRATH_OF_THE_LICH_KING_A2);
|
||||
if (status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED)
|
||||
{
|
||||
if (creature->GetEntry() == NPC_SYLVANAS_PART1)
|
||||
player->ADD_GOSSIP_ITEM(0, "Dark Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
|
||||
AddGossipItemFor(player, 0, "Dark Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
|
||||
else
|
||||
player->ADD_GOSSIP_ITEM(0, "My Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
|
||||
AddGossipItemFor(player, 0, "My Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
|
||||
}
|
||||
}
|
||||
|
||||
player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
|
||||
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) override
|
||||
{
|
||||
if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
|
||||
return true;
|
||||
@@ -126,17 +126,17 @@ public:
|
||||
|
||||
instance->SetData(DATA_BATTERED_HILT, 1);
|
||||
|
||||
player->PlayerTalkClass->ClearMenus();
|
||||
ClearGossipMenuFor(player);
|
||||
switch (uiAction)
|
||||
{
|
||||
case GOSSIP_ACTION_INFO_DEF+1:
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
CloseGossipMenuFor(player);
|
||||
if (creature->AI())
|
||||
creature->AI()->DoAction(ACTION_START_INTRO);
|
||||
creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF+2:
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
CloseGossipMenuFor(player);
|
||||
if (creature->AI())
|
||||
creature->AI()->DoAction(ACTION_SKIP_INTRO);
|
||||
creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_hor_leaderAI(creature);
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public:
|
||||
bool first;
|
||||
bool shortver;
|
||||
|
||||
void Reset()
|
||||
void Reset() override
|
||||
{
|
||||
shortver = false;
|
||||
events.Reset();
|
||||
@@ -180,7 +180,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void DoAction(int32 actionId)
|
||||
void DoAction(int32 actionId) override
|
||||
{
|
||||
switch(actionId)
|
||||
{
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
events.Update(diff);
|
||||
switch(events.ExecuteEvent())
|
||||
@@ -1452,7 +1452,7 @@ public:
|
||||
me->SetHealth(me->GetMaxHealth()*3/4);
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
|
||||
if (me->IsNonMeleeSpellCast(false, true, true))
|
||||
return;
|
||||
|
||||
@@ -1597,12 +1597,12 @@ class npc_hor_leader_second : public CreatureScript
|
||||
public:
|
||||
npc_hor_leader_second() : CreatureScript("npc_hor_leader_second") { }
|
||||
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 /*uiAction*/)
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 /*uiAction*/) override
|
||||
{
|
||||
if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
|
||||
return true;
|
||||
|
||||
player->PlayerTalkClass->ClearMenus();
|
||||
ClearGossipMenuFor(player);
|
||||
|
||||
if (InstanceScript* pInstance = creature->GetInstanceScript())
|
||||
if (!pInstance->GetData(DATA_LICH_KING))
|
||||
@@ -1615,7 +1615,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_hor_leader_secondAI(creature);
|
||||
}
|
||||
@@ -1633,13 +1633,13 @@ public:
|
||||
EventMap events;
|
||||
uint8 currentStopPoint;
|
||||
|
||||
void Reset()
|
||||
void Reset() override
|
||||
{
|
||||
currentStopPoint = 0;
|
||||
events.Reset();
|
||||
}
|
||||
|
||||
void DoAction(int32 actionId)
|
||||
void DoAction(int32 actionId) override
|
||||
{
|
||||
switch(actionId)
|
||||
{
|
||||
@@ -1657,7 +1657,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void DamageTaken(Unit*, uint32& dmg, DamageEffectType, SpellSchoolMask)
|
||||
void DamageTaken(Unit*, uint32& dmg, DamageEffectType, SpellSchoolMask) override
|
||||
{
|
||||
if (dmg >= me->GetHealth())
|
||||
dmg = me->GetHealth()-1;
|
||||
@@ -1674,13 +1674,13 @@ public:
|
||||
me->GetMotionMaster()->MoveSplinePath(&path);
|
||||
}
|
||||
|
||||
void MovementInform(uint32 type, uint32 /*id*/)
|
||||
void MovementInform(uint32 type, uint32 /*id*/) override
|
||||
{
|
||||
if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized())
|
||||
events.ScheduleEvent(EVENT_SAY_LEADER_STOP_TEXT, 1000);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
events.Update(diff);
|
||||
switch(events.ExecuteEvent())
|
||||
|
||||
Reference in New Issue
Block a user