Beispiel #1
0
        public static void WriteQuestLangs(DefinitionDetails definitionDetails)
        {
            string[] LangIdList        = UpdateNotifsManager.getLangIds();
            string[] DisplayList       = UpdateNotifsManager.getDispNotifs();
            int      notificationIndex = definitionDetails.progNotif;

            string entryLines = "";

            entryLines += string.Format("\n\t\t<Entry LangId=\"name_q{0}\" Color=\"5\" Value=\"{1}\" />", definitionDetails.QuestNum, definitionDetails.QuestTitle);
            entryLines += string.Format("\n\t\t<Entry LangId=\"info_q{0}\" Color=\"5\" Value=\"{1}\" />\n", definitionDetails.QuestNum, definitionDetails.QuestDesc);

            if (UpdateNotifsManager.isCustomNotification(LangIdList[notificationIndex]))
            {
                string progressId   = LangIdList[notificationIndex];
                string progressdesc = DisplayList[notificationIndex] + " [%d/%d]";

                entryLines += string.Format("\t\t<Entry LangId=\"{0}\" Color=\"5\" Value=\"{1}\" />\n", progressId, progressdesc);
            }

            string entries = string.Format("\n\t<Entries>{0}\t</Entries>\n", entryLines);

            string lngText = (string.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LangFile xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" Endianess=\"BigEndian\">{0}</LangFile>", entries));

            foreach (string language in lngLanguages)
            {
                string lngPath = string.Format("Sideop_Build//Assets//tpp/pack//ui//lang//lang_default_data_{0}_fpk//Assets//tpp//lang//ui", language);
                string lngFile = Path.Combine(lngPath, string.Format(@"ih_quest_q{0}.{1}.lng2.xml", definitionDetails.QuestNum, language));

                Directory.CreateDirectory(lngPath);
                File.WriteAllText(lngFile, lngText);

                XmlCompiler.CompileFile(lngFile, XmlCompiler.LangToolPath);
                File.Delete(lngFile);
            }
        }
Beispiel #2
0
        public static void WriteDefinitionLua(DefinitionDetails definitionDetails, QuestEntities questDetails)
        {
            CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("en-US");

            BodyInfoEntry bodyInfo = new BodyInfoEntry();

            if (questDetails.hostageBodyIndex >= 0)
            {
                bodyInfo = BodyInfo.BodyInfoArray[questDetails.hostageBodyIndex];
            }

            string packFiles = "";
            string locName   = "";
            string gender    = "MALE";

            if (bodyInfo.isFemale)
            {
                gender = "FEMALE";
            }

            if (definitionDetails.locationID == 10)
            {
                locName = "AFGH";
            }

            else if (definitionDetails.locationID == 20)
            {
                locName = "MAFR";
            }

            if (questDetails.hostages.Count > 0)
            {
                packFiles += "\n\t\t\"/Assets/tpp/pack/mission2/ih/ih_hostage_base.fpk\", ";
                packFiles += string.Format("\n\t\t\"{0}\", ", bodyInfo.missionPackPath);
            }

            packFiles += string.Format("\n\t\t\"/Assets/tpp/pack/mission2/quest/ih/{0}.fpk\", ", definitionDetails.FpkName);

            if (questDetails.hostages.Count > 0)
            {
                if (!bodyInfo.hasface)
                {
                    packFiles += string.Format("\n\t\trandomFaceListIH = {{gender = \"{0}\", count = {1}}}, ", gender, questDetails.hostages.Count);
                }
            }

            string bodies = "";
            string faces  = "";

            if (locName.Equals("AFGH") || locName.Equals("MAFR"))
            {
                if (EnemyInfo.balaCount > 0)
                {
                    faces += string.Format("TppDefine.QUEST_FACE_ID_LIST.{0}_BALACLAVA, ", locName);
                }
                if (EnemyInfo.armorCount > 0)
                {
                    bodies += string.Format("TppDefine.QUEST_BODY_ID_LIST.{0}_ARMOR, ", locName);
                }
            }

            foreach (string body in getEnemyBodies(questDetails.cpEnemies))
            {
                bodies += string.Format("TppEnemyBodyId.{0}, ", body);
            }
            foreach (string body in getEnemyBodies(questDetails.questEnemies))
            {
                bodies += string.Format("TppEnemyBodyId.{0}, ", body);
            }

            packFiles += string.Format("\n\t\tfaceIdList={{{0}}}, ", faces);
            packFiles += string.Format("\n\t\tbodyIdList={{{0}}}, ", bodies);

            string questPackList = string.Format("\tquestPackList = {{ {0} \n\t}},", packFiles);

            string locationInfo = string.Format("\tlocationId={0}, areaName=\"{1}\", iconPos=Vector3({2},{3},{4}), radius={5},", definitionDetails.locationID, definitionDetails.loadArea, definitionDetails.coords.xCoord, definitionDetails.coords.yCoord, definitionDetails.coords.zCoord, definitionDetails.radius);

            string progressLangId = string.Format("\tquestCompleteLangId=\"{0}\",", UpdateNotifsManager.getLangIds()[definitionDetails.progNotif]);

            string canOpenQuestFunction = "\tcanOpenQuest=InfQuest.AllwaysOpenQuest, --function that decides whether the quest is open or not";                                                                                          //todo in future update?

            string disableLzs = "\tdisableLzs={ }, --disables lzs while the quest is active. Turn on the debugMessages option and look in ih_log.txt for StartedMoveToLandingZone after calling in a support heli to find the lz name."; // todo in future update

            string equipIds = ""; List <string> requestHistory = new List <string>();

            foreach (Item item in questDetails.items)
            {
                if (item.item.Contains("EQP_WP_") && !requestHistory.Contains(item.item))
                {
                    equipIds += string.Format("\"{0}\", ", item.item);
                    requestHistory.Add(item.item);
                }
            }


            string requestEquipIds = string.Format("\trequestEquipIds={{ {0} }},", equipIds);

            string hasEnemyHeli = "\thasEnemyHeli = false, --reserves an enemy helicopter for the sideop. set to true if the sideop has a heli.";


            string DefinitionLuaPath = "Sideop_Build//GameDir//mod//quests//";
            string DefinitionLuaFile = Path.Combine(DefinitionLuaPath, string.Format("ih_quest_q{0}.lua", definitionDetails.QuestNum));

            Directory.CreateDirectory(DefinitionLuaPath);

            using (StreamWriter defFile =
                       new StreamWriter(DefinitionLuaFile))
            {
                defFile.WriteLine("local this={");
                defFile.WriteLine(questPackList);
                defFile.WriteLine(locationInfo);
                if (definitionDetails.locationID == 50)
                {
                    defFile.WriteLine(string.Format("\tclusterName=\"{0}\",", definitionDetails.loadArea.Substring(4)));
                }
                defFile.WriteLine(string.Format("\tcategory=TppQuest.QUEST_CATEGORIES_ENUM.{0},", definitionDetails.category));
                defFile.WriteLine(progressLangId);
                defFile.WriteLine(canOpenQuestFunction);
                defFile.WriteLine(string.Format("\tquestRank=TppDefine.QUEST_RANK.{0},", definitionDetails.reward));
                defFile.WriteLine(disableLzs);
                defFile.WriteLine(requestEquipIds);
                defFile.WriteLine(hasEnemyHeli);
                defFile.WriteLine("} return this");
            }
        }