Core/Scripts: Fix menu clearing in onGossipSelect()-sections for some scripts (including examples) - patch/fix by Paradox
Closes issue 4524 --HG-- branch : trunk
This commit is contained in:
@@ -140,6 +140,7 @@ class npc_lore_keeper_of_norgannon : public CreatureScript
|
|||||||
|
|
||||||
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||||
{
|
{
|
||||||
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
switch (uiAction)
|
switch (uiAction)
|
||||||
{
|
{
|
||||||
case GOSSIP_ACTION_INFO_DEF+1:
|
case GOSSIP_ACTION_INFO_DEF+1:
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ class npc_zulaman_hostage : public CreatureScript
|
|||||||
|
|
||||||
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||||
{
|
{
|
||||||
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
if (uiAction == GOSSIP_ACTION_INFO_DEF + 1)
|
if (uiAction == GOSSIP_ACTION_INFO_DEF + 1)
|
||||||
pPlayer->CLOSE_GOSSIP_MENU();
|
pPlayer->CLOSE_GOSSIP_MENU();
|
||||||
|
|
||||||
|
|||||||
@@ -258,27 +258,28 @@ class example_creature : public CreatureScript
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const
|
CreatureAI* GetAI(Creature* pCreature) const
|
||||||
{
|
{
|
||||||
return new example_creatureAI(creature);
|
return new example_creatureAI(pCreature);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OnGossipHello(Player* player, Creature* creature)
|
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
|
||||||
{
|
{
|
||||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
|
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
|
||||||
player->SEND_GOSSIP_MENU(907, creature->GetGUID());
|
pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
|
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||||
{
|
{
|
||||||
if (action == GOSSIP_ACTION_INFO_DEF+1)
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
|
if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
|
||||||
{
|
{
|
||||||
player->CLOSE_GOSSIP_MENU();
|
pPlayer->CLOSE_GOSSIP_MENU();
|
||||||
//Set our faction to hostile towards all
|
//Set our faction to hostile towards all
|
||||||
creature->setFaction(FACTION_WORGEN);
|
pCreature->setFaction(FACTION_WORGEN);
|
||||||
creature->AI()->AttackStart(player);
|
pCreature->AI()->AttackStart(pPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -178,48 +178,49 @@ class example_escort : public CreatureScript
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const
|
CreatureAI* GetAI(Creature* pCreature) const
|
||||||
{
|
{
|
||||||
return new example_escortAI(creature);
|
return new example_escortAI(pCreature);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OnGossipHello(Player* player, Creature* creature)
|
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
|
||||||
{
|
{
|
||||||
player->TalkedToCreature(creature->GetEntry(), creature->GetGUID());
|
pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID());
|
||||||
player->PrepareGossipMenu(creature, 0);
|
pPlayer->PrepareGossipMenu(pCreature, 0);
|
||||||
|
|
||||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
|
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
|
||||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
|
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
|
||||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
|
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
|
||||||
|
|
||||||
player->SendPreparedGossip(creature);
|
pPlayer->SendPreparedGossip(pCreature);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
|
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||||
{
|
{
|
||||||
npc_escortAI* pEscortAI = CAST_AI(example_escort::example_escortAI, creature->AI());
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
|
npc_escortAI* pEscortAI = CAST_AI(example_escort::example_escortAI, pCreature->AI());
|
||||||
|
|
||||||
switch(action)
|
switch(uiAction)
|
||||||
{
|
{
|
||||||
case GOSSIP_ACTION_INFO_DEF+1:
|
case GOSSIP_ACTION_INFO_DEF+1:
|
||||||
player->CLOSE_GOSSIP_MENU();
|
pPlayer->CLOSE_GOSSIP_MENU();
|
||||||
|
|
||||||
if (pEscortAI)
|
if (pEscortAI)
|
||||||
pEscortAI->Start(true, true, player->GetGUID());
|
pEscortAI->Start(true, true, pPlayer->GetGUID());
|
||||||
break;
|
break;
|
||||||
case GOSSIP_ACTION_INFO_DEF+2:
|
case GOSSIP_ACTION_INFO_DEF+2:
|
||||||
player->CLOSE_GOSSIP_MENU();
|
pPlayer->CLOSE_GOSSIP_MENU();
|
||||||
|
|
||||||
if (pEscortAI)
|
if (pEscortAI)
|
||||||
pEscortAI->Start(false, false, player->GetGUID());
|
pEscortAI->Start(false, false, pPlayer->GetGUID());
|
||||||
break;
|
break;
|
||||||
case GOSSIP_ACTION_INFO_DEF+3:
|
case GOSSIP_ACTION_INFO_DEF+3:
|
||||||
player->CLOSE_GOSSIP_MENU();
|
pPlayer->CLOSE_GOSSIP_MENU();
|
||||||
|
|
||||||
if (pEscortAI)
|
if (pEscortAI)
|
||||||
pEscortAI->Start(false, true, player->GetGUID());
|
pEscortAI->Start(false, true, pPlayer->GetGUID());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false; // nothing defined -> trinity core handling
|
return false; // nothing defined -> trinity core handling
|
||||||
|
|||||||
@@ -48,45 +48,47 @@ class example_gossip_codebox : public CreatureScript
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OnGossipHello(Player* player, Creature* creature)
|
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
|
||||||
{
|
{
|
||||||
player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1, "", 0, true);
|
pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1, "", 0, true);
|
||||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
|
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
|
||||||
|
|
||||||
player->PlayerTalkClass->SendGossipMenu(907, creature->GetGUID());
|
pPlayer->PlayerTalkClass->SendGossipMenu(907, pCreature->GetGUID());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
|
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||||
{
|
{
|
||||||
if (action == GOSSIP_ACTION_INFO_DEF+2)
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
|
if (uiAction == GOSSIP_ACTION_INFO_DEF+2)
|
||||||
{
|
{
|
||||||
DoScriptText(SAY_NOT_INTERESTED, creature);
|
DoScriptText(SAY_NOT_INTERESTED, pCreature);
|
||||||
player->CLOSE_GOSSIP_MENU();
|
pPlayer->CLOSE_GOSSIP_MENU();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code)
|
bool OnGossipSelectCode(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* code)
|
||||||
{
|
{
|
||||||
if (sender == GOSSIP_SENDER_MAIN)
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
|
if (uiSender == GOSSIP_SENDER_MAIN)
|
||||||
{
|
{
|
||||||
switch (action)
|
switch (uiAction)
|
||||||
{
|
{
|
||||||
case GOSSIP_ACTION_INFO_DEF+1:
|
case GOSSIP_ACTION_INFO_DEF+1:
|
||||||
if (std::strcmp(code, player->GetName()) != 0)
|
if (std::strcmp(code, pPlayer->GetName()) != 0)
|
||||||
{
|
{
|
||||||
DoScriptText(SAY_WRONG, creature);
|
DoScriptText(SAY_WRONG, pCreature);
|
||||||
creature->CastSpell(player, SPELL_POLYMORPH, true);
|
pCreature->CastSpell(pPlayer, SPELL_POLYMORPH, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DoScriptText(SAY_CORRECT, creature);
|
DoScriptText(SAY_CORRECT, pCreature);
|
||||||
creature->CastSpell(player, SPELL_MARK_OF_THE_WILD, true);
|
pCreature->CastSpell(pPlayer, SPELL_MARK_OF_THE_WILD, true);
|
||||||
}
|
}
|
||||||
player->CLOSE_GOSSIP_MENU();
|
pPlayer->CLOSE_GOSSIP_MENU();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ public:
|
|||||||
|
|
||||||
bool OnGossipSelect (Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
bool OnGossipSelect (Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||||
{
|
{
|
||||||
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
if (uiAction == GOSSIP_ACTION_INFO_DEF + 1)
|
if (uiAction == GOSSIP_ACTION_INFO_DEF + 1)
|
||||||
{
|
{
|
||||||
pPlayer->CastSpell(pPlayer, SPELL_TEACHING_GOLDTHORN_TEA, true);
|
pPlayer->CastSpell(pPlayer, SPELL_TEACHING_GOLDTHORN_TEA, true);
|
||||||
|
|||||||
+1
@@ -151,6 +151,7 @@ class npc_announcer_toc10 : public CreatureScript
|
|||||||
|
|
||||||
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||||
{
|
{
|
||||||
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
InstanceScript* m_pInstance;
|
InstanceScript* m_pInstance;
|
||||||
m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
|
m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
|
||||||
if (!m_pInstance) return false;
|
if (!m_pInstance) return false;
|
||||||
|
|||||||
@@ -1278,6 +1278,7 @@ public:
|
|||||||
|
|
||||||
//bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
|
//bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
|
||||||
//{
|
//{
|
||||||
|
// pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
// switch(uiAction)
|
// switch(uiAction)
|
||||||
// {
|
// {
|
||||||
// case GOSSIP_ACTION_INFO_DEF+1:
|
// case GOSSIP_ACTION_INFO_DEF+1:
|
||||||
|
|||||||
@@ -503,6 +503,7 @@ public:
|
|||||||
|
|
||||||
bool OnGossipSelect(Player *pPlayer, Creature *pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
bool OnGossipSelect(Player *pPlayer, Creature *pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||||
{
|
{
|
||||||
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
uint32 spellId = 0;
|
uint32 spellId = 0;
|
||||||
switch (uiAction)
|
switch (uiAction)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user