Some checks failed
Tag and Release Lightless / tag-and-release (push) Failing after 32s
 Lightless 1.12.0 is HERE! In this major update, we are introducing something we've been working on and testing for the last couple of weeks. In this update we are introducing a new (**OPTIONAL**) feature called **LightFinder**! We took inspiration from FFXIV's very own Party Finder and decided to implement something that allows users to not only look for fellow Lightless users, but also put up their Syncshell for others looking to join a sync community! When you enable LightFinder, you will be visible to other LightFinder users for **3 hours** or when you want to disabled it. When the 3 hours are up, you can either leave it disabled or enable it again for another 3 hours. The tag shown above will show above your nameplate, and you will be able to receive pair requests in your UI from other users with LightFinder enabled without having to input their uid!  Are you at a Venue? In Limsa? Partying in the streets of Uldah? If you're looking for fellow Lightless users you can now enable LightFinder and you will be shown to others who also have LightFinder enabled! Looking for a Syncshell to join? Enable LightFinder to see what SyncShells are available to join! Want to advertise your Syncshell? Choose the syncshell you want to put up in LightFinder and enable LightFinder. **IMPORTANT: We want to stress the fact that, if you just want to sync with just your friends and no one else, this does not take that away. No one will know you use Lightless unless you choose to tell them, or use this **OPTIONAL** feature. Your privacy is still maintained if you don't want to use the feature.** # Major Changes ## LightFinder - **OPTIONAL FEATURE** - **DOES NOT AFFECT YOU IF YOU DON'T WANT TO USE IT**  * New **OPTIONAL** syncing feature where one can enable something like a Party Finder so that other Lightless users in the area can see you are looking for people to sync with. Enable it by clicking the compass button and then the `Enable LightFinder` button.  * [L] Send Pair Request has been added to player context menus. You should still be able to send a request without Lightfinder on BUT you will need to know the other player is using Lightless and have them send a pair request back.  * When in LightFinder mode, for X mins you will be visible to all Lightless Users WHO ALSO HAVE LIGHTFINDER ON and will receive notifications of people wanting to pair with you. If you are the person using LightFinder, you understand the risks of pairing with someone you don't know. If you are the person sending a request to someone with LightFinder on, you also understand the risks of pairing with someone you don't know. **AGAIN, THIS IS OPTIONAL.** * When in LightFinder mode, you can also put up a Syncshell you own on the Syncshell Finder so that others can easily find it and join. This has to be done prior to enabling LightFinder.  * Syncshell Finder allows you to join Syncshells that are indexed by LightFinder  # Minor Changes * Vanity addition to our supporters: On top of vanity ids you can find a fun addition under Your User Settings -> Edit Lightless Profile -> Vanity Settings to change the colour of your name in the lightless ui. This will be shown to all users.  * Pairing nameplate colour override can also now override FC tag (new option_ * Bunch of UI fixes, updates, and changes * kdb is now a whitelisted filetype that can upload Co-authored-by: CakeAndBanana <admin@cakeandbanana.nl> Co-authored-by: azyges <aaaaaa@aaa.aaa> Co-authored-by: choco <thijmenhogenkamp@gmail.com> Co-authored-by: choco <choco@noreply.git.lightless-sync.org> Co-authored-by: defnotken <itsdefnotken@gmail.com> Reviewed-on: #39
181 lines
10 KiB
C#
181 lines
10 KiB
C#
using Dalamud.Bindings.ImGui;
|
|
using Dalamud.Interface.Colors;
|
|
using Dalamud.Interface.Utility;
|
|
using Dalamud.Interface.Utility.Raii;
|
|
using LightlessSync.API.Data.Enum;
|
|
using LightlessSync.API.Data.Extensions;
|
|
using LightlessSync.API.Dto;
|
|
using LightlessSync.API.Dto.Group;
|
|
using LightlessSync.Services;
|
|
using LightlessSync.Services.Mediator;
|
|
using LightlessSync.Utils;
|
|
using LightlessSync.WebAPI;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace LightlessSync.UI;
|
|
|
|
internal class JoinSyncshellUI : WindowMediatorSubscriberBase
|
|
{
|
|
private readonly ApiController _apiController;
|
|
private readonly UiSharedService _uiSharedService;
|
|
private string _desiredSyncshellToJoin = string.Empty;
|
|
private GroupJoinInfoDto? _groupJoinInfo = null;
|
|
private DefaultPermissionsDto _ownPermissions = null!;
|
|
private string _previousPassword = string.Empty;
|
|
private string _syncshellPassword = string.Empty;
|
|
|
|
public JoinSyncshellUI(ILogger<JoinSyncshellUI> logger, LightlessMediator mediator,
|
|
UiSharedService uiSharedService, ApiController apiController, PerformanceCollectorService performanceCollectorService)
|
|
: base(logger, mediator, "Join existing Syncshell###LightlessSyncJoinSyncshell", performanceCollectorService)
|
|
{
|
|
_uiSharedService = uiSharedService;
|
|
_apiController = apiController;
|
|
SizeConstraints = new()
|
|
{
|
|
MinimumSize = new(700, 400),
|
|
MaximumSize = new(700, 400)
|
|
};
|
|
|
|
Mediator.Subscribe<DisconnectedMessage>(this, (_) => IsOpen = false);
|
|
|
|
Flags = ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize;
|
|
}
|
|
|
|
public override void OnOpen()
|
|
{
|
|
_desiredSyncshellToJoin = string.Empty;
|
|
_syncshellPassword = string.Empty;
|
|
_previousPassword = string.Empty;
|
|
_groupJoinInfo = null;
|
|
_ownPermissions = _apiController.DefaultPermissions.DeepClone()!;
|
|
}
|
|
|
|
protected override void DrawInternal()
|
|
{
|
|
using (_uiSharedService.UidFont.Push())
|
|
ImGui.TextUnformatted(_groupJoinInfo == null || !_groupJoinInfo.Success ? "Join Syncshell" : "Finalize join Syncshell " + _groupJoinInfo.GroupAliasOrGID);
|
|
ImGui.Separator();
|
|
|
|
if (_groupJoinInfo == null || !_groupJoinInfo.Success)
|
|
{
|
|
UiSharedService.TextWrapped("Here you can join existing Syncshells. " +
|
|
"Please keep in mind that you cannot join more than " + _apiController.ServerInfo.MaxGroupsJoinedByUser + " syncshells on this server." + Environment.NewLine +
|
|
"Joining a Syncshell will pair you implicitly with all existing users in the Syncshell." + Environment.NewLine +
|
|
"All permissions to all users in the Syncshell will be set to the preferred Syncshell permissions on joining, excluding prior set preferred permissions.");
|
|
ImGui.Separator();
|
|
ImGui.TextUnformatted("Note: Syncshell ID and Password are case sensitive. LLS- is part of Syncshell IDs, unless using Vanity IDs.");
|
|
|
|
ImGui.AlignTextToFramePadding();
|
|
ImGui.TextUnformatted("Syncshell ID");
|
|
ImGui.SameLine(200);
|
|
ImGui.InputTextWithHint("##syncshellId", "Full Syncshell ID", ref _desiredSyncshellToJoin, 20);
|
|
|
|
ImGui.AlignTextToFramePadding();
|
|
ImGui.TextUnformatted("Syncshell Password");
|
|
ImGui.SameLine(200);
|
|
ImGui.InputTextWithHint("##syncshellpw", "Password", ref _syncshellPassword, 50, ImGuiInputTextFlags.Password);
|
|
using (ImRaii.Disabled(string.IsNullOrEmpty(_desiredSyncshellToJoin) || string.IsNullOrEmpty(_syncshellPassword)))
|
|
{
|
|
if (_uiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.Plus, "Join Syncshell"))
|
|
{
|
|
_groupJoinInfo = _apiController.GroupJoin(new GroupPasswordDto(new API.Data.GroupData(_desiredSyncshellToJoin), _syncshellPassword)).Result;
|
|
_previousPassword = _syncshellPassword;
|
|
_syncshellPassword = string.Empty;
|
|
}
|
|
}
|
|
if (_groupJoinInfo != null && !_groupJoinInfo.Success)
|
|
{
|
|
UiSharedService.ColorTextWrapped("Failed to join the Syncshell. This is due to one of following reasons:" + Environment.NewLine +
|
|
"- The Syncshell does not exist or the password is incorrect" + Environment.NewLine +
|
|
"- You are already in that Syncshell or are banned from that Syncshell" + Environment.NewLine +
|
|
"- The Syncshell is at capacity or has invites disabled" + Environment.NewLine, UIColors.Get("LightlessYellow"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ImGui.TextUnformatted("You are about to join the Syncshell " + _groupJoinInfo.GroupAliasOrGID + " by " + _groupJoinInfo.OwnerAliasOrUID);
|
|
ImGuiHelpers.ScaledDummy(2f);
|
|
ImGui.TextUnformatted("This Syncshell staff has set the following suggested Syncshell permissions:");
|
|
ImGui.AlignTextToFramePadding();
|
|
ImGui.TextUnformatted("- Sounds ");
|
|
_uiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableSounds());
|
|
ImGui.AlignTextToFramePadding();
|
|
ImGui.TextUnformatted("- Animations");
|
|
_uiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableAnimations());
|
|
ImGui.AlignTextToFramePadding();
|
|
ImGui.TextUnformatted("- VFX");
|
|
_uiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableVFX());
|
|
|
|
if (_groupJoinInfo.GroupPermissions.IsPreferDisableSounds() != _ownPermissions.DisableGroupSounds
|
|
|| _groupJoinInfo.GroupPermissions.IsPreferDisableVFX() != _ownPermissions.DisableGroupVFX
|
|
|| _groupJoinInfo.GroupPermissions.IsPreferDisableAnimations() != _ownPermissions.DisableGroupAnimations)
|
|
{
|
|
ImGuiHelpers.ScaledDummy(2f);
|
|
UiSharedService.ColorText("Your current preferred default Syncshell permissions deviate from the suggested permissions:", UIColors.Get("LightlessYellow"));
|
|
if (_groupJoinInfo.GroupPermissions.IsPreferDisableSounds() != _ownPermissions.DisableGroupSounds)
|
|
{
|
|
ImGui.AlignTextToFramePadding();
|
|
ImGui.TextUnformatted("- Sounds");
|
|
_uiSharedService.BooleanToColoredIcon(!_ownPermissions.DisableGroupSounds);
|
|
ImGui.SameLine(200);
|
|
ImGui.AlignTextToFramePadding();
|
|
ImGui.TextUnformatted("Suggested");
|
|
_uiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableSounds());
|
|
ImGui.SameLine();
|
|
using var id = ImRaii.PushId("suggestedSounds");
|
|
if (_uiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.ArrowRight, "Apply suggested"))
|
|
{
|
|
_ownPermissions.DisableGroupSounds = _groupJoinInfo.GroupPermissions.IsPreferDisableSounds();
|
|
}
|
|
}
|
|
if (_groupJoinInfo.GroupPermissions.IsPreferDisableAnimations() != _ownPermissions.DisableGroupAnimations)
|
|
{
|
|
ImGui.AlignTextToFramePadding();
|
|
ImGui.TextUnformatted("- Animations");
|
|
_uiSharedService.BooleanToColoredIcon(!_ownPermissions.DisableGroupAnimations);
|
|
ImGui.SameLine(200);
|
|
ImGui.AlignTextToFramePadding();
|
|
ImGui.TextUnformatted("Suggested");
|
|
_uiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableAnimations());
|
|
ImGui.SameLine();
|
|
using var id = ImRaii.PushId("suggestedAnims");
|
|
if (_uiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.ArrowRight, "Apply suggested"))
|
|
{
|
|
_ownPermissions.DisableGroupAnimations = _groupJoinInfo.GroupPermissions.IsPreferDisableAnimations();
|
|
}
|
|
}
|
|
if (_groupJoinInfo.GroupPermissions.IsPreferDisableVFX() != _ownPermissions.DisableGroupVFX)
|
|
{
|
|
ImGui.AlignTextToFramePadding();
|
|
ImGui.TextUnformatted("- VFX");
|
|
_uiSharedService.BooleanToColoredIcon(!_ownPermissions.DisableGroupVFX);
|
|
ImGui.SameLine(200);
|
|
ImGui.AlignTextToFramePadding();
|
|
ImGui.TextUnformatted("Suggested");
|
|
_uiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableVFX());
|
|
ImGui.SameLine();
|
|
using var id = ImRaii.PushId("suggestedVfx");
|
|
if (_uiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.ArrowRight, "Apply suggested"))
|
|
{
|
|
_ownPermissions.DisableGroupVFX = _groupJoinInfo.GroupPermissions.IsPreferDisableVFX();
|
|
}
|
|
}
|
|
UiSharedService.TextWrapped("Note: you do not need to apply the suggested Syncshell permissions, they are solely suggestions by the staff of the Syncshell.");
|
|
}
|
|
else
|
|
{
|
|
UiSharedService.TextWrapped("Your default syncshell permissions on joining are in line with the suggested Syncshell permissions through the owner.");
|
|
}
|
|
ImGuiHelpers.ScaledDummy(2f);
|
|
if (_uiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.Plus, "Finalize and join " + _groupJoinInfo.GroupAliasOrGID))
|
|
{
|
|
GroupUserPreferredPermissions joinPermissions = GroupUserPreferredPermissions.NoneSet;
|
|
joinPermissions.SetDisableSounds(_ownPermissions.DisableGroupSounds);
|
|
joinPermissions.SetDisableAnimations(_ownPermissions.DisableGroupAnimations);
|
|
joinPermissions.SetDisableVFX(_ownPermissions.DisableGroupVFX);
|
|
_ = _apiController.GroupJoinFinalize(new GroupJoinDto(_groupJoinInfo.Group, _previousPassword, joinPermissions));
|
|
IsOpen = false;
|
|
}
|
|
}
|
|
}
|
|
} |