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;
            }
        }
Пример #2
0
 private void btnNewOption_Click(object sender, EventArgs e)
 {
     if (CurrentDialog != null)
     {
         NpcDialogOption option = new NpcDialogOption("[...]");
         CurrentDialog.Options.Add(option);
         LoadItems(lbxOptions, CurrentDialog.Options);
     }
 }
Пример #3
0
 internal void AddCloseDialog()
 {
     var option = new NpcDialogOption("[Close dialog]");
     option.Function = NpcDialogOptionFunction.None;
     Options.Add(option);
 }