Exemplo n.º 1
0
        private static string BuildMain(CoreDetails coreDetails, DetailManager[] managers)
        {
            MainLua mainLua = new MainLua();

            mainLua.AddToOpeningVariables("this", "{}");
            mainLua.AddToOpeningVariables("quest_step", "{}");
            mainLua.AddToOpeningVariables("StrCode32", "Fox.StrCode32");
            mainLua.AddToOpeningVariables("StrCode32Table", "Tpp.StrCode32Table");
            mainLua.AddToOpeningVariables("GetGameObjectId", "GameObject.GetGameObjectId");
            mainLua.AddToOpeningVariables("ELIMINATE", "TppDefine.QUEST_TYPE.ELIMINATE");
            mainLua.AddToOpeningVariables("RECOVERED", "TppDefine.QUEST_TYPE.RECOVERED");
            mainLua.AddToOpeningVariables("KILLREQUIRED", "9");

            string cpNameString = coreDetails.CPName;

            if (coreDetails.CPName == "NONE")
            {
                /*
                 * if (LoadAreas.isAfgh(coreDetails.locationID))
                 * {
                 *  cpNameString = @"""afgh_plantSouth_ob"""; // empty ob for afgh. doesn't trigger interrogations?
                 * }
                 * else if (LoadAreas.isMafr(coreDetails.locationID))
                 * {
                 *  cpNameString = @"""mafr_factory_cp"""; // empty cp for mafr
                 * }
                 * else
                 * {
                 */
                cpNameString = $"InfMain.GetClosestCp{{{coreDetails.coords.xCoord},{coreDetails.coords.yCoord},{coreDetails.coords.zCoord}}}";
                //}
            }
            else
            {
                cpNameString = $@"""{coreDetails.CPName}""";
            }

            mainLua.AddToOpeningVariables("CPNAME", cpNameString);
            mainLua.AddToOpeningVariables("DISTANTCP", $@"""{QuestObjects.Enemy.EnemyInfo.ChooseDistantCP(coreDetails.CPName, coreDetails.locationID)}""");
            mainLua.AddToOpeningVariables("questTrapName", $@"""trap_preDeactiveQuestArea_{coreDetails.loadArea}""");

            mainLua.AddToQuestTable("questType = ELIMINATE");
            mainLua.AddToQuestTable("soldierSubType = SUBTYPE");
            mainLua.AddToQuestTable(BuildCpList(coreDetails));

            foreach (DetailManager manager in managers)
            {
                manager.AddToMainLua(mainLua);
            }

            return(mainLua.GetMainLuaFormatted());
        }
Exemplo n.º 2
0
 public static void GetMain(AnimalDetail detail, MainLua mainLua)
 {
     if (detail.animals.Count > 0)
     {
         mainLua.AddToQuestTable(BuildAnimalList(detail.animals));
         if (detail.animals.Any(animal => animal.target))
         {
             CheckQuestAnimal checkAnimal = new CheckQuestAnimal(mainLua, detail.animalMetadata.objectiveType);
             mainLua.AddToQuestTable(BuildAnimalTargetList(detail.animals));
             mainLua.AddToQStep_Main(QStep_MainCommonMessages.animalTargetMessages);
         }
     }
 }
Exemplo n.º 3
0
 internal static void GetMain(ActiveItemDetail questDetail, MainLua mainLua)
 {
     if (questDetail.activeItems.Any(activeItem => activeItem.isTarget))
     {
         CheckQuestItem checkQuestItem = new CheckQuestItem(mainLua, checkIsActiveItem, questDetail.activeItemMetadata.objectiveType);
         mainLua.AddToQuestTable(BuildTargetItemList(questDetail));
         mainLua.AddToQStep_Main(QStep_MainCommonMessages.activeItemTargetMessages);
     }
 }
Exemplo n.º 4
0
 internal static void GetMain(ItemDetail questDetail, MainLua mainLua)
 {
     if (questDetail.items.Any(item => item.isTarget))
     {
         CheckQuestItem checkQuestItem = new CheckQuestItem(mainLua, checkIsDormantItem, questDetail.itemMetadata.objectiveType);
         mainLua.AddToQuestTable(BuildItemTargetList(questDetail.items));
         mainLua.AddToQStep_Main(QStep_MainCommonMessages.dormantItemTargetMessages);
     }
 }
Exemplo n.º 5
0
        public static void GetMain(HostageDetail hostageDetail, MainLua mainLua)
        {
            List <Hostage>  hostages = hostageDetail.hostages;
            HostageMetadata meta     = hostageDetail.hostageMetadata;

            mainLua.AddToQuestTable(BuildHostageList(hostageDetail));

            if (hostages.Count > 0)
            {
                if (meta.canInterrogate)
                {
                    mainLua.AddToAuxiliary(InterCall_hostage_pos01);
                    mainLua.AddToAuxiliary(questCpInterrogation);
                    mainLua.AddToAuxiliary(SwitchEnableQuestHighIntTable);

                    //mainLua.AddToAuxiliary($"local hostageCount = {hostages.Count}"); unnecessary if MarkerChangeToEnable message isn't a static readonly
                    mainLua.AddToAuxiliary("local hostagei = 0"); // only used for MarkerChangeToEnable's function
                    mainLua.AddToQStep_Main(new QStep_Message("Marker", @"""ChangeToEnable""", $@"function(arg0, arg1)
              if arg0 == StrCode32(""Hostage_0"") then
                hostagei = hostagei + 1
                if hostagei >= {hostages.Count} then
                  this.SwitchEnableQuestHighIntTable(false, CPNAME, this.questCpInterrogation)
                end
              end
            end"));                                               // could be a static readonly message, but a total hostage count would have to be an auxiliary variable

                    mainLua.AddToQStep_Start_OnEnter("this.SwitchEnableQuestHighIntTable(true, CPNAME, this.questCpInterrogation)");
                    mainLua.AddToOnTerminate("this.SwitchEnableQuestHighIntTable(false, CPNAME, this.questCpInterrogation)");
                }

                mainLua.AddToQStep_Main(QStep_MainCommonMessages.genericTargetMessages);

                mainLua.AddToQStep_Start_OnEnter(WarpHostages);
                mainLua.AddToAuxiliary(WarpHostages);

                mainLua.AddToQStep_Start_OnEnter(SetHostageAttributes);
                mainLua.AddToAuxiliary(SetHostageAttributes);

                if (hostages.Any(hostage => hostage.isTarget))
                {
                    CheckQuestGenericEnemy hostageCheck = new CheckQuestGenericEnemy(mainLua, CheckIsHostage, meta.objectiveType);
                    foreach (Hostage hostage in hostages)
                    {
                        if (hostage.isTarget)
                        {
                            mainLua.AddToTargetList(hostage.GetObjectName());
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        public static void GetMain(EnemyDetail detail, MainLua mainLua)
        {
            List <Enemy>  enemies = detail.enemies;
            EnemyMetadata meta    = detail.enemyMetadata;

            mainLua.AddToOpeningVariables("SUBTYPE", $@"""{meta.subtype}""");

            mainLua.AddToQuestTable(BuildEnemyList(enemies));
            bool hasSpawn  = false;
            bool hasTarget = false;

            foreach (Enemy enemy in enemies)
            {
                if (enemy.spawn)
                {
                    hasSpawn = true;
                    if (enemy.isTarget)
                    {
                        hasTarget = true;
                        mainLua.AddToTargetList(enemy.GetObjectName());
                    }
                }
            }

            if (hasSpawn)
            {
                string questarmor     = $"isQuestArmor = {(HasArmors(enemies) ? "true" : "false")}";
                string questZombie    = $"isQuestZombie = {(HasZombie(enemies) ? "true" : "false")}";
                string questBalaclava = $"isQuestBalaclava = {(HasBalaclavas(enemies) ? "true" : "false")}";
                mainLua.AddToQuestTable(questarmor, questZombie, questBalaclava);

                if (hasTarget)
                {
                    mainLua.AddToQStep_Main(QStep_MainCommonMessages.genericTargetMessages);
                    CheckQuestGenericEnemy CheckEnemy = new CheckQuestGenericEnemy(mainLua, CheckIsSoldier, meta.objectiveType);
                }
            }
        }
Exemplo n.º 7
0
 internal static void GetMain(HelicopterDetail questDetail, MainLua mainLua)
 {
     if (questDetail.helicopters.Any(helicopter => helicopter.isSpawn))
     {
         mainLua.AddToQuestTable(BuildHeliList(questDetail));
         mainLua.AddToAuxiliary(setHelicopterAttributes);
         if (questDetail.helicopters.Any(helicopter => helicopter.isTarget))
         {
             mainLua.AddToQStep_Main(QStep_MainCommonMessages.mechaNoCaptureTargetMessages);
             CheckQuestGenericEnemy helicopterCheck = new CheckQuestGenericEnemy(mainLua);
             foreach (Helicopter heli in questDetail.helicopters)
             {
                 if (heli.isTarget)
                 {
                     mainLua.AddToTargetList(heli.GetObjectName());
                 }
             }
         }
     }
 }
Exemplo n.º 8
0
        internal static void GetMain(WalkerDetail detail, MainLua mainLua)
        {
            List <WalkerGear> walkers = detail.walkers;
            WalkerMetadata    meta    = detail.walkerMetadata;

            if (detail.walkers.Count > 0)
            {
                mainLua.AddToOpeningVariables("questWalkerGearList", "{}");
                mainLua.AddToOpeningVariables("playerWGResetPosition");
                mainLua.AddToOpeningVariables("walkerGearGameId");
                mainLua.AddToOpeningVariables("inMostActiveQuestArea", "true");
                mainLua.AddToOpeningVariables("exitOnce", "true");

                mainLua.AddToQuestTable(BuildWalkerList(detail));

                mainLua.AddToAuxiliary(OneTimeAnnounce);
                mainLua.AddToAuxiliary(ReboundWalkerGear);
                mainLua.AddToQStep_Main(ExitTrap, EnterTrap, FinishTimerActiveArea, FinishTimerCooldown);
                mainLua.AddToQStep_Main(QStep_MainCommonMessages.mechaCaptureTargetMessages);

                mainLua.AddToAuxiliary("local setupOnce = true");
                mainLua.AddToOnUpdate("setupOnce = this.SetupGearsQuest(setupOnce)");
                mainLua.AddToAuxiliary(SetupGearsQuest);

                mainLua.AddToQStep_Start_OnEnter(BuildWalkerGameObjectIdList);
                mainLua.AddToAuxiliary(BuildWalkerGameObjectIdList);

                if (walkers.Any(walker => walker.isTarget))
                {
                    CheckQuestGenericEnemy checkQuestMethod = new CheckQuestGenericEnemy(mainLua, checkWalkerGear, meta.objectiveType);
                    foreach (WalkerGear walker in walkers)
                    {
                        if (walker.isTarget)
                        {
                            mainLua.AddToTargetList(walker.GetObjectName());
                        }
                    }
                }
            }
        }
Exemplo n.º 9
0
        internal static void GetMain(UAVDetail detail, MainLua mainLua)
        {
            if (detail.UAVs.Count > 0)
            {
                mainLua.AddToQuestTable(BuildUAVList(detail.UAVs));

                mainLua.AddToQStep_Main(QStep_MainCommonMessages.mechaNoCaptureTargetMessages);

                mainLua.AddToQStep_Start_OnEnter(setupUAV);
                mainLua.AddToAuxiliary(setupUAV);

                if (detail.UAVs.Any(uav => uav.isTarget))
                {
                    CheckQuestGenericEnemy checkUAV = new CheckQuestGenericEnemy(mainLua);
                    foreach (UAV drone in detail.UAVs)
                    {
                        if (drone.isTarget)
                        {
                            mainLua.AddToTargetList(drone.GetObjectName());
                        }
                    }
                }
            }
        }
Exemplo n.º 10
0
        public static void GetMain(VehicleDetail detail, MainLua mainLua)
        {
            mainLua.AddToQuestTable(BuildVehicleList(detail.vehicles));

            if (detail.vehicles.Count > 0)
            {
                mainLua.AddToQStep_Main(QStep_MainCommonMessages.mechaCaptureTargetMessages);

                mainLua.AddToQStep_Start_OnEnter(warpVehicles);
                mainLua.AddToAuxiliary(warpVehicles);

                if (detail.vehicles.Any(vehicle => vehicle.isTarget))
                {
                    CheckQuestGenericEnemy checkQuestMethod = new CheckQuestGenericEnemy(mainLua, checkVehicle, detail.vehicleMetadata.ObjectiveType);
                    foreach (Vehicle vehicle in detail.vehicles)
                    {
                        if (vehicle.isTarget)
                        {
                            mainLua.AddToTargetList(vehicle.GetObjectName());
                        }
                    }
                }
            }
        }
Exemplo n.º 11
0
        internal static void GetMain(CameraDetail detail, MainLua mainLua)
        {
            if (detail.cameras.Count > 0)
            {
                mainLua.AddToQuestTable(BuildCameraList(detail.cameras));

                mainLua.AddToQStep_Main(QStep_MainCommonMessages.mechaNoCaptureTargetMessages);

                mainLua.AddToQStep_Start_OnEnter(SetCameraAttributes);
                mainLua.AddToAuxiliary(SetCameraAttributes);

                if (detail.cameras.Any(camera => camera.isTarget))
                {
                    CheckQuestGenericEnemy cameraCheck = new CheckQuestGenericEnemy(mainLua);
                    foreach (Camera cam in detail.cameras)
                    {
                        if (cam.isTarget)
                        {
                            mainLua.AddToTargetList(cam.GetObjectName());
                        }
                    }
                }
            }
        }