private void btnNewDialog_Click(object sender, EventArgs e) { if (CurrentNpc != null) { NpcDialog dialog = new NpcDialog(CurrentNpc, "Silence is bliss"); CurrentNpc.Dialogs.Add(dialog); LoadItems(lbxDialogs, CurrentNpc.Dialogs); } }
private void ProcessNpcDialogResponse(Npc npc, NpcDialog dialog, NpcDialogOption option) { // If the next dialog listed can be called bool canCallNextDialog = false; if (option.Function == NpcDialogOptionFunction.StartEvent) { canCallNextDialog = true; //ProcessMapEvent(Event.Load(option.EventId)); } else if (option.Function == NpcDialogOptionFunction.StartQuest) { canCallNextDialog = true; Game.PlayerQuests.Add(Game.GameProject.Quests.Find(x => x.Id == option.EventId)); } else if (option.Function == NpcDialogOptionFunction.ShowMarket) { canCallNextDialog = true; } else if (option.Function == NpcDialogOptionFunction.FinishQuest) { int questIndex = Game.PlayerQuests.FindIndex(x => x.Id == option.EventId); if (questIndex != -1) { bool finishedQuest = CheckQuestStatus(Game.PlayerQuests[questIndex]); canCallNextDialog = finishedQuest; if (finishedQuest) { floatingText.Add( new TextAnimation(LanguageConfig.Config.QuestFinished, Player.Position, Fonts.ArialBlack14, Color.LightGreen)); AddQuestAwards(Game.PlayerQuests[questIndex]); Game.PlayerQuests[questIndex].State = QuestState.Completed; } } } else if (option.Function == NpcDialogOptionFunction.SaveGame) { Game.SaveGame(); canCallNextDialog = true; } if (canCallNextDialog) { if (option.NextDialogType == NextDialogType.ContinueConversation) { dialog.NextDialog(option.NextDialog); if (dialogs.Contains(npc.CurrentDialog)) dialogs.Remove(dialog); dialog = npc.CurrentDialog; dialog.Show(); if (!dialogs.Contains(dialog)) dialogs.Add(dialog); } else if (option.NextDialogType == NextDialogType.NewConversation) { dialog.NextDialog(option.NextDialog); Game.Paused = false; } } else { Game.Paused = false; } }