public static void Prefix(SimGameState __instance, WorkOrderEntry entry)
        {
            try
            {
                var install = entry as WorkOrderEntry_InstallComponent;
                var repair  = entry as WorkOrderEntry_RepairComponent;

                string SimGameUID;
                if (install != null)
                {
                    SimGameUID = install.ComponentSimGameUID;
                }
                else if (repair != null)
                {
                    SimGameUID = repair.ComponentSimGameUID;
                }
                else
                {
                    return;
                }

                SimGameStateAddItemStatPatch.lastMechComponentRef = __instance.WorkOrderComponents.FirstOrDefault(c => c.SimGameUID == SimGameUID);
            }
            catch (Exception e)
            {
                Control.mod.Logger.LogError(e);
            }
        }
        public void WorkOrderButtonEntryClick(object sender, RoutedEventArgs e)
        {
            ClickSound();
            //entry logic, similar to EntryButtonClick but we want to change lblScanPrompt.Text.

            WorkOrderEntry.Focus(); //set focus
            String gotcontent = (String)((Button)sender).Content;

            int intresult = 0;

            if (int.TryParse(gotcontent, out intresult))
            {
                //a number was entered.
                if (WorkOrderEntry.Text.Length >= dbase.Configuration.WorkOrderMaxLength && dbase.Configuration.WorkOrderMaxLength > 0)
                {
                    playthesound("errorsound.wav");
                }
                else
                {
                    WorkOrderEntry.Text = WorkOrderEntry.Text + gotcontent;
                }
            }
            else if (gotcontent.Equals("c", StringComparison.OrdinalIgnoreCase))
            {
                WorkOrderEntry.Text = "";
            }
            else if (gotcontent.Equals("ü", StringComparison.OrdinalIgnoreCase))
            {
                //Enter button logic.
                WorkOrderEntry_Enter();
            }
        }
Beispiel #3
0
        public static void StopAdvancing()
        {
            if (advancingTo == null)
            {
                return;
            }

            advancingTo = null;

            Sim.Constants.Time.DayElapseTimeNormal = oldDayElapseTimeNormal;
            Sim.SetTimeMoving(false);
        }
 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);
 }
Beispiel #5
0
 static bool Prefix(WorkOrderEntry entry)
 {
     try {
         if (Fields.Deployment && entry.ID.Equals("Deployment End"))
         {
             return(false);
         }
         return(true);
     }
     catch (Exception e) {
         Logger.LogError(e);
         return(true);
     }
 }
Beispiel #6
0
        public static void StopAdvancing()
        {
            if (_advancingTo == null)
            {
                return;
            }

            _advancingTo = null;

            var simGame = UnityGameInstance.BattleTechGame.Simulation;

            simGame.Constants.Time.DayElapseTimeNormal = _oldDayElapseTimeNormal;
            simGame.SetTimeMoving(false);
        }
Beispiel #7
0
        public static void StartAdvancing(WorkOrderEntry entry)
        {
            if (Sim.CurRoomState != DropshipLocation.SHIP)
            {
                return;
            }

            advancingTo = entry;
            Sim.SetTimeMoving(true);

            // set the elapseTime variable so that the days pass faster
            if (Math.Abs(Sim.Constants.Time.DayElapseTimeNormal - Settings.AdvanceToTaskTime) > 0.01)
            {
                oldDayElapseTimeNormal = Sim.Constants.Time.DayElapseTimeNormal;
                Sim.Constants.Time.DayElapseTimeNormal = Settings.AdvanceToTaskTime;
            }
        }
Beispiel #8
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");
                    }
                }
            }
Beispiel #9
0
        public static void StartAdvancing(WorkOrderEntry entry)
        {
            var simGame = UnityGameInstance.BattleTechGame.Simulation;

            if (simGame.CurRoomState != DropshipLocation.SHIP)
            {
                return;
            }

            AdvancingTo = entry;
            simGame.SetTimeMoving(true);

            // set the elapseTime variable so that the days pass faster
            if (Math.Abs(simGame.Constants.Time.DayElapseTimeNormal - Core.Settings.AdvanceToTaskTime) > 0.01)
            {
                _oldDayElapseTimeNormal = simGame.Constants.Time.DayElapseTimeNormal;
                simGame.Constants.Time.DayElapseTimeNormal = Core.Settings.AdvanceToTaskTime;
            }
        }
Beispiel #10
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));
                    }
                }
            }
Beispiel #11
0
            public static void Postfix(TaskManagementElement __instance, TextMeshProUGUI ___subTitleText, UIColorRefTracker ___subTitleColor,
                                       WorkOrderEntry ___entry)
            {
                WorkOrderEntry_MedBayHeal healOrder = ___entry as WorkOrderEntry_MedBayHeal;

                try
                {
                    if (healOrder.Pilot.pilotDef.TimeoutRemaining > 0 && healOrder.Pilot.pilotDef.Injuries == 0 &&
                        !healOrder.Pilot.pilotDef.PilotTags.Contains("pilot_lightinjury") && healOrder.Pilot.pilotDef.PilotTags.Contains("pilot_fatigued"))
                    {
                        ___subTitleText.text = "FATIGUED";
                        ___subTitleColor.SetUIColor(UIColor.Orange);
                    }
                }
                catch (Exception)
                {
                }
                try
                {
                    if (healOrder.Pilot.pilotDef.TimeoutRemaining > 0 && healOrder.Pilot.pilotDef.Injuries == 0 &&
                        !healOrder.Pilot.pilotDef.PilotTags.Contains("pilot_lightinjury") && !healOrder.Pilot.pilotDef.PilotTags.Contains("pilot_fatigued"))
                    {
                        ___subTitleText.text = "UNAVAILABLE";
                        ___subTitleColor.SetUIColor(UIColor.Blue);
                    }
                }
                catch (Exception)
                {
                }
                try
                {
                    if (healOrder.Pilot.pilotDef.PilotTags.Contains("pilot_lightinjury"))
                    {
                        ___subTitleText.text = "LIGHT INJURY";
                        ___subTitleColor.SetUIColor(UIColor.Green);
                    }
                }
                catch (Exception)
                {
                }
            }
Beispiel #12
0
        public static void Postfix(TaskTimelineWidget __instance, SimGameState ___Sim)
        {
            int numMechBayPods = ___Sim.CompanyStats.GetValue <int>(___Sim.Constants.Story.MechBayPodsID);

            bool auto1 = false;
            bool auto2 = false;

            if (___Sim.shipUpgrades.Any(u => u.Tags.Any(t => t.Contains("argo_mechBay_automation1"))))
            {
                auto1 = true;
            }

            if (___Sim.shipUpgrades.Any(u => u.Tags.Any(t => t.Contains("argo_mechBay_automation2"))))
            {
                auto2 = true;
            }

            int cumulativeDays = 0;

            for (int i = 0; i < ___Sim.MechLabQueue.Count; i++)
            {
                WorkOrderEntry        workOrderEntry2       = ___Sim.MechLabQueue[i];
                TaskManagementElement taskManagementElement = null;
                if (__instance.ActiveItems.TryGetValue(workOrderEntry2, out taskManagementElement) && i == 0)
                {
                    if (___Sim.WorkOrderIsMechTech(workOrderEntry2.Type))
                    {
                        cumulativeDays = taskManagementElement.UpdateItem(cumulativeDays);
                    }
                    else
                    {
                        taskManagementElement.UpdateItem(0);
                    }
                }

                if (__instance.ActiveItems.TryGetValue(workOrderEntry2, out taskManagementElement) && i == 1)
                {
                    if (___Sim.WorkOrderIsMechTech(workOrderEntry2.Type) && numMechBayPods == 1)
                    {
                        cumulativeDays = taskManagementElement.UpdateItem(cumulativeDays);
                    }
                    else if (___Sim.WorkOrderIsMechTech(workOrderEntry2.Type) && numMechBayPods > 1)
                    {
                        int temptime = taskManagementElement.UpdateItem(0);
                        if (auto1)
                        {
                            temptime = 0;
                        }
                        taskManagementElement.UpdateItem(Convert.ToInt32(temptime));
                    }
                    else
                    {
                        taskManagementElement.UpdateItem(0);
                    }
                }

                if (__instance.ActiveItems.TryGetValue(workOrderEntry2, out taskManagementElement) && i == 2)
                {
                    if (___Sim.WorkOrderIsMechTech(workOrderEntry2.Type) && numMechBayPods <= 2)
                    {
                        cumulativeDays = taskManagementElement.UpdateItem(cumulativeDays);
                    }
                    else if (___Sim.WorkOrderIsMechTech(workOrderEntry2.Type) && numMechBayPods > 2)
                    {
                        int temptime = taskManagementElement.UpdateItem(0);
                        if (auto2)
                        {
                            temptime = 0;
                        }
                        taskManagementElement.UpdateItem(Convert.ToInt32(2 * temptime));
                    }
                    else
                    {
                        taskManagementElement.UpdateItem(0);
                    }
                }

                if (__instance.ActiveItems.TryGetValue(workOrderEntry2, out taskManagementElement) && i > 2)
                {
                    if (___Sim.WorkOrderIsMechTech(workOrderEntry2.Type))
                    {
                        cumulativeDays = taskManagementElement.UpdateItem(cumulativeDays);
                    }
                    else
                    {
                        taskManagementElement.UpdateItem(0);
                    }
                }
            }
        }