diff --git a/LightlessSyncAPI/Data/Enum/GroupUserPreferredPermissions.cs b/LightlessSyncAPI/Data/Enum/GroupUserPreferredPermissions.cs index cf0b448..0924b83 100644 --- a/LightlessSyncAPI/Data/Enum/GroupUserPreferredPermissions.cs +++ b/LightlessSyncAPI/Data/Enum/GroupUserPreferredPermissions.cs @@ -8,4 +8,5 @@ public enum GroupUserPreferredPermissions DisableAnimations = 0x2, DisableSounds = 0x4, DisableVFX = 0x8, + ShareLocation = 0x10, } \ No newline at end of file diff --git a/LightlessSyncAPI/Data/Enum/UserPermissions.cs b/LightlessSyncAPI/Data/Enum/UserPermissions.cs index 7d875d7..6e2f0c0 100644 --- a/LightlessSyncAPI/Data/Enum/UserPermissions.cs +++ b/LightlessSyncAPI/Data/Enum/UserPermissions.cs @@ -9,4 +9,5 @@ public enum UserPermissions DisableSounds = 4, DisableVFX = 8, Sticky = 16, + ShareLocation = 32 } \ No newline at end of file diff --git a/LightlessSyncAPI/Data/Extensions/GroupUserPermissionsExtensions.cs b/LightlessSyncAPI/Data/Extensions/GroupUserPermissionsExtensions.cs index f55f1cd..a16fae0 100644 --- a/LightlessSyncAPI/Data/Extensions/GroupUserPermissionsExtensions.cs +++ b/LightlessSyncAPI/Data/Extensions/GroupUserPermissionsExtensions.cs @@ -23,6 +23,11 @@ public static class GroupUserPermissionsExtensions { return perm.HasFlag(GroupUserPreferredPermissions.Paused); } + + public static bool IsSharingLocation(this GroupUserPreferredPermissions perm) + { + return perm.HasFlag(GroupUserPreferredPermissions.ShareLocation); + } public static void SetDisableAnimations(this ref GroupUserPreferredPermissions perm, bool set) { @@ -47,4 +52,10 @@ public static class GroupUserPermissionsExtensions if (set) perm |= GroupUserPreferredPermissions.Paused; else perm &= ~GroupUserPreferredPermissions.Paused; } + + public static void SetShareLocation(this ref GroupUserPreferredPermissions perm, bool set) + { + if (set) perm |= GroupUserPreferredPermissions.ShareLocation; + else perm &= ~GroupUserPreferredPermissions.ShareLocation; + } } \ No newline at end of file diff --git a/LightlessSyncAPI/Data/Extensions/UserPermissionsExtensions.cs b/LightlessSyncAPI/Data/Extensions/UserPermissionsExtensions.cs index 6357b8f..63b516e 100644 --- a/LightlessSyncAPI/Data/Extensions/UserPermissionsExtensions.cs +++ b/LightlessSyncAPI/Data/Extensions/UserPermissionsExtensions.cs @@ -28,6 +28,10 @@ public static class UserPermissionsExtensions { return perm.HasFlag(UserPermissions.Sticky); } + public static bool IsSharingLocation(this UserPermissions perm) + { + return perm.HasFlag(UserPermissions.ShareLocation); + } public static void SetDisableAnimations(this ref UserPermissions perm, bool set) { @@ -58,4 +62,10 @@ public static class UserPermissionsExtensions if (sticky) perm |= UserPermissions.Sticky; else perm &= ~UserPermissions.Sticky; } + + public static void SetShareLocation(this ref UserPermissions perm, bool? set) + { + if (set == true) perm |= UserPermissions.ShareLocation; + else perm &= ~UserPermissions.ShareLocation; + } } \ No newline at end of file diff --git a/LightlessSyncAPI/Dto/CharaData/CharaDataFullDto.cs b/LightlessSyncAPI/Dto/CharaData/CharaDataFullDto.cs index 726b4b2..4eaa391 100644 --- a/LightlessSyncAPI/Dto/CharaData/CharaDataFullDto.cs +++ b/LightlessSyncAPI/Dto/CharaData/CharaDataFullDto.cs @@ -59,6 +59,7 @@ public record struct LocationInfo [Key(4)] public uint WardId { get; set; } [Key(5)] public uint HouseId { get; set; } [Key(6)] public uint RoomId { get; set; } + [Key(7)] public uint InstanceId { get; set; } } [MessagePackObject] diff --git a/LightlessSyncAPI/Dto/User/LocationDto.cs b/LightlessSyncAPI/Dto/User/LocationDto.cs new file mode 100644 index 0000000..0b70b26 --- /dev/null +++ b/LightlessSyncAPI/Dto/User/LocationDto.cs @@ -0,0 +1,9 @@ +using LightlessSync.API.Data; +using LightlessSync.API.Dto.CharaData; +using MessagePack; + +namespace LightlessSync.API.Dto.User; + + +[MessagePackObject(keyAsPropertyName: true)] +public record LocationDto(UserData user, LocationInfo location); \ No newline at end of file diff --git a/LightlessSyncAPI/SignalR/ILightlessHub.cs b/LightlessSyncAPI/SignalR/ILightlessHub.cs index 46b4074..70ce047 100644 --- a/LightlessSyncAPI/SignalR/ILightlessHub.cs +++ b/LightlessSyncAPI/SignalR/ILightlessHub.cs @@ -8,9 +8,9 @@ using LightlessSync.API.Dto.User; namespace LightlessSync.API.SignalR; -public interface ILightlessHub -{ - const int ApiVersion = 35; +public interface ILightlessHub +{ + const int ApiVersion = 35; const string Path = "/lightless"; Task CheckClientHealth(); @@ -45,6 +45,7 @@ public interface ILightlessHub Task Client_GposeLobbyPushPoseData(UserData userData, PoseData poseData); Task Client_GposeLobbyPushWorldData(UserData userData, WorldData worldData); Task Client_ChatReceive(ChatMessageDto message); + Task Client_SendLocationToClient(LocationDto locationDto); Task GetConnectionDto(); Task> GetZoneChatChannels(); @@ -112,7 +113,11 @@ public interface ILightlessHub Task GposeLobbyPushPoseData(PoseData poseData); Task GposeLobbyPushWorldData(WorldData worldData); Task UpdateChatPresence(ChatPresenceUpdateDto presence); - Task SendChatMessage(ChatSendRequestDto request); - Task ReportChatMessage(ChatReportSubmitDto request); - Task SetChatParticipantMute(ChatParticipantMuteRequestDto request); -} + Task SendChatMessage(ChatSendRequestDto request); + Task ReportChatMessage(ChatReportSubmitDto request); + Task SetChatParticipantMute(ChatParticipantMuteRequestDto request); + + Task UpdateLocation(LocationDto locationDto, bool offline); + Task> RequestAllLocationInfo(); + +} diff --git a/LightlessSyncAPI/SignalR/ILightlessHubClient.cs b/LightlessSyncAPI/SignalR/ILightlessHubClient.cs index 38918de..a63c013 100644 --- a/LightlessSyncAPI/SignalR/ILightlessHubClient.cs +++ b/LightlessSyncAPI/SignalR/ILightlessHubClient.cs @@ -58,4 +58,5 @@ public interface ILightlessHubClient : ILightlessHub void OnGposeLobbyPushCharacterData(Action act); void OnGposeLobbyPushPoseData(Action act); void OnGposeLobbyPushWorldData(Action act); + void OnReciveLocation(Action act); } \ No newline at end of file