public virtual ActionResult ArchiveSpell(int skillSourceId) { var myMembershipId = User.Identity.GetUserId(); var me = PlayerProcedures.GetPlayerFromMembership(myMembershipId); // assert that player does own this skill var skill = SkillProcedures.GetSkillViewModel(skillSourceId, me.Id); if (skill == null) { TempData["Error"] = "You don't know this spell yet."; return(RedirectToAction(MVC.PvP.Play())); } if (skill.dbSkill.SkillSourceId == PvPStatics.Spell_WeakenId) { ViewBag.Message = $"You can't archive the {skill.StaticSkill.FriendlyName} skill."; return(PartialView(MVC.Settings.Views.partial.ArchiveNotice)); } SkillProcedures.ArchiveSpell(skill.dbSkill.Id); if (!skill.dbSkill.IsArchived) { ViewBag.Message = "You have successfully archived " + skill.StaticSkill.FriendlyName + "."; } else { ViewBag.Message = "You have successfully restored " + skill.StaticSkill.FriendlyName + " from your spell archive."; } ViewBag.Number = skill.dbSkill.Id; return(PartialView(MVC.Settings.Views.partial.ArchiveNotice)); }
public virtual ActionResult SelfCastSend(int itemId, int skillSourceId) { var myMembershipId = User.Identity.GetUserId(); var me = PlayerProcedures.GetPlayerFromMembership(myMembershipId); // assert player is animate if (me.Mobility != PvPStatics.MobilityFull) { TempData["Error"] = "You must be animate in order to use this."; return(RedirectToAction(MVC.PvP.Play())); } // assert that this player is not in a duel if (me.InDuel > 0) { TempData["Error"] = "You must finish your duel before you use this item."; return(RedirectToAction(MVC.PvP.Play())); } // assert that this player is not in a quest if (me.InQuest > 0) { TempData["Error"] = "You must finish your quest before you use this item."; 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 type item next turn."; return(RedirectToAction(MVC.Item.MyInventory())); } var item = ItemProcedures.GetItemViewModel(itemId); // assert player does own this if (item.dbItem.OwnerId != me.Id) { TempData["Error"] = "You don't own that item."; return(RedirectToAction(MVC.PvP.Play())); } // assert that it is equipped if (!item.dbItem.IsEquipped) { TempData["Error"] = "You cannot use an item you do not have equipped."; return(RedirectToAction(MVC.PvP.Play())); } // assert this item is a transmog if (item.dbItem.ItemSourceId != ItemStatics.AutoTransmogItemSourceId) { TempData["Error"] = "You cannot change form with that item."; return(RedirectToAction(MVC.PvP.Play())); } // assert player does own this skill var skill = SkillProcedures.GetSkillViewModel(skillSourceId, me.Id); if (skill == null) { TempData["Error"] = "You do not own this spell."; return(RedirectToAction(MVC.PvP.Play())); } // assert desired form is animate if (skill.MobilityType != PvPStatics.MobilityFull) { TempData["Error"] = "The target form must be an animate form."; return(RedirectToAction(MVC.PvP.Play())); } // assert player is not already in the form of the spell if (me.FormSourceId == skill.StaticSkill.FormSourceId) { TempData["Error"] = "You are already in the target form of that spell, so doing this would do you no good."; return(RedirectToAction(MVC.PvP.Play())); } PlayerProcedures.InstantChangeToForm(me, skill.StaticSkill.FormSourceId.Value); ItemProcedures.DeleteItem(itemId); PlayerProcedures.SetTimestampToNow(me); PlayerProcedures.AddItemUses(me.Id, 1); var form = FormStatics.GetForm(skill.StaticSkill.FormSourceId.Value); TempData["Result"] = "You use a " + item.Item.FriendlyName + ", your spell bouncing through the device for a second before getting flung back at you and hitting you square in the chest, instantly transforming you into a " + form.FriendlyName + "!"; StatsProcedures.AddStat(me.MembershipId, StatsProcedures.Stat__TransmogsUsed, 1); return(RedirectToAction(MVC.PvP.Play())); }