public ActionResult SellEquipment(string name) { var g = (Game)Session["Game"]; var s = new Shop(); var e = g.Player.CharacterEquipment.First(i => i.Name == name); if (e == null) { // TODO - Exception } EquipmentHelper.SellEquipment(g.Player, e); s.AddPlayerToShop(g.Player); Session["Game"] = g; return View("~/Views/Home/Shop.cshtml", s); }
public ActionResult PurchaseEquipment(string name) { var p = (Player)Session["Player"]; var s = new Shop(); var e = s.Equipment.First(i => i.Name == name); if (e == null) { // TODO - Exception } p.PurchaseEquipment(e); s.AddPlayerToShop(p); Session["Player"] = p; return View("Shop", s); }
public ActionResult Shop() { var g = (Game)Session["Game"]; if (g.Player == null) { ModelState.AddModelError(string.Empty, "You must create a character first."); return View("Index"); } if (g.CurrentBattleDetails.BattleStatus != BattleStatus.InBattle) { g.Player.LeaveArena(); var s = new Shop(); s.AddPlayerToShop(g.Player); return View("Shop", s); } ModelState.AddModelError(string.Empty, "You cannot leave the battle!"); return View("Arena", g.CurrentBattleDetails); }
public ActionResult Shop() { var p = (Player)Session["Player"]; if (p == null) { ModelState.AddModelError(string.Empty, "You must create a character first."); return View("Index"); } var s = new Shop(); s.AddPlayerToShop(p); return View("Shop", s); }