Ejemplo n.º 1
0
 static void Prefix(SimGameState __instance, int timeLapse)
 {
     try {
         int num = (timeLapse <= 0) ? 1 : timeLapse;
         if (Fields.Deployment)
         {
             Fields.DeploymentRemainingDays -= num;
         }
         if (Fields.DeploymentRemainingDays % __instance.Constants.Finances.QuarterLength == 0)
         {
             Fields.PaymentCall = true;
             Fields.MissionsDoneCurrentMonth = 0;
         }
         if (Fields.TimeLineEntry != null)
         {
             Fields.TimeLineEntry.PayCost(num);
             TaskManagementElement taskManagementElement4 = null;
             TaskTimelineWidget    timelineWidget         = (TaskTimelineWidget)AccessTools.Field(typeof(SGRoomManager), "timelineWidget").GetValue(__instance.RoomManager);
             Dictionary <WorkOrderEntry, TaskManagementElement> ActiveItems = (Dictionary <WorkOrderEntry, TaskManagementElement>)AccessTools.Field(typeof(TaskTimelineWidget), "ActiveItems").GetValue(timelineWidget);
             if (ActiveItems.TryGetValue(Fields.TimeLineEntry, out taskManagementElement4))
             {
                 taskManagementElement4.UpdateItem(0);
             }
         }
     }
     catch (Exception e) {
         Logger.LogError(e);
     }
 }
Ejemplo n.º 2
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);
                    }
                }
            }
        }