Core/Conversations: Replace _participants with generic personal object implementation
Port From (https://github.com/TrinityCore/TrinityCore/commit/3fe9b0a2961b60509d11dd38a90e7b7657b68084)
This commit is contained in:
@@ -2405,7 +2405,7 @@ namespace Game.AI
|
||||
if (playerTarget != null)
|
||||
{
|
||||
Conversation conversation = Conversation.CreateConversation(e.Action.conversation.id, playerTarget,
|
||||
playerTarget, new List<ObjectGuid>() { playerTarget.GetGUID() }, null);
|
||||
playerTarget, playerTarget.GetGUID(), null);
|
||||
if (!conversation)
|
||||
Log.outWarn(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_CREATE_CONVERSATION: id {e.Action.conversation.id}, baseObject {baseObject?.GetName()}, target {playerTarget.GetName()} - failed to create");
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
return Conversation.CreateConversation(conversationEntry, target, target, new List<ObjectGuid>() { target.GetGUID() }) != null;
|
||||
return Conversation.CreateConversation(conversationEntry, target, target, target.GetGUID()) != null;
|
||||
}
|
||||
|
||||
[Command("entervehicle", RBACPermissions.CommandDebugEntervehicle)]
|
||||
|
||||
@@ -59,14 +59,6 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsNeverVisibleFor(WorldObject seer)
|
||||
{
|
||||
if (!_participants.Contains(seer.GetGUID()))
|
||||
return true;
|
||||
|
||||
return base.IsNeverVisibleFor(seer);
|
||||
}
|
||||
|
||||
public override void Update(uint diff)
|
||||
{
|
||||
if (GetDuration() > diff)
|
||||
@@ -96,7 +88,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public static Conversation CreateConversation(uint conversationEntry, Unit creator, Position pos, List<ObjectGuid> participants, SpellInfo spellInfo = null)
|
||||
public static Conversation CreateConversation(uint conversationEntry, Unit creator, Position pos, ObjectGuid privateObjectOwner, SpellInfo spellInfo = null)
|
||||
{
|
||||
ConversationTemplate conversationTemplate = Global.ConversationDataStorage.GetConversationTemplate(conversationEntry);
|
||||
if (conversationTemplate == null)
|
||||
@@ -105,19 +97,19 @@ namespace Game.Entities
|
||||
ulong lowGuid = creator.GetMap().GenerateLowGuid(HighGuid.Conversation);
|
||||
|
||||
Conversation conversation = new();
|
||||
if (!conversation.Create(lowGuid, conversationEntry, creator.GetMap(), creator, pos, participants, spellInfo))
|
||||
if (!conversation.Create(lowGuid, conversationEntry, creator.GetMap(), creator, pos, privateObjectOwner, spellInfo))
|
||||
return null;
|
||||
|
||||
return conversation;
|
||||
}
|
||||
|
||||
bool Create(ulong lowGuid, uint conversationEntry, Map map, Unit creator, Position pos, List<ObjectGuid> participants, SpellInfo spellInfo = null)
|
||||
bool Create(ulong lowGuid, uint conversationEntry, Map map, Unit creator, Position pos, ObjectGuid privateObjectOwner, SpellInfo spellInfo = null)
|
||||
{
|
||||
ConversationTemplate conversationTemplate = Global.ConversationDataStorage.GetConversationTemplate(conversationEntry);
|
||||
//ASSERT(conversationTemplate);
|
||||
|
||||
_creatorGuid = creator.GetGUID();
|
||||
_participants = participants;
|
||||
SetPrivateObjectOwner(privateObjectOwner);
|
||||
|
||||
SetMap(map);
|
||||
Relocate(pos);
|
||||
@@ -212,11 +204,6 @@ namespace Game.Entities
|
||||
SetUpdateFieldValue(ref actorField.Type, ConversationActorType.WorldObjectActor);
|
||||
}
|
||||
|
||||
void AddParticipant(ObjectGuid participantGuid)
|
||||
{
|
||||
_participants.Add(participantGuid);
|
||||
}
|
||||
|
||||
public uint GetScriptId()
|
||||
{
|
||||
return Global.ConversationDataStorage.GetConversationTemplate(GetEntry()).ScriptId;
|
||||
@@ -303,6 +290,5 @@ namespace Game.Entities
|
||||
ObjectGuid _creatorGuid;
|
||||
uint _duration;
|
||||
uint _textureKitId;
|
||||
List<ObjectGuid> _participants = new();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5333,7 +5333,7 @@ namespace Game.Spells
|
||||
if (unitCaster == null || !m_targets.HasDst())
|
||||
return;
|
||||
|
||||
Conversation.CreateConversation((uint)effectInfo.MiscValue, unitCaster, destTarget.GetPosition(), new List<ObjectGuid>() { GetCaster().GetGUID() }, GetSpellInfo());
|
||||
Conversation.CreateConversation((uint)effectInfo.MiscValue, unitCaster, destTarget.GetPosition(), ObjectGuid.Empty, GetSpellInfo());
|
||||
}
|
||||
|
||||
[SpellEffectHandler(SpellEffectName.AddGarrisonFollower)]
|
||||
@@ -5681,7 +5681,7 @@ namespace Game.Spells
|
||||
if (unitCaster == null || unitTarget == null || !unitTarget.IsPlayer())
|
||||
return;
|
||||
|
||||
Conversation.CreateConversation((uint)effectInfo.MiscValue, unitCaster, unitTarget.GetPosition(), new List<ObjectGuid>() { unitTarget.GetGUID() }, GetSpellInfo());
|
||||
Conversation.CreateConversation((uint)effectInfo.MiscValue, unitCaster, unitTarget.GetPosition(), unitTarget.GetGUID(), GetSpellInfo());
|
||||
}
|
||||
|
||||
[SpellEffectHandler(SpellEffectName.SendChatMessage)]
|
||||
|
||||
Reference in New Issue
Block a user