public virtual ActionResult ReadSkillBook(int id) { var myMembershipId = User.Identity.GetUserId(); var me = PlayerProcedures.GetPlayerFromMembership(myMembershipId); // assert player is animate if (me.Mobility != PvPStatics.MobilityFull) { TempData["Error"] = "This curse is too strong to be lifted."; return(RedirectToAction(MVC.PvP.Play())); } // assert player has not already used an item this turn if (me.ItemsUsedThisTurn >= PvPStatics.MaxItemUsesPerUpdate) { TempData["Error"] = "You've already used an item this turn."; TempData["SubError"] = "You will be able to use another consumable next turn."; return(RedirectToAction(MVC.Item.MyInventory())); } var book = ItemProcedures.GetItemViewModel(id); // assert player owns this book if (book.dbItem.OwnerId != me.Id) { TempData["Error"] = "You do not own this book."; return(RedirectToAction(MVC.PvP.Play())); } // make sure that this is actually a book if (book.Item.ConsumableSubItemType != (int)ItemStatics.ConsumableSubItemTypes.Tome) { TempData["Error"] = "You can't read that item!"; TempData["SubError"] = "It's not a book."; return(RedirectToAction(MVC.PvP.Play())); } // assert player hasn't already read this book if (ItemProcedures.PlayerHasReadBook(me, book.dbItem.ItemSourceId)) { TempData["Error"] = "You have already absorbed the knowledge from this book and can learn nothing more from it."; TempData["SubError"] = "Perhaps a friend could use this tome more than you right now."; return(RedirectToAction(MVC.PvP.Play())); } ItemProcedures.DeleteItem(book.dbItem.Id); ItemProcedures.AddBookReading(me, book.dbItem.ItemSourceId); PlayerProcedures.GiveXP(me, 35); PlayerProcedures.AddItemUses(me.Id, 1); StatsProcedures.AddStat(me.MembershipId, StatsProcedures.Stat__LoreBooksRead, 1); TempData["Result"] = "You read your copy of " + book.Item.FriendlyName + ", absorbing its knowledge for 35 XP. The tome slips into thin air so it can provide its knowledge to another mage in a different time and place."; return(RedirectToAction(MVC.PvP.Play())); }