public void processSaveData(string savetext)
        {
            //get campaign info
            string strCampaignEnd   = "/Game/Campaign_Main/Quest_Campaign_Main.Quest_Campaign_Main_C";
            string strCampaignStart = "/Game/Campaign_Main/Quest_Campaign_City.Quest_Campaign_City";
            int    campaignEnd      = savetext.IndexOf(strCampaignEnd);
            int    campaignStart    = savetext.IndexOf(strCampaignStart);

            if (campaignStart != -1 && campaignEnd != -1)
            {
                string campaigntext = savetext.Substring(0, campaignEnd);
                campaignStart = campaigntext.LastIndexOf(strCampaignStart);
                campaigntext  = campaigntext.Substring(campaignStart);
                RemnantWorldEvent.ProcessEvents(this, campaigntext, RemnantWorldEvent.ProcessMode.Campaign);
            }
            else
            {
                strCampaignEnd   = "/Game/Campaign_Clementine/Quest_Campaign_Clementine.Quest_Campaign_Clementine_C";
                strCampaignStart = "/Game/World_Rural/Templates/Template_Rural_Overworld_0";
                campaignEnd      = savetext.IndexOf(strCampaignEnd);
                campaignStart    = savetext.IndexOf(strCampaignStart);
                if (campaignStart != -1 && campaignEnd != -1)
                {
                    string campaigntext = savetext.Substring(0, campaignEnd);
                    campaignStart = campaigntext.LastIndexOf(strCampaignStart);
                    campaigntext  = campaigntext.Substring(campaignStart);
                    RemnantWorldEvent.ProcessEvents(this, campaigntext, RemnantWorldEvent.ProcessMode.Subject2923);
                }
                else
                {
                    Console.WriteLine("Campaign not found; likely in tutorial mission.");
                }
            }

            //get adventure info
            if (savetext.Contains("Quest_AdventureMode_"))
            {
                string adventureZone = null;
                if (savetext.Contains("Quest_AdventureMode_City_C"))
                {
                    adventureZone = "City";
                }
                if (savetext.Contains("Quest_AdventureMode_Wasteland_C"))
                {
                    adventureZone = "Wasteland";
                }
                if (savetext.Contains("Quest_AdventureMode_Swamp_C"))
                {
                    adventureZone = "Swamp";
                }
                if (savetext.Contains("Quest_AdventureMode_Jungle_C"))
                {
                    adventureZone = "Jungle";
                }
                if (savetext.Contains("Quest_AdventureMode_Snow_C"))
                {
                    adventureZone = "Snow";
                }

                string strAdventureEnd   = String.Format("/Game/World_{0}/Quests/Quest_AdventureMode/Quest_AdventureMode_{0}.Quest_AdventureMode_{0}_C", adventureZone);
                int    adventureEnd      = savetext.IndexOf(strAdventureEnd) + strAdventureEnd.Length;
                string advtext           = savetext.Substring(0, adventureEnd);
                string strAdventureStart = String.Format("/Game/World_{0}/Quests/Quest_AdventureMode/Quest_AdventureMode_{0}_0", adventureZone);
                int    adventureStart    = advtext.LastIndexOf(strAdventureStart) + strAdventureStart.Length;
                advtext = advtext.Substring(adventureStart);
                RemnantWorldEvent.ProcessEvents(this, advtext, RemnantWorldEvent.ProcessMode.Adventure);
            }

            missingItems.Clear();
            foreach (RemnantItem[] eventItems in GameInfo.EventItem.Values)
            {
                foreach (RemnantItem item in eventItems)
                {
                    if (!this.Inventory.Contains(item.GetKey()))
                    {
                        if (!missingItems.Contains(item))
                        {
                            missingItems.Add(item);
                        }
                    }
                }
            }
            missingItems.Sort();
        }
        //credit to /u/hzla00 for original javascript implementation
        static public void ProcessEvents(RemnantCharacter character, string eventsText, ProcessMode mode)
        {
            Dictionary <string, Dictionary <string, string> > zones      = new Dictionary <string, Dictionary <string, string> >();
            Dictionary <string, List <RemnantWorldEvent> >    zoneEvents = new Dictionary <string, List <RemnantWorldEvent> >();
            List <RemnantWorldEvent> churchEvents = new List <RemnantWorldEvent>();

            foreach (string z in GameInfo.Zones)
            {
                zones.Add(z, new Dictionary <string, string>());
                zoneEvents.Add(z, new List <RemnantWorldEvent>());
            }

            string zone = null;
            string currentMainLocation = "Fairview";
            string currentSublocation  = null;

            string          eventName = null;
            MatchCollection matches   = Regex.Matches(eventsText, "(?:/[a-zA-Z0-9_]+){3}/(([a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9_]+)|Quest_Church)");

            foreach (Match match in matches)
            {
                string eventType     = null;
                string lastEventname = eventName;
                eventName = null;

                string textLine = match.Value;
                try
                {
                    if (currentSublocation != null)
                    {
                        //Some world bosses don't have a preceding dungeon; subsequent items therefore spawn in the overworld
                        if (currentSublocation.Equals("TheRavager'sHaunt") || currentSublocation.Equals("TheTempestCourt"))
                        {
                            currentSublocation = null;
                        }
                    }
                    zone = getZone(textLine);

                    eventType = getEventType(textLine);
                    if (textLine.Contains("Overworld_Zone"))
                    {
                        //process overworld zone marker
                        currentMainLocation = textLine.Split('/')[4].Split('_')[1] + " " + textLine.Split('/')[4].Split('_')[2] + " " + textLine.Split('/')[4].Split('_')[3];
                        if (GameInfo.MainLocations.ContainsKey(currentMainLocation))
                        {
                            currentMainLocation = GameInfo.MainLocations[currentMainLocation];
                        }
                        else
                        {
                            currentMainLocation = null;
                        }
                        continue;
                    }
                    else if (textLine.Contains("Quest_Church"))
                    {
                        //process Root Mother event
                        currentMainLocation = "Chapel Station";
                        eventName           = "RootMother";
                        currentSublocation  = "Church of the Harbinger";
                    }
                    else if (eventType != null)
                    {
                        //process other events, if they're recognized by getEventType
                        eventName = textLine.Split('/')[4].Split('_')[2];
                        if (textLine.Contains("OverworldPOI"))
                        {
                            currentSublocation = null;
                        }
                        else if (!textLine.Contains("Quest_Event"))
                        {
                            if (GameInfo.SubLocations.ContainsKey(eventName))
                            {
                                currentSublocation = GameInfo.SubLocations[eventName];
                            }
                            else
                            {
                                currentSublocation = null;
                            }
                        }
                        if ("Chapel Station".Equals(currentMainLocation))
                        {
                            if (textLine.Contains("Quest_Boss"))
                            {
                                currentMainLocation = "Westcourt";
                            }
                            else
                            {
                                currentSublocation = null;
                            }
                        }
                    }

                    if (mode == ProcessMode.Adventure)
                    {
                        currentMainLocation = null;
                    }

                    if (eventName != lastEventname)
                    {
                        RemnantWorldEvent se = new RemnantWorldEvent();
                        // Replacements
                        if (eventName != null)
                        {
                            se.setKey(eventName);
                            se.Name = eventName.Replace("LizAndLiz", "TaleOfTwoLiz's").Replace("Fatty", "TheUncleanOne").Replace("WastelandGuardian", "Claviger").Replace("RootEnt", "TheEnt").Replace("Wolf", "TheRavager").Replace("RootDragon", "Singe").Replace("SwarmMaster", "Scourge").Replace("RootWraith", "Shroud").Replace("RootTumbleweed", "TheMangler").Replace("Kincaller", "Warden").Replace("Tyrant", "Thrall").Replace("Vyr", "ShadeAndShatter").Replace("ImmolatorAndZephyr", "ScaldAndSear").Replace("RootBrute", "Gorefist").Replace("SlimeHulk", "Canker").Replace("BlinkFiend", "Onslaught").Replace("Sentinel", "Raze").Replace("Penitent", "Leto'sAmulet").Replace("LastWill", "SupplyRun").Replace("SwampGuardian", "Ixillis").Replace("OldManAndConstruct", "WudAndAncientConstruct").Replace("Splitter", "Riphide").Replace("Nexus", "RootNexus").Replace("FlickeringHorror", "DreamEater").Replace("BarbTerror", "BarbedTerror").Replace("Wisp", "CircletHatchery").Replace("GunslignersRing", "Gunslinger'sRing");
                            se.Name = Regex.Replace(se.Name, "([a-z])([A-Z])", "$1 $2");
                        }

                        if (zone != null && eventType != null && eventName != null)
                        {
                            if (!zones[zone].ContainsKey(eventType))
                            {
                                zones[zone].Add(eventType, "");
                            }
                            if (!zones[zone][eventType].Contains(eventName))
                            {
                                zones[zone][eventType] += ", " + eventName;
                                List <string> locationList = new List <string>();
                                locationList.Add(zone);
                                if (currentMainLocation != null)
                                {
                                    locationList.Add(Regex.Replace(currentMainLocation, "([a-z])([A-Z])", "$1 $2"));
                                }
                                if (currentSublocation != null)
                                {
                                    locationList.Add(Regex.Replace(currentSublocation, "([a-z])([A-Z])", "$1 $2"));
                                }
                                se.Location = string.Join(": ", locationList);
                                se.Type     = eventType;
                                se.setMissingItems(character);
                                if (!"Chapel Station".Equals(currentMainLocation))
                                {
                                    zoneEvents[zone].Add(se);
                                }
                                else
                                {
                                    churchEvents.Insert(0, se);
                                }

                                // rings drop with the Cryptolith on Rhom
                                if (eventName.Equals("Cryptolith") && zone.Equals("Rhom"))
                                {
                                    RemnantWorldEvent ringdrop = new RemnantWorldEvent();
                                    ringdrop.Location = zone;
                                    ringdrop.setKey("SoulLink");
                                    ringdrop.Name = "Soul Link";
                                    ringdrop.Type = "Item Drop";
                                    ringdrop.setMissingItems(character);
                                    zoneEvents[zone].Add(ringdrop);
                                }
                                // beetle always spawns in Strange Pass
                                else if (eventName.Equals("BrainBug"))
                                {
                                    RemnantWorldEvent beetle = new RemnantWorldEvent();
                                    beetle.Location = se.Location;
                                    beetle.setKey("Sketterling");
                                    beetle.Name = "Sketterling";
                                    beetle.Type = "Loot Beetle";
                                    beetle.setMissingItems(character);
                                    zoneEvents[zone].Add(beetle);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error parsing save event:");
                    Console.WriteLine("\tLine: " + textLine);
                    Console.WriteLine("\tError: " + ex.ToString());
                }
            }

            List <RemnantWorldEvent> orderedEvents = new List <RemnantWorldEvent>();

            bool churchAdded          = false;
            bool queenAdded           = false;
            bool navunAdded           = false;
            RemnantWorldEvent ward13  = new RemnantWorldEvent();
            RemnantWorldEvent hideout = new RemnantWorldEvent();
            RemnantWorldEvent undying = new RemnantWorldEvent();
            RemnantWorldEvent queen   = new RemnantWorldEvent();
            RemnantWorldEvent navun   = new RemnantWorldEvent();
            RemnantWorldEvent ward17  = new RemnantWorldEvent();

            if (mode == ProcessMode.Campaign)
            {
                ward13.setKey("Ward13");
                ward13.Name     = "Ward 13";
                ward13.Location = "Earth: Ward 13";
                ward13.Type     = "Home";
                ward13.setMissingItems(character);
                if (ward13.MissingItems.Length > 0)
                {
                    orderedEvents.Add(ward13);
                }

                hideout.setKey("FoundersHideout");
                hideout.Name     = "Founder's Hideout";
                hideout.Location = "Earth: Fairview";
                hideout.Type     = "Point of Interest";
                hideout.setMissingItems(character);
                if (hideout.MissingItems.Length > 0)
                {
                    orderedEvents.Add(hideout);
                }

                undying.setKey("UndyingKing");
                undying.Name     = "Undying King";
                undying.Location = "Rhom: Undying Throne";
                undying.Type     = "World Boss";
                undying.setMissingItems(character);

                queen.Name = "Iskal Queen";
                queen.setKey("IskalQueen");
                queen.Location = "Corsus: The Mist Fen";
                queen.Type     = "Point of Interest";
                queen.setMissingItems(character);

                navun.Name = "Fight With The Rebels";
                navun.setKey("SlaveRevolt");
                navun.Location = "Yaesha: Shrine of the Immortals";
                navun.Type     = "Siege";
                navun.setMissingItems(character);

                ward17.setKey("Ward17");
                ward17.Name     = "The Dreamer";
                ward17.Location = "Earth: Ward 17";
                ward17.Type     = "World Boss";
                ward17.setMissingItems(character);
            }

            for (int i = 0; i < zoneEvents["Earth"].Count; i++)
            {
                if (mode == ProcessMode.Campaign && !churchAdded && zoneEvents["Earth"][i].Location.Contains("Westcourt"))
                {
                    foreach (RemnantWorldEvent rwe in churchEvents)
                    {
                        orderedEvents.Add(rwe);
                    }
                    churchAdded = true;
                }
                orderedEvents.Add(zoneEvents["Earth"][i]);
            }
            for (int i = 0; i < zoneEvents["Rhom"].Count; i++)
            {
                orderedEvents.Add(zoneEvents["Rhom"][i]);
            }
            if (mode == ProcessMode.Campaign && undying.MissingItems.Length > 0)
            {
                orderedEvents.Add(undying);
            }
            for (int i = 0; i < zoneEvents["Corsus"].Count; i++)
            {
                if (mode == ProcessMode.Campaign && !queenAdded && zoneEvents["Corsus"][i].Location.Contains("The Mist Fen"))
                {
                    if (queen.MissingItems.Length > 0)
                    {
                        orderedEvents.Add(queen);
                    }
                    queenAdded = true;
                }
                orderedEvents.Add(zoneEvents["Corsus"][i]);
            }
            for (int i = 0; i < zoneEvents["Yaesha"].Count; i++)
            {
                if (mode == ProcessMode.Campaign && !navunAdded && zoneEvents["Yaesha"][i].Location.Contains("The Scalding Glade"))
                {
                    if (navun.MissingItems.Length > 0)
                    {
                        orderedEvents.Add(navun);
                    }
                    navunAdded = true;
                }
                orderedEvents.Add(zoneEvents["Yaesha"][i]);
            }

            if (mode == ProcessMode.Campaign)
            {
                if (ward17.MissingItems.Length > 0)
                {
                    orderedEvents.Add(ward17);
                }
            }

            for (int i = 0; i < orderedEvents.Count; i++)
            {
                if (mode == ProcessMode.Campaign)
                {
                    character.CampaignEvents.Add(orderedEvents[i]);
                }
                else
                {
                    character.AdventureEvents.Add(orderedEvents[i]);
                }
            }
        }
Beispiel #3
0
        //credit to /u/hzla00 for original javascript implementation
        static public void ProcessEvents(RemnantCharacter character, string eventsText, ProcessMode mode)
        {
            Dictionary <string, Dictionary <string, string> > zones      = new Dictionary <string, Dictionary <string, string> >();
            Dictionary <string, List <RemnantWorldEvent> >    zoneEvents = new Dictionary <string, List <RemnantWorldEvent> >();
            List <RemnantWorldEvent> churchEvents = new List <RemnantWorldEvent>();

            foreach (string z in GameInfo.Zones)
            {
                zones.Add(z, new Dictionary <string, string>());
                zoneEvents.Add(z, new List <RemnantWorldEvent>());
            }

            string zone = null;
            string currentMainLocation = "Fairview";
            string currentSublocation  = null;

            string          eventName = null;
            MatchCollection matches   = Regex.Matches(eventsText, "(?:/[a-zA-Z0-9_]+){3}/(([a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9_]+)|Quest_Church)");

            foreach (Match match in matches)
            {
                string eventType     = null;
                string lastEventname = eventName;
                eventName = null;

                string textLine = match.Value;
                try
                {
                    if (currentSublocation != null)
                    {
                        //Some world bosses don't have a preceding dungeon; subsequent items therefore spawn in the overworld
                        if (currentSublocation.Equals("TheRavager'sHaunt") || currentSublocation.Equals("TheTempestCourt"))
                        {
                            currentSublocation = null;
                        }
                    }
                    zone = getZone(textLine);

                    eventType = getEventType(textLine);

                    if (textLine.Contains("Overworld_Zone") || textLine.Contains("_Overworld_"))
                    {
                        //process overworld zone marker
                        currentMainLocation = textLine.Split('/')[4].Split('_')[1] + " " + textLine.Split('/')[4].Split('_')[2] + " " + textLine.Split('/')[4].Split('_')[3];
                        if (GameInfo.MainLocations.ContainsKey(currentMainLocation))
                        {
                            currentMainLocation = GameInfo.MainLocations[currentMainLocation];
                        }
                        else
                        {
                            currentMainLocation = null;
                        }
                        continue;
                    }
                    else if (textLine.Contains("Quest_Church"))
                    {
                        //process Root Mother event
                        currentMainLocation = "Chapel Station";
                        eventName           = "RootMother";
                        currentSublocation  = "Church of the Harbinger";
                    }
                    else if (eventType != null)
                    {
                        //process other events, if they're recognized by getEventType
                        eventName = textLine.Split('/')[4].Split('_')[2];
                        if (textLine.Contains("OverworldPOI"))
                        {
                            currentSublocation = null;
                        }
                        else if (!textLine.Contains("Quest_Event"))
                        {
                            if (GameInfo.SubLocations.ContainsKey(eventName))
                            {
                                currentSublocation = GameInfo.SubLocations[eventName];
                            }
                            else
                            {
                                currentSublocation = null;
                            }
                        }
                        if ("Chapel Station".Equals(currentMainLocation))
                        {
                            if (textLine.Contains("Quest_Boss"))
                            {
                                currentMainLocation = "Westcourt";
                            }
                            else
                            {
                                currentSublocation = null;
                            }
                        }
                    }

                    if (mode == ProcessMode.Adventure)
                    {
                        currentMainLocation = null;
                    }

                    if (eventName != lastEventname)
                    {
                        RemnantWorldEvent se = new RemnantWorldEvent();
                        // Replacements
                        if (eventName != null)
                        {
                            se.setKey(eventName);
                            if (GameInfo.Events.ContainsKey(eventName))
                            {
                                se.Name = GameInfo.Events[eventName];
                            }
                            else
                            {
                                se.Name = eventName;
                            }
                            se.Name = Regex.Replace(se.Name, "([a-z])([A-Z])", "$1 $2");
                        }

                        if (zone != null && eventType != null && eventName != null)
                        {
                            if (!zones[zone].ContainsKey(eventType))
                            {
                                zones[zone].Add(eventType, "");
                            }
                            if (!zones[zone][eventType].Contains(eventName))
                            {
                                zones[zone][eventType] += ", " + eventName;
                                List <string> locationList = new List <string>();
                                locationList.Add(zone);
                                if (currentMainLocation != null)
                                {
                                    locationList.Add(Regex.Replace(currentMainLocation, "([a-z])([A-Z])", "$1 $2"));
                                }
                                if (currentSublocation != null)
                                {
                                    locationList.Add(Regex.Replace(currentSublocation, "([a-z])([A-Z])", "$1 $2"));
                                }
                                se.Location = string.Join(": ", locationList);
                                se.Type     = eventType;
                                se.setMissingItems(character);
                                if (!"Chapel Station".Equals(currentMainLocation))
                                {
                                    zoneEvents[zone].Add(se);
                                }
                                else
                                {
                                    churchEvents.Insert(0, se);
                                }

                                // rings drop with the Cryptolith on Rhom
                                if (eventName.Equals("Cryptolith") && zone.Equals("Rhom"))
                                {
                                    RemnantWorldEvent ringdrop = new RemnantWorldEvent();
                                    ringdrop.Location = zone;
                                    ringdrop.setKey("SoulLink");
                                    ringdrop.Name = "Soul Link";
                                    ringdrop.Type = "Item Drop";
                                    ringdrop.setMissingItems(character);
                                    zoneEvents[zone].Add(ringdrop);
                                }
                                // beetle always spawns in Strange Pass
                                else if (eventName.Equals("BrainBug"))
                                {
                                    RemnantWorldEvent beetle = new RemnantWorldEvent();
                                    beetle.Location = se.Location;
                                    beetle.setKey("Sketterling");
                                    beetle.Name = "Sketterling";
                                    beetle.Type = "Loot Beetle";
                                    beetle.setMissingItems(character);
                                    zoneEvents[zone].Add(beetle);
                                }
                                else if (eventName.Equals("BarnSiege"))
                                {
                                    RemnantWorldEvent wardPrime = new RemnantWorldEvent();
                                    wardPrime.setKey("WardPrime");
                                    wardPrime.Name     = "Ward Prime";
                                    wardPrime.Location = "Earth: Ward Prime";
                                    wardPrime.Type     = "Quest Event";
                                    wardPrime.setMissingItems(character);
                                    zoneEvents[zone].Add(wardPrime);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error parsing save event:");
                    Console.WriteLine("\tLine: " + textLine);
                    Console.WriteLine("\tError: " + ex.ToString());
                }
            }

            List <RemnantWorldEvent> orderedEvents = new List <RemnantWorldEvent>();

            bool churchAdded          = false;
            bool queenAdded           = false;
            bool navunAdded           = false;
            RemnantWorldEvent ward13  = new RemnantWorldEvent();
            RemnantWorldEvent hideout = new RemnantWorldEvent();
            RemnantWorldEvent undying = new RemnantWorldEvent();
            RemnantWorldEvent queen   = new RemnantWorldEvent();
            RemnantWorldEvent navun   = new RemnantWorldEvent();
            RemnantWorldEvent ward17  = new RemnantWorldEvent();

            if (mode == ProcessMode.Campaign)
            {
                ward13.setKey("Ward13");
                ward13.Name     = "Ward 13";
                ward13.Location = "Earth: Ward 13";
                ward13.Type     = "Home";
                ward13.setMissingItems(character);
                if (ward13.MissingItems.Length > 0)
                {
                    orderedEvents.Add(ward13);
                }

                hideout.setKey("FoundersHideout");
                hideout.Name     = "Founder's Hideout";
                hideout.Location = "Earth: Fairview";
                hideout.Type     = "Point of Interest";
                hideout.setMissingItems(character);
                if (hideout.MissingItems.Length > 0)
                {
                    orderedEvents.Add(hideout);
                }

                undying.setKey("UndyingKing");
                undying.Name     = "Undying King";
                undying.Location = "Rhom: Undying Throne";
                undying.Type     = "World Boss";
                undying.setMissingItems(character);

                queen.Name = "Iskal Queen";
                queen.setKey("IskalQueen");
                queen.Location = "Corsus: The Mist Fen";
                queen.Type     = "Point of Interest";
                queen.setMissingItems(character);

                navun.Name = "Fight With The Rebels";
                navun.setKey("SlaveRevolt");
                navun.Location = "Yaesha: Shrine of the Immortals";
                navun.Type     = "Siege";
                navun.setMissingItems(character);

                ward17.setKey("Ward17");
                ward17.Name     = "The Dreamer";
                ward17.Location = "Earth: Ward 17";
                ward17.Type     = "World Boss";
                ward17.setMissingItems(character);
            }

            for (int i = 0; i < zoneEvents["Earth"].Count; i++)
            {
                //if (mode == ProcessMode.Subject2923) Console.WriteLine(zoneEvents["Earth"][i].eventKey);
                if (mode == ProcessMode.Campaign && !churchAdded && zoneEvents["Earth"][i].Location.Contains("Westcourt"))
                {
                    foreach (RemnantWorldEvent rwe in churchEvents)
                    {
                        orderedEvents.Add(rwe);
                    }
                    churchAdded = true;
                }
                orderedEvents.Add(zoneEvents["Earth"][i]);
            }
            for (int i = 0; i < zoneEvents["Rhom"].Count; i++)
            {
                orderedEvents.Add(zoneEvents["Rhom"][i]);
            }
            if (mode == ProcessMode.Campaign && undying.MissingItems.Length > 0)
            {
                orderedEvents.Add(undying);
            }
            for (int i = 0; i < zoneEvents["Corsus"].Count; i++)
            {
                if (mode == ProcessMode.Campaign && !queenAdded && zoneEvents["Corsus"][i].Location.Contains("The Mist Fen"))
                {
                    if (queen.MissingItems.Length > 0)
                    {
                        orderedEvents.Add(queen);
                    }
                    queenAdded = true;
                }
                orderedEvents.Add(zoneEvents["Corsus"][i]);
            }
            for (int i = 0; i < zoneEvents["Yaesha"].Count; i++)
            {
                if (mode == ProcessMode.Campaign && !navunAdded && zoneEvents["Yaesha"][i].Location.Contains("The Scalding Glade"))
                {
                    if (navun.MissingItems.Length > 0)
                    {
                        orderedEvents.Add(navun);
                    }
                    navunAdded = true;
                }
                orderedEvents.Add(zoneEvents["Yaesha"][i]);
            }
            for (int i = 0; i < zoneEvents["Reisum"].Count; i++)
            {
                /*if (mode == ProcessMode.Campaign && !navunAdded && zoneEvents["Yaesha"][i].Location.Contains("The Scalding Glade"))
                 * {
                 *  if (navun.MissingItems.Length > 0) orderedEvents.Add(navun);
                 *  navunAdded = true;
                 * }*/
                orderedEvents.Add(zoneEvents["Reisum"][i]);
            }

            if (mode == ProcessMode.Campaign)
            {
                if (ward17.MissingItems.Length > 0)
                {
                    orderedEvents.Add(ward17);
                }
            }

            for (int i = 0; i < orderedEvents.Count; i++)
            {
                if (mode == ProcessMode.Campaign || mode == ProcessMode.Subject2923)
                {
                    character.CampaignEvents.Add(orderedEvents[i]);
                }
                else
                {
                    character.AdventureEvents.Add(orderedEvents[i]);
                }
            }

            if (mode == ProcessMode.Subject2923)
            {
                ward17.setKey("Ward17Root");
                ward17.Name     = "Harsgaard";
                ward17.Location = "Earth: Ward 17 (Root Dimension)";
                ward17.Type     = "World Boss";
                ward17.setMissingItems(character);
                character.CampaignEvents.Add(ward17);
            }
        }
        public void processSaveData(string savetext)
        {
            //get campaign info
            string campaigntext = savetext.Split(new string[] { "/Game/Campaign_Main/Quest_Campaign_Ward13.Quest_Campaign_Ward13" }, StringSplitOptions.None)[0];

            string[] campaign = campaigntext.Split(new string[] { "/Game/Campaign_Main/Quest_Campaign_City.Quest_Campaign_City" }, StringSplitOptions.None);
            if (campaign.Length > 1)
            {
                campaigntext = campaign[1];
                RemnantWorldEvent.ProcessEvents(this, campaigntext, RemnantWorldEvent.ProcessMode.Campaign);
            }
            else
            {
                Console.WriteLine("Campaign not found; likely in tutorial mission.");
            }

            //get adventure info
            if (savetext.Contains("Quest_AdventureMode_"))
            {
                string adventureZone = null;
                if (savetext.Contains("Quest_AdventureMode_City_C"))
                {
                    adventureZone = "City";
                }
                if (savetext.Contains("Quest_AdventureMode_Wasteland_C"))
                {
                    adventureZone = "Wasteland";
                }
                if (savetext.Contains("Quest_AdventureMode_Swamp_C"))
                {
                    adventureZone = "Swamp";
                }
                if (savetext.Contains("Quest_AdventureMode_Jungle_C"))
                {
                    adventureZone = "Jungle";
                }

                string strAdventureEnd   = String.Format("/Game/World_{0}/Quests/Quest_AdventureMode/Quest_AdventureMode_{0}.Quest_AdventureMode_{0}_C", adventureZone);
                int    adventureEnd      = savetext.IndexOf(strAdventureEnd) + strAdventureEnd.Length;
                string advtext           = savetext.Substring(0, adventureEnd);
                string strAdventureStart = String.Format("/Game/World_{0}/Quests/Quest_AdventureMode/Quest_AdventureMode_{0}_0", adventureZone);
                int    adventureStart    = advtext.LastIndexOf(strAdventureStart) + strAdventureStart.Length;
                //advtext = advtext.Substring(advtext.LastIndexOf("Quest_Campaign_Main_C"));
                advtext = advtext.Substring(adventureStart);
                RemnantWorldEvent.ProcessEvents(this, advtext, RemnantWorldEvent.ProcessMode.Adventure);
            }

            missingItems.Clear();
            foreach (RemnantItem[] eventItems in GameInfo.EventItem.Values)
            {
                foreach (RemnantItem item in eventItems)
                {
                    if (!this.Inventory.Contains(item.GetKey()))
                    {
                        if (!missingItems.Contains(item))
                        {
                            missingItems.Add(item);
                        }
                    }
                }
            }
            missingItems.Sort();
        }