mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 03:15:41 +00:00
Refactor(Core/Gossip): Replacing old macros with new (#1338)
* Correct support new macro
This commit is contained in:
@@ -18,12 +18,12 @@ class npc_announcer_toc5 : public CreatureScript
|
||||
public:
|
||||
npc_announcer_toc5() : CreatureScript("npc_announcer_toc5") {}
|
||||
|
||||
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
|
||||
bool OnGossipHello(Player* player, Creature* creature) override
|
||||
{
|
||||
if (!pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
|
||||
if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
|
||||
return true;
|
||||
|
||||
InstanceScript* pInstance = pCreature->GetInstanceScript();
|
||||
InstanceScript* pInstance = creature->GetInstanceScript();
|
||||
if (!pInstance)
|
||||
return true;
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
switch (pInstance->GetData(DATA_INSTANCE_PROGRESS))
|
||||
{
|
||||
case INSTANCE_PROGRESS_INITIAL:
|
||||
if (!pPlayer->GetVehicle())
|
||||
if (!player->GetVehicle())
|
||||
{
|
||||
if (pInstance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE)
|
||||
gossipTextId = 15043; //Horde text
|
||||
@@ -41,55 +41,55 @@ public:
|
||||
else
|
||||
{
|
||||
gossipTextId = 14688;
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT1a, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1338);
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT1b, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1341);
|
||||
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_START_EVENT1a, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1338);
|
||||
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_START_EVENT1b, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1341);
|
||||
}
|
||||
break;
|
||||
case INSTANCE_PROGRESS_CHAMPIONS_DEAD:
|
||||
gossipTextId = 14737;
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1339);
|
||||
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_START_EVENT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1339);
|
||||
break;
|
||||
case INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED:
|
||||
gossipTextId = 14738;
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1340);
|
||||
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_START_EVENT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1340);
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
pPlayer->SEND_GOSSIP_MENU(gossipTextId, pCreature->GetGUID());
|
||||
SendGossipMenuFor(player, gossipTextId, creature->GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) override
|
||||
{
|
||||
if( !pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) )
|
||||
if(!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
|
||||
return true;
|
||||
|
||||
InstanceScript* pInstance = pCreature->GetInstanceScript();
|
||||
if( !pInstance )
|
||||
InstanceScript* pInstance = creature->GetInstanceScript();
|
||||
if(!pInstance)
|
||||
return true;
|
||||
|
||||
if( uiAction == GOSSIP_ACTION_INFO_DEF+1338 || uiAction == GOSSIP_ACTION_INFO_DEF+1341 || uiAction == GOSSIP_ACTION_INFO_DEF+1339 || uiAction == GOSSIP_ACTION_INFO_DEF+1340 )
|
||||
if(uiAction == GOSSIP_ACTION_INFO_DEF+1338 || uiAction == GOSSIP_ACTION_INFO_DEF+1341 || uiAction == GOSSIP_ACTION_INFO_DEF+1339 || uiAction == GOSSIP_ACTION_INFO_DEF+1340)
|
||||
{
|
||||
pInstance->SetData(DATA_ANNOUNCER_GOSSIP_SELECT, (uiAction == GOSSIP_ACTION_INFO_DEF+1341 ? 1 : 0));
|
||||
pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
CloseGossipMenuFor(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) const
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_announcer_toc5AI(pCreature);
|
||||
return new npc_announcer_toc5AI(creature);
|
||||
}
|
||||
|
||||
struct npc_announcer_toc5AI : public CreatureAI
|
||||
{
|
||||
npc_announcer_toc5AI(Creature *pCreature) : CreatureAI(pCreature) {}
|
||||
npc_announcer_toc5AI(Creature *creature) : CreatureAI(creature) {}
|
||||
|
||||
void Reset()
|
||||
void Reset() override
|
||||
{
|
||||
InstanceScript* pInstance = me->GetInstanceScript();
|
||||
if( !pInstance )
|
||||
@@ -99,13 +99,13 @@ public:
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // removed during black knight scene
|
||||
}
|
||||
|
||||
void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask)
|
||||
void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) override
|
||||
{
|
||||
if (damage >= me->GetHealth()) // for bk scene so strangulate doesn't kill him
|
||||
damage = me->GetHealth()-1;
|
||||
}
|
||||
|
||||
void MovementInform(uint32 type, uint32 /*id*/)
|
||||
void MovementInform(uint32 type, uint32 /*id*/) override
|
||||
{
|
||||
if (type != EFFECT_MOTION_TYPE)
|
||||
return;
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
Unit::Kill(me, me); // for bk scene, die after knockback
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 /*diff*/) {}
|
||||
void UpdateAI(uint32 /*diff*/) override { }
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -2436,17 +2436,17 @@ class go_toc_champions_cache : public GameObjectScript
|
||||
public:
|
||||
go_toc_champions_cache() : GameObjectScript("go_toc_champions_cache") { }
|
||||
|
||||
bool OnGossipHello(Player* plr, GameObject* go)
|
||||
bool OnGossipHello(Player* player, GameObject* go) override
|
||||
{
|
||||
if (plr->IsGameMaster())
|
||||
if (player->IsGameMaster())
|
||||
return false;
|
||||
|
||||
if (!go->loot.items.size())
|
||||
return false;
|
||||
|
||||
for( std::vector<LootItem>::iterator itr = go->loot.items.begin(); itr != go->loot.items.end(); ++itr )
|
||||
for(std::vector<LootItem>::iterator itr = go->loot.items.begin(); itr != go->loot.items.end(); ++itr)
|
||||
if( ItemTemplate const *iProto = sObjectMgr->GetItemTemplate((*itr).itemid) )
|
||||
if( ((iProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && plr->GetTeamId() != TEAM_HORDE) || ((iProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && plr->GetTeamId() != TEAM_ALLIANCE) )
|
||||
if( ((iProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && player->GetTeamId() != TEAM_HORDE) || ((iProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && player->GetTeamId() != TEAM_ALLIANCE) )
|
||||
if (!((*itr).is_looted))
|
||||
{
|
||||
(*itr).count = 0;
|
||||
|
||||
@@ -556,7 +556,7 @@ class npc_essence_of_twin : public CreatureScript
|
||||
public:
|
||||
npc_essence_of_twin() : CreatureScript("npc_essence_of_twin") { }
|
||||
|
||||
bool OnGossipHello(Player* player, Creature* creature)
|
||||
bool OnGossipHello(Player* player, Creature* creature) override
|
||||
{
|
||||
switch( creature->GetEntry() )
|
||||
{
|
||||
@@ -655,7 +655,7 @@ public:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
CloseGossipMenuFor(player);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,17 +21,17 @@ class npc_announcer_toc10 : public CreatureScript
|
||||
public:
|
||||
npc_announcer_toc10() : CreatureScript("npc_announcer_toc10") { }
|
||||
|
||||
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
|
||||
bool OnGossipHello(Player* player, Creature* creature) override
|
||||
{
|
||||
if( !pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) )
|
||||
if(!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
|
||||
return true;
|
||||
|
||||
InstanceScript* pInstance = pCreature->GetInstanceScript();
|
||||
if( !pInstance )
|
||||
InstanceScript* pInstance = creature->GetInstanceScript();
|
||||
if(!pInstance)
|
||||
return true;
|
||||
|
||||
uint32 gossipTextId = 0;
|
||||
switch( pInstance->GetData(TYPE_INSTANCE_PROGRESS) )
|
||||
switch(pInstance->GetData(TYPE_INSTANCE_PROGRESS))
|
||||
{
|
||||
case INSTANCE_PROGRESS_INITIAL:
|
||||
gossipTextId = MSG_TESTED;
|
||||
@@ -46,33 +46,33 @@ public:
|
||||
gossipTextId = MSG_CRUSADERS;
|
||||
break;
|
||||
case INSTANCE_PROGRESS_DONE:
|
||||
pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "We are ready!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1337);
|
||||
pPlayer->SEND_GOSSIP_MENU(gossipTextId, pCreature->GetGUID());
|
||||
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "We are ready!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1337);
|
||||
SendGossipMenuFor(player, gossipTextId, creature->GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*sender*/, uint32 uiAction)
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 uiAction) override
|
||||
{
|
||||
if( !pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) )
|
||||
if( !creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) )
|
||||
return true;
|
||||
|
||||
InstanceScript* pInstance = pCreature->GetInstanceScript();
|
||||
InstanceScript* pInstance = creature->GetInstanceScript();
|
||||
if( !pInstance )
|
||||
return true;
|
||||
|
||||
if( uiAction == GOSSIP_ACTION_INFO_DEF+1337 )
|
||||
{
|
||||
pInstance->SetData(TYPE_ANNOUNCER_GOSSIP_SELECT, 0);
|
||||
pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
CloseGossipMenuFor(player);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user