Rework How Room OPs Are Handled Per Room (if the game server itself isn't handling it, just send it to the room every time)
42 lines
1.5 KiB
C#
42 lines
1.5 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using ReboundEmulator.Core;
|
|
|
|
namespace ReboundEmulator.Controllers
|
|
{
|
|
public class CDLController : Controller
|
|
{
|
|
[HttpGet]
|
|
[Route("/cdl/cdl-info.jsp")]
|
|
public IResult CDLInfo(string lkey)
|
|
{
|
|
var acct = Sessions.Find(lkey);
|
|
if (acct is null)
|
|
return Results.Text("error notloggedin", "text/plain");
|
|
|
|
var enti = $"oava {(acct.OwnsPremiumAvatar ? 1 : 0)} obad {(acct.OwnsBadges ? 1 : 0)}";
|
|
var body = string.Join(" ",
|
|
"error", "none",
|
|
"screenname", Q(acct.ScreenName),
|
|
"site", Q(acct.Site),
|
|
"tokens", acct.Tokens.ToString(),
|
|
"enti", Q(enti),
|
|
"avatar", Q(acct.Avatar));
|
|
return Results.Text(body, "text/plain");
|
|
}
|
|
|
|
static string Q(string s) => "'" + s.Replace("\\", "\\\\").Replace("'", "\\'") + "'";
|
|
|
|
[HttpGet("/cdl/1/login")]
|
|
public IResult CDLLogin(string name)
|
|
{
|
|
var lkey = Sessions.Issue(name);
|
|
|
|
return Results.Text($"<LoginResponse error=\"none\">\n<LoginSessionKey>{lkey}</LoginSessionKey></LoginResponse>", "text/xml");
|
|
}
|
|
|
|
[HttpGet("/cdl/1/cdl-clientprops")]
|
|
public IActionResult CDLClientProps() { return Ok(); } // CDL games don't really need the client props to be present on the server,
|
|
// it was there so Pogo could update assets for CDL games on the fly
|
|
}
|
|
}
|