コード例 #1
0
        public static int ModCallAddQuest(object[] args)
        {
            if (args.Length < 9)
            {
                SpiritMod.Instance.Logger.Warn("Error adding custom quest! Less than 9 arguments means something must be missing, check you've added everything you need to add!");
                return(-1);
            }

            int index = 1;

            // quest name
            if (!QuestUtils.TryUnbox(args[index++], out string questName, "Quest name"))
            {
                return(-1);
            }

            // quest category
            if (!QuestUtils.TryUnbox(args[index++], out string questCategory, "Quest category"))
            {
                return(-1);
            }
            // TODO: check if quest category exists. if it doesn't, add it, make the colour white.

            // quest client
            if (!QuestUtils.TryUnbox(args[index++], out string questClient, "Quest client"))
            {
                return(-1);
            }

            // quest description
            if (!QuestUtils.TryUnbox(args[index++], out string questDesc, "Quest description"))
            {
                return(-1);
            }

            // quest rewards
            if (!QuestUtils.TryUnbox(args[index++], out (int, int)[] questRewards, "Quest rewards"))
            {
                return(-1);
            }

            // quest difficulty
            if (!QuestUtils.TryUnbox(args[index++], out int questDifficulty, "Quest difficulty"))
            {
                return(-1);
            }

            // quest image
            if (!QuestUtils.TryUnbox(args[index++], out Texture2D questImage, "Quest image"))
            {
                return(-1);
            }

            // quest objectives
            List <QuestTask> tasks = new List <QuestTask>();

            for (int i = index; i < args.Length; i++)
            {
                if (!QuestUtils.TryUnbox(args[i], out object[] objectiveArgs, "Quest objective " + (i - index + 1)))
コード例 #2
0
 public override QuestTask Parse(object[] args)
 {
     //NPC type
     if (!QuestUtils.TryUnbox(args[1], out int npcID))
     {
         if (QuestUtils.TryUnbox(args[1], out short IDasShort, "NPC Type"))
         {
             npcID = IDasShort;
         }
         else
         {
             return(null);
         }
     }
コード例 #3
0
        public override QuestTask Parse(object[] args)
        {
            // get the item ID
            int itemID = -1;

            if (!QuestUtils.TryUnbox(args[1], out itemID))
            {
                if (QuestUtils.TryUnbox(args[1], out short IDasShort, "Item ID"))
                {
                    itemID = IDasShort;
                }
                else
                {
                    return(null);
                }
            }
コード例 #4
0
ファイル: SlayTask.cs プロジェクト: PhoenixBladez/SpiritMod
        public override QuestTask Parse(object[] args)
        {
            // get the ids
            int[] monsterIDs;
            if (!QuestUtils.TryUnbox(args[1], out monsterIDs))
            {
                if (QuestUtils.TryUnbox(args[1], out int id))
                {
                    monsterIDs = new int[] { id }
                }
                ;

                else if (QuestUtils.TryUnbox(args[1], out short idShort))
                {
                    monsterIDs = new int[] { idShort }
                }
                ;
                else
                {
                    return(null);
                }
            }
            if (monsterIDs == null || monsterIDs.Length == 0)
            {
                return(null);
            }

            // get the amount of kills required
            if (!QuestUtils.TryUnbox(args[2], out int amount, "Kills required"))
            {
                return(null);
            }

            // get the name override, if there is one
            string nameOverride = null;

            if (args.Length > 3)
            {
                if (!QuestUtils.TryUnbox(args[3], out nameOverride, "Slay Task name override"))
                {
                    return(null);
                }
            }

            return(new SlayTask(monsterIDs, amount, nameOverride));
        }
コード例 #5
0
        public override QuestTask Parse(object[] args)
        {
            // get the func
            if (!QuestUtils.TryUnbox(args[1], out Func <Player, bool> func, "Explore function"))
            {
                return(null);
            }

            // get the distance
            if (!QuestUtils.TryUnbox(args[2], out float distance, "Distance"))
            {
                return(null);
            }

            // get the area's name
            if (!QuestUtils.TryUnbox(args[3], out string name, "Area name"))
            {
                return(null);
            }

            return(new ExploreTask(func, distance, name));
        }
コード例 #6
0
 public override QuestTask Parse(object[] args)
 {
     if (!QuestUtils.TryUnbox(args[1], out object[] tasks, "Concurrent Task's Tasks"))