Exemplo n.º 1
0
    public static bool IsAnInactiveContractControlledObjective(this ObjectiveGameLogic objectiveGameLogic)
    {
        EncounterChunkGameLogic chunkGameLogic = objectiveGameLogic.GetComponentInParent <EncounterChunkGameLogic>();

        if ((chunkGameLogic.StartingStatus == EncounterObjectStatus.ControlledByContract) && (chunkGameLogic.GetState() == EncounterObjectStatus.Finished))
        {
            return(true);
        }
        return(false);
    }
Exemplo n.º 2
0
 private void SetupChunk(EncounterChunkGameLogic chunkGameLogic)
 {
     chunkGameLogic.encounterObjectGuid = this.guid;
     if (this.startingStatus != null)
     {
         chunkGameLogic.startingStatus = (EncounterObjectStatus)this.startingStatus;
     }
     if (controlledByContract)
     {
         chunkGameLogic.startingStatus = EncounterObjectStatus.ControlledByContract;
     }
 }
Exemplo n.º 3
0
    public static void SetObjectivesAsPrimary(this EncounterChunkGameLogic encounterChunkGameLogic, bool flag)
    {
        ItemRegistry itemRegistry = UnityGameInstance.BattleTechGame.Combat.ItemRegistry;

        ObjectiveGameLogic[] objectiveGameLogics = encounterChunkGameLogic.GetComponentsInChildren <ObjectiveGameLogic>();
        foreach (ObjectiveGameLogic objectiveGameLogic in objectiveGameLogics)
        {
            string setting = flag ? "primary" : "non-primary";
            MissionControl.Main.LogDebug($"[SetInactiveContractControlledObjectivesNotRequired] Setting '{objectiveGameLogic.gameObject.name}' {setting}");
            AccessTools.Field(typeof(ObjectiveGameLogic), "primary").SetValue(objectiveGameLogic, flag);
        }
    }
        public override void Trigger(MessageCenterMessage inMessage, string triggeringName)
        {
            Main.LogDebug("[SetChunkObjectivesAsPrimary] Setting...");

            EncounterChunkGameLogic encounterChunkGameLogic = UnityGameInstance.BattleTechGame.Combat.ItemRegistry.GetItemByGUID <EncounterChunkGameLogic>(EncounterGuid);

            if (encounterChunkGameLogic != null)
            {
                encounterChunkGameLogic.SetObjectivesAsPrimary(Primary);
            }
            else
            {
                Main.LogDebug($"[SetChunkObjectivesAsPrimary] Cannot find EncounterChunkGameLogic with Guid '{EncounterGuid}'");
            }
        }
Exemplo n.º 5
0
        private void IgnoreChunks()
        {
            foreach (string encounterGuid in EncounterGuids)
            {
                EncounterChunkGameLogic encounterChunkGameLogic = UnityGameInstance.BattleTechGame.Combat.ItemRegistry.GetItemByGUID <EncounterChunkGameLogic>(encounterGuid);

                if (encounterChunkGameLogic != null)
                {
                    encounterChunkGameLogic.SetObjectivesAsIgnored();
                    encounterChunkGameLogic.SetState(EncounterObjectStatus.Finished);
                }
                else
                {
                    Main.LogDebug($"[SetChunkObjectivesAsPrimary] Cannot find EncounterChunkGameLogic with Guid '{encounterGuid}'");
                }
            }
        }
    public static void SetObjectivesAsIgnored(this EncounterChunkGameLogic encounterChunkGameLogic)
    {
        ItemRegistry itemRegistry = UnityGameInstance.BattleTechGame.Combat.ItemRegistry;

        ObjectiveGameLogic[] objectiveGameLogics = encounterChunkGameLogic.GetComponentsInChildren <ObjectiveGameLogic>();
        foreach (ObjectiveGameLogic objectiveGameLogic in objectiveGameLogics)
        {
            MissionControl.Main.LogDebug($"[SetObjectivesAsIgnored] Setting '{objectiveGameLogic.gameObject.name}' to IGNORED");
            objectiveGameLogic.IgnoreObjective();
        }

        ContractObjectiveGameLogic[] contractGameLogics = MissionControl.MissionControl.Instance.EncounterLayerData.GetComponentsInChildren <ContractObjectiveGameLogic>();
        foreach (ContractObjectiveGameLogic contractObjective in contractGameLogics)
        {
            MissionControl.Main.LogDebug($"[SetObjectivesAsIgnored] Calling '{contractObjective.gameObject.name}' QueueCheckContractObjective");
            contractObjective.QueueCheckContractObjective();
        }
    }
Exemplo n.º 7
0
        static bool Prefix(EncounterChunkGameLogic __instance, ChunkOverride chunkOverride)
        {
            Main.LogDebug($"[EncounterChunkGameLogicApplyContractOverridePatch.Prefix] Running EncounterChunkGameLogicApplyContractOverridePatch - {chunkOverride.name}");
            EncounterObjectStatus startingStatus = EncounterObjectStatus.Active;

            if (chunkOverride.enableChunkFromContract)
            {
                if (chunkOverride.controlledByContractChunkGroupList.Count > 0)
                {
                    if (!Enum.TryParse(chunkOverride.controlledByContractChunkGroupList[0], out startingStatus))
                    {
                        startingStatus = EncounterObjectStatus.Active;
                    }
                }
                __instance.startingStatus = startingStatus;
            }
            return(false);
        }
        public override void Trigger(MessageCenterMessage inMessage, string triggeringName)
        {
            Main.LogDebug("[ExecuteGameLogicResult] Executing Game Logic...");

            if (ChunkGuid != null)
            {
                EncounterChunkGameLogic chunkGameLogic = UnityGameInstance.BattleTechGame.Combat.ItemRegistry.GetItemByGUID <EncounterChunkGameLogic>(ChunkGuid);
                if (chunkGameLogic != null)
                {
                    MonoBehaviour[] monoBehaviours = chunkGameLogic.GetComponentsInChildren <MonoBehaviour>();
                    foreach (MonoBehaviour monoBehaviour in monoBehaviours)
                    {
                        if (monoBehaviour is ExecutableGameLogic)
                        {
                            ((ExecutableGameLogic)monoBehaviour).Execute();
                        }
                    }
                }
                else
                {
                    Main.LogDebug($"[ExecuteGameLogicResult] Cannot find ChunkGameLogic with Guid '{ChunkGuid}'");
                }
            }
            else if (EncounterGuid != null)
            {
                EncounterObjectGameLogic encounterGameLogic = UnityGameInstance.BattleTechGame.Combat.ItemRegistry.GetItemByGUID <EncounterObjectGameLogic>(EncounterGuid);

                if (encounterGameLogic != null)
                {
                    MonoBehaviour[] monoBehaviours = encounterGameLogic.GetComponents <MonoBehaviour>();
                    foreach (MonoBehaviour monoBehaviour in monoBehaviours)
                    {
                        if (monoBehaviour is ExecutableGameLogic)
                        {
                            ((ExecutableGameLogic)monoBehaviour).Execute();
                        }
                    }
                }
                else
                {
                    Main.LogDebug($"[ExecuteGameLogicResult] Cannot find EncounterObjectGameLogic with Guid '{EncounterGuid}'");
                }
            }
        }
    public static void SetObjectivesAsPrimary(this EncounterChunkGameLogic encounterChunkGameLogic, bool flag)
    {
        ItemRegistry itemRegistry = UnityGameInstance.BattleTechGame.Combat.ItemRegistry;

        ObjectiveGameLogic[] objectiveGameLogics = encounterChunkGameLogic.GetComponentsInChildren <ObjectiveGameLogic>();
        foreach (ObjectiveGameLogic objectiveGameLogic in objectiveGameLogics)
        {
            string setting = flag ? "primary" : "non-primary";
            MissionControl.Main.LogDebug($"[SetObjectivesAsPrimary] Setting '{objectiveGameLogic.gameObject.name}' {setting}");
            AccessTools.Field(typeof(ObjectiveGameLogic), "primary").SetValue(objectiveGameLogic, flag);
        }


        ContractObjectiveGameLogic[] contractGameLogics = MissionControl.MissionControl.Instance.EncounterLayerData.GetComponentsInChildren <ContractObjectiveGameLogic>();
        foreach (ContractObjectiveGameLogic contractObjective in contractGameLogics)
        {
            MissionControl.Main.LogDebug($"[SetObjectivesAsPrimary] Calling '{contractObjective.gameObject.name}' QueueCheckContractObjective");
            contractObjective.QueueCheckContractObjective();
        }
    }