示例#1
0
        public override IQuestAction CreateNew(string source, Quest parentQuest)
        {
            // Source must match pattern
            Match match = Test(source);

            if (!match.Success)
            {
                return(null);
            }

            // Factory new action
            ClickedNpc action = new ClickedNpc(parentQuest);

            action.npcSymbol = new Symbol(match.Groups["anNPC"].Value);
            action.id        = Parser.ParseInt(match.Groups["id"].Value);

            // Resolve static message back to ID
            string idName = match.Groups["idName"].Value;

            if (action.id == 0 && !string.IsNullOrEmpty(idName))
            {
                Table table = QuestMachine.Instance.StaticMessagesTable;
                action.id = Parser.ParseInt(table.GetValue("id", idName));
            }

            // Read gold amount and task name for "clicked anNPC and at least goldAmount gold otherwise do taskName"
            action.goldAmount = Parser.ParseInt(match.Groups["goldAmount"].Value);
            action.taskSymbol = new Symbol(match.Groups["taskName"].Value);

            return(action);
        }
示例#2
0
        public override IQuestAction CreateNew(string source, Quest parentQuest)
        {
            // Source must match pattern
            Match match = Test(source);

            if (!match.Success)
            {
                return(null);
            }

            // Factory new action
            ClickedNpc action = new ClickedNpc(parentQuest);

            action.npcSymbol = new Symbol(match.Groups["anNPC"].Value);

            return(action);
        }