Esempio n. 1
0
        public static void Postfix(Contract __instance, MissionResult result, bool isGoodFaithEffort)
        {
            try {
                Settings s = WIIC.settings;
                WIIC.modLog.Debug?.Write($"Contract complete: {__instance.Name}, override: {__instance.Override.ID}");

                Flareup flareup = Utilities.currentFlareup();
                if (flareup == null || __instance.Name != flareup.currentContractName)
                {
                    return;
                }

                int bonus   = flareup.type == "Attack" ? s.attackBonusPerHalfSkull : s.raidBonusPerHalfSkull;
                int newCost = __instance.MoneyResults + bonus * __instance.Difficulty;
                WIIC.modLog.Info?.Write($"{flareup.type} contract complete, adding bonus. old money: {__instance.MoneyResults}, new: {newCost}, funds: {WIIC.sim.Funds}");

                Traverse.Create(__instance).Property("MoneyResults").SetValue(newCost);
                WIIC.modLog.Info?.Write($"Reading it back after setting: {__instance.MoneyResults}");

                bonus = flareup.type == "Attack" ? s.attackBonusSalvage : s.raidBonusSalvage;
                WIIC.modLog.Info?.Write($"Addng salvage. FinalSalvageCount: {__instance.FinalSalvageCount}, bonus: {bonus}");
                Traverse.Create(__instance).Property("FinalSalvageCount").SetValue(__instance.FinalSalvageCount + bonus);
            }
            catch (Exception e) {
                WIIC.modLog.Error?.Write(e);
            }
        }
Esempio n. 2
0
        public static void LoadFlareups(GameInstanceSave gameInstanceSave, SimGameState __instance)
        {
            try {
                WIIC.sim = __instance;
                WIIC.modLog.Debug?.Write("Loading Flareups");
                WIIC.flareups.Clear();
                WIIC.sim.CompanyTags.Add("WIIC_enabled");

                WIIC.readFromJson("WIIC_ephemeralSystemControl.json", true);

                foreach (StarSystem system in __instance.StarSystems)
                {
                    string tag = system.Tags.ToList().Find(Flareup.isSerializedFlareup);
                    if (tag != null)
                    {
                        system.Tags.Remove(tag);

                        Flareup flareup = Flareup.Deserialize(tag);
                        WIIC.flareups[system.ID] = flareup;
                    }

                    tag = system.Tags.ToList().Find(Utilities.isControlTag);
                    if (tag != null)
                    {
                        system.Tags.Remove(tag);
                        WIIC.systemControl[system.ID] = tag;
                    }
                }

                WIIC.modLog.Debug?.Write($"Loaded {WIIC.flareups.Keys.Count} flareups and {WIIC.systemControl.Keys.Count} system control tags");
                Utilities.redrawMap();
            } catch (Exception e) {
                WIIC.modLog.Error?.Write(e);
            }
        }
Esempio n. 3
0
        public static void checkForNewFlareup()
        {
            double rand          = Utilities.rng.NextDouble();
            double flareupChance = Utilities.statOrDefault("WIIC_dailyAttackChance", WIIC.settings.dailyAttackChance);
            double raidChance    = Utilities.statOrDefault("WIIC_dailyRaidChance", WIIC.settings.dailyRaidChance);

            WIIC.modLog.Debug?.Write($"Checking for new flareup: {rand} flareupChance: {flareupChance}, raidChance: {raidChance}");

            string type = "";

            if (rand < flareupChance)
            {
                type = "Attack";
            }
            else if (rand < flareupChance + raidChance)
            {
                type = "Raid";
            }

            if (type == "")
            {
                return;
            }

            (StarSystem system, FactionValue attacker) = getAttackerAndLocation(type);

            Flareup flareup = new Flareup(system, attacker, type);

            WIIC.flareups[system.ID] = flareup;
        }
Esempio n. 4
0
        public static void ParticipateInFlareupPostfix(SimGameState __instance, bool __state)
        {
            try {
                // __state is used to tell the postfix (from the prefix) that we're in the middle of accepting a flareup
                if (!__state)
                {
                    return;
                }

                Flareup flareup = Utilities.currentFlareup();
                if (flareup == null)
                {
                    return;
                }

                // Clean up the opposite-side travel contract, if it exists
                __instance.ClearBreadcrumb();
                flareup.removeParticipationContracts();

                // When the player arrives, we start the flareup the next day - it's only fair not to make them wait around. :)
                flareup.countdown        = 0;
                flareup.daysUntilMission = 1;

                WIIC.modLog.Info?.Write($"Player embarked on flareup at {flareup.location.Name}.");

                __instance.SetSimRoomState(DropshipLocation.SHIP);
                __instance.RoomManager.AddWorkQueueEntry(flareup.workOrder);
                __instance.RoomManager.RefreshTimeline(false);
            } catch (Exception e) {
                WIIC.modLog.Error?.Write(e);
            }
        }
Esempio n. 5
0
        public static Flareup Deserialize(string tag)
        {
            Flareup newFlareup = JsonConvert.DeserializeObject <Flareup>(tag.Substring(5));

            newFlareup.initAfterDeserialization();

            return(newFlareup);
        }
Esempio n. 6
0
        public static Flareup Deserialize(string tag, SimGameState __instance)
        {
            Flareup newFlareup = JsonConvert.DeserializeObject <Flareup>(tag.Substring(5));

            newFlareup.sim      = __instance;
            newFlareup.location = __instance.GetSystemById(newFlareup.locationID);
            newFlareup.attacker = FactionEnumeration.GetFactionByName(newFlareup.attackerName);

            return(newFlareup);
        }
Esempio n. 7
0
 static bool Prefix(WorkOrderEntry entry)
 {
     try {
         Flareup flareup = Utilities.currentFlareup();
         if (flareup != null && flareup.workOrder == entry)
         {
             return(false);
         }
     } catch (Exception e) {
         WIIC.modLog.Error?.Write(e);
     }
     return(true);
 }
Esempio n. 8
0
 public static bool Prefix(SGContractsWidget __instance)
 {
     try {
         Flareup flareup = Utilities.currentFlareup();
         if (flareup != null && __instance.SelectedContract.Name == flareup.currentContractName)
         {
             WIIC.modLog.Debug?.Write($"Blocking HandleEscapeKeypress. selected: {__instance.SelectedContract.Name}, selectedContract: {__instance.SelectedContract.Name}, flareupContract: {flareup.currentContractName}");
             return(false);
         }
     }
     catch (Exception e) {
         WIIC.modLog.Error?.Write(e);
     }
     return(true);
 }
Esempio n. 9
0
 public static bool Prefix(SGCmdCenterLanceConfigBG __instance)
 {
     try {
         Flareup flareup = Utilities.currentFlareup();
         WIIC.modLog.Debug?.Write($"LanceConfiguratorPanel.OnCancelClicked. selectedContract: {WIIC.sim.SelectedContract.Name}, flareup: {flareup}");
         if (flareup != null && WIIC.sim.SelectedContract.Name == flareup.currentContractName)
         {
             return(false);
         }
     }
     catch (Exception e) {
         WIIC.modLog.Error?.Write(e);
     }
     return(true);
 }
Esempio n. 10
0
        static void Postfix(TaskManagementElement element)
        {
            try {
                Flareup flareup = Utilities.currentFlareup();
                if (element.Entry.ID != "nextflareupContract" || flareup == null)
                {
                    return;
                }

                WIIC.sim.SetTimeMoving(false);
                PauseNotification.Show("Flareup Details", flareup.getDescription(), WIIC.sim.GetCrewPortrait(SimGameCrew.Crew_Sumire), "", true, null);
            } catch (Exception e) {
                WIIC.modLog.Error?.Write(e);
            }
        }
Esempio n. 11
0
 public static void Postfix()
 {
     try {
         Flareup flareup = Utilities.currentFlareup();
         WIIC.modLog.Debug?.Write($"CompleteLanceConfigurationPrep. selectedContract: {WIIC.sim.SelectedContract.Name}, flareupContract: {(flareup != null ? flareup.currentContractName : null)}");
         if (flareup != null && WIIC.sim.SelectedContract.Name == flareup.currentContractName)
         {
             WIIC.modLog.Debug?.Write($"Hiding nav drawer from CompleteLanceConfigurationPrep.");
             SGLeftNavDrawer leftDrawer = (SGLeftNavDrawer)AccessTools.Field(typeof(SGRoomManager), "LeftDrawerWidget").GetValue(WIIC.sim.RoomManager);
             leftDrawer.Visible = false;
         }
     }
     catch (Exception e) {
         WIIC.modLog.Error?.Write(e);
     }
 }
Esempio n. 12
0
        static void Postfix(TaskTimelineWidget __instance)
        {
            WIIC.modLog.Debug?.Write("TaskTimelineWidget.RegenerateEntries");

            try {
                Flareup flareup = Utilities.currentFlareup();
                if (flareup == null)
                {
                    return;
                }

                __instance.AddEntry(flareup.workOrder, false);
                __instance.RefreshEntries();
            }
            catch (Exception e) {
                WIIC.modLog.Error?.Write(e);
            }
        }
        private static void Postfix(AAR_ContractObjectivesWidget __instance)
        {
            try {
                Flareup  flareup  = Utilities.currentFlareup();
                Contract contract = Traverse.Create(__instance).Field("theContract").GetValue <Contract>();

                if (flareup == null || flareup.currentContractName != contract.Name)
                {
                    return;
                }

                Settings s = WIIC.settings;

                int    bonus           = flareup.type == "Attack" ? s.attackBonusPerHalfSkull : s.raidBonusPerHalfSkull;
                int    bonusMoney      = bonus * contract.Difficulty;
                int    bonusSalvage    = flareup.type == "Attack" ? s.attackBonusSalvage : s.raidBonusSalvage;
                string loss            = Utilities.forcesToString(flareup.currentContractForceLoss);
                string objectiveString = Strings.T("{0} takes {1} point loss in Flareup\n¢{2:n0} bonus, {3} additional salvage", flareup.target.FactionDef.ShortName, loss, bonusMoney, bonusSalvage);
                WIIC.modLog.Debug?.Write(objectiveString);

                bool won = contract.State == Contract.ContractState.Complete;
                if ((flareup.employer == flareup.attacker && won) || (flareup.employer == flareup.target && !won))
                {
                    flareup.defenderStrength -= flareup.currentContractForceLoss;
                    WIIC.modLog.Debug?.Write($"defenderStrength -= {flareup.currentContractForceLoss}");
                }
                else
                {
                    flareup.attackerStrength -= flareup.currentContractForceLoss;
                    WIIC.modLog.Debug?.Write($"attackerStrength -= {flareup.currentContractForceLoss}");
                }

                MissionObjectiveResult objective = new MissionObjectiveResult(objectiveString, GUID, false, true, ObjectiveStatus.Ignored, false);
                Traverse.Create(__instance).Method("AddObjective", objective).GetValue();

                WIIC.modLog.Info?.Write($"MoneyResults from ARR: {contract.MoneyResults}, funds: {WIIC.sim.Funds}");

                flareup.playerDrops += 1;
                flareup.currentContractForceLoss = 0;
                flareup.currentContractName      = "";
            } catch (Exception e) {
                WIIC.modLog.Error?.Write(e);
            }
        }
Esempio n. 14
0
        static bool Prefix(SGTravelManager __instance)
        {
            try {
                WIIC.modLog.Debug?.Write($"DisplayEnteredOrbitPopup. System {WIIC.sim.CurSystem.ID}");
                if (!WIIC.flareups.ContainsKey(WIIC.sim.CurSystem.ID))
                {
                    return(true);
                }

                Flareup flareup = WIIC.flareups[WIIC.sim.CurSystem.ID];

                string text = Strings.T("We've arrived at {0}, Commander. The system is currently controlled by {1}, but {2} will attack it soon. If we have good enough reputation with one or both factions, they may have a contract for us to sign on with their side.", flareup.location.Name, flareup.location.OwnerValue.FactionDef.ShortName, flareup.attacker.FactionDef.ShortName);
                WIIC.modLog.Debug?.Write(text);


                WIIC.sim.GetInterruptQueue().QueueTravelPauseNotification("Arrived", text, WIIC.sim.GetCrewPortrait(SimGameCrew.Crew_Sumire), "notification_travelcomplete", delegate {
                    try {
                        WIIC.modLog.Info?.Write($"Sent to command center from popup");
                        WIIC.sim.TriggerSaveNow(SaveReason.SIM_GAME_ARRIVED_AT_PLANET, SimGameState.TriggerSaveNowOption.QUEUE_IF_NEEDED);
                        WIIC.sim.RoomManager.SetQueuedUIActivationID(DropshipMenuType.Contract, DropshipLocation.CMD_CENTER, true);
                        WIIC.sim.RoomManager.ForceShipRoomChangeOfRoom(DropshipLocation.CMD_CENTER);
                    } catch (Exception e) {
                        WIIC.modLog.Error?.Write(e);
                    }
                }, "View contracts", delegate {
                    try {
                        WIIC.sim.TriggerSaveNow(SaveReason.SIM_GAME_ARRIVED_AT_PLANET, SimGameState.TriggerSaveNowOption.QUEUE_IF_NEEDED);
                        WIIC.modLog.Info?.Write($"Passed on poppup");
                    } catch (Exception e) {
                        WIIC.modLog.Error?.Write(e);
                    }
                }, "Continue");

                if (!WIIC.sim.TimeMoving)
                {
                    WIIC.sim.GetInterruptQueue().DisplayIfAvailable();
                }

                return(false);
            } catch (Exception e) {
                WIIC.modLog.Error?.Write(e);
                return(true);
            }
        }
Esempio n. 15
0
        public static void Postfix(SGContractsWidget __instance)
        {
            try {
                Flareup flareup = Utilities.currentFlareup();
                if (flareup != null && __instance.SelectedContract.Name == flareup.currentContractName)
                {
                    WIIC.modLog.Debug?.Write($"Hiding widgets for NegotiateContract. selectedContract: {__instance.SelectedContract.Name}, flareupContract: {flareup.currentContractName}");

                    HBSButton backButton = (HBSButton)AccessTools.Field(typeof(SGContractsWidget), "NegotiateTitleBackButton").GetValue(__instance);
                    backButton.SetState(ButtonState.Disabled);

                    SGLeftNavDrawer leftDrawer = (SGLeftNavDrawer)AccessTools.Field(typeof(SGRoomManager), "LeftDrawerWidget").GetValue(WIIC.sim.RoomManager);
                    leftDrawer.gameObject.SetActive(false);
                }
            }
            catch (Exception e) {
                WIIC.modLog.Error?.Write(e);
            }
        }
Esempio n. 16
0
        public static void SetCurrentSystemPrefix(StarSystem system, bool force = false, bool timeSkip = false)
        {
            try {
                WIIC.modLog.Debug?.Write($"Entering system {system.ID} from {WIIC.sim.CurSystem.ID}");

                if (WIIC.flareups.ContainsKey(WIIC.sim.CurSystem.ID))
                {
                    WIIC.modLog.Debug?.Write($"Found flareup from previous system, cleaning up contracts");
                    Flareup prevFlareup = WIIC.flareups[WIIC.sim.CurSystem.ID];
                    prevFlareup.removeParticipationContracts();
                }

                if (WIIC.flareups.ContainsKey(system.ID))
                {
                    WIIC.modLog.Debug?.Write($"Found flareup for new system, adding contracts");
                    WIIC.flareups[system.ID].spawnParticipationContracts();
                }
            } catch (Exception e) {
                WIIC.modLog.Error?.Write(e);
            }
        }
        public static void Postfix(SGCmdCenterLanceConfigBG __instance)
        {
            try {
                Flareup flareup = Utilities.currentFlareup();
                if (flareup == null || WIIC.sim.SelectedContract == null)
                {
                    return;
                }

                WIIC.modLog.Debug?.Write($"SGCmdCenterLanceConfigBG.ShowLanceConfiguratorScreen. selectedContract: {WIIC.sim.SelectedContract.Name}, flareup: {flareup}");
                if (WIIC.sim.SelectedContract.Name == flareup.currentContractName)
                {
                    WIIC.modLog.Debug?.Write($"Hiding nav drawer from ShowLanceConfiguratorScreen.");
                    SGLeftNavDrawer leftDrawer = (SGLeftNavDrawer)AccessTools.Field(typeof(SGRoomManager), "LeftDrawerWidget").GetValue(WIIC.sim.RoomManager);
                    leftDrawer.gameObject.SetActive(false);
                }
            }
            catch (Exception e) {
                WIIC.modLog.Error?.Write(e);
            }
        }
Esempio n. 18
0
        private static bool Prefix(SGNavigationScreen __instance)
        {
            try {
                Flareup flareup = Utilities.currentFlareup();
                WIIC.modLog.Warn?.Write($"OnTravelCourseAccepted. Flareup: {flareup}, ActiveTravelContract: {WIIC.sim.ActiveTravelContract}");
                if (flareup == null)
                {
                    return(true);
                }

                if (!WIIC.flareups.ContainsKey(WIIC.sim.CurSystem.ID))
                {
                    WIIC.modLog.Warn?.Write($"Found company tag indicating flareup participation, but no matching flareup for {WIIC.sim.CurSystem.ID}");
                    WIIC.sim.CompanyTags.Remove("WIIC_helping_attacker");
                    WIIC.sim.CompanyTags.Remove("WIIC_helping_defender");
                    return(true);
                }

                UIManager uiManager = (UIManager)AccessTools.Field(typeof(SGNavigationScreen), "uiManager").GetValue(__instance);

                void cleanup()
                {
                    uiManager.ResetFader(UIManagerRootType.PopupRoot);
                    WIIC.sim.Starmap.Screen.AllowInput(true);
                }

                string title             = Strings.T("Navigation Change");
                string primaryButtonText = Strings.T("Break Deployment");
                string cancel            = Strings.T("Cancel");
                string message           = Strings.T("Leaving {0} will break our current deployment. Our reputation with {1} and the MRB will suffer, Commander.", flareup.location.Name, flareup.employer.FactionDef.ShortName);
                WIIC.modLog.Info?.Write(message);
                PauseNotification.Show(title, message, WIIC.sim.GetCrewPortrait(SimGameCrew.Crew_Sumire), string.Empty, true, delegate {
                    try {
                        WIIC.modLog.Info?.Write("Breaking deployment contract");

                        Flareup flareup2 = Utilities.currentFlareup();
                        WIIC.modLog.Info?.Write("Flareup: {flareup2}");

                        if (flareup2 != null && flareup2.employer.DoesGainReputation)
                        {
                            WIIC.modLog.Info?.Write("Employer: {flareup2.employer}");

                            float employerRepBadFaithMod = WIIC.sim.Constants.Story.EmployerRepBadFaithMod;
                            WIIC.modLog.Info?.Write("employerRepBadFaithMod: {employerRepBadFaithMod}");
                            WIIC.modLog.Info?.Write("CAREER: {SimGameState.SimGameType.CAREER}");
                            WIIC.modLog.Info?.Write("difficulty: {flareup2.location.Def.GetDifficulty(SimGameState.SimGameType.CAREER)}");
                            int num = (int)Math.Round(flareup2.location.Def.GetDifficulty(SimGameState.SimGameType.CAREER) * employerRepBadFaithMod);

                            WIIC.sim.SetReputation(flareup2.employer, num);
                            WIIC.sim.SetReputation(FactionEnumeration.GetMercenaryReviewBoardFactionValue(), num);
                        }

                        WIIC.sim.CompanyTags.Remove("WIIC_helping_attacker");
                        WIIC.sim.CompanyTags.Remove("WIIC_helping_defender");

                        WIIC.sim.RoomManager.RefreshTimeline(false);
                        WIIC.sim.Starmap.SetActivePath();
                        WIIC.sim.SetSimRoomState(DropshipLocation.SHIP);

                        cleanup();
                    } catch (Exception e) {
                        WIIC.modLog.Error?.Write(e);
                    }
                }, primaryButtonText, cleanup, cancel);

                WIIC.sim.Starmap.Screen.AllowInput(false);
                uiManager.SetFaderColor(uiManager.UILookAndColorConstants.PopupBackfill, UIManagerFader.FadePosition.FadeInBack, UIManagerRootType.PopupRoot);
                return(false);
            } catch (Exception e) {
                WIIC.modLog.Error?.Write(e);
                return(true);
            }
        }
Esempio n. 19
0
        public static void Prefix(ref SimGameEventResult result)
        {
            Settings s = WIIC.settings;

            if (result.Scope == EventScope.Company && result.AddedTags != null)
            {
                foreach (string addedTag in result.AddedTags.ToList())
                {
                    try {
                        MatchCollection matches = GIVE_SYSTEM.Matches(addedTag);
                        if (matches.Count > 0)
                        {
                            string systemId  = matches[0].Groups["system"].Value;
                            string factionID = matches[0].Groups["faction"].Value;
                            WIIC.modLog.Info?.Write($"ApplySimGameEventResult GIVE_SYSTEM: systemId {systemId}, factionID {factionID}");

                            StarSystem   system  = WIIC.sim.GetSystemById(systemId);
                            FactionValue faction = Utilities.getFactionValueByFactionID(factionID);

                            WIIC.cleanupSystem(system);
                            Utilities.applyOwner(system, faction, true);

                            result.AddedTags.Remove(addedTag);
                            continue;
                        }

                        matches = ATTACK_SYSTEM.Matches(addedTag);
                        if (matches.Count > 0)
                        {
                            string factionID = matches[0].Groups["faction"].Value;
                            string systemId  = matches[0].Groups["system"].Value;
                            WIIC.modLog.Info?.Write($"ApplySimGameEventResult ATTACK_SYSTEM: factionID {factionID}, systemId {systemId}");

                            StarSystem   system  = WIIC.sim.GetSystemById(systemId);
                            FactionValue faction = Utilities.getFactionValueByFactionID(factionID);

                            if (system.OwnerValue.Name == faction.Name)
                            {
                                WIIC.modLog.Info?.Write($"Tagged system {system.Name} already owned by attacker {faction.Name}, ignoring");
                                continue;
                            }

                            WIIC.cleanupSystem(system);
                            Flareup flareup = new Flareup(system, faction, "Attack", WIIC.sim);
                            WIIC.flareups[system.ID] = flareup;
                            Utilities.redrawMap();

                            result.AddedTags.Remove(addedTag);
                            continue;
                        }

                        matches = RAID_SYSTEM.Matches(addedTag);
                        if (matches.Count > 0)
                        {
                            string factionID = matches[0].Groups["faction"].Value;
                            string systemId  = matches[0].Groups["system"].Value;
                            WIIC.modLog.Info?.Write($"ApplySimGameEventResult RAID_SYSTEM: factionID {factionID}, systemId {systemId}");

                            FactionValue faction = Utilities.getFactionValueByFactionID(factionID);
                            StarSystem   system  = WIIC.sim.GetSystemById(systemId);

                            WIIC.cleanupSystem(system);
                            Flareup flareup = new Flareup(system, faction, "Raid", WIIC.sim);
                            WIIC.flareups[system.ID] = flareup;
                            Utilities.redrawMap();

                            result.AddedTags.Remove(addedTag);
                            continue;
                        }

                        matches = ATTACKER_FORCES.Matches(addedTag);
                        if (matches.Count > 0)
                        {
                            string systemId = matches[0].Groups["system"].Value;
                            int    strength = int.Parse(matches[0].Groups["strength"].Value);
                            WIIC.modLog.Info?.Write($"ApplySimGameEventResult ATTACKER_FORCES: systemId {systemId}, strength {strength}");

                            StarSystem system = WIIC.sim.GetSystemById(systemId);

                            if (WIIC.flareups.ContainsKey(system.ID))
                            {
                                WIIC.flareups[system.ID].attackerStrength = strength;
                            }
                            else
                            {
                                WIIC.modLog.Error?.Write($"ApplySimGameEventResult: No flareup found at {systemId}");
                            }

                            result.AddedTags.Remove(addedTag);
                            continue;
                        }

                        matches = DEFENDER_FORCES.Matches(addedTag);
                        if (matches.Count > 0)
                        {
                            string systemId = matches[0].Groups["system"].Value;
                            int    strength = int.Parse(matches[0].Groups["strength"].Value);
                            WIIC.modLog.Info?.Write($"ApplySimGameEventResult DEFENDER_FORCES: systemId {systemId}, strength {strength}");

                            StarSystem system = WIIC.sim.GetSystemById(systemId);

                            if (WIIC.flareups.ContainsKey(system.ID))
                            {
                                WIIC.flareups[system.ID].attackerStrength = strength;
                            }
                            else
                            {
                                WIIC.modLog.Error?.Write($"ApplySimGameEventResult: No flareup found at {systemId}");
                            }

                            result.AddedTags.Remove(addedTag);
                            continue;
                        }

                        matches = ADD_SYSTEM_TAG.Matches(addedTag);
                        if (matches.Count > 0)
                        {
                            string tag      = matches[0].Groups["tag"].Value;
                            string systemId = matches[0].Groups["system"].Value;
                            WIIC.modLog.Info?.Write($"ApplySimGameEventResult ADD_SYSTEM_TAG: tag {tag}, systemId {systemId}");

                            StarSystem system = WIIC.sim.GetSystemById(systemId);
                            system.Tags.Add(tag);

                            result.AddedTags.Remove(addedTag);
                            continue;
                        }

                        matches = REMOVE_SYSTEM_TAG.Matches(addedTag);
                        if (matches.Count > 0)
                        {
                            string tag      = matches[0].Groups["tag"].Value;
                            string systemId = matches[0].Groups["system"].Value;
                            WIIC.modLog.Info?.Write($"ApplySimGameEventResult REMOVE_SYSTEM_TAG: tag {tag}, systemId {systemId}");

                            StarSystem system = WIIC.sim.GetSystemById(systemId);
                            system.Tags.Remove(tag);

                            result.AddedTags.Remove(addedTag);
                            continue;
                        }
                    } catch (Exception e) {
                        WIIC.modLog.Error?.Write(e);
                    }
                }
            }
        }