public override void OnConversation() { base.OnConversation(); string convo = Self.GetLocalString("CONVERSATION"); if (!string.IsNullOrWhiteSpace(convo)) { NWPlayer player = NWPlayer.Wrap(_.GetLastSpeaker()); _dialog.StartConversation(player, Self, convo); } else if (!string.IsNullOrWhiteSpace(_nwnxObject.GetDialogResref(Self))) { _.BeginConversation(_nwnxObject.GetDialogResref(Self)); } }
public void StartConversation(NWPlayer player, NWObject talkTo, string @class) { if (player == null) { throw new ArgumentNullException(nameof(player)); } if (player.Object == null) { throw new ArgumentNullException(nameof(player.Object)); } if (talkTo == null) { throw new ArgumentNullException(nameof(talkTo)); } if (talkTo.Object == null) { throw new ArgumentNullException(nameof(talkTo.Object)); } if (string.IsNullOrWhiteSpace(@class)) { throw new ArgumentException(nameof(@class), nameof(@class) + " cannot be null, empty, or whitespace."); } LoadConversation(player, talkTo, @class, -1); PlayerDialog dialog = _cache.PlayerDialogs[player.GlobalID]; // NPC conversations if (_.GetObjectType(talkTo.Object) == NWScript.OBJECT_TYPE_CREATURE && !talkTo.IsPlayer && !talkTo.IsDM) { _.BeginConversation("dialog" + dialog.DialogNumber, new Object()); } // Everything else else { player.AssignCommand(() => _.ActionStartConversation(talkTo.Object, "dialog" + dialog.DialogNumber, NWScript.TRUE, NWScript.FALSE)); } }