public async Task <IActionResult> Index() { if (User.Identity.IsAuthenticated) { var c = await cultivatordb.GetCultivator(User.Identity.Name); TempData["Nickname"] = c.Name; TempData["Gold"] = c.Gold; } return(View()); }
public async Task <IActionResult> go(int?Id) { var cult = await cultivatordb.GetCultivator(User.Identity.Name); if (Id != null) { if (Id != 0) { cult.LocationId = (int)Id; await cultivatordb.Update(cult); } else { return(RedirectToAction("Map")); } } if (cult.LocationId == 0) { cult.LocationId = 1; await cultivatordb.Update(cult); } var location = GLocationsList.GetById(cult.LocationId); if (location is CBuilding) { if (location is CTown) { return(RedirectToAction("Town", cult)); } if (location is CMarket) { return(RedirectToAction("Market", cult)); } } if (location is CNPC) { if (location is CBaseTrader) { return(RedirectToAction("Shop", cult)); } } throw new Exception("This Location is unknown"); }
public async Task <ActionResult> Index() { if (User.Identity.IsAuthenticated) { var c = await cultivatordb.GetCultivator(User.Identity.Name); if (c == null) { CCultivator newCultivator = new CCultivator() { LocationId = GWorld.World.SubLocations[0].Id }; newCultivator.PlayerId = CultivatorContext.getHex(User.Identity.Name); newCultivator.Name = User.Identity.Name; newCultivator.Inventory = new CCultivator.CInventory(); newCultivator.HeroType = User.Identity.Name; await cultivatordb.Create(newCultivator); } TempData["Nickname"] = c.Name; TempData["Gold"] = c.Gold; } return(View()); }
public async Task <ActionResult> Profile(string id) { var cult = await cultivatordb.GetCultivator(User.Identity.Name); TempData["Nickname"] = cult.Name; TempData["Strength"] = cult.Stats.MainStats.Strength; TempData["Agility"] = cult.Stats.MainStats.Agility; TempData["Intelligence"] = cult.Stats.MainStats.Intelligence; TempData["Endurance"] = cult.Stats.MainStats.Endurance; TempData["Gold"] = cult.Gold; TempData["Tier"] = cult.Tier; TempData["HeroType"] = cult.HeroType; return(View()); }