public async Task <IActionResult> GetList([FromBody] GetList.Request req) { var res = new GetList.Response { accounts = new List <GetList.Response.Account>(), }; var names = await Common2DB.PlayerNames.ToListAsync(); var list = await Common1DB.Accounts.ToListAsync(); list.ForEach(a => { var name = names.Find(r => r.playerId == a.playerId); res.accounts.Add(new GetList.Response.Account { account = a.account, type = a.type, privilegeLevel = a.privilegeLevel, playerName = (name != null) ? name.playerName : "", }); }); return(Ok(res)); }
public async Task <IActionResult> GetList([FromBody] GetList.Request req) { var res = new GetList.Response(); var playerId = SelfHost.playerInfo.playerId; var db = PDBSM.PersonalDBContext(playerId); var srcList = await evolib.GivenHistory.GetAsync(playerId, db); res.list = new List <GetList.Response.History>(); srcList.ForEach( i => res.list.Add(new GetList.Response.History { id = i.Id, datetime = i.obtainedDate, type = i.type, presentId = (i.presentId != null) ? i.presentId : "", amount = i.amount, giveType = i.giveType, text = (i.text != null) ? i.text : "", }) ); return(Ok(res)); }
public async Task <IActionResult> GetList([FromBody] GetList.Request req) { var playerId = SelfHost.playerInfo.playerId; var db = PDBSM.PersonalDBContext(playerId); var srcList = await evolib.ChallengeList.GetAsync(playerId, MasterData, db); var ret = new GetList.Response(); ret.list = srcList.Select(r => { var isPaidChallenge = false; var unlocked = true; if (r.type != evolib.Challenge.Type.Beginner) { // TODO: 抽選で有償枠に入ったチャレンジの時にtrueを設定 isPaidChallenge = false; unlocked = r.unlocked; } return(new ChallengeStatus() { challengeId = r.challengeId, num = r.value, completed = (r.status == evolib.Challenge.Status.Clear), type = r.type, isPaidChallenge = isPaidChallenge, unlocked = unlocked, expirationDate = r.expirationDate, }); }) .ToList(); var beginnerTarget = srcList .FirstOrDefault(r => r.type == evolib.Challenge.Type.Beginner && r.unlocked && r.status != evolib.Challenge.Status.Clear); ret.currentSheet = String.Empty; if (beginnerTarget != null) { var challengeInfo = MasterData.GetChallenge(beginnerTarget.challengeId); if (challengeInfo != null) { ret.currentSheet = challengeInfo.sheetId; } } return(Ok(ret)); }
public async Task <IActionResult> GetList([FromBody] GetList.Request req) { var res = new GetList.Response(); int takeNum = req.getNum.Value; int skipNum = req.pageNum * takeNum; var now = DateTime.UtcNow; var db = PDBSM.PersonalDBContext(SelfHost.playerInfo.playerId); var query = db.PresentBoxs.Where(i => i.playerId == SelfHost.playerInfo.playerId && i.beginDate <now && i.endDate> now ); var source = await query.ToListAsync(); source.Sort((a, b) => (a.endDate.CompareTo(b.endDate))); var count = source.Count; res.count = count; var dataSrc = new List <PresentBox>(); dataSrc.AddRange(source.Skip(skipNum).Take(takeNum)); var dataDst = new List <GetList.Response.Present>(); dataSrc.ForEach( i => dataDst.Add(new GetList.Response.Present() { id = i.Id, datetime = i.endDate, type = i.type, presentId = (i.presentId != null) ? i.presentId : "", amount = i.amount, giveType = i.giveType, text = (i.text != null) ? i.text : "", }) ); res.list = dataDst; return(Ok(res)); }
public async Task <IActionResult> GetList([FromBody] GetList.Request req) { var res = new GetList.Response(); res.list = new List <GetList.Response.Achievement>(); for (int i = 0; i < MasterData.AllAchievement.Count; i++) { bool obtained = 0 == (i % 2); var achi = MasterData.AllAchievement[i]; res.list.Add(new GetList.Response.Achievement { achievementId = achi.achievementId, achievementValue = achi.value, value = achi.value - (obtained ? 0 : 1), obtained = obtained, obtainedDate = obtained?DateTime.UtcNow:DateTime.MinValue, }); } return(Ok(res)); }