mirror of
https://github.com/CyberL1/MyMcRealms.git
synced 2024-11-21 13:38:21 -05:00
feat: send dummy world's slots list
This commit is contained in:
parent
5ca12b1530
commit
87a5fce41d
@ -2,7 +2,9 @@
|
||||
using MyMcRealms.Attributes;
|
||||
using MyMcRealms.MyMcAPI.Responses;
|
||||
using MyMcRealms.Responses;
|
||||
using Newtonsoft.Json;
|
||||
using Semver;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace MyMcRealms.Controllers
|
||||
{
|
||||
@ -113,6 +115,12 @@ namespace MyMcRealms.Controllers
|
||||
whitelistedPlayers.Add(whitelistedPlayer);
|
||||
}
|
||||
|
||||
string cookie = Request.Headers.Cookie;
|
||||
string gameVerision = cookie.Split(";")[2].Split("=")[1];
|
||||
|
||||
int versionsCompared = SemVersion.Parse(gameVerision, SemVersionStyles.OptionalPatch).ComparePrecedenceTo(SemVersion.Parse(world.GameVersion, SemVersionStyles.OptionalPatch));
|
||||
string isCompatible = versionsCompared == 0 ? "COMPATIBLE" : versionsCompared < 0 ? "NEEDS_DOWNGRADE" : "NEEDS_UPGRADE";
|
||||
|
||||
WorldResponse response = new()
|
||||
{
|
||||
Id = wId,
|
||||
@ -132,7 +140,20 @@ namespace MyMcRealms.Controllers
|
||||
DaysLeft = 7,
|
||||
Expired = false,
|
||||
ExpiredTrial = false,
|
||||
ActiveVersion = world.GameVersion
|
||||
ActiveVersion = world.GameVersion,
|
||||
Slots =
|
||||
[
|
||||
new()
|
||||
{
|
||||
SlotId = 1,
|
||||
Options = JsonConvert.SerializeObject(new
|
||||
{
|
||||
slotName = "my-mc.link",
|
||||
version = world.GameVersion,
|
||||
compatibility = isCompatible,
|
||||
})
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
return Ok(response);
|
||||
|
8
MyMcRealms/Responses/SlotResponse.cs
Normal file
8
MyMcRealms/Responses/SlotResponse.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace MyMcRealms.Responses
|
||||
{
|
||||
public class SlotResponse
|
||||
{
|
||||
public int SlotId { get; set; }
|
||||
public string Options { get; set; } = null!;
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ namespace MyMcRealms.Responses
|
||||
public int? MinigameId { get; set; }
|
||||
public string? MinigameImage { get; set; }
|
||||
public int ActiveSlot { get; set; } = 1;
|
||||
public JsonDocument[] Slots { get; set; } = [];
|
||||
public List<SlotResponse> Slots { get; set; } = [];
|
||||
public bool Member { get; set; } = false;
|
||||
public string RemoteSubscriptionId { get; set; } = Guid.NewGuid().ToString();
|
||||
public int DaysLeft { get; set; } = 30;
|
||||
|
Loading…
Reference in New Issue
Block a user