Skip to content

Commit b2a5be0

Browse files
author
billsonnn
committed
Updates
1 parent 2f3e86a commit b2a5be0

20 files changed

Lines changed: 99 additions & 31 deletions

Turbo.Players/Grains/PlayerPresenceGrain.Room.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ await _grainFactory
108108
}
109109
}
110110

111-
public async Task SetPendingRoomAsync(RoomId roomId, bool approved)
111+
public Task SetPendingRoomAsync(RoomId roomId, bool approved)
112112
{
113113
_state.PendingRoomId = roomId;
114114
_state.PendingRoomApproved = approved;
115+
116+
return Task.CompletedTask;
115117
}
116118
}

Turbo.Players/Grains/PlayerWalletGrain.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,13 @@ CancellationToken ct
9191
return WalletDebitResult.Success();
9292
}
9393

94-
public async Task RollbackUpdatesAsync(
94+
public Task RollbackUpdatesAsync(
9595
List<WalletCurrencyUpdateSnapshot> updates,
9696
CancellationToken ct
9797
)
9898
{
9999
if (updates.Count == 0)
100-
return;
101-
100+
return Task.CompletedTask;
102101
foreach (var update in updates)
103102
{
104103
if (update is null || update.ChangedBy == 0)
@@ -112,14 +111,16 @@ CancellationToken ct
112111
};
113112
}
114113
}
114+
115+
return Task.CompletedTask;
115116
}
116117

117118
public Task<int> GetAmountForCurrencyAsync(CurrencyKind kind, CancellationToken ct) =>
118119
Task.FromResult(
119120
_currenciesByKind.TryGetValue(kind, out var snapshot) ? snapshot.Amount : 0
120121
);
121122

122-
public async Task<Dictionary<int, int>> GetActivityPointsAsync(CancellationToken ct)
123+
public Task<Dictionary<int, int>> GetActivityPointsAsync(CancellationToken ct)
123124
{
124125
var result = new Dictionary<int, int>();
125126

@@ -134,7 +135,7 @@ currency is null
134135
result[currency.CurrencyKind.ActivityPointType ?? -1] = currency.Amount;
135136
}
136137

137-
return result;
138+
return Task.FromResult(result);
138139
}
139140

140141
private static bool TryNormalizeRequests(

Turbo.Primitives/Messages/Incoming/Room/Chat/ChatMessage.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22

33
namespace Turbo.Primitives.Messages.Incoming.Room.Chat;
44

5-
public record ChatMessage : IMessageEvent { }
5+
public sealed record ChatMessage : IMessageEvent
6+
{
7+
public required string Text { get; init; }
8+
public required int StyleId { get; init; }
9+
public required int TrackingId { get; init; }
10+
}

Turbo.Primitives/Messages/Incoming/Room/Chat/ShoutMessage.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22

33
namespace Turbo.Primitives.Messages.Incoming.Room.Chat;
44

5-
public record ShoutMessage : IMessageEvent { }
5+
public sealed record ShoutMessage : IMessageEvent
6+
{
7+
public required string Text { get; init; }
8+
public required int StyleId { get; init; }
9+
}

Turbo.Primitives/Messages/Incoming/Room/Chat/WhisperMessage.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22

33
namespace Turbo.Primitives.Messages.Incoming.Room.Chat;
44

5-
public record WhisperMessage : IMessageEvent { }
5+
public sealed record WhisperMessage : IMessageEvent
6+
{
7+
public required string Text { get; init; }
8+
public required string RecipientName { get; init; }
9+
public required int StyleId { get; init; }
10+
}
Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1+
using System.Collections.Generic;
12
using Orleans;
23
using Turbo.Primitives.Networking;
4+
using Turbo.Primitives.Rooms.Enums;
35

46
namespace Turbo.Primitives.Messages.Outgoing.Room.Chat;
57

68
[GenerateSerializer, Immutable]
7-
public sealed record ChatMessageComposer : IComposer
9+
public record ChatMessageComposer : IComposer
810
{
9-
// TODO: add properties if/when identified
11+
[Id(0)]
12+
public required int UserId { get; init; }
13+
14+
[Id(1)]
15+
public required string Text { get; init; }
16+
17+
[Id(2)]
18+
public required AvatarGestureType Gesture { get; init; }
19+
20+
[Id(3)]
21+
public required int StyleId { get; init; }
22+
23+
[Id(4)]
24+
public required List<(string, string, bool)> Links { get; init; }
25+
26+
[Id(5)]
27+
public required int TrackingId { get; init; }
1028
}

Turbo.Primitives/Messages/Outgoing/Room/Chat/FloodControlMessageComposer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ namespace Turbo.Primitives.Messages.Outgoing.Room.Chat;
66
[GenerateSerializer, Immutable]
77
public sealed record FloodControlMessageComposer : IComposer
88
{
9-
// TODO: add properties if/when identified
9+
[Id(0)]
10+
public required int Seconds { get; init; }
1011
}

Turbo.Primitives/Messages/Outgoing/Room/Chat/RemainingMutePeriodMessageComposer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ namespace Turbo.Primitives.Messages.Outgoing.Room.Chat;
66
[GenerateSerializer, Immutable]
77
public sealed record RemainingMutePeriodMessageComposer : IComposer
88
{
9-
// TODO: add properties if/when identified
9+
[Id(0)]
10+
public required int SecondsRemaining { get; init; }
1011
}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
using Orleans;
2-
using Turbo.Primitives.Networking;
32

43
namespace Turbo.Primitives.Messages.Outgoing.Room.Chat;
54

65
[GenerateSerializer, Immutable]
7-
public sealed record ShoutMessageComposer : IComposer
8-
{
9-
// TODO: add properties if/when identified
10-
}
6+
public sealed record ShoutMessageComposer : ChatMessageComposer;

Turbo.Primitives/Messages/Outgoing/Room/Chat/UserTypingMessageComposer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ namespace Turbo.Primitives.Messages.Outgoing.Room.Chat;
66
[GenerateSerializer, Immutable]
77
public sealed record UserTypingMessageComposer : IComposer
88
{
9-
// TODO: add properties if/when identified
9+
[Id(0)]
10+
public required int UserId { get; init; }
11+
12+
[Id(1)]
13+
public required bool IsTyping { get; init; }
1014
}

0 commit comments

Comments
 (0)