1
1
using System . Text ;
2
2
using Google . ProtocolBuffers ;
3
3
using Gazillion ;
4
+ using MHServerEmu . Common ;
5
+ using MHServerEmu . Common . Extensions ;
4
6
5
7
namespace MHServerEmu . Games . Achievements
6
8
{
7
9
public class AchievementState
8
10
{
9
11
public uint Id { get ; set ; }
10
12
public uint Count { get ; set ; }
11
- public ulong CompletedDate { get ; set ; }
13
+ public long CompletedDate { get ; set ; } // DateTime in microseconds
12
14
13
15
public AchievementState ( CodedInputStream stream )
14
16
{
15
17
Id = stream . ReadRawVarint32 ( ) ;
16
18
Count = stream . ReadRawVarint32 ( ) ;
17
- CompletedDate = stream . ReadRawVarint64 ( ) ;
19
+ CompletedDate = stream . ReadRawInt64 ( ) ;
18
20
}
19
21
20
- public AchievementState ( uint id , uint count , ulong completedDate )
22
+ public AchievementState ( uint id , uint count , long completedDate )
21
23
{
22
24
Id = id ;
23
25
Count = count ;
@@ -28,15 +30,15 @@ public void Encode(CodedOutputStream stream)
28
30
{
29
31
stream . WriteRawVarint64 ( Id ) ;
30
32
stream . WriteRawVarint64 ( Count ) ;
31
- stream . WriteRawVarint64 ( CompletedDate ) ;
33
+ stream . WriteRawInt64 ( CompletedDate ) ;
32
34
}
33
35
34
36
public NetMessageAchievementStateUpdate . Types . AchievementState ToNetStruct ( )
35
37
{
36
38
return NetMessageAchievementStateUpdate . Types . AchievementState . CreateBuilder ( )
37
39
. SetId ( Id )
38
40
. SetCount ( Count )
39
- . SetCompleteddate ( CompletedDate )
41
+ . SetCompleteddate ( ( ulong ) CompletedDate )
40
42
. Build ( ) ;
41
43
}
42
44
@@ -45,7 +47,7 @@ public override string ToString()
45
47
StringBuilder sb = new ( ) ;
46
48
sb . AppendLine ( $ "Id: { Id } ") ;
47
49
sb . AppendLine ( $ "Count: { Count } ") ;
48
- sb . AppendLine ( $ "CompletionDate: 0x { CompletedDate : X } ") ;
50
+ sb . AppendLine ( $ "CompletionDate: { Clock . DateTimeMicrosecondsToDateTime ( CompletedDate ) } ") ;
49
51
return sb . ToString ( ) ;
50
52
}
51
53
}
0 commit comments