mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Creatures: Allow overriding default gossip menu id
This commit is contained in:
@@ -3523,6 +3523,19 @@ void Creature::ExitVehicle(Position const* /*exitPosition*/)
|
||||
SetHomePosition(GetPosition());
|
||||
}
|
||||
|
||||
uint32 Creature::GetGossipMenuId() const
|
||||
{
|
||||
if (_gossipMenuId)
|
||||
return *_gossipMenuId;
|
||||
|
||||
return GetCreatureTemplate()->GossipMenuId;
|
||||
}
|
||||
|
||||
void Creature::SetGossipMenuId(Optional<uint32> gossipMenuId)
|
||||
{
|
||||
_gossipMenuId = gossipMenuId;
|
||||
}
|
||||
|
||||
uint32 Creature::GetTrainerId() const
|
||||
{
|
||||
if (_trainerId)
|
||||
|
||||
@@ -401,6 +401,9 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
bool HasFlag(CreatureStaticFlags7 flag) const { return _staticFlags.HasFlag(flag); }
|
||||
bool HasFlag(CreatureStaticFlags8 flag) const { return _staticFlags.HasFlag(flag); }
|
||||
|
||||
uint32 GetGossipMenuId() const;
|
||||
void SetGossipMenuId(Optional<uint32> gossipMenuId);
|
||||
|
||||
uint32 GetTrainerId() const;
|
||||
void SetTrainerId(Optional<uint32> trainerId);
|
||||
|
||||
@@ -491,6 +494,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
|
||||
bool _isMissingCanSwimFlagOutOfCombat;
|
||||
|
||||
Optional<uint32> _gossipMenuId;
|
||||
Optional<uint32> _trainerId;
|
||||
};
|
||||
|
||||
|
||||
@@ -14249,7 +14249,7 @@ uint32 Player::GetDefaultGossipMenuForSource(WorldObject* source)
|
||||
switch (source->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
return source->ToCreature()->GetCreatureTemplate()->GossipMenuId;
|
||||
return source->ToCreature()->GetGossipMenuId();
|
||||
case TYPEID_GAMEOBJECT:
|
||||
return source->ToGameObject()->GetGOInfo()->GetGossipMenuId();
|
||||
default:
|
||||
|
||||
@@ -183,7 +183,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPackets::NPC::Hello& packet)
|
||||
if (!unit->AI()->OnGossipHello(_player))
|
||||
{
|
||||
// _player->TalkedToCreature(unit->GetEntry(), unit->GetGUID());
|
||||
_player->PrepareGossipMenu(unit, unit->GetCreatureTemplate()->GossipMenuId, true);
|
||||
_player->PrepareGossipMenu(unit, unit->GetGossipMenuId(), true);
|
||||
_player->SendPreparedGossip(unit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPackets::Quest::QuestGiverHe
|
||||
if (creature->AI()->OnGossipHello(_player))
|
||||
return;
|
||||
|
||||
_player->PrepareGossipMenu(creature, creature->GetCreatureTemplate()->GossipMenuId, true);
|
||||
_player->PrepareGossipMenu(creature, creature->GetGossipMenuId(), true);
|
||||
_player->SendPreparedGossip(creature);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ class npc_voljin_zulaman : public CreatureScript
|
||||
if (_instance->GetData(DATA_ZULAMAN_STATE) != NOT_STARTED)
|
||||
return true;
|
||||
|
||||
if (me->GetCreatureTemplate()->GossipMenuId == menuId && !gossipListId)
|
||||
if (me->GetGossipMenuId() == menuId && !gossipListId)
|
||||
{
|
||||
_events.Reset();
|
||||
me->SetMountDisplayId(0);
|
||||
|
||||
@@ -336,7 +336,7 @@ class npc_brann_bronzebeard_anraphet : public CreatureScript
|
||||
if (_instance->GetBossState(DATA_VAULT_OF_LIGHTS) == DONE)
|
||||
return true;
|
||||
|
||||
if (me->GetCreatureTemplate()->GossipMenuId == sender && !action)
|
||||
if (me->GetGossipMenuId() == sender && !action)
|
||||
{
|
||||
_instance->SetBossState(DATA_VAULT_OF_LIGHTS, IN_PROGRESS);
|
||||
_currentPoint = 0;
|
||||
|
||||
@@ -1193,7 +1193,7 @@ struct npc_tirion_fordring_tft : public ScriptedAI
|
||||
|
||||
bool OnGossipSelect(Player* /*player*/, uint32 menuId, uint32 gossipListId) override
|
||||
{
|
||||
if (me->GetCreatureTemplate()->GossipMenuId == menuId && !gossipListId)
|
||||
if (me->GetGossipMenuId() == menuId && !gossipListId)
|
||||
{
|
||||
_events.SetPhase(PHASE_INTRO);
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
|
||||
Reference in New Issue
Block a user