forked from TehCheat/XpBar
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCore.cs
More file actions
157 lines (146 loc) · 3.85 KB
/
Core.cs
File metadata and controls
157 lines (146 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
using System;
using ExileCore;
using ExileCore.PoEMemory.Components;
using ExileCore.Shared.Enums;
using SharpDX;
namespace XPBar
{
public class Core : BaseSettingsPlugin<Settings>
{
#region ExpTable
private readonly uint[] ExpTable =
{
0,
525,
1760,
3781,
7184,
12186,
19324,
29377,
43181,
61693,
85990,
117506,
157384,
207736,
269997,
346462,
439268,
551295,
685171,
843709,
1030734,
1249629,
1504995,
1800847,
2142652,
2535122,
2984677,
3496798,
4080655,
4742836,
5490247,
6334393,
7283446,
8384398,
9541110,
10874351,
12361842,
14018289,
15859432,
17905634,
20171471,
22679999,
25456123,
28517857,
31897771,
35621447,
39721017,
44225461,
49176560,
54607467,
60565335,
67094245,
74247659,
82075627,
90631041,
99984974,
110197515,
121340161,
133497202,
146749362,
161191120,
176922628,
194049893,
212684946,
232956711,
255001620,
278952403,
304972236,
333233648,
363906163,
397194041,
433312945,
472476370,
514937180,
560961898,
610815862,
664824416,
723298169,
786612664,
855129128,
929261318,
1009443795,
1096169525,
1189918242,
1291270350,
1400795257,
1519130326,
1646943474,
1784977296,
1934009687,
2094900291,
2268549086,
2455921256,
2658074992,
2876116901,
3111280300,
3364828162,
3638186694,
3932818530,
4250334444,
};
#endregion
public override bool Initialise()
{
return true;
}
private double GetExpPct(int Level, uint Exp)
{
if (Level >= 100) return 0.0f;
uint LevelStartExp = ExpTable[Level - 1];
uint ExpNeededForNextLevel = ExpTable[Level];
uint CurrLevelExp = Exp - LevelStartExp;
uint NextLevelExp = ExpNeededForNextLevel - LevelStartExp;
double LevelPct = (double)CurrLevelExp / NextLevelExp;
return LevelPct * 100;
}
public override void Render()
{
int PlayerLevel = GameController.Player.GetComponent<Player>().Level;
uint PlayerExp = GameController.Player.GetComponent<Player>().XP;
double ExpPct = GetExpPct(PlayerLevel, PlayerExp);
var PlayerExpString = PlayerLevel + ": " + Math.Round(ExpPct, 3) + "%";
var size = Graphics.MeasureText(PlayerExpString, 20);
var scrRect = GameController.Window.GetWindowRectangle();
var center = new Vector2(scrRect.X + scrRect.Width / 2, scrRect.Height - 10);
center.Y -= 5;
var textRect = center;
textRect.Y -= 5;
Graphics.DrawText(PlayerExpString, textRect, Color.White, FontAlign.Center); // - new Vector2(size.Width / 2, size.Height / 2)
var drawRect = new RectangleF(center.X - 5 - size.X / 2, center.Y - size.Y / 2, size.X + 10, size.Y);
Graphics.DrawBox(drawRect, Color.Black);
}
}
}