Esempio n. 1
0
        public override IQuestAction CreateNew(string source, Quest parentQuest)
        {
            base.CreateNew(source, parentQuest);

            // Source must match pattern
            Match match = Test(source);

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

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

            action.foeSymbol     = new Symbol(match.Groups["symbol"].Value);
            action.spawnInterval = (uint)Parser.ParseInt(match.Groups["minutes"].Value) * 60;
            action.spawnMaxTimes = Parser.ParseInt(match.Groups["count"].Value);
            action.spawnChance   = Parser.ParseInt(match.Groups["percent"].Value);

            // Handle infinite
            if (!string.IsNullOrEmpty(match.Groups["infinite"].Value))
            {
                action.spawnMaxTimes = -1;
            }

            return(action);
        }
Esempio n. 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
            CreateFoe action = new CreateFoe(parentQuest);

            action.foeSymbol     = new Symbol(match.Groups["symbol"].Value);
            action.spawnInterval = (uint)Parser.ParseInt(match.Groups["minutes"].Value) * 60;
            action.spawnMaxTimes = Parser.ParseInt(match.Groups["count"].Value);
            action.spawnChance   = Parser.ParseInt(match.Groups["percent"].Value);

            // Handle infinite
            if (!string.IsNullOrEmpty(match.Groups["infinite"].Value))
            {
                action.spawnMaxTimes = -1;
            }

            // Handle "send" variant
            if (!string.IsNullOrEmpty(match.Groups["send"].Value))
            {
                action.isSendAction = true;

                // "send" without "count" implies infinite
                if (action.spawnMaxTimes == 0)
                {
                    action.spawnMaxTimes = -1;
                }
            }

            // Split options from declaration
            string          optionsSource = source.Substring(match.Length);
            MatchCollection options       = Regex.Matches(optionsSource, optionsMatchStr);

            foreach (Match option in options)
            {
                // Message ID
                Group msgIDGroup = option.Groups["msgId"];
                if (msgIDGroup.Success)
                {
                    action.msgMessageID = Parser.ParseInt(msgIDGroup.Value);
                }
            }

            return(action);
        }
Esempio n. 3
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
            CreateFoe action = new CreateFoe(parentQuest);

            action.foeSymbol     = new Symbol(match.Groups["symbol"].Value);
            action.spawnInterval = (uint)Parser.ParseInt(match.Groups["minutes"].Value) * 60;
            action.spawnMaxTimes = Parser.ParseInt(match.Groups["count"].Value);
            action.spawnChance   = Parser.ParseInt(match.Groups["percent"].Value);
            action.lastSpawnTime = DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.ToSeconds();

            // Handle infinite
            if (!string.IsNullOrEmpty(match.Groups["infinite"].Value))
            {
                action.spawnMaxTimes = -1;
            }

            // Handle "send" variant
            if (!string.IsNullOrEmpty(match.Groups["send"].Value))
            {
                action.isSendAction = true;

                // "send" without "count" implies infinite
                if (action.spawnMaxTimes == 0)
                {
                    action.spawnMaxTimes = -1;
                }
            }

            return(action);
        }