From 39652f944555e437a7b08eddd59c874ce6b0612b Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 8 Mar 2021 20:30:32 +0100 Subject: Core/Conversations: Fill more updatefields with correct data --- .../game/Entities/Conversation/Conversation.cpp | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Conversation/Conversation.cpp b/src/server/game/Entities/Conversation/Conversation.cpp index 1e622b642f9..d51053ee15b 100644 --- a/src/server/game/Entities/Conversation/Conversation.cpp +++ b/src/server/game/Entities/Conversation/Conversation.cpp @@ -34,9 +34,7 @@ Conversation::Conversation() : WorldObject(false), _duration(0), _textureKitId(0 m_updateFlag.Conversation = true; } -Conversation::~Conversation() -{ -} +Conversation::~Conversation() = default; void Conversation::AddToWorld() { @@ -69,9 +67,20 @@ bool Conversation::IsNeverVisibleFor(WorldObject const* seer) const void Conversation::Update(uint32 diff) { if (GetDuration() > int32(diff)) + { _duration -= diff; + DoWithSuppressingObjectUpdates([&]() + { + // Only sent in CreateObject + ApplyModUpdateFieldValue(m_values.ModifyValue(&Conversation::m_conversationData).ModifyValue(&UF::ConversationData::Progress), int32(diff), true); + const_cast(*m_conversationData).ClearChanged(&UF::ConversationData::Progress); + }); + } else + { Remove(); // expired + return; + } WorldObject::Update(diff); } @@ -112,6 +121,7 @@ bool Conversation::Create(ObjectGuid::LowType lowGuid, uint32 conversationEntry, SetMap(map); Relocate(pos); + RelocateStationaryPosition(pos); Object::_Create(ObjectGuid::Create(GetMapId(), conversationEntry, lowGuid)); PhasingHandler::InheritPhaseShift(this, creator); @@ -123,20 +133,21 @@ bool Conversation::Create(ObjectGuid::LowType lowGuid, uint32 conversationEntry, _duration = conversationTemplate->LastLineEndTime; _textureKitId = conversationTemplate->TextureKitId; - for (uint16 actorIndex = 0; actorIndex < conversationTemplate->Actors.size(); ++actorIndex) + for (ConversationActorTemplate const* actor : conversationTemplate->Actors) { - if (ConversationActorTemplate const* actor = conversationTemplate->Actors[actorIndex]) + if (actor) { UF::ConversationActor& actorField = AddDynamicUpdateFieldValue(m_values.ModifyValue(&Conversation::m_conversationData).ModifyValue(&UF::ConversationData::Actors)); actorField.CreatureID = actor->CreatureId; actorField.CreatureDisplayInfoID = actor->CreatureModelId; + actorField.Id = actor->Id; actorField.Type = AsUnderlyingType(ActorType::CreatureActor); } } for (uint16 actorIndex = 0; actorIndex < conversationTemplate->ActorGuids.size(); ++actorIndex) { - ObjectGuid::LowType const& actorGuid = conversationTemplate->ActorGuids[actorIndex]; + ObjectGuid::LowType actorGuid = conversationTemplate->ActorGuids[actorIndex]; if (!actorGuid) continue; -- cgit v1.2.3