2013-08-27 17:14:08 +02:00
|
|
|
|
namespace LOC.Website.Web.Controllers
|
|
|
|
|
{
|
|
|
|
|
using System;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using Common;
|
|
|
|
|
using Common.Models;
|
2013-09-18 00:50:23 +02:00
|
|
|
|
using Core.Model.Server;
|
2013-08-27 17:14:08 +02:00
|
|
|
|
using Core.Tokens;
|
|
|
|
|
using Core.Tokens.Client;
|
|
|
|
|
using Newtonsoft.Json;
|
2014-04-25 09:44:14 +02:00
|
|
|
|
using System.Collections.Generic;
|
2015-05-13 09:00:37 +02:00
|
|
|
|
using LOC.Core;
|
2013-08-27 17:14:08 +02:00
|
|
|
|
|
|
|
|
|
public class PlayerAccountController : Controller
|
|
|
|
|
{
|
|
|
|
|
private readonly IAccountAdministrator _accountAdministrator;
|
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
|
|
|
|
|
|
public PlayerAccountController(IAccountAdministrator accountAdministrator, ILogger logger)
|
|
|
|
|
{
|
|
|
|
|
_accountAdministrator = accountAdministrator;
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult GetAccountNames()
|
|
|
|
|
{
|
|
|
|
|
var accountNames = _accountAdministrator.GetAccountNames();
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.SerializeObject(accountNames);
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult GetAccount(string name)
|
|
|
|
|
{
|
|
|
|
|
var account = _accountAdministrator.GetAccountByName(name);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.SerializeObject(account);
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-22 23:33:25 +02:00
|
|
|
|
/*
|
2015-05-13 03:59:22 +02:00
|
|
|
|
[HttpPost]
|
2015-05-13 09:00:37 +02:00
|
|
|
|
public ActionResult GetTasksByCount(SearchConf searchConf)
|
2015-05-13 03:59:22 +02:00
|
|
|
|
{
|
2015-05-13 09:00:37 +02:00
|
|
|
|
var tasks = _accountAdministrator.GetTasksByCount(searchConf);
|
2015-05-13 03:59:22 +02:00
|
|
|
|
|
|
|
|
|
var json = JsonConvert.SerializeObject(tasks);
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
2015-05-22 23:33:25 +02:00
|
|
|
|
*/
|
2015-05-13 03:59:22 +02:00
|
|
|
|
|
2014-08-20 03:36:23 +02:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult GetAccountByUUID(string uuid)
|
|
|
|
|
{
|
2014-08-21 22:55:09 +02:00
|
|
|
|
var json = JsonConvert.SerializeObject(_accountAdministrator.GetAccountByUUID(uuid));
|
2014-08-20 03:36:23 +02:00
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult GetDonor(string name)
|
|
|
|
|
{
|
|
|
|
|
var account = _accountAdministrator.GetAccountByName(name);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.SerializeObject(account);
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult Login(LoginRequestToken loginRequest)
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.SerializeObject(new ClientToken(_accountAdministrator.Login(loginRequest)));
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult PurchaseKnownSalesPackage(PurchaseToken token)
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.SerializeObject(_accountAdministrator.PurchaseGameSalesPackage(token));
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult PurchaseUnknownSalesPackage(UnknownPurchaseToken token)
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.SerializeObject(_accountAdministrator.PurchaseUnknownSalesPackage(token));
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-13 04:20:41 +01:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void ApplyKits(string name)
|
|
|
|
|
{
|
|
|
|
|
_accountAdministrator.ApplyKits(name);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Logout(string name)
|
|
|
|
|
{
|
|
|
|
|
_accountAdministrator.Logout(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult AccountExists(string name)
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.SerializeObject(_accountAdministrator.AccountExists(name));
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult GetMatches(string name)
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.SerializeObject(_accountAdministrator.GetAllAccountNamesMatching(name));
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult Punish(PunishToken token)
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.SerializeObject(_accountAdministrator.Punish(token).ToString());
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult RemovePunishment(RemovePunishmentToken token)
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.SerializeObject(_accountAdministrator.RemovePunishment(token).ToString());
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void RemoveBan(RemovePunishmentToken token)
|
|
|
|
|
{
|
|
|
|
|
_accountAdministrator.RemoveBan(token);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Ignore(ClientIgnoreToken token)
|
|
|
|
|
{
|
|
|
|
|
_accountAdministrator.Ignore(token.Name, token.IgnoredPlayer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void RemoveIgnore(ClientIgnoreToken token)
|
|
|
|
|
{
|
|
|
|
|
_accountAdministrator.RemoveIgnore(token.Name, token.IgnoredPlayer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void SaveCustomBuild(CustomBuildToken token)
|
|
|
|
|
{
|
|
|
|
|
_accountAdministrator.SaveCustomBuild(token);
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-25 09:44:14 +02:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void UpdateAccountUUIDs(List<AccountNameToken> tokens)
|
|
|
|
|
{
|
|
|
|
|
_accountAdministrator.UpdateAccountUUIDs(tokens);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult GetAccounts(AccountBatchToken token)
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.SerializeObject(_accountAdministrator.GetAccounts(token));
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
|
[HttpPost]
|
2013-10-18 09:46:06 +02:00
|
|
|
|
public ActionResult GemReward(GemRewardToken token)
|
2013-08-27 17:14:08 +02:00
|
|
|
|
{
|
2013-10-18 09:46:06 +02:00
|
|
|
|
var json = JsonConvert.SerializeObject(_accountAdministrator.GemReward(token));
|
2013-08-27 17:14:08 +02:00
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-08 09:05:58 +02:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult CoinReward(GemRewardToken token)
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.SerializeObject(_accountAdministrator.CoinReward(token));
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult RankUpdate(RankUpdateToken token)
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.SerializeObject(_accountAdministrator.UpdateRank(token));
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult GetPunishClient(string name)
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.SerializeObject(new ClientToken(_accountAdministrator.GetAccountByName(name)));
|
|
|
|
|
return Content(json, "application/json");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|