Beispiel #1
0
        public static Quest getQuestFromId(int id)
        {
            Dictionary <int, string> questData = Game1.temporaryContent.Load <Dictionary <int, string> >("Data\\Quests");

            if (questData != null && questData.ContainsKey(id))
            {
                string[] rawData         = questData[id].Split('/');
                string   questType       = rawData[0];
                Quest    q               = null;
                string[] conditionsSplit = rawData[4].Split(' ');
                switch (questType)
                {
                case "Crafting":
                    q = new CraftingQuest(Convert.ToInt32(conditionsSplit[0]), conditionsSplit[1].ToLower().Equals("true"));
                    q.questType.Value = 2;
                    break;

                case "Location":
                    q = new GoSomewhereQuest(conditionsSplit[0]);
                    q.questType.Value = 6;
                    break;

                case "Building":
                    q = new Quest();
                    q.questType.Value        = 8;
                    q.completionString.Value = conditionsSplit[0];
                    break;

                case "ItemDelivery":
                    q = new ItemDeliveryQuest();
                    (q as ItemDeliveryQuest).target.Value  = conditionsSplit[0];
                    (q as ItemDeliveryQuest).item.Value    = Convert.ToInt32(conditionsSplit[1]);
                    (q as ItemDeliveryQuest).targetMessage = rawData[9];
                    if (conditionsSplit.Length > 2)
                    {
                        (q as ItemDeliveryQuest).number.Value = Convert.ToInt32(conditionsSplit[2]);
                    }
                    q.questType.Value = 3;
                    break;

                case "Monster":
                    q = new SlayMonsterQuest();
                    (q as SlayMonsterQuest).loadQuestInfo();
                    (q as SlayMonsterQuest).monster.Value.Name = conditionsSplit[0].Replace('_', ' ');
                    (q as SlayMonsterQuest).monsterName.Value  = (q as SlayMonsterQuest).monster.Value.Name;
                    (q as SlayMonsterQuest).numberToKill.Value = Convert.ToInt32(conditionsSplit[1]);
                    if (conditionsSplit.Length > 2)
                    {
                        (q as SlayMonsterQuest).target.Value = conditionsSplit[2];
                    }
                    else
                    {
                        (q as SlayMonsterQuest).target.Value = "null";
                    }
                    q.questType.Value = 4;
                    break;

                case "Basic":
                    q = new Quest();
                    q.questType.Value = 1;
                    break;

                case "Social":
                    q = new SocializeQuest();
                    (q as SocializeQuest).loadQuestInfo();
                    break;

                case "ItemHarvest":
                    q = new ItemHarvestQuest(Convert.ToInt32(conditionsSplit[0]), (conditionsSplit.Length <= 1) ? 1 : Convert.ToInt32(conditionsSplit[1]));
                    break;

                case "LostItem":
                    q = new LostItemQuest(conditionsSplit[0], conditionsSplit[2], Convert.ToInt32(conditionsSplit[1]), Convert.ToInt32(conditionsSplit[3]), Convert.ToInt32(conditionsSplit[4]));
                    break;

                case "SecretLostItem":
                    q = new SecretLostItemQuest(conditionsSplit[0], Convert.ToInt32(conditionsSplit[1]), Convert.ToInt32(conditionsSplit[2]), Convert.ToInt32(conditionsSplit[3]));
                    break;
                }
                q.id.Value         = id;
                q.questTitle       = rawData[1];
                q.questDescription = rawData[2];
                if (rawData[3].Length > 1)
                {
                    q.currentObjective = rawData[3];
                }
                string[] nextQuestsSplit = rawData[5].Split(' ');
                for (int i = 0; i < nextQuestsSplit.Length; i++)
                {
                    string nextQuest = nextQuestsSplit[i];
                    if (nextQuest.StartsWith("h"))
                    {
                        if (!Game1.IsMasterGame)
                        {
                            continue;
                        }
                        nextQuest = nextQuest.Substring(1);
                    }
                    q.nextQuests.Add(Convert.ToInt32(nextQuest));
                }
                q.showNew.Value           = true;
                q.moneyReward.Value       = Convert.ToInt32(rawData[6]);
                q.rewardDescription.Value = (rawData[6].Equals("-1") ? null : rawData[7]);
                if (rawData.Length > 8)
                {
                    q.canBeCancelled.Value = rawData[8].Equals("true");
                }
                return(q);
            }
            return(null);
        }
Beispiel #2
0
        public static Quest getQuestFromId(int id)
        {
            Dictionary <int, string> dictionary = Game1.temporaryContent.Load <Dictionary <int, string> >("Data\\Quests");

            if (dictionary != null && dictionary.ContainsKey(id))
            {
                string[] array = dictionary[id].Split(new char[]
                {
                    '/'
                });
                string   text   = array[0];
                Quest    quest  = null;
                string[] array2 = array[4].Split(new char[]
                {
                    ' '
                });
                uint num = < PrivateImplementationDetails >.ComputeStringHash(text);
                if (num <= 1539345862u)
                {
                    if (num <= 133275711u)
                    {
                        if (num != 126609884u)
                        {
                            if (num == 133275711u)
                            {
                                if (text == "Crafting")
                                {
                                    quest           = new CraftingQuest(Convert.ToInt32(array2[0]), array2[1].ToLower().Equals("true"));
                                    quest.questType = 2;
                                }
                            }
                        }
                        else if (text == "LostItem")
                        {
                            quest = new LostItemQuest(array2[0], array2[2], Convert.ToInt32(array2[1]), Convert.ToInt32(array2[3]), Convert.ToInt32(array2[4]));
                        }
                    }
                    else if (num != 1217142150u)
                    {
                        if (num == 1539345862u)
                        {
                            if (text == "Location")
                            {
                                quest           = new GoSomewhereQuest(array2[0]);
                                quest.questType = 6;
                            }
                        }
                    }
                    else if (text == "ItemDelivery")
                    {
                        quest = new ItemDeliveryQuest();
                        (quest as ItemDeliveryQuest).target        = array2[0];
                        (quest as ItemDeliveryQuest).item          = Convert.ToInt32(array2[1]);
                        (quest as ItemDeliveryQuest).targetMessage = array[9];
                        if (array2.Length > 2)
                        {
                            (quest as ItemDeliveryQuest).number = Convert.ToInt32(array2[2]);
                        }
                        quest.questType = 3;
                    }
                }
                else if (num <= 2324152213u)
                {
                    if (num != 1629445681u)
                    {
                        if (num == 2324152213u)
                        {
                            if (text == "Building")
                            {
                                quest                  = new Quest();
                                quest.questType        = 8;
                                quest.completionString = array2[0];
                            }
                        }
                    }
                    else if (text == "Monster")
                    {
                        quest = new SlayMonsterQuest();
                        (quest as SlayMonsterQuest).loadQuestInfo();
                        (quest as SlayMonsterQuest).monster.name = array2[0].Replace('_', ' ');
                        if ((quest as SlayMonsterQuest).monsterName == "Frost Jelly" || (quest as SlayMonsterQuest).monsterName == "Sludge")
                        {
                            (quest as SlayMonsterQuest).monster      = new Monster();
                            (quest as SlayMonsterQuest).monster.name = (quest as SlayMonsterQuest).monsterName;
                        }
                        else
                        {
                            (quest as SlayMonsterQuest).monster = new Monster((quest as SlayMonsterQuest).monsterName, Vector2.Zero);
                        }
                        (quest as SlayMonsterQuest).numberToKill = Convert.ToInt32(array2[1]);
                        if (array2.Length > 2)
                        {
                            (quest as SlayMonsterQuest).target = array2[2];
                        }
                        else
                        {
                            (quest as SlayMonsterQuest).target = "null";
                        }
                        quest.questType = 4;
                    }
                }
                else if (num != 3610215645u)
                {
                    if (num != 4023868591u)
                    {
                        if (num == 4177547506u)
                        {
                            if (text == "Social")
                            {
                                quest = new SocializeQuest();
                            }
                        }
                    }
                    else if (text == "ItemHarvest")
                    {
                        quest = new ItemHarvestQuest(Convert.ToInt32(array2[0]), (array2.Length > 1) ? Convert.ToInt32(array2[1]) : 1);
                    }
                }
                else if (text == "Basic")
                {
                    quest           = new Quest();
                    quest.questType = 1;
                }
                quest.id               = id;
                quest.questTitle       = array[1];
                quest.questDescription = array[2];
                if (array[3].Length > 1)
                {
                    quest.currentObjective = array[3];
                }
                string[] array3 = array[5].Split(new char[]
                {
                    ' '
                });
                for (int i = 0; i < array3.Length; i++)
                {
                    quest.nextQuests.Add(Convert.ToInt32(array3[i]));
                }
                quest.showNew           = true;
                quest.moneyReward       = Convert.ToInt32(array[6]);
                quest.rewardDescription = (array[6].Equals("-1") ? null : array[7]);
                if (array.Length > 8)
                {
                    quest.canBeCancelled = array[8].Equals("true");
                }
                return(quest);
            }
            return(null);
        }
        // Token: 0x06000A22 RID: 2594 RVA: 0x000D8CAC File Offset: 0x000D6EAC
        public static Quest getQuestFromId(int id)
        {
            if (Game1.temporaryContent == null)
            {
                Game1.temporaryContent = Game1.content.CreateTemporary();
            }
            Dictionary <int, string> questData = Game1.temporaryContent.Load <Dictionary <int, string> >("Data\\Quests");

            if (questData != null && questData.ContainsKey(id))
            {
                string[] rawData = questData[id].Split(new char[]
                {
                    '/'
                });
                string   questType       = rawData[0];
                Quest    q               = null;
                string[] conditionsSplit = rawData[4].Split(new char[]
                {
                    ' '
                });
                uint num = < PrivateImplementationDetails >.ComputeStringHash(questType);
                if (num <= 1539345862u)
                {
                    if (num <= 133275711u)
                    {
                        if (num != 126609884u)
                        {
                            if (num == 133275711u)
                            {
                                if (questType == "Crafting")
                                {
                                    q           = new CraftingQuest(Convert.ToInt32(conditionsSplit[0]), conditionsSplit[1].ToLower().Equals("true"));
                                    q.questType = 2;
                                }
                            }
                        }
                        else if (questType == "LostItem")
                        {
                            q = new LostItemQuest(conditionsSplit[0], conditionsSplit[2], Convert.ToInt32(conditionsSplit[1]), Convert.ToInt32(conditionsSplit[3]), Convert.ToInt32(conditionsSplit[4]));
                        }
                    }
                    else if (num != 1217142150u)
                    {
                        if (num == 1539345862u)
                        {
                            if (questType == "Location")
                            {
                                q           = new GoSomewhereQuest(conditionsSplit[0]);
                                q.questType = 6;
                            }
                        }
                    }
                    else if (questType == "ItemDelivery")
                    {
                        q = new ItemDeliveryQuest();
                        (q as ItemDeliveryQuest).target        = conditionsSplit[0];
                        (q as ItemDeliveryQuest).item          = Convert.ToInt32(conditionsSplit[1]);
                        (q as ItemDeliveryQuest).targetMessage = rawData[9];
                        if (conditionsSplit.Length > 2)
                        {
                            (q as ItemDeliveryQuest).number = Convert.ToInt32(conditionsSplit[2]);
                        }
                        q.questType = 3;
                    }
                }
                else if (num <= 2324152213u)
                {
                    if (num != 1629445681u)
                    {
                        if (num == 2324152213u)
                        {
                            if (questType == "Building")
                            {
                                q                  = new Quest();
                                q.questType        = 8;
                                q.completionString = conditionsSplit[0];
                            }
                        }
                    }
                    else if (questType == "Monster")
                    {
                        q = new SlayMonsterQuest();
                        (q as SlayMonsterQuest).monsterName  = conditionsSplit[0].Replace('_', ' ');
                        (q as SlayMonsterQuest).numberToKill = Convert.ToInt32(conditionsSplit[1]);
                        if (conditionsSplit.Length > 2)
                        {
                            (q as SlayMonsterQuest).target = conditionsSplit[2];
                        }
                        else
                        {
                            (q as SlayMonsterQuest).target = "null";
                        }
                        q.questType = 4;
                    }
                }
                else if (num != 3610215645u)
                {
                    if (num != 4023868591u)
                    {
                        if (num == 4177547506u)
                        {
                            if (questType == "Social")
                            {
                                q = new SocializeQuest();
                            }
                        }
                    }
                    else if (questType == "ItemHarvest")
                    {
                        q = new ItemHarvestQuest(Convert.ToInt32(conditionsSplit[0]), (conditionsSplit.Length > 1) ? Convert.ToInt32(conditionsSplit[1]) : 1);
                    }
                }
                else if (questType == "Basic")
                {
                    q           = new Quest();
                    q.questType = 1;
                }
                q.id               = id;
                q.questTitle       = rawData[1];
                q.questDescription = rawData[2];
                if (rawData[3].Length > 1)
                {
                    q.currentObjective = rawData[3];
                }
                string[] nextQuestsSplit = rawData[5].Split(new char[]
                {
                    ' '
                });
                for (int i = 0; i < nextQuestsSplit.Length; i++)
                {
                    q.nextQuests.Add(Convert.ToInt32(nextQuestsSplit[i]));
                }
                q.showNew           = true;
                q.moneyReward       = Convert.ToInt32(rawData[6]);
                q.rewardDescription = (rawData[6].Equals("-1") ? null : rawData[7]);
                if (rawData.Length > 8)
                {
                    q.canBeCancelled = rawData[8].Equals("true");
                }
                return(q);
            }
            return(null);
        }