aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/master/2022_10_09_09_world.sql9
-rw-r--r--src/server/game/Entities/Player/Player.cpp8
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp19
-rw-r--r--src/server/game/Globals/ObjectMgr.h1
-rw-r--r--src/server/scripts/World/npcs_special.cpp53
5 files changed, 43 insertions, 47 deletions
diff --git a/sql/updates/world/master/2022_10_09_09_world.sql b/sql/updates/world/master/2022_10_09_09_world.sql
new file mode 100644
index 00000000000..c2029a02dd4
--- /dev/null
+++ b/sql/updates/world/master/2022_10_09_09_world.sql
@@ -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;
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 9c59b4b5105..9d7ff5c40a2 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -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:
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index f5542024956..96db3bfa064 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -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)
{
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 91499ba7e40..6919992f228 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -747,7 +747,6 @@ struct GossipMenuItems
GossipOptionNpc OptionNpc;
std::string OptionText;
uint32 OptionBroadcastTextID;
- uint32 OptionNpcFlag;
uint32 Language;
uint32 ActionMenuID;
uint32 ActionPoiID;
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 16103698dd9..ac11e69a6a8 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -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 (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 (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 ((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);
+ return false;
}
bool IsArgentSquire() const { return me->GetEntry() == NPC_ARGENT_SQUIRE; }
-
- private:
- TaskScheduler _scheduler;
};
CreatureAI* GetAI(Creature *creature) const override