mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Gossip: Drop OptionNpcFlag from gossip_menu_option (#28254)
Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
9
sql/updates/world/master/2022_10_09_09_world.sql
Normal file
9
sql/updates/world/master/2022_10_09_09_world.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
-- Update table `gossip_menu_option`
|
||||
ALTER TABLE `gossip_menu_option` DROP `OptionNpcFlag`;
|
||||
|
||||
-- Argent Squire | Argent Gruntling
|
||||
UPDATE `creature_template` SET `npcflag`=1 WHERE `entry` IN (33238, 33239);
|
||||
UPDATE `gossip_menu_option` SET `OptionNpc`=18 WHERE `MenuID` IN (10317, 10318) AND `OptionID`=2;
|
||||
|
||||
-- OptionNpcFlag inserted in wrong field
|
||||
UPDATE `gossip_menu_option` SET `ActionMenuID`=0 WHERE `MenuID`=10662 AND `OptionID`=0;
|
||||
@@ -13634,12 +13634,9 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId, bool showQues
|
||||
|
||||
Trinity::IteratorPair menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(menuId);
|
||||
|
||||
uint64 npcflags = 0;
|
||||
|
||||
if (source->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
npcflags = (uint64(source->ToUnit()->m_unitData->NpcFlags[1]) << 32) | source->ToUnit()->m_unitData->NpcFlags[0];
|
||||
if (showQuests && npcflags & UNIT_NPC_FLAG_QUESTGIVER)
|
||||
if (showQuests && source->ToUnit()->IsQuestGiver())
|
||||
PrepareQuestMenu(source->GetGUID());
|
||||
}
|
||||
else if (source->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
@@ -13654,9 +13651,6 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId, bool showQues
|
||||
bool canTalk = true;
|
||||
if (Creature* creature = source->ToCreature())
|
||||
{
|
||||
if (!(gossipMenuItem.OptionNpcFlag & npcflags))
|
||||
continue;
|
||||
|
||||
switch (gossipMenuItem.OptionNpc)
|
||||
{
|
||||
case GossipOptionNpc::TaxiNode:
|
||||
|
||||
@@ -9616,8 +9616,8 @@ void ObjectMgr::LoadGossipMenuItems()
|
||||
_gossipMenuItemsStore.clear();
|
||||
|
||||
QueryResult result = WorldDatabase.Query(
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12
|
||||
"SELECT MenuID, OptionID, OptionNpc, OptionText, OptionBroadcastTextID, OptionNpcFlag, Language, ActionMenuID, ActionPoiID, BoxCoded, BoxMoney, BoxText, BoxBroadcastTextID "
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11
|
||||
"SELECT MenuID, OptionID, OptionNpc, OptionText, OptionBroadcastTextID, Language, ActionMenuID, ActionPoiID, BoxCoded, BoxMoney, BoxText, BoxBroadcastTextID "
|
||||
"FROM gossip_menu_option ORDER BY MenuID, OptionID");
|
||||
|
||||
if (!result)
|
||||
@@ -9637,14 +9637,13 @@ void ObjectMgr::LoadGossipMenuItems()
|
||||
gMenuItem.OptionNpc = GossipOptionNpc(fields[2].GetUInt8());
|
||||
gMenuItem.OptionText = fields[3].GetString();
|
||||
gMenuItem.OptionBroadcastTextID = fields[4].GetUInt32();
|
||||
gMenuItem.OptionNpcFlag = fields[5].GetUInt64();
|
||||
gMenuItem.Language = fields[6].GetUInt32();
|
||||
gMenuItem.ActionMenuID = fields[7].GetUInt32();
|
||||
gMenuItem.ActionPoiID = fields[8].GetUInt32();
|
||||
gMenuItem.BoxCoded = fields[9].GetBool();
|
||||
gMenuItem.BoxMoney = fields[10].GetUInt32();
|
||||
gMenuItem.BoxText = fields[11].GetString();
|
||||
gMenuItem.BoxBroadcastTextID = fields[12].GetUInt32();
|
||||
gMenuItem.Language = fields[5].GetUInt32();
|
||||
gMenuItem.ActionMenuID = fields[6].GetUInt32();
|
||||
gMenuItem.ActionPoiID = fields[7].GetUInt32();
|
||||
gMenuItem.BoxCoded = fields[8].GetBool();
|
||||
gMenuItem.BoxMoney = fields[9].GetUInt32();
|
||||
gMenuItem.BoxText = fields[10].GetString();
|
||||
gMenuItem.BoxBroadcastTextID = fields[11].GetUInt32();
|
||||
|
||||
if (gMenuItem.OptionNpc >= GossipOptionNpc::Count)
|
||||
{
|
||||
|
||||
@@ -747,7 +747,6 @@ struct GossipMenuItems
|
||||
GossipOptionNpc OptionNpc;
|
||||
std::string OptionText;
|
||||
uint32 OptionBroadcastTextID;
|
||||
uint32 OptionNpcFlag;
|
||||
uint32 Language;
|
||||
uint32 ActionMenuID;
|
||||
uint32 ActionPoiID;
|
||||
|
||||
@@ -2026,7 +2026,8 @@ enum ArgentPetGossipOptions
|
||||
|
||||
enum Misc
|
||||
{
|
||||
NPC_ARGENT_SQUIRE = 33238
|
||||
NPC_ARGENT_SQUIRE = 33238,
|
||||
ACHIEVEMENT_PONY_UP = 3736
|
||||
};
|
||||
|
||||
struct ArgentPonyBannerSpells
|
||||
@@ -2053,24 +2054,24 @@ public:
|
||||
{
|
||||
npc_argent_squire_gruntlingAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
ScheduleTasks();
|
||||
}
|
||||
|
||||
void ScheduleTasks()
|
||||
void Reset() override
|
||||
{
|
||||
_scheduler
|
||||
.Schedule(Seconds(1), [this](TaskContext /*context*/)
|
||||
if (Player* owner = Object::ToPlayer(me->GetOwner()))
|
||||
{
|
||||
if (Aura* ownerTired = owner->GetAura(SPELL_TIRED_PLAYER))
|
||||
if (Aura* squireTired = me->AddAura(IsArgentSquire() ? SPELL_AURA_TIRED_S : SPELL_AURA_TIRED_G, me))
|
||||
squireTired->SetDuration(ownerTired->GetDuration());
|
||||
|
||||
if (owner->HasAchieved(ACHIEVEMENT_PONY_UP) && !me->HasAura(SPELL_AURA_TIRED_S) && !me->HasAura(SPELL_AURA_TIRED_G))
|
||||
{
|
||||
if (Aura* ownerTired = me->GetOwner()->GetAura(SPELL_TIRED_PLAYER))
|
||||
if (Aura* squireTired = me->AddAura(IsArgentSquire() ? SPELL_AURA_TIRED_S : SPELL_AURA_TIRED_G, me))
|
||||
squireTired->SetDuration(ownerTired->GetDuration());
|
||||
})
|
||||
.Schedule(Seconds(1), [this](TaskContext context)
|
||||
{
|
||||
if ((me->HasAura(SPELL_AURA_TIRED_S) || me->HasAura(SPELL_AURA_TIRED_G)) && me->HasNpcFlag(UNIT_NPC_FLAG_BANKER | UNIT_NPC_FLAG_MAILBOX | UNIT_NPC_FLAG_VENDOR))
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_BANKER | UNIT_NPC_FLAG_MAILBOX | UNIT_NPC_FLAG_VENDOR);
|
||||
context.Repeat();
|
||||
});
|
||||
me->SetNpcFlag(UNIT_NPC_FLAG_BANKER | UNIT_NPC_FLAG_MAILBOX | UNIT_NPC_FLAG_VENDOR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_BANKER | UNIT_NPC_FLAG_MAILBOX | UNIT_NPC_FLAG_VENDOR);
|
||||
}
|
||||
|
||||
bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
|
||||
@@ -2079,7 +2080,7 @@ public:
|
||||
{
|
||||
case GOSSIP_OPTION_BANK:
|
||||
{
|
||||
me->SetNpcFlag(UNIT_NPC_FLAG_BANKER);
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_MAILBOX | UNIT_NPC_FLAG_VENDOR);
|
||||
uint32 _bankAura = IsArgentSquire() ? SPELL_AURA_BANK_S : SPELL_AURA_BANK_G;
|
||||
if (!me->HasAura(_bankAura))
|
||||
DoCastSelf(_bankAura);
|
||||
@@ -2090,7 +2091,7 @@ public:
|
||||
}
|
||||
case GOSSIP_OPTION_SHOP:
|
||||
{
|
||||
me->SetNpcFlag(UNIT_NPC_FLAG_VENDOR);
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_BANKER | UNIT_NPC_FLAG_MAILBOX);
|
||||
uint32 _shopAura = IsArgentSquire() ? SPELL_AURA_SHOP_S : SPELL_AURA_SHOP_G;
|
||||
if (!me->HasAura(_shopAura))
|
||||
DoCastSelf(_shopAura);
|
||||
@@ -2101,9 +2102,7 @@ public:
|
||||
}
|
||||
case GOSSIP_OPTION_MAIL:
|
||||
{
|
||||
me->SetNpcFlag(UNIT_NPC_FLAG_MAILBOX);
|
||||
player->GetSession()->SendShowMailBox(me->GetGUID());
|
||||
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_BANKER | UNIT_NPC_FLAG_VENDOR);
|
||||
uint32 _mailAura = IsArgentSquire() ? SPELL_AURA_POSTMAN_S : SPELL_AURA_POSTMAN_G;
|
||||
if (!me->HasAura(_mailAura))
|
||||
DoCastSelf(_mailAura);
|
||||
@@ -2121,21 +2120,17 @@ public:
|
||||
DoCastSelf(bannerSpells[gossipListId - 3].spellSquire, true);
|
||||
else
|
||||
DoCastSelf(bannerSpells[gossipListId - 3].spellGruntling, true);
|
||||
|
||||
player->PlayerTalkClass->SendCloseGossip();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
player->PlayerTalkClass->SendCloseGossip();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
|
||||
bool IsArgentSquire() const { return me->GetEntry() == NPC_ARGENT_SQUIRE; }
|
||||
|
||||
private:
|
||||
TaskScheduler _scheduler;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature *creature) const override
|
||||
|
||||
Reference in New Issue
Block a user