mirror of
https://github.com/BtbN/ClanServer.git
synced 2026-09-07 07:55:16 -05:00
Try to save collected Jbox points
This commit is contained in:
@@ -14,8 +14,9 @@ namespace ClanServer.Controllers.Core
|
||||
public class PcbEventController : ControllerBase
|
||||
{
|
||||
[HttpPost, XrpcCall("pcbevent.put")]
|
||||
public ActionResult<EamuseXrpcData> Put([FromBody] EamuseXrpcData data, [FromQuery] string model)
|
||||
public ActionResult<EamuseXrpcData> Put([FromBody] EamuseXrpcData data)
|
||||
{
|
||||
// TODO: log these, maybe?
|
||||
Console.WriteLine(data.Document);
|
||||
|
||||
data.Document = new XDocument(new XElement("response", new XElement("pcbevent")));
|
||||
|
||||
@@ -40,17 +40,12 @@ namespace ClanServer.Controllers.L44
|
||||
.Include(p => p.Jubilitys)
|
||||
.SingleOrDefaultAsync(p => p.ID == jid);
|
||||
|
||||
if (profile == null)
|
||||
return NotFound();
|
||||
|
||||
if (profile.ClanData == null)
|
||||
profile.ClanData = new JubeatClanProfileData();
|
||||
if (profile.ClanSettings == null)
|
||||
profile.ClanSettings = new JubeatClanSettings();
|
||||
|
||||
var data = profile.ClanData;
|
||||
var settings = profile.ClanSettings;
|
||||
|
||||
if (profile == null || data == null || settings == null)
|
||||
return NotFound();
|
||||
|
||||
XElement teamE = playerE.Element("team");
|
||||
data.Team = byte.Parse(teamE.Attribute("id").Value);
|
||||
data.Street = int.Parse(teamE.Element("street").Value);
|
||||
@@ -73,6 +68,9 @@ namespace ClanServer.Controllers.L44
|
||||
data.BonusTunePoints = int.Parse(pInfoE.Element("bonus_tune_points").Value);
|
||||
data.BonusTunePlayed = pInfoE.Element("is_bonus_tune_played").Value == "1";
|
||||
|
||||
XElement jboxE = playerE.Element("jbox");
|
||||
data.JboxPoints = int.Parse(jboxE.Element("point").Value);
|
||||
|
||||
XElement lastE = playerE.Element("last");
|
||||
settings.ExpertOption = sbyte.Parse(lastE.Element("expert_option").Value);
|
||||
settings.Sort = sbyte.Parse(lastE.Element("sort").Value);
|
||||
@@ -164,10 +162,36 @@ namespace ClanServer.Controllers.L44
|
||||
}
|
||||
|
||||
[HttpPost, Route("8"), XrpcCall("gameend.final")]
|
||||
public ActionResult<EamuseXrpcData> Final([FromBody] EamuseXrpcData data)
|
||||
public async Task<ActionResult<EamuseXrpcData>> Final([FromBody] EamuseXrpcData xrpcData)
|
||||
{
|
||||
data.Document = new XDocument(new XElement("response", new XElement("gameend")));
|
||||
return data;
|
||||
try
|
||||
{
|
||||
XElement dataE = xrpcData.Document.Element("call").Element("gameend").Element("data");
|
||||
XElement playerE = dataE.Element("player");
|
||||
|
||||
int jid = int.Parse(playerE.Element("jid").Value);
|
||||
|
||||
JubeatProfile profile = await ctx.JubeatProfiles
|
||||
.Include(p => p.ClanData)
|
||||
.Include(p => p.ClanSettings)
|
||||
.Include(p => p.Jubilitys)
|
||||
.SingleOrDefaultAsync(p => p.ID == jid);
|
||||
|
||||
var data = profile.ClanData;
|
||||
|
||||
XElement jboxE = playerE.Element("jbox");
|
||||
data.JboxPoints = int.Parse(jboxE.Element("point").Value);
|
||||
|
||||
await ctx.SaveChangesAsync();
|
||||
|
||||
xrpcData.Document = new XDocument(new XElement("response", new XElement("gameend")));
|
||||
return xrpcData;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.ToString());
|
||||
return StatusCode(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ namespace ClanServer.Controllers.L44
|
||||
)
|
||||
),
|
||||
new XElement("jbox",
|
||||
new KS32("point", 0),
|
||||
new KS32("point", data.JboxPoints),
|
||||
new XElement("emblem",
|
||||
new XElement("normal",
|
||||
new KS16("index", 1182)
|
||||
|
||||
@@ -47,5 +47,7 @@ namespace ClanServer.Models
|
||||
public bool BonusTunePlayed { get; set; }
|
||||
|
||||
public int JubilityParam { get; set; }
|
||||
|
||||
public int JboxPoints { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user