Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
HairstyleUnlocksHelper.cs
Go to the documentation of this file.
1
using
System.Collections.Generic
;
2
3
namespace
Terraria.GameContent
;
4
5
public
class
HairstyleUnlocksHelper
6
{
7
public
List<int>
AvailableHairstyles
=
new
List<int>
();
8
9
private
bool
_defeatedMartians
;
10
11
private
bool
_defeatedMoonlord
;
12
13
private
bool
_defeatedPlantera
;
14
15
private
bool
_isAtStylist
;
16
17
private
bool
_isAtCharacterCreation
;
18
19
public
void
UpdateUnlocks
()
20
{
21
if
(
ListWarrantsRemake
())
22
{
23
RebuildList
();
24
}
25
}
26
27
private
bool
ListWarrantsRemake
()
28
{
29
bool
flag = NPC.downedMartians && !
Main
.
gameMenu
;
30
bool
flag2
= NPC.downedMoonlord && !
Main
.
gameMenu
;
31
bool
flag3
= NPC.downedPlantBoss && !
Main
.
gameMenu
;
32
bool
flag4
= Main.hairWindow && !
Main
.
gameMenu
;
33
bool
gameMenu =
Main
.
gameMenu
;
34
bool
result =
false
;
35
if
(
_defeatedMartians
!= flag ||
_defeatedMoonlord
!=
flag2
||
_defeatedPlantera
!=
flag3
||
_isAtStylist
!=
flag4
||
_isAtCharacterCreation
!= gameMenu)
36
{
37
result =
true
;
38
}
39
_defeatedMartians
= flag;
40
_defeatedMoonlord
=
flag2
;
41
_defeatedPlantera
=
flag3
;
42
_isAtStylist
=
flag4
;
43
_isAtCharacterCreation
= gameMenu;
44
return
result;
45
}
46
47
private
void
RebuildList
()
48
{
49
List<int>
availableHairstyles
=
AvailableHairstyles
;
50
availableHairstyles
.
Clear
();
51
if
(
_isAtCharacterCreation
||
_isAtStylist
)
52
{
53
for
(
int
i = 0; i < 51; i++)
54
{
55
availableHairstyles
.
Add
(i);
56
}
57
availableHairstyles
.
Add
(136);
58
availableHairstyles
.
Add
(137);
59
availableHairstyles
.
Add
(138);
60
availableHairstyles
.
Add
(139);
61
availableHairstyles
.
Add
(140);
62
availableHairstyles
.
Add
(141);
63
availableHairstyles
.
Add
(142);
64
availableHairstyles
.
Add
(143);
65
availableHairstyles
.
Add
(144);
66
availableHairstyles
.
Add
(147);
67
availableHairstyles
.
Add
(148);
68
availableHairstyles
.
Add
(149);
69
availableHairstyles
.
Add
(150);
70
availableHairstyles
.
Add
(151);
71
availableHairstyles
.
Add
(154);
72
availableHairstyles
.
Add
(155);
73
availableHairstyles
.
Add
(157);
74
availableHairstyles
.
Add
(158);
75
availableHairstyles
.
Add
(161);
76
}
77
for
(
int
j
= 51;
j
< 123;
j
++)
78
{
79
availableHairstyles
.
Add
(
j
);
80
}
81
availableHairstyles
.
Add
(134);
82
availableHairstyles
.
Add
(135);
83
availableHairstyles
.
Add
(146);
84
availableHairstyles
.
Add
(152);
85
availableHairstyles
.
Add
(153);
86
availableHairstyles
.
Add
(156);
87
availableHairstyles
.
Add
(159);
88
availableHairstyles
.
Add
(160);
89
if
(
_defeatedPlantera
)
90
{
91
availableHairstyles
.
Add
(162);
92
availableHairstyles
.
Add
(164);
93
availableHairstyles
.
Add
(163);
94
availableHairstyles
.
Add
(145);
95
}
96
if
(
_defeatedMartians
)
97
{
98
availableHairstyles
.
AddRange
(
new
int
[10] { 132, 131, 130, 129, 128, 127, 126, 125, 124, 123 });
99
}
100
if
(
_defeatedMartians
&&
_defeatedMoonlord
)
101
{
102
availableHairstyles
.
Add
(133);
103
}
104
}
105
}
System.Collections.Generic.Dictionary.AddRange
void AddRange(IEnumerable< KeyValuePair< TKey, TValue > > collection)
Definition
Dictionary.cs:837
System.Collections.Generic.Dictionary.Clear
void Clear()
Definition
Dictionary.cs:904
System.Collections.Generic.Dictionary.Add
void Add(TKey key, TValue value)
Definition
Dictionary.cs:873
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
Terraria.GameContent.HairstyleUnlocksHelper._isAtStylist
bool _isAtStylist
Definition
HairstyleUnlocksHelper.cs:15
Terraria.GameContent.HairstyleUnlocksHelper.AvailableHairstyles
List< int > AvailableHairstyles
Definition
HairstyleUnlocksHelper.cs:7
Terraria.GameContent.HairstyleUnlocksHelper.ListWarrantsRemake
bool ListWarrantsRemake()
Definition
HairstyleUnlocksHelper.cs:27
Terraria.GameContent.HairstyleUnlocksHelper._isAtCharacterCreation
bool _isAtCharacterCreation
Definition
HairstyleUnlocksHelper.cs:17
Terraria.GameContent.HairstyleUnlocksHelper.RebuildList
void RebuildList()
Definition
HairstyleUnlocksHelper.cs:47
Terraria.GameContent.HairstyleUnlocksHelper._defeatedPlantera
bool _defeatedPlantera
Definition
HairstyleUnlocksHelper.cs:13
Terraria.GameContent.HairstyleUnlocksHelper._defeatedMoonlord
bool _defeatedMoonlord
Definition
HairstyleUnlocksHelper.cs:11
Terraria.GameContent.HairstyleUnlocksHelper._defeatedMartians
bool _defeatedMartians
Definition
HairstyleUnlocksHelper.cs:9
Terraria.GameContent.HairstyleUnlocksHelper.UpdateUnlocks
void UpdateUnlocks()
Definition
HairstyleUnlocksHelper.cs:19
Terraria.GameContent.HairstyleUnlocksHelper
Definition
HairstyleUnlocksHelper.cs:6
Terraria.Main.gameMenu
static bool gameMenu
Definition
Main.cs:1926
Terraria.Main
Definition
Main.cs:79
System.Collections.Generic
Definition
IHashKeyCollection.cs:1
Terraria.GameContent
Definition
AchievementsHelper.cs:1
source
Terraria.GameContent
HairstyleUnlocksHelper.cs
Generated by
1.10.0