コード例 #1
0
ファイル: HostageLua.cs プロジェクト: JosephZoeller/SOC
        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());
                        }
                    }
                }
            }
        }