Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_GameLogHelper.c
Go to the documentation of this file.
2 {
3  //------------------------------------------------------------------------------------------------
4  static void LogScenariosConfPaths(int maxWorkshopScenarios = 500)
5  {
6  array<ResourceName> officialScenarioResourceNames = GetGame().GetDefaultGameConfigs();
7  array<MissionWorkshopItem> missionWorkshopItems = {};
8 
9  WorkshopApi workshopAPI = GetGame().GetBackendApi().GetWorkshop();
10  if (workshopAPI)
11  workshopAPI.GetPageScenarios(missionWorkshopItems, 0, maxWorkshopScenarios);
12 
13  Print("--------------------------------------------------");
14  if (!officialScenarioResourceNames)
15  {
16  Print("could not get official scenarios conf paths", LogLevel.WARNING);
17  }
18  else
19  {
20  Resource resource;
21  BaseContainer container;
22  SCR_MissionHeader missionHeader;
23  string missionName;
24  PrintFormat("Official scenarios (%1 entries)", officialScenarioResourceNames.Count());
25  Print("--------------------------------------------------");
26  foreach (ResourceName officialScenarioResourceName : officialScenarioResourceNames)
27  {
28  missionHeader = SCR_ConfigHelperT<SCR_MissionHeader>.GetConfigObject(officialScenarioResourceName);
29  if (missionHeader)
30  {
31  missionName = missionHeader.m_sName;
32  }
33  else
34  {
35  missionName = "n/a";
36  resource = Resource.Load(officialScenarioResourceName);
37  if (resource.IsValid())
38  {
39  container = resource.GetResource().ToBaseContainer();
40  if (container)
41  container.Get("m_sName", missionName);
42  }
43  }
44 
45  if (missionName.Contains("#"))
46  missionName = WidgetManager.Translate(missionName);
47 
48  PrintFormat("%1 (%2)", officialScenarioResourceName, missionName);
49  }
50  }
51 
52  Print("--------------------------------------------------");
53 
54  if (!workshopAPI)
55  {
56  Print("could not get Workshop API to read mod scenarios conf paths", LogLevel.WARNING);
57  Print("--------------------------------------------------");
58  return;
59  }
60 
61  int workshopCount = missionWorkshopItems.Count() - officialScenarioResourceNames.Count();
62  if (workshopCount < 1)
63  return;
64 
65  PrintFormat("Workshop scenarios (%1 entries)", workshopCount);
66  Print("--------------------------------------------------");
67  foreach (MissionWorkshopItem mission : missionWorkshopItems)
68  {
69  // mods cannot be loaded here, so ResourceName will do
70  if (mission.GetOwner())
71  Print(mission.Id());
72  }
73  Print("--------------------------------------------------");
74  }
75 };
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_GameLogHelper
Definition: SCR_GameLogHelper.c:1
SCR_MissionHeader
Definition: SCR_MissionHeader.c:1