public virtual ActionResult SendMessage(MessageSubmitViewModel input) { var myMembershipId = User.Identity.GetUserId(); var me = PlayerProcedures.GetPlayerFromMembership(myMembershipId); var receiver = PlayerProcedures.GetPlayer(input.ReceiverId); // assert player is not banned from chat if (me.IsBannedFromGlobalChat) { TempData["Error"] = "You have been banned and cannot send any messages."; TempData["SubError"] = "If you feel this is in error or wish to make an appeal you may do so on the forums."; return(RedirectToAction(MVC.PvP.Play())); } // assert no blacklist exists if (BlacklistProcedures.PlayersHaveBlacklistedEachOther(me, receiver, "message")) { TempData["Error"] = "This player has blacklisted you or is on your own blacklist."; TempData["SubError"] = "You cannot send messages to players who have blacklisted you. Remove them from your blacklist or ask them to remove you from theirs."; return(RedirectToAction(MVC.PvP.Play())); } if (EffectProcedures.PlayerHasActiveEffect(me, CharacterPrankProcedures.HUSHED_EFFECT)) { TempData["ErrorMessage"] = "You have been hushed and cannot currently send a message. Try again once the effect has worn off."; TempData["MessageText"] = input.MessageText; return(RedirectToAction(MVC.Messages.Write(input.ReceiverId, input.responseToId))); } if (input.MessageText.IsNullOrEmpty()) { TempData["ErrorMessage"] = "You need to write something to send to this person."; TempData["MessageText"] = input.MessageText; return(RedirectToAction(MVC.Messages.Write(input.ReceiverId, input.responseToId))); } if (input.MessageText.Length > 1000) { TempData["ErrorMessage"] = "Your message is too long."; TempData["MessageText"] = input.MessageText; return(RedirectToAction(MVC.Messages.Write(input.ReceiverId, input.responseToId))); } MessageDetail repliedMsg = null; if (input.responseToId > 0) { repliedMsg = DomainRegistry.Repository.FindSingle(new GetMessage { MessageId = input.responseToId, OwnerId = me.Id }); } DomainRegistry.Repository.Execute(new CreateMessage { ReceiverId = receiver.Id, SenderId = me.Id, Text = input.MessageText, ReplyingToThisMessage = repliedMsg }); NoticeService.PushNotice(receiver, "<b>" + me.GetFullName() + " has sent you a new message.</b>", NoticeService.PushType__PlayerMessage); TempData["Result"] = "Your message has been sent."; if (me.Mobility != PvPStatics.MobilityFull) { ItemProcedures.UpdateSouledItem(me); } return(RedirectToAction(MVC.Messages.Index())); }