Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
BigProgressBarSystem.cs
Go to the documentation of this file.
4using Terraria.IO;
5
7
9{
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
42 public static bool ShowText = true;
43
45 {
46 { 125, _twinsBar },
47 { 126, _twinsBar },
48 { 13, _eaterOfWorldsBar },
49 { 14, _eaterOfWorldsBar },
50 { 15, _eaterOfWorldsBar },
51 { 266, _brainOfCthuluBar },
52 { 245, _golemBar },
53 { 246, _golemBar },
54 { 249, _neverValid },
55 { 517, _solarPillarBar },
56 { 422, _vortexPillarBar },
57 { 507, _nebulaPillarBar },
58 { 493, _stardustPillarBar },
59 { 398, _moonlordBar },
60 { 396, _moonlordBar },
61 { 397, _moonlordBar },
62 { 548, _neverValid },
63 { 549, _neverValid },
64 { 491, _pirateShipBar },
65 { 492, _pirateShipBar },
66 { 440, _neverValid },
67 { 395, _martianSaucerBar },
68 { 393, _martianSaucerBar },
69 { 394, _martianSaucerBar },
70 { 68, _neverValid },
71 { 668, _deerclopsBar }
72 };
73
74 private const string _preferencesKey = "ShowBossBarHealthText";
75
77 {
78 preferences.OnLoad += Configuration_OnLoad;
79 preferences.OnSave += Configuration_Save;
80 }
81
82 public void Update()
83 {
84 if (_currentBar == null)
85 {
87 }
89 {
90 _currentBar = null;
91 }
92 }
93
94 public void Draw(SpriteBatch spriteBatch)
95 {
96 if (_currentBar != null)
97 {
98 _currentBar.Draw(ref _info, spriteBatch);
99 }
100 }
101
102 private void TryFindingNPCToTrack()
103 {
105 value.Inflate(5000, 5000);
106 float num = float.PositiveInfinity;
107 for (int i = 0; i < 200; i++)
108 {
109 NPC nPC = Main.npc[i];
110 if (nPC.active && nPC.Hitbox.Intersects(value))
111 {
112 float num2 = nPC.Distance(Main.LocalPlayer.Center);
113 if (num > num2 && TryTracking(i))
114 {
115 num = num2;
116 }
117 }
118 }
119 }
120
121 public bool TryTracking(int npcIndex)
122 {
124 {
125 return false;
126 }
128 if (!nPC.active)
129 {
130 return false;
131 }
133 bigProgressBarInfo.npcIndexToAimAt = npcIndex;
136 if (_bossBarsByNpcNetId.TryGetValue(nPC.netID, out var value))
137 {
138 bigProgressBar = value;
139 }
140 if (!bigProgressBar.ValidateAndCollectNecessaryInfo(ref info))
141 {
142 return false;
143 }
145 info.showText = true;
146 _info = info;
147 return true;
148 }
149
151 {
152 obj.Put("ShowBossBarHealthText", ShowText);
153 }
154
156 {
157 ShowText = obj.Get("ShowBossBarHealthText", ShowText);
158 }
159
160 public static void ToggleShowText()
161 {
163 }
164}
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
static int screenHeight
Definition Main.cs:1721
static Vector2 screenPosition
Definition Main.cs:1715
static NPC[] npc
Definition Main.cs:1685
static int screenWidth
Definition Main.cs:1719
static Player LocalPlayer
Definition Main.cs:2829
void Draw(ref BigProgressBarInfo info, SpriteBatch spriteBatch)
bool ValidateAndCollectNecessaryInfo(ref BigProgressBarInfo info)