Skip to content

Commit e38fb40

Browse files
author
billsonnn
committed
Updates
1 parent cfda135 commit e38fb40

102 files changed

Lines changed: 1654 additions & 2140 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Turbo.Catalog/Configuration/CatalogConfig.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
31
namespace Turbo.Catalog.Configuration;
42

53
public class CatalogConfig

Turbo.Catalog/Providers/CatalogSnapshotProvider.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using Microsoft.EntityFrameworkCore;
77
using Microsoft.Extensions.Logging;
88
using Turbo.Database.Context;
9-
using Turbo.Database.Entities.Catalog;
109
using Turbo.Primitives.Catalog;
1110
using Turbo.Primitives.Catalog.Enums;
1211
using Turbo.Primitives.Catalog.Providers;

Turbo.Database/Entities/Catalog/LtdSeriesEntity.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.ComponentModel;
3-
using System.ComponentModel.DataAnnotations;
43
using System.ComponentModel.DataAnnotations.Schema;
54

65
namespace Turbo.Database.Entities.Catalog;

Turbo.Database/Entities/Messenger/MessengerFriendEntity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.ComponentModel.DataAnnotations.Schema;
33
using Microsoft.EntityFrameworkCore;
44
using Turbo.Database.Entities.Players;
5-
using Turbo.Primitives.FriendList.Enums;
5+
using Turbo.Primitives.Players.Enums.Messenger;
66

77
namespace Turbo.Database.Entities.Messenger;
88

Turbo.PacketHandlers/Catalog/PurchaseFromCatalogMessageHandler.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using Turbo.Messages.Registry;
77
using Turbo.Primitives.Catalog;
88
using Turbo.Primitives.Catalog.Enums;
9-
using Turbo.Primitives.Catalog.Grains;
109
using Turbo.Primitives.Catalog.Snapshots;
1110
using Turbo.Primitives.Messages.Incoming.Catalog;
1211
using Turbo.Primitives.Messages.Outgoing.Catalog;
Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Threading;
22
using System.Threading.Tasks;
3-
using Microsoft.Extensions.Configuration;
43
using Orleans;
54
using Turbo.Messages.Registry;
65
using Turbo.Primitives.Messages.Incoming.FriendList;
@@ -9,11 +8,10 @@
98

109
namespace Turbo.PacketHandlers.FriendList;
1110

12-
public class AcceptFriendMessageHandler(IGrainFactory grainFactory, IConfiguration configuration)
11+
public class AcceptFriendMessageHandler(IGrainFactory grainFactory)
1312
: IMessageHandler<AcceptFriendMessage>
1413
{
1514
private readonly IGrainFactory _grainFactory = grainFactory;
16-
private readonly IConfiguration _configuration = configuration;
1715

1816
public async ValueTask HandleAsync(
1917
AcceptFriendMessage message,
@@ -24,32 +22,18 @@ CancellationToken ct
2422
if (ctx.PlayerId <= 0)
2523
return;
2624

27-
var friendLimit = _configuration.GetValue<int>("Turbo:FriendList:UserFriendLimit");
28-
29-
var messengerGrain = _grainFactory.GetMessengerGrain(ctx.PlayerId);
30-
var (failures, updates) = await messengerGrain
31-
.AcceptFriendRequestsAsync(message.Friends, friendLimit, ct)
25+
var failures = await _grainFactory
26+
.GetPlayerMessengerGrain(ctx.PlayerId)
27+
.AcceptFriendRequestsAsync(message.Friends, ct)
3228
.ConfigureAwait(false);
3329

34-
// Send the failures result
30+
if (failures.Count == 0)
31+
return;
32+
3533
await ctx.SendComposerAsync(
3634
new AcceptFriendResultMessageComposer { Failures = failures },
3735
ct
3836
)
3937
.ConfigureAwait(false);
40-
41-
// Send the friend list update with newly added friends
42-
if (updates.Count > 0)
43-
{
44-
await ctx.SendComposerAsync(
45-
new FriendListUpdateMessageComposer
46-
{
47-
FriendCategories = [],
48-
Updates = updates,
49-
},
50-
ct
51-
)
52-
.ConfigureAwait(false);
53-
}
5438
}
5539
}

Turbo.PacketHandlers/FriendList/DeclineFriendMessageHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ CancellationToken ct
2121
if (ctx.PlayerId <= 0)
2222
return;
2323

24-
var messengerGrain = _grainFactory.GetMessengerGrain(ctx.PlayerId);
25-
await messengerGrain
24+
await _grainFactory
25+
.GetPlayerMessengerGrain(ctx.PlayerId)
2626
.DeclineFriendRequestsAsync(message.Friends, message.DeclineAll, ct)
2727
.ConfigureAwait(false);
2828
}

Turbo.PacketHandlers/FriendList/FollowFriendMessageHandler.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
using Orleans;
44
using Turbo.Messages.Registry;
55
using Turbo.Primitives.Messages.Incoming.FriendList;
6-
using Turbo.Primitives.Messages.Outgoing.FriendList;
7-
using Turbo.Primitives.Messages.Outgoing.Room.Session;
8-
using Turbo.Primitives.Orleans;
9-
using Turbo.Primitives.Rooms;
106

117
namespace Turbo.PacketHandlers.FriendList;
128

@@ -24,7 +20,7 @@ CancellationToken ct
2420
if (ctx.PlayerId <= 0)
2521
return;
2622

27-
var messengerGrain = _grainFactory.GetMessengerGrain(ctx.PlayerId);
23+
/* var messengerGrain = _grainFactory.GetMessengerGrain(ctx.PlayerId);
2824
var (success, roomId, error) = await messengerGrain
2925
.FollowFriendAsync(message.PlayerId, ct)
3026
.ConfigureAwait(false);
@@ -47,6 +43,6 @@ await ctx.SendComposerAsync(
4743
ct
4844
)
4945
.ConfigureAwait(false);
50-
}
46+
} */
5147
}
5248
}

Turbo.PacketHandlers/FriendList/FriendListUpdateMessageHandler.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Turbo.Messages.Registry;
55
using Turbo.Primitives.Messages.Incoming.FriendList;
66
using Turbo.Primitives.Messages.Outgoing.FriendList;
7-
using Turbo.Primitives.Orleans;
87

98
namespace Turbo.PacketHandlers.FriendList;
109

@@ -22,10 +21,8 @@ CancellationToken ct
2221
if (ctx.PlayerId <= 0)
2322
return;
2423

25-
// The client sends this as a periodic poll.
26-
// We respond with an empty update (real updates are pushed via grain notifications).
2724
await ctx.SendComposerAsync(
28-
new FriendListUpdateMessageComposer { FriendCategories = [], Updates = [] },
25+
new FriendListUpdateMessageComposer { Categories = [], Updates = [] },
2926
ct
3027
)
3128
.ConfigureAwait(false);

Turbo.PacketHandlers/FriendList/GetFriendRequestsMessageHandler.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ CancellationToken ct
2222
if (ctx.PlayerId <= 0)
2323
return;
2424

25-
var messengerGrain = _grainFactory.GetMessengerGrain(ctx.PlayerId);
26-
var requests = await messengerGrain.GetFriendRequestsAsync(ct).ConfigureAwait(false);
25+
var requests = await _grainFactory
26+
.GetPlayerMessengerGrain(ctx.PlayerId)
27+
.GetRequestsAsync(ct)
28+
.ConfigureAwait(false);
2729

2830
await ctx.SendComposerAsync(new FriendRequestsMessageComposer { Requests = requests }, ct)
2931
.ConfigureAwait(false);

0 commit comments

Comments
 (0)