Exemple #1
0
        private static DialogType GetDialogType(ScriptMetadata scriptMetadata, NpcTalk npcTalk, bool hasNextScript)
        {
            DialogType dialogType = DialogType.CloseNext1;
            Option     option     = scriptMetadata.Options.First(x => x.Id == npcTalk.ScriptId);

            if (option.Goto.Count == 0)
            {
                dialogType = DialogType.CloseNext1;
            }
            if (option.AmountContent > 1)
            {
                dialogType = DialogType.CloseNext;
            }

            if (!hasNextScript)
            {
                ScriptIdType type = (ScriptIdType)(npcTalk.ScriptId / 100);
                if (npcTalk.IsQuest)
                {
                    dialogType = type switch
                    {
                        ScriptIdType.Start => DialogType.AcceptDecline,
                        ScriptIdType.End => DialogType.QuestReward,
                        _ => DialogType.Close1,
                    };
                }
                else
                {
                    dialogType = DialogType.Close1;
                }
            }
            return(dialogType);
        }
Exemple #2
0
        private static DialogType GetDialogType(ScriptMetadata scriptMetadata, NpcTalk npcTalk, bool hasNextScript)
        {
            DialogType dialogType = DialogType.None;
            Option     option     = scriptMetadata.Options.First(x => x.Id == npcTalk.ScriptId);

            // If npc has buttonSet by xmls, use it
            if (option.Contents[npcTalk.ContentIndex].ButtonSet != DialogType.None)
            {
                return(option.Contents[npcTalk.ContentIndex].ButtonSet);
            }

            if (option.Contents[npcTalk.ContentIndex].Goto.Count == 0)
            {
                dialogType = DialogType.CloseNext;
            }
            else
            {
                dialogType = DialogType.CloseNextWithDistractor;
            }

            if (!hasNextScript)
            {
                // Get the correct dialog type for the last quest content
                ScriptIdType type = (ScriptIdType)(npcTalk.ScriptId / 100);
                if (npcTalk.IsQuest)
                {
                    dialogType = type switch
                    {
                        ScriptIdType.Start => DialogType.AcceptDecline,
                        ScriptIdType.End => DialogType.QuestReward,
                        _ => DialogType.Close1,
                    };
                }
                else
                {
                    dialogType = DialogType.Close1;
                }
            }
            return(dialogType);
        }
    private static DialogType GetDialogType(ScriptMetadata scriptMetadata, NpcTalk npcTalk, bool hasNextScript)
    {
        Option  option  = scriptMetadata.Options.First(x => x.Id == npcTalk.ScriptId);
        Content content = option.Contents[npcTalk.ContentIndex];

        // If npc has buttonSet by xmls, use it
        if (content.ButtonSet != DialogType.None)
        {
            return(content.ButtonSet);
        }

        if (!hasNextScript)
        {
            // Get the correct dialog type for the last quest content
            ScriptIdType type = (ScriptIdType)(npcTalk.ScriptId / 100);
            if (npcTalk.IsQuest)
            {
                return(type switch
                {
                    ScriptIdType.Start => DialogType.AcceptDecline,
                    ScriptIdType.End => DialogType.QuestReward,
                    _ => DialogType.Close1
                });
Exemple #4
0
    private static ResponseSelection GetResponseSelection(NpcKind npcKind, DialogType type, int contentIndex, NpcScript npcScript)
    {
        if (npcScript?.Contents[contentIndex]?.ButtonSet != 0 && npcScript != null)
        {
            return(npcScript.Contents[contentIndex].ButtonSet);
        }

        if (type.HasFlag(DialogType.Options))
        {
            if (npcScript?.Contents.Count > 0)
            {
                return(ResponseSelection.SelectableTalk);
            }

            return(ResponseSelection.None);
        }

        if (type.HasFlag(DialogType.UI) && npcScript?.Type == ScriptType.Select)
        {
            return(ResponseSelection.None);
        }

        if (npcScript?.Contents[contentIndex].Distractor.Count > 0)
        {
            return(ResponseSelection.SelectableDistractor);
        }

        if (npcScript?.Contents.ElementAtOrDefault(contentIndex + 1) is not null)
        {
            return(ResponseSelection.Next);
        }

        switch (npcScript?.Type)
        {
        case ScriptType.Job:
            switch (npcKind)
            {
            case NpcKind.Travel:
                return(ResponseSelection.TakeBoat);

            case NpcKind.BeautyDye:
            case NpcKind.BeautyHair:
            case NpcKind.BeautyFaceAndSkin:
            case NpcKind.BeautyFaceDecoration:
            case NpcKind.Mirror:
                return(ResponseSelection.Beauty);

            case NpcKind.JobAdvancement:
                return(ResponseSelection.JobAdvance);

            case NpcKind.Wheel:
                return(ResponseSelection.Roulette);
            }

            break;

        case ScriptType.Select:
            switch (npcKind)
            {
            case NpcKind.Storage:
            case NpcKind.FixedShop:
            case NpcKind.BalmyShop:
            case NpcKind.RotatingShop:
                return(ResponseSelection.None);
            }

            break;
        }

        if (type == DialogType.Quest)
        {
            ScriptIdType questScriptIdType = (ScriptIdType)(npcScript.Id / 100);
            return(questScriptIdType switch
            {
                ScriptIdType.Start => ResponseSelection.QuestAccept,
                ScriptIdType.Continue => ResponseSelection.QuestProgress,
                ScriptIdType.End => ResponseSelection.QuestComplete,
                _ => ResponseSelection.Close
            });