Fixed a crash in CreateConversation.

This commit is contained in:
hondacrx
2021-02-28 14:02:38 -05:00
parent b413849c4d
commit fb944d9d82
+22 -16
View File
@@ -121,30 +121,36 @@ namespace Game.Entities
_duration = conversationTemplate.LastLineEndTime; _duration = conversationTemplate.LastLineEndTime;
_textureKitId = conversationTemplate.TextureKitId; _textureKitId = conversationTemplate.TextureKitId;
for (ushort actorIndex = 0; actorIndex < conversationTemplate.Actors.Count; ++actorIndex) if (conversationTemplate.Actors != null)
{ {
ConversationActorTemplate actor = conversationTemplate.Actors[actorIndex]; for (ushort actorIndex = 0; actorIndex < conversationTemplate.Actors.Count; ++actorIndex)
if (actor != null)
{ {
ConversationActor actorField = new ConversationActor(); ConversationActorTemplate actor = conversationTemplate.Actors[actorIndex];
actorField.CreatureID = actor.CreatureId; if (actor != null)
actorField.CreatureDisplayInfoID = actor.CreatureModelId; {
actorField.Type = ConversationActorType.CreatureActor; ConversationActor actorField = new ConversationActor();
actorField.CreatureID = actor.CreatureId;
actorField.CreatureDisplayInfoID = actor.CreatureModelId;
actorField.Type = ConversationActorType.CreatureActor;
AddDynamicUpdateFieldValue(m_values.ModifyValue(m_conversationData).ModifyValue(m_conversationData.Actors), actorField); AddDynamicUpdateFieldValue(m_values.ModifyValue(m_conversationData).ModifyValue(m_conversationData.Actors), actorField);
}
} }
} }
for (ushort actorIndex = 0; actorIndex < conversationTemplate.ActorGuids.Count; ++actorIndex) if (conversationTemplate.ActorGuids != null)
{ {
ulong actorGuid = conversationTemplate.ActorGuids[actorIndex]; for (ushort actorIndex = 0; actorIndex < conversationTemplate.ActorGuids.Count; ++actorIndex)
if (actorGuid == 0)
continue;
foreach (var creature in map.GetCreatureBySpawnIdStore().LookupByKey(actorGuid))
{ {
// we just need the last one, overriding is legit ulong actorGuid = conversationTemplate.ActorGuids[actorIndex];
AddActor(creature.GetGUID(), actorIndex); if (actorGuid == 0)
continue;
foreach (var creature in map.GetCreatureBySpawnIdStore().LookupByKey(actorGuid))
{
// we just need the last one, overriding is legit
AddActor(creature.GetGUID(), actorIndex);
}
} }
} }