Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
mainmenudata.c
Go to the documentation of this file.
1
class
MainMenuData
2
{
3
protected
static
ref
JsonDataNewsList
m_NewsData
;
4
protected
static
ref
array<ref ModInfo>
m_AllMods
;
5
protected
static
ref
map<string, ref ModInfo>
m_AllDlcsMap
;
6
7
static
JsonDataNewsList
GetNewsData
()
8
{
9
if
(!
m_NewsData
)
10
m_NewsData
=
new
JsonDataNewsList
();
11
12
return
m_NewsData
;
13
}
14
15
static
JsonDataNewsArticle
GetNewsArticle
(
int
index)
16
{
17
if
(!
m_NewsData
)
18
return
null;
19
20
if
(index >
m_NewsData
.News.Count() - 1)
21
{
22
ErrorEx
(
string
.Format(
"Requested news article for index %1 but article count is %2. Index out of bounds!"
, index,
m_NewsData
.News.Count()));
23
return
null;
24
}
25
26
return
m_NewsData
.News[index];
27
}
28
29
static
void
LoadMods
()
30
{
31
if
(!
m_NewsData
)
32
GetNewsData
();
33
34
if
(
m_AllMods
!= null)
35
return
;
36
37
m_AllMods
=
new
array<ref ModInfo>
;
38
39
g_Game
.GetModInfos(
m_AllMods
);
40
if
(
m_AllMods
.Count() > 0)
41
{
42
m_AllMods
.Remove(
m_AllMods
.Count() - 1);
43
m_AllMods
.Invert();
44
}
45
46
FilterDLCs
(
m_AllMods
);
47
48
CreateDLCArticles
();
49
}
50
51
static
void
FilterDLCs
(inout
array<ref ModInfo>
modArray)
52
{
53
if
(!
m_AllDlcsMap
)
54
m_AllDlcsMap
=
new
map<string,ref ModInfo>
;
55
else
56
m_AllDlcsMap
.Clear();
57
58
ModInfo
info;
59
int
count = modArray.Count();
60
for
(
int
i = count - 1; i >= 0; i--)
61
{
62
info = modArray[i];
63
if
(info.
GetIsDLC
())
64
{
65
string
dlcName = info.
GetName
();
66
dlcName.
ToLower
();
67
dlcName.
Replace
(
"dayz "
,
""
);
68
m_AllDlcsMap
.Insert(dlcName, info);
69
}
70
}
71
}
72
73
static
void
CreateDLCArticles
()
74
{
75
if
(!
m_AllDlcsMap
)
76
{
77
ErrorEx
(
"Failed to get DLC map data!"
,
ErrorExSeverity
.WARNING);
78
return
;
79
}
80
81
if
(!
m_NewsData
)
82
{
83
ErrorEx
(
"Failed to get news data!"
,
ErrorExSeverity
.WARNING);
84
return
;
85
}
86
87
for
(
int
i = 0; i <
m_AllDlcsMap
.Count(); i++)
88
{
89
ModInfo
info =
m_AllDlcsMap
.GetElement(i);
90
if
(info.
GetIsOwned
())
91
{
92
continue
;
93
}
94
JsonDataNewsArticle
dlcArticle =
new
JsonDataNewsArticle
;
95
96
dlcArticle.
categoryID
=
NewsCategory
.DLCS;
97
dlcArticle.
excerpt
= info.
GetOverview
();
98
dlcArticle.
title
= info.
GetName
();
99
dlcArticle.
fullUrl
= info.
GetAction
();
100
string
dlcName = info.
GetName
();
101
dlcName.
ToLower
();
102
dlcName.
Replace
(
"dayz "
,
""
);
103
dlcArticle.
dlcName
= dlcName;
104
dlcArticle.
coverImage
=
ModInfo
.
GetDLCImage
(dlcName);
105
m_NewsData
.News.Insert(dlcArticle);
106
}
107
109
JsonDataNewsArticle
tempDLCArticle =
new
JsonDataNewsArticle
;
110
tempDLCArticle.
categoryID
=
NewsCategory
.DLC_PROMO;
111
tempDLCArticle.
title
=
"#dlc_news_badlands"
;
112
#ifdef PLATFORM_WINDOWS
113
tempDLCArticle.
fullUrl
=
"https://store.steampowered.com/app/3816030"
;
114
#else
115
tempDLCArticle.
fullUrl
=
""
;
116
#endif
117
tempDLCArticle.
dlcName
=
"badlands"
;
118
tempDLCArticle.
coverImage
=
ModInfo
.
GetDLCImage
(tempDLCArticle.
dlcName
);
119
m_NewsData
.News.Insert(tempDLCArticle);
120
}
121
122
static
void
ClearAllDLCs
()
123
{
124
m_AllMods
= null;
125
m_AllDlcsMap
= null;
126
m_NewsData
= null;
127
}
128
130
static
ModInfo
GetDLCModInfoByName
(
string
dlcName)
131
{
132
ModInfo
modInfo;
133
m_AllDlcsMap
.Find(dlcName, modInfo);
134
return
modInfo;
135
}
136
138
static
array<ref ModInfo>
GetAllMods
()
139
{
140
return
m_AllMods
;
141
}
142
}
JsonDataNewsArticle
Definition
bioslobbyservice.c:6
JsonDataNewsArticle::coverImage
string coverImage
Definition
bioslobbyservice.c:21
JsonDataNewsArticle::categoryID
int categoryID
Definition
bioslobbyservice.c:8
JsonDataNewsArticle::excerpt
string excerpt
Definition
bioslobbyservice.c:17
JsonDataNewsArticle::title
string title
Definition
bioslobbyservice.c:19
JsonDataNewsArticle::fullUrl
string fullUrl
Definition
bioslobbyservice.c:22
JsonDataNewsArticle::dlcName
string dlcName
Definition
bioslobbyservice.c:11
JsonDataNewsList
Definition
bioslobbyservice.c:26
MainMenuData
Definition
mainmenudata.c:2
MainMenuData::GetAllMods
static array< ref ModInfo > GetAllMods()
All mods including DLCs.
Definition
mainmenudata.c:138
MainMenuData::GetNewsData
static JsonDataNewsList GetNewsData()
Definition
mainmenudata.c:7
MainMenuData::GetNewsArticle
static JsonDataNewsArticle GetNewsArticle(int index)
Definition
mainmenudata.c:15
MainMenuData::m_AllMods
static ref array< ref ModInfo > m_AllMods
Definition
mainmenudata.c:4
MainMenuData::GetDLCModInfoByName
static ModInfo GetDLCModInfoByName(string dlcName)
DLCs only.
Definition
mainmenudata.c:130
MainMenuData::CreateDLCArticles
static void CreateDLCArticles()
Definition
mainmenudata.c:73
MainMenuData::m_NewsData
static ref JsonDataNewsList m_NewsData
Definition
mainmenudata.c:3
MainMenuData::FilterDLCs
static void FilterDLCs(inout array< ref ModInfo > modArray)
Definition
mainmenudata.c:51
MainMenuData::LoadMods
static void LoadMods()
Definition
mainmenudata.c:29
MainMenuData::m_AllDlcsMap
static ref map< string, ref ModInfo > m_AllDlcsMap
Definition
mainmenudata.c:5
MainMenuData::ClearAllDLCs
static void ClearAllDLCs()
Definition
mainmenudata.c:122
ModInfo
Definition
modinfo.c:2
ModInfo::GetDLCImage
static string GetDLCImage(string name)
Definition
modinfo.c:24
ModInfo::GetOverview
proto owned string GetOverview()
ModInfo::GetName
proto owned string GetName()
ModInfo::GetIsDLC
proto bool GetIsDLC()
ModInfo::GetIsOwned
proto bool GetIsOwned()
ModInfo::GetAction
proto owned string GetAction()
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
map
Definition
cachedequipmentstorage.c:4
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
ErrorExSeverity
ErrorExSeverity
Definition
endebug.c:62
ErrorEx
enum ShapeType ErrorEx
string::Replace
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
string::ToLower
proto int ToLower()
Changes string to lowercase.
NewsCategory
NewsCategory
Definition
newscarousel.c:2
Games
Dayz
scripts
5_mission
gui
newui
mainmenu
mainmenudata.c
Generated by
1.17.0