public static void FixCost(
            SimGameState __instance,
            MechComponentRef mechComponent,
            ChassisLocations newLocation,
            ChassisLocations previousLocation,
            string mechSimGameUID,
            WorkOrderEntry_InstallComponent __result)
        {
            try
            {
                Control.LogDebug(DType.InstallCost, $"SimGameState_CreateComponentInstallWorkOrder: for {mechComponent.ComponentDefID}");
                Control.LogDebug(DType.InstallCost, $"-- from {previousLocation} to {newLocation}");
                Control.LogDebug(DType.InstallCost, $"-- order {__result?.GetType().ToString() ?? "null"}");

                if (__result == null)
                {
                    Control.LogDebug(DType.InstallCost, "-- No order");
                    return;
                }


                if (__result.DesiredLocation == ChassisLocations.None)
                {
                    var tr = Traverse.Create(__result);
                    tr.Field <int>("Cost").Value = 0;
                }
                else
                {
                    var tr = Traverse.Create(__result).Field <int>("Cost");

                    if (tr == null)
                    {
                        Control.LogDebug(DType.InstallCost, "SimGameState_CreateComponentInstallWorkOrder: traverce not created!");
                        return;
                    }
                    MechDef mechByID = __instance.GetMechByID(mechSimGameUID);
#if CCDEBUG
                    if (mechByID == null)
                    {
                        Control.LogDebug(DType.InstallCost, "-- no mech found!");
                    }
#endif
                    if (mechByID != null && mechByID.Chassis.ChassisTags.Contains(Control.Settings.OmniTechFlag))
                    {
                        Control.LogDebug(DType.InstallCost, "-- mech is omni!");
                        tr.Value = (Control.Settings.OmniTechCostBySize ? mechComponent.Def.InventorySize / 2 : 1) * Control.Settings.OmniTechInstallCost;
                    }


                    if (tr.Value == 0)
                    {
                        tr.Value = 1;
                    }
                }
            }
            catch (Exception e)
            {
                Control.LogError(e);
            }
        }
示例#2
0
        /* Submits a Mech Lab Work Order to the game's Mech Lab queue to actually be processed */
        public static void SubmitWorkOrder(SimGameState simGame, WorkOrderEntry_MechLab newMechLabWorkOrder)
        {
            try
            {
                Logger.LogDebug("Begin SubmitWorkOrder(): ");

                // Now that all WO subentries are added, insert the base MechLab work order to the game's Mech Lab Work Order Queue as the highest priority (index 0)
                simGame.MechLabQueue.Insert(0, newMechLabWorkOrder);
                // Call this to properly Initialize the base Mech Lab WO and make it visible in the Mech Lab queue UI / timeline etc.
                simGame.InitializeMechLabEntry(newMechLabWorkOrder, newMechLabWorkOrder.GetCBillCost());
                // Force an update of the Mech Lab queue, false is to tell it a day isn't passing.
                simGame.UpdateMechLabWorkQueue(false);

                // Simple cost debugging for the log
                foreach (WorkOrderEntry subEntries in newMechLabWorkOrder.SubEntries)
                {
                    Logger.LogDebug(subEntries.Description + " Repair Tech Costs: " + subEntries.GetCost());
                }

                Logger.LogInfo(simGame.GetMechByID(newMechLabWorkOrder.MechID).Name + " Repair Costs are - techCost: " + newMechLabWorkOrder.GetCost() + " | CBill Cost: " + newMechLabWorkOrder.GetCBillCost());
                Logger.LogInfo("=====================================================================");

                // Deduct the total CBill costs of the WO from player inventory. For some reason this isn't done automatically via the HBS WO system.
                simGame.AddFunds(-newMechLabWorkOrder.GetCBillCost(), "ArmorRepair", true);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }
示例#3
0
            public static void Prefix(SimGameState __instance, WorkOrderEntry_ModifyMechArmor order)
            {
                if (!Core.Settings.RepairRearm || order.MechLabParent.MechID == null)
                {
                    return;
                }

                MechDef mechDef = __instance.GetMechByID(order.MechLabParent.MechID);

                if (mechDef.MechTags.Contains("XLRP_Armor_Repairing") || order.Location == ChassisLocations.All)
                {
                    order.SetMechLabComplete(true);
                }
            }
示例#4
0
            public static void Postfix(SimGameState __instance, WorkOrderEntry entry)
            {
                if (!Core.Settings.RepairRearm)
                {
                    return;
                }

                if (entry.Type == WorkOrderType.MechLabModifyArmor)
                {
                    WorkOrderEntry_MechLab workOrderEntry_MechLab = entry as WorkOrderEntry_MechLab;
                    MechDef mechBayID = __instance.GetMechByID(workOrderEntry_MechLab.MechID);
                    Logger.LogDebug("CancelWorkOrder");
                    if (mechBayID.MechTags.Contains("XLRP_Armor_Repairing"))
                    {
                        mechBayID.MechTags.Remove("XLRP_Armor_Repairing");
                    }
                }
            }
        public static bool Prefix(SimGameState __instance, WorkOrderEntry_RepairMechStructure order)
        {
            if (order.IsMechLabComplete)
            {
                return(true);
            }
            else
            {
                MechDef            mechByID           = __instance.GetMechByID(order.MechLabParent.MechID);
                LocationLoadoutDef locationLoadoutDef = mechByID.GetLocationLoadoutDef(order.Location);
                locationLoadoutDef.CurrentInternalStructure = mechByID.GetChassisLocationDef(order.Location).InternalStructure;
                // Original method resets currentArmor to assignedArmor here for some reason! Removed them from this override
                Logger.LogDebug("ALERT: Intercepted armor reset from ML_RepairMech and prevented it.");
                mechByID.RefreshBattleValue();
                order.SetMechLabComplete(true);

                return(false); // Prevent original method from firing
            }
        }
示例#6
0
 public static void Postfix(
     SimGameState __instance,
     string mechSimGameUID,
     MechComponentRef mechComponent,
     ChassisLocations newLocation,
     ChassisLocations previousLocation,
     WorkOrderEntry_InstallComponent __result
     )
 {
     try
     {
         var mechDef = __instance.GetMechByID(mechSimGameUID);
         WorkOrderCostsHandler.Shared.ComponentInstallWorkOrder(mechDef, mechComponent, newLocation, __result);
     }
     catch (Exception e)
     {
         Control.LogError(e);
     }
 }
示例#7
0
            public static void Postfix(SimGameState __instance, WorkOrderEntry entry)
            {
                if (!Core.Settings.RepairRearm)
                {
                    return;
                }

                if (entry.Type == WorkOrderType.MechLabModifyArmor)
                {
                    Logger.LogDebug("CompleteWorkOrder");
                    WorkOrderEntry_MechLab workOrderEntry_MechLab = entry as WorkOrderEntry_MechLab;
                    MechDef mechBayID = __instance.GetMechByID(workOrderEntry_MechLab.MechLabParent.MechID);
                    if (mechBayID.MechTags.Contains("XLRP_Armor_Repairing"))
                    {
                        mechBayID.MechTags.Remove("XLRP_Armor_Repairing");
                        mechBayID.MechTags.Remove("XLRP_R&R");
                        mechBayID.MechTags.Where(tag => tag.StartsWith("XLRPArmor")).Do(x => mechBayID.MechTags.Remove(x));
                    }
                }
            }
        public static void Postfix(WorkOrderEntry_InstallComponent order, SimGameState __instance)
        {
            Control.LogDebug(DType.ComponentInstall, $"ML_InstallComponent {order.MechComponentRef.ComponentDefID} - {order.MechComponentRef.Def == null}");
            if (!order.IsMechLabComplete)
            {
                return;
            }

            var mech = __instance.GetMechByID(order.MechID);

            if (mech == null)
            {
                return;
            }

            foreach (var handler in order.MechComponentRef.GetComponents <IOnInstalled>())
            {
                handler.OnInstalled(order, __instance, mech);
            }
            Control.LogDebug(DType.ComponentInstall, $"ML_InstallComponent complete");
        }
        public static void Postfix(WorkOrderEntry_InstallComponent order, SimGameState __instance)
        {
            try
            {
                Control.LogDebug(DType.ComponentInstall, $"ML_InstallComponent {order.MechComponentRef.ComponentDefID} - {order.MechComponentRef.Def == null}");
                if (!order.IsMechLabComplete)
                {
                    return;
                }

                var mech = __instance.GetMechByID(order.MechID);
                if (mech == null)
                {
                    return;
                }

                var changes = new Queue <IChange>();
                if (order.PreviousLocation != ChassisLocations.None)
                {
                    changes.Enqueue(new Change_Remove(order.MechComponentRef, order.PreviousLocation, true));
                }
                if (order.DesiredLocation != ChassisLocations.None)
                {
                    changes.Enqueue(new Change_Add(order.MechComponentRef, order.DesiredLocation, true));
                }
                var state = new InventoryOperationState(changes, mech);
                state.DoChanges();
                state.ApplyInventory();

                Control.LogDebug(DType.ComponentInstall, $"ML_InstallComponent complete");
            }
            catch (Exception e)
            {
                Control.LogError(e);
            }
        }
        // Run after completion of contracts and queue up any orders in the temp queue into the game's Mech Lab queue
        public static void Postfix(SimGameState __instance)
        {
            try
            {
                // If there are any work orders in the temporary queue, prompt the player
                if (Globals.tempMechLabQueue.Count > 0)
                {
                    Logger.LogDebug("Processing temp Mech Lab queue orders.");

                    int    cbills                   = 0;
                    int    techCost                 = 0;
                    int    mechRepairCount          = 0;
                    int    skipMechCount            = 0;
                    string mechRepairCountDisplayed = String.Empty;
                    string skipMechCountDisplayed   = String.Empty;
                    string skipMechMessage          = String.Empty;
                    string finalMessage             = String.Empty;

                    // If player has disabled auto repairing mechs with destroyed components, check for them and remove them from the temp queue before continuing
                    if (!ArmorRepair.ModSettings.AutoRepairMechsWithDestroyedComponents)
                    {
                        for (int index = 0; index < Globals.tempMechLabQueue.Count; index++)
                        {
                            WorkOrderEntry_MechLab order = Globals.tempMechLabQueue[index];

                            Logger.LogDebug("Checking for destroyed components.");
                            bool    destroyedComponents = false;
                            MechDef mech = __instance.GetMechByID(order.MechID);
                            destroyedComponents = Helpers.CheckDestroyedComponents(mech);

                            if (destroyedComponents)
                            {
                                // Remove this work order from the temp mech lab queue if the mech has destroyed components and move to next iteration
                                Logger.LogDebug("Removing " + mech.Name + " order from temp queue due to destroyed components and mod settings.");
                                Globals.tempMechLabQueue.Remove(order);
                                destroyedComponents = false;
                                skipMechCount++;
                                index++;
                            }
                        }
                    }

                    Logger.LogDebug("Temp Queue has " + Globals.tempMechLabQueue.Count + " entries.");

                    // Calculate summary of total repair costs from the temp work order queue
                    for (int index = 0; index < Globals.tempMechLabQueue.Count; index++)
                    {
                        WorkOrderEntry_MechLab order = Globals.tempMechLabQueue[index];
                        MechDef mech = __instance.GetMechByID(order.MechID);
                        Logger.LogDebug("Adding " + mech.Name + " to RepairCount.");
                        cbills   += order.GetCBillCost();
                        techCost += order.GetCost();
                        mechRepairCount++;
                    }

                    mechRepairCount = Mathf.Clamp(mechRepairCount, 0, 4);
                    Logger.LogDebug("Temp Queue has " + Globals.tempMechLabQueue.Count + " work order entries.");

                    // If Yang's Auto Repair prompt is enabled, build a message prompt dialog for the player
                    if (ArmorRepair.ModSettings.EnableAutoRepairPrompt)
                    {
                        // Calculate a friendly techCost of the work order in days, based on number of current mechtechs in the player's game.
                        if (techCost != 0 && __instance.MechTechSkill != 0)
                        {
                            techCost = Mathf.CeilToInt((float)techCost / (float)__instance.MechTechSkill);
                        }
                        else
                        {
                            techCost = 1; // Safety in case of weird div/0
                        }

                        // Generate a quick friendly description of how many mechs were damaged in battle
                        switch (mechRepairCount)
                        {
                        case 0: { Logger.LogDebug("mechRepairCount was 0."); break; }

                        case 1: { mechRepairCountDisplayed = "one of our 'Mechs was"; break; }

                        case 2: { mechRepairCountDisplayed = "a couple of the 'Mechs were"; break; }

                        case 3: { mechRepairCountDisplayed = "three of our 'Mechs were"; break; }

                        case 4: { mechRepairCountDisplayed = "our whole lance was"; break; }
                        }
                        // Generate a friendly description of how many mechs were damaged but had components destroyed
                        switch (skipMechCount)
                        {
                        case 0: { Logger.LogDebug("skipMechCount was 0."); break; }

                        case 1: { skipMechCountDisplayed = "one of the 'Mechs is damaged but has"; break; }

                        case 2: { skipMechCountDisplayed = "two of the 'Mechs are damaged but have"; break; }

                        case 3: { skipMechCountDisplayed = "three of the 'Mechs are damaged but have "; break; }

                        case 4: { skipMechCountDisplayed = "the whole lance is damaged but has"; break; }
                        }

                        // Check if there are any mechs to process
                        if (mechRepairCount > 0 || skipMechCount > 0)
                        {
                            Logger.LogDebug("mechRepairCount is " + mechRepairCount + " skipMechCount is " + skipMechCount);

                            // Setup the notification for mechs with damaged components that we might want to skip
                            if (skipMechCount > 0 && mechRepairCount == 0)
                            {
                                skipMechMessage = String.Format("{0} destroyed components. I'll leave the repairs for you to review.", skipMechCountDisplayed);
                            }
                            else
                            {
                                skipMechMessage = String.Format("{0} destroyed components, so I'll leave those repairs to you.", skipMechCountDisplayed);
                            }

                            Logger.LogDebug("Firing Yang's UI notification.");
                            SimGameInterruptManager notificationQueue = __instance.GetInterruptQueue();

                            // If all of the mechs needing repairs have damaged components and should be skipped from auto-repair, change the message notification structure to make more sense (e.g. just have an OK button)
                            if (skipMechCount > 0 && mechRepairCount == 0)
                            {
                                finalMessage = String.Format(
                                    "Boss, {0} \n\n",
                                    skipMechMessage
                                    );

                                // Queue Notification
                                notificationQueue.QueuePauseNotification(
                                    "'Mech Repairs Needed",
                                    finalMessage,
                                    __instance.GetCrewPortrait(SimGameCrew.Crew_Yang),
                                    string.Empty,
                                    delegate
                                {
                                    Logger.LogDebug("[PROMPT] All damaged mechs had destroyed components and won't be queued for repair.");
                                },
                                    "OK"
                                    );
                            }
                            else
                            {
                                if (skipMechCount > 0)
                                {
                                    finalMessage = String.Format(
                                        "Boss, {0} damaged. It'll cost <color=#DE6729>{1}{2:n0}</color> and {3} days for these repairs. Want my crew to get started?\n\nAlso, {4}\n\n",
                                        mechRepairCountDisplayed,
                                        '¢', cbills.ToString(),
                                        techCost.ToString(),
                                        skipMechMessage
                                        );
                                }
                                else
                                {
                                    finalMessage = String.Format(
                                        "Boss, {0} damaged on the last engagement. It'll cost <color=#DE6729>{1}{2:n0}</color> and {3} days for the repairs.\n\nWant my crew to get started?",
                                        mechRepairCountDisplayed,
                                        '¢', cbills.ToString(),
                                        techCost.ToString()
                                        );
                                }


                                // Queue up Yang's notification
                                notificationQueue.QueuePauseNotification(
                                    "'Mech Repairs Needed",
                                    finalMessage,
                                    __instance.GetCrewPortrait(SimGameCrew.Crew_Yang),
                                    string.Empty,
                                    delegate
                                {
                                    Logger.LogDebug("[PROMPT] Moving work orders from temp queue to Mech Lab queue: " + Globals.tempMechLabQueue.Count + " work orders");
                                    foreach (WorkOrderEntry_MechLab workOrder in Globals.tempMechLabQueue.ToList())
                                    {
                                        Logger.LogInfo("[PROMPT] Moving work order from temp queue to Mech Lab queue: " + workOrder.Description + " - " + workOrder.GetCBillCost());
                                        Helpers.SubmitWorkOrder(__instance, workOrder);
                                        Globals.tempMechLabQueue.Remove(workOrder);
                                    }
                                },
                                    "Yes",
                                    delegate
                                {
                                    Logger.LogInfo("[PROMPT] Discarding work orders from temp queue: " + Globals.tempMechLabQueue.Count + " work orders");
                                    foreach (WorkOrderEntry_MechLab workOrder in Globals.tempMechLabQueue.ToList())
                                    {
                                        Logger.LogInfo("[PROMPT] Discarding work order from temp queue: " + workOrder.Description + " - " + workOrder.GetCBillCost());
                                        Globals.tempMechLabQueue.Remove(workOrder);
                                    }
                                },
                                    "No"
                                    );
                            }
                        }
                    }
                    else // If Auto Repair prompt is not enabled, just proceed with queuing the remaining temp queue work orders and don't notify the player
                    {
                        foreach (WorkOrderEntry_MechLab workOrder in Globals.tempMechLabQueue.ToList())
                        {
                            Logger.LogInfo("[AUTO] Moving work order from temp queue to Mech Lab queue: " + workOrder.Description + " - " + workOrder.GetCBillCost());
                            Helpers.SubmitWorkOrder(__instance, workOrder);
                            Globals.tempMechLabQueue.Remove(workOrder);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Globals.tempMechLabQueue.Clear();
                Logger.LogError(ex);
            }
        }
示例#11
0
        // Run after completion of contracts and queue up any orders in the temp queue into the game's Mech Lab queue
        public static void Postfix(SimGameState __instance)
        {
            try
            {
                foreach (var mechDef in Core.CombatMechs)
                {
                    if (mechDef.MechDefCurrentStructure < mechDef.MechDefMaxStructure)
                    {
                        continue;
                    }

                    bool componentDamage = false;
                    for (int i = 0; i < mechDef.inventory.Length; i++)
                    {
                        if (mechDef.inventory[i].DamageLevel == ComponentDamageLevel.Destroyed ||
                            mechDef.inventory[i].DamageLevel == ComponentDamageLevel.NonFunctional)
                        {
                            componentDamage = true;
                        }
                    }
                    if (componentDamage)
                    {
                        continue;
                    }

                    var tempWO = Helpers.CreateBaseMechLabOrder(__instance, mechDef);
                    tempWO.AddSubEntry(Repair_ReArm.RepairArmorMechDef(mechDef));
                    Core.tempMechLabQueue.Add(tempWO);
                }


                // If there are any work orders in the temporary queue, prompt the player
                if (Core.tempMechLabQueue.Count > 0)
                {
                    Logger.LogDebug("Processing temp Mech Lab queue orders.");

                    int    cbills                   = 0;
                    int    techCost                 = 0;
                    int    mechRepairCount          = 0;
                    int    skipMechCount            = 0;
                    string mechRepairCountDisplayed = String.Empty;
                    string skipMechCountDisplayed   = String.Empty;
                    string skipMechMessage          = String.Empty;
                    string finalMessage             = String.Empty;

                    //int Counter = Core.tempMechLabQueue.Count;
                    //for (int index = Counter - 1; index < 0; index--)
                    //{
                    //    if (Counter == 0)
                    //        break;

                    //    WorkOrderEntry_MechLab order = Core.tempMechLabQueue[index];

                    //    LogDebug("Checking for destroyed components.");
                    //    bool destroyedComponents = false;
                    //    MechDef mech = __instance.GetMechByID(order.MechID);
                    //    if (mech != null)
                    //        destroyedComponents = Helpers.CheckDestroyedComponents(mech);
                    //    else
                    //        destroyedComponents = true;

                    //    if (destroyedComponents)
                    //    {
                    //        // Remove this work order from the temp mech lab queue if the mech has destroyed components and move to next iteration
                    //        Logger.LogDebug("Removing " + mech.Name + " order from temp queue due to destroyed components and mod settings.");
                    //        Core.tempMechLabQueue.Remove(order);
                    //        destroyedComponents = false;
                    //        skipMechCount++;
                    //    }
                    //}

                    // Calculate summary of total repair costs from the temp work order queue
                    for (int index = 0; index < Core.tempMechLabQueue.Count; index++)
                    {
                        if (Core.tempMechLabQueue.Count == 0)
                        {
                            break;
                        }

                        WorkOrderEntry_MechLab order = Core.tempMechLabQueue[index];
                        MechDef mech = __instance.GetMechByID(order.MechID);
                        LogDebug("Adding " + mech.Name + " to RepairCount.");
                        cbills   += order.GetCBillCost();
                        techCost += order.GetCost();
                        mechRepairCount++;
                    }

                    mechRepairCount = Mathf.Clamp(mechRepairCount, 0, 6);

                    // If Yang's Auto Repair prompt is enabled, build a message prompt dialog for the player
                    if (true)
                    {
                        // Calculate a friendly techCost of the work order in days, based on number of current mechtechs in the player's game.
                        if (techCost != 0 && __instance.MechTechSkill != 0)
                        {
                            techCost = Mathf.CeilToInt((float)techCost / (float)__instance.MechTechSkill);
                        }
                        else
                        {
                            techCost = 1; // Safety in case of weird div/0
                        }

                        // Generate a quick friendly description of how many mechs were damaged in battle
                        switch (mechRepairCount)
                        {
                        case 0: { Logger.LogDebug("mechRepairCount was 0."); break; }

                        case 1: { mechRepairCountDisplayed = "one of our 'Mechs had only its armor"; break; }

                        case 2: { mechRepairCountDisplayed = "a couple of the 'Mechs had only their armor"; break; }

                        case 3: { mechRepairCountDisplayed = "three of our 'Mechs had only their armor"; break; }

                        case 4: { mechRepairCountDisplayed = "an entire lance of ours had only their armor"; break; }

                        case 5: { mechRepairCountDisplayed = "five of our 'Mechs had only their armor"; break; }

                        case 6: { mechRepairCountDisplayed = "every 'Mech we dropped with had only their armor"; break; }
                        }
                        // Generate a friendly description of how many mechs were damaged but had components destroyed
                        switch (skipMechCount)
                        {
                        case 0: { Logger.LogDebug("skipMechCount was 0."); break; }

                        case 1: { skipMechCountDisplayed = "one of the 'Mechs is damaged but has"; break; }

                        case 2: { skipMechCountDisplayed = "two of the 'Mechs are damaged but have"; break; }

                        case 3: { skipMechCountDisplayed = "three of the 'Mechs are damaged but have "; break; }

                        case 4: { skipMechCountDisplayed = "the whole lance is damaged but has"; break; }
                        }

                        // Check if there are any mechs to process
                        if (mechRepairCount > 0 || skipMechCount > 0)
                        {
                            Logger.LogDebug("mechRepairCount is " + mechRepairCount + " skipMechCount is " + skipMechCount);

                            // Setup the notification for mechs with damaged components that we might want to skip
                            if (skipMechCount > 0 && mechRepairCount == 0)
                            {
                                skipMechMessage = String.Format("{0} destroyed components. I'll leave the repairs for you to review.", skipMechCountDisplayed);
                            }
                            else
                            {
                                skipMechMessage = String.Format("{0} destroyed components, so I'll leave those repairs to you.", skipMechCountDisplayed);
                            }

                            Logger.LogDebug("Firing Yang's UI notification.");
                            SimGameInterruptManager notificationQueue = __instance.GetInterruptQueue();

                            // If all of the mechs needing repairs have damaged components and should be skipped from auto-repair, change the message notification structure to make more sense (e.g. just have an OK button)
                            if (skipMechCount > 0 && mechRepairCount == 0)
                            {
                                finalMessage = String.Format(
                                    "Boss, {0} \n\n",
                                    skipMechMessage
                                    );

                                // Queue Notification
                                notificationQueue.QueuePauseNotification(
                                    "'Mech Armor Repairs Needed",
                                    finalMessage,
                                    __instance.GetCrewPortrait(SimGameCrew.Crew_Yang),
                                    string.Empty,
                                    delegate
                                {
                                    Logger.LogDebug("[PROMPT] All damaged mechs had destroyed components and won't be queued for repair.");
                                },
                                    "OK"
                                    );
                            }
                            else
                            {
                                if (skipMechCount > 0)
                                {
                                    finalMessage = String.Format(
                                        "Boss, {0} damaged. It'll cost <color=#DE6729>{1}{2:n0}</color> and {3} days for these repairs. Want my crew to get started?\n\nAlso, {4}\n\n",
                                        mechRepairCountDisplayed,
                                        '¢', cbills.ToString(),
                                        techCost.ToString(),
                                        skipMechMessage
                                        );
                                }
                                else
                                {
                                    finalMessage = String.Format(
                                        "Boss, {0} damaged on the last engagement. It'll cost <color=#DE6729>{1}{2:n0}</color> and {3} days for the repairs.\n\nWant my crew to get started?",
                                        mechRepairCountDisplayed,
                                        '¢', cbills.ToString(),
                                        techCost.ToString()
                                        );
                                }


                                // Queue up Yang's notification
                                notificationQueue.QueuePauseNotification(
                                    "'Mech Armor Repairs Needed",
                                    finalMessage,
                                    __instance.GetCrewPortrait(SimGameCrew.Crew_Yang),
                                    string.Empty,
                                    delegate
                                {
                                    Logger.LogDebug("[PROMPT] Moving work orders from temp queue to Mech Lab queue: " + Core.tempMechLabQueue.Count + " work orders");
                                    foreach (WorkOrderEntry_MechLab workOrder in Core.tempMechLabQueue.ToList())
                                    {
                                        Helpers.SubmitWorkOrder(__instance, workOrder);
                                        Core.tempMechLabQueue.Remove(workOrder);
                                    }
                                },
                                    "Yes",
                                    delegate
                                {
                                    foreach (WorkOrderEntry_MechLab workOrder in Core.tempMechLabQueue.ToList())
                                    {
                                        Core.tempMechLabQueue.Remove(workOrder);
                                    }
                                },
                                    "No"
                                    );
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Core.tempMechLabQueue.Clear();
                Error(ex);
            }
        }