public QuestChallenge(SerializationInfo info, StreamingContext context)
        {
            string ID = info.GetString("quest_id");

            type = GameRegistry.GetObstacleByID(ID);
            //UnityEngine.Debug.Log("ID: " + ID + ", " + type);
            questBonus    = info.GetInt32("bonus");
            monsterHealth = info.GetInt32("monsterHealth");
        }
Exemple #2
0
        public Quest(SerializationInfo info, StreamingContext context)
        {
            questRand      = new System.Random();
            heroMaxHealth  = info.GetInt32("heroMaxHealth");
            heroCurHealth  = info.GetInt32("heroCurHealth");
            heroName       = info.GetString("heroName");
            STR            = info.GetInt32("STR");
            AGL            = info.GetInt32("AGL");
            CHA            = info.GetInt32("CHA");
            INT            = info.GetInt32("INT");
            questTimer     = (float)info.GetDouble("questTimer");
            questTotalTime = (float)info.GetDouble("questTotalTime");
            questStep      = info.GetInt32("questStep");
            int num = info.GetInt32("numObstacles");

            questComplete = questStep >= num;
            _obstacles    = new QuestChallenge[num];
            for (int o = 0; o < num; o++)
            {
                QuestChallenge temp = (QuestChallenge)info.GetValue("obs_" + o, typeof(QuestChallenge));
                //_obstacles[o] = (QuestChallenge)info.GetValue("obs_" + o, typeof(QuestChallenge));
                fromDisk.Add(new ChallengeLoadWrapper(temp));
            }
            originalGoal = GameRegistry.GetObstacleByID(info.GetString("originalGoal"));
            num          = info.GetInt32("inventorySize");
            inventory    = new List <ItemStack>();
            for (int o = 0; o < num; o++)
            {
                inventory.Add((ItemStack)info.GetValue("inven_" + o, typeof(ItemStack)));
            }
            timeUntilQuestExpires = (float)info.GetDouble("timeUntilQuestExpires");
            numQuestsBefore       = info.GetInt64("numQuestsBefore");

            rewards    = new ItemStack[2];
            rewards[0] = (ItemStack)info.GetValue("reward_0", typeof(ItemStack));
            rewards[1] = (ItemStack)info.GetValue("reward_1", typeof(ItemStack));
            if (Main.saveVersionFromDisk >= 9)
            {
                if (info.GetBoolean("hasMiscData"))
                {
                    miscData = (Dictionary <string, object>)info.GetValue("miscData", typeof(Dictionary <string, object>));
                }
            }
            if (Main.saveVersionFromDisk >= 16)
            {
                finalResult = (EnumResult)info.GetInt32("finalResult");
            }
            if (Main.saveVersionFromDisk >= 24)
            {
                num = info.GetInt32("numKnownRequirements");
                knownRequirements = new long[num];
                for (int o = 0; o < num; o++)
                {
                    long temp = (long)info.GetValue("knReq_" + o, typeof(long));
                    knownRequirements[o] = temp;
                }
            }
            else
            {
            }
        }