forked from Elfocrash/L2dotNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayerStatus.cs
More file actions
54 lines (43 loc) · 1.28 KB
/
Copy pathPlayerStatus.cs
File metadata and controls
54 lines (43 loc) · 1.28 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
using System.Runtime.CompilerServices;
using L2dotNET.Models.Player;
namespace L2dotNET.Models.Status
{
public class PlayerStatus : CharStatus
{
public double CurrentCp { get; set; } = 0;
public PlayerStatus(L2Player player) : base(player)
{
Character = player;
}
public void SetCurrentCp(double newCp)
{
//SetCurrentHp(newCp, true);
}
[MethodImpl(MethodImplOptions.Synchronized)]
public void SetCurrentCp(double newCp, bool broadcastUpdate)
{
L2Player player = (L2Player)Character;
double maxCp = player.MaxCp;
if (player.Dead)
return;
if (newCp < 0)
newCp = 0;
if(newCp >= maxCp)
{
CurrentCp = maxCp;
_flagsRegenActive &= RegenFlagCp;
if(_flagsRegenActive == 0)
StopHpMpRegeneration();
}
if (broadcastUpdate)
Character.BroadcastStatusUpdateAsync();
}
public void ReduceCp(int value)
{
if (CurrentCp > value)
CurrentCp = CurrentHp - value;
else
CurrentCp = 0;
}
}
}