1
1
using System . Text ;
2
2
using Google . ProtocolBuffers ;
3
- using MHServerEmu . Core ;
4
3
using MHServerEmu . Core . Extensions ;
5
4
using MHServerEmu . Core . Logging ;
6
5
using MHServerEmu . Core . Serialization ;
@@ -31,6 +30,18 @@ public enum ConditionSerializationFlags : uint
31
30
HasCancelOnFlags = 1 << 11 , // cancelOnFalgs from ConditionPrototype
32
31
}
33
32
33
+ [ Flags ]
34
+ public enum ConditionCancelOnFlags : uint
35
+ {
36
+ None = 0 ,
37
+ OnHit = 1 << 0 ,
38
+ OnKilled = 1 << 1 ,
39
+ OnPowerUse = 1 << 2 ,
40
+ OnPowerUsePost = 1 << 3 ,
41
+ OnTransfer = 1 << 4 ,
42
+ OnIntraRegionTeleport = 1 << 5
43
+ }
44
+
34
45
public class Condition
35
46
{
36
47
private static readonly Logger Logger = LogManager . CreateLogger ( ) ;
@@ -53,7 +64,7 @@ public class Condition
53
64
private bool _isEnabled = true ;
54
65
private int _updateIntervalMS ; // milliseconds
55
66
private ReplicatedPropertyCollection _properties = new ( ) ;
56
- private UInt32Flags _cancelOnFlags ;
67
+ private ConditionCancelOnFlags _cancelOnFlags ;
57
68
58
69
private ulong _creatorPlayerId ; // Player guid
59
70
@@ -82,7 +93,7 @@ public PrototypeId CreatorPowerPrototypeRef {
82
93
public bool IsEnabled { get => _isEnabled ; set => _isEnabled = value ; }
83
94
public TimeSpan UpdateInterval { get => TimeSpan . FromMilliseconds ( _updateIntervalMS ) ; set => _updateIntervalMS = ( int ) value . TotalMilliseconds ; }
84
95
public ReplicatedPropertyCollection Properties { get => _properties ; }
85
- public UInt32Flags CancelOnFlags { get => _cancelOnFlags ; set => _cancelOnFlags = value ; }
96
+ public ConditionCancelOnFlags CancelOnFlags { get => _cancelOnFlags ; set => _cancelOnFlags = value ; }
86
97
87
98
public ulong CreatorPlayerId { get => _creatorPlayerId ; set => _creatorPlayerId = value ; }
88
99
@@ -248,7 +259,7 @@ public bool Serialize(Archive archive, WorldEntity owner)
248
259
{
249
260
uint cancelOnFlags = 0 ;
250
261
success &= Serializer . Transfer ( archive , ref cancelOnFlags ) ;
251
- _cancelOnFlags = ( UInt32Flags ) cancelOnFlags ;
262
+ _cancelOnFlags = ( ConditionCancelOnFlags ) cancelOnFlags ;
252
263
}
253
264
}
254
265
@@ -297,7 +308,7 @@ public void Decode(CodedInputStream stream)
297
308
_properties . Decode ( stream ) ;
298
309
299
310
if ( _serializationFlags . HasFlag ( ConditionSerializationFlags . HasCancelOnFlags ) )
300
- _cancelOnFlags = ( UInt32Flags ) stream . ReadRawVarint32 ( ) ;
311
+ _cancelOnFlags = ( ConditionCancelOnFlags ) stream . ReadRawVarint32 ( ) ;
301
312
}
302
313
303
314
public void Encode ( CodedOutputStream stream )
0 commit comments