public override void Run(RunPayload payload)
        {
            Main.Logger.Log($"[AddDestroyWholeUnitChunk] Adding encounter structure");
            EncounterLayerData     encounterLayerData = MissionControl.Instance.EncounterLayerData;
            DestroyWholeLanceChunk destroyWholeChunk  = ChunkFactory.CreateDestroyWholeLanceChunk();

            destroyWholeChunk.encounterObjectGuid = System.Guid.NewGuid().ToString();

            this.objectiveLabel = MissionControl.Instance.CurrentContract.Interpolate(this.objectiveLabel).ToString();

            bool spawnOnActivation             = true;
            LanceSpawnerGameLogic lanceSpawner = LanceSpawnerFactory.CreateLanceSpawner(
                destroyWholeChunk.gameObject,
                spawnerName,
                lanceGuid,
                teamGuid,
                spawnOnActivation,
                SpawnUnitMethodType.InstantlyAtSpawnPoint,
                unitGuids
                );
            LanceSpawnerRef lanceSpawnerRef = new LanceSpawnerRef(lanceSpawner);

            bool showProgress = true;
            DestroyLanceObjective objective = ObjectiveFactory.CreateDestroyLanceObjective(
                objectiveGuid,
                destroyWholeChunk.gameObject,
                lanceSpawnerRef,
                lanceGuid,
                objectiveLabel,
                showProgress,
                ProgressFormat.PERCENTAGE_COMPLETE,
                "The primary objective to destroy the enemy lance",
                priority,
                displayToUser,
                ObjectiveMark.AttackTarget,
                contractObjectiveGameLogicGuid,
                Main.Settings.ActiveAdditionalLances.GetRewards()
                );

            if (isPrimary)
            {
                AccessTools.Field(typeof(ObjectiveGameLogic), "primary").SetValue(objective, true);
            }
            else
            {
                AccessTools.Field(typeof(ObjectiveGameLogic), "primary").SetValue(objective, false);
            }

            DestroyLanceObjectiveRef destroyLanceObjectiveRef = new DestroyLanceObjectiveRef();

            destroyLanceObjectiveRef.encounterObject = objective;

            destroyWholeChunk.lanceSpawner     = lanceSpawnerRef;
            destroyWholeChunk.destroyObjective = destroyLanceObjectiveRef;
        }
Пример #2
0
        private void BuildDestroyWholeLanceObjective(GameObject parent, JObject objective, string name, string title, string guid,
                                                     bool isPrimaryObjectve, int priority, bool displayToUser, string contractObjectiveGuid)
        {
            DestroyWholeLanceChunk destroyWholeLanceChunk = parent.GetComponent <DestroyWholeLanceChunk>();
            string lanceToDestroyGuid          = objective["LanceToDestroyGuid"].ToString();
            Dictionary <string, float> rewards = (objective.ContainsKey("Rewards")) ? objective["Rewards"].ToObject <Dictionary <string, float> >() : new Dictionary <string, float>();
            bool showProgress = true;

            LanceSpawnerRef lanceSpawnerRef = new LanceSpawnerRef();

            lanceSpawnerRef.EncounterObjectGuid = lanceToDestroyGuid;

            DestroyLanceObjective objectiveLogic = ObjectiveFactory.CreateDestroyLanceObjective(
                guid,
                parent,
                lanceSpawnerRef,
                lanceToDestroyGuid,
                title,
                showProgress,
                ChunkLogic.ProgressFormat.PERCENTAGE_COMPLETE,
                "The primary objective to destroy the enemy lance",
                priority,
                displayToUser,
                ObjectiveMark.AttackTarget,
                contractObjectiveGuid,
                rewards,
                rewards.Count > 0
                );

            if (isPrimaryObjectve)
            {
                AccessTools.Field(typeof(ObjectiveGameLogic), "primary").SetValue(objectiveLogic, true);
            }
            else
            {
                AccessTools.Field(typeof(ObjectiveGameLogic), "primary").SetValue(objectiveLogic, false);
            }

            DestroyLanceObjectiveRef destroyLanceObjectiveRef = new DestroyLanceObjectiveRef();

            destroyLanceObjectiveRef.encounterObject = objectiveLogic;

            if (destroyWholeLanceChunk != null)
            {
                destroyWholeLanceChunk.lanceSpawner     = lanceSpawnerRef;
                destroyWholeLanceChunk.destroyObjective = destroyLanceObjectiveRef;
            }
        }
Пример #3
0
        private void BuildDestroyWholeLanceObjective(GameObject parent, JObject objective, string name, string title, string guid,
                                                     bool isPrimaryObjectve, int priority, string contractObjectiveGuid)
        {
            DestroyWholeLanceChunk destroyWholeLanceChunk = parent.GetComponent <DestroyWholeLanceChunk>();
            string lanceToDestroyGuid = objective["LanceToDestroyGuid"].ToString();
            bool   showProgress       = true;
            bool   displayToUser      = true;

            LanceSpawnerRef lanceSpawnerRef = new LanceSpawnerRef();

            lanceSpawnerRef.EncounterObjectGuid = lanceToDestroyGuid;

            DestroyLanceObjective objectiveLogic = ObjectiveFactory.CreateDestroyLanceObjective(
                guid,
                parent,
                lanceSpawnerRef,
                lanceToDestroyGuid,
                title,
                showProgress,
                ChunkLogic.ProgressFormat.PERCENTAGE_COMPLETE,
                "The primary objective to destroy the enemy lance",
                priority,
                displayToUser,
                ObjectiveMark.AttackTarget,
                contractObjectiveGuid,
                false // Don't create the objective override as it's provided by the contract json
                );

            if (isPrimaryObjectve)
            {
                AccessTools.Field(typeof(ObjectiveGameLogic), "primary").SetValue(objectiveLogic, true);
            }
            else
            {
                AccessTools.Field(typeof(ObjectiveGameLogic), "primary").SetValue(objectiveLogic, false);
            }

            DestroyLanceObjectiveRef destroyLanceObjectiveRef = new DestroyLanceObjectiveRef();

            destroyLanceObjectiveRef.encounterObject = objectiveLogic;

            destroyWholeLanceChunk.lanceSpawner     = lanceSpawnerRef;
            destroyWholeLanceChunk.destroyObjective = destroyLanceObjectiveRef;
        }