diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Conversation/Conversation.cpp | 22 | ||||
| -rw-r--r-- | src/server/game/Entities/Conversation/Conversation.h | 10 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 4 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_debug.cpp | 2 |
5 files changed, 11 insertions, 29 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 2d191d2082b..4574e4abb49 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2433,7 +2433,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (Player* playerTarget = target->ToPlayer()) { Conversation* conversation = Conversation::CreateConversation(e.action.conversation.id, playerTarget, - *playerTarget, { playerTarget->GetGUID() }, nullptr); + *playerTarget, playerTarget->GetGUID(), nullptr); if (!conversation) TC_LOG_WARN("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_CREATE_CONVERSATION: id %u, baseObject %s, target %s - failed to create conversation", e.action.conversation.id, !baseObject ? "" : baseObject->GetName().c_str(), playerTarget->GetName().c_str()); diff --git a/src/server/game/Entities/Conversation/Conversation.cpp b/src/server/game/Entities/Conversation/Conversation.cpp index 015846b88fb..826d6dac525 100644 --- a/src/server/game/Entities/Conversation/Conversation.cpp +++ b/src/server/game/Entities/Conversation/Conversation.cpp @@ -16,6 +16,7 @@ */ #include "Conversation.h" +#include "ConversationDataStore.h" #include "Creature.h" #include "IteratorPair.h" #include "Log.h" @@ -56,14 +57,6 @@ void Conversation::RemoveFromWorld() } } -bool Conversation::IsNeverVisibleFor(WorldObject const* seer) const -{ - if (_participants.find(seer->GetGUID()) == _participants.end()) - return true; - - return WorldObject::IsNeverVisibleFor(seer); -} - void Conversation::Update(uint32 diff) { if (GetDuration() > int32(diff)) @@ -93,7 +86,7 @@ void Conversation::Remove() } } -Conversation* Conversation::CreateConversation(uint32 conversationEntry, Unit* creator, Position const& pos, GuidUnorderedSet&& participants, SpellInfo const* spellInfo /*= nullptr*/) +Conversation* Conversation::CreateConversation(uint32 conversationEntry, Unit* creator, Position const& pos, ObjectGuid privateObjectOwner, SpellInfo const* spellInfo /*= nullptr*/) { ConversationTemplate const* conversationTemplate = sConversationDataStore->GetConversationTemplate(conversationEntry); if (!conversationTemplate) @@ -102,7 +95,7 @@ Conversation* Conversation::CreateConversation(uint32 conversationEntry, Unit* c ObjectGuid::LowType lowGuid = creator->GetMap()->GenerateLowGuid<HighGuid::Conversation>(); Conversation* conversation = new Conversation(); - if (!conversation->Create(lowGuid, conversationEntry, creator->GetMap(), creator, pos, std::move(participants), spellInfo)) + if (!conversation->Create(lowGuid, conversationEntry, creator->GetMap(), creator, pos, privateObjectOwner, spellInfo)) { delete conversation; return nullptr; @@ -111,13 +104,13 @@ Conversation* Conversation::CreateConversation(uint32 conversationEntry, Unit* c return conversation; } -bool Conversation::Create(ObjectGuid::LowType lowGuid, uint32 conversationEntry, Map* map, Unit* creator, Position const& pos, GuidUnorderedSet&& participants, SpellInfo const* /*spellInfo = nullptr*/) +bool Conversation::Create(ObjectGuid::LowType lowGuid, uint32 conversationEntry, Map* map, Unit* creator, Position const& pos, ObjectGuid privateObjectOwner, SpellInfo const* /*spellInfo = nullptr*/) { ConversationTemplate const* conversationTemplate = sConversationDataStore->GetConversationTemplate(conversationEntry); ASSERT(conversationTemplate); _creatorGuid = creator->GetGUID(); - _participants = std::move(participants); + SetPrivateObjectOwner(privateObjectOwner); SetMap(map); Relocate(pos); @@ -197,11 +190,6 @@ void Conversation::AddActor(ObjectGuid const& actorGuid, uint16 actorIdx) SetUpdateFieldValue(actorField.ModifyValue(&UF::ConversationActor::Type), AsUnderlyingType(ActorType::WorldObjectActor)); } -void Conversation::AddParticipant(ObjectGuid const& participantGuid) -{ - _participants.insert(participantGuid); -} - uint32 Conversation::GetScriptId() const { return sConversationDataStore->GetConversationTemplate(GetEntry())->ScriptId; diff --git a/src/server/game/Entities/Conversation/Conversation.h b/src/server/game/Entities/Conversation/Conversation.h index aa180000016..a2356cd8a40 100644 --- a/src/server/game/Entities/Conversation/Conversation.h +++ b/src/server/game/Entities/Conversation/Conversation.h @@ -19,8 +19,6 @@ #define TRINITYCORE_CONVERSATION_H #include "Object.h" -#include "ConversationDataStore.h" -#include <cstring> class Unit; class SpellInfo; @@ -43,17 +41,14 @@ class TC_GAME_API Conversation : public WorldObject, public GridObject<Conversat void AddToWorld() override; void RemoveFromWorld() override; - bool IsNeverVisibleFor(WorldObject const* seer) const override; - void Update(uint32 diff) override; void Remove(); int32 GetDuration() const { return _duration; } uint32 GetTextureKitId() const { return _textureKitId; } - static Conversation* CreateConversation(uint32 conversationEntry, Unit* creator, Position const& pos, GuidUnorderedSet&& participants, SpellInfo const* spellInfo = nullptr); - bool Create(ObjectGuid::LowType lowGuid, uint32 conversationEntry, Map* map, Unit* creator, Position const& pos, GuidUnorderedSet&& participants, SpellInfo const* spellInfo = nullptr); + static Conversation* CreateConversation(uint32 conversationEntry, Unit* creator, Position const& pos, ObjectGuid privateObjectOwner, SpellInfo const* spellInfo = nullptr); + bool Create(ObjectGuid::LowType lowGuid, uint32 conversationEntry, Map* map, Unit* creator, Position const& pos, ObjectGuid privateObjectOwner, SpellInfo const* spellInfo = nullptr); void AddActor(ObjectGuid const& actorGuid, uint16 actorIdx); - void AddParticipant(ObjectGuid const& participantGuid); ObjectGuid const& GetCreatorGuid() const { return _creatorGuid; } ObjectGuid GetOwnerGUID() const override { return GetCreatorGuid(); } @@ -80,7 +75,6 @@ class TC_GAME_API Conversation : public WorldObject, public GridObject<Conversat ObjectGuid _creatorGuid; uint32 _duration; uint32 _textureKitId; - GuidUnorderedSet _participants; }; #endif // TRINITYCORE_CONVERSATION_H diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index d92a72f0cb8..d94d3163a20 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -5543,7 +5543,7 @@ void Spell::EffectCreateConversation() if (!unitCaster || !m_targets.HasDst()) return; - Conversation::CreateConversation(effectInfo->MiscValue, unitCaster, destTarget->GetPosition(), { GetCaster()->GetGUID() }, GetSpellInfo()); + Conversation::CreateConversation(effectInfo->MiscValue, unitCaster, destTarget->GetPosition(), ObjectGuid::Empty, GetSpellInfo()); } void Spell::EffectAddGarrisonFollower() @@ -5884,7 +5884,7 @@ void Spell::EffectCreatePrivateConversation() if (!unitCaster || !unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - Conversation::CreateConversation(effectInfo->MiscValue, unitCaster, unitTarget->GetPosition(), { unitTarget->GetGUID() }, GetSpellInfo()); + Conversation::CreateConversation(effectInfo->MiscValue, unitCaster, unitTarget->GetPosition(), unitTarget->GetGUID(), GetSpellInfo()); } void Spell::EffectSendChatMessage() diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index fd5fd2143e1..752fcc19386 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1631,7 +1631,7 @@ public: return false; } - return Conversation::CreateConversation(conversationEntry, target, *target, { target->GetGUID() }) != nullptr; + return Conversation::CreateConversation(conversationEntry, target, *target, target->GetGUID()) != nullptr; } static bool HandleDebugWorldStateCommand(ChatHandler* handler, char const* args) |
