public ActionResult AddWithRoom(AddPathwayWithRoomTemplateViewModel vModel) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IRoomTemplate origin = TemplateCache.Get <IRoomTemplate>(vModel.Origin.Id); IRoomTemplate newRoom = vModel.Destination; newRoom.ParentLocation = origin.ParentLocation; string message = string.Empty; if (newRoom.Create(authedUser.GameAccount, authedUser.GetStaffRank(User)) != null) { IPathwayTemplate newObj = vModel.DataObject; newObj.Destination = newRoom; newObj.Origin = origin; if (newObj.Create(authedUser.GameAccount, authedUser.GetStaffRank(User)) == null) { message = "Error; Creation failed."; } else { if (vModel.CreateReciprocalPath) { PathwayTemplate reversePath = new PathwayTemplate { Name = newObj.Name, DegreesFromNorth = Utilities.ReverseDirection(newObj.DegreesFromNorth), Origin = newObj.Destination, Destination = newObj.Origin, Model = newObj.Model, InclineGrade = newObj.InclineGrade * -1 }; if (reversePath.Create(authedUser.GameAccount, authedUser.GetStaffRank(User)) == null) { message = "Reverse Path creation FAILED. Origin path creation SUCCESS."; } } LoggingUtility.LogAdminCommandUsage("*WEB* - AddPathwayWithRoom[" + newObj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); } } else { message = "Error; Creation failed."; } return(RedirectToRoute("ModalErrorOrClose", new { Message = message })); }
public string Quickbuild(long originId, long destinationId, int direction, int incline) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IRoomTemplate origin = TemplateCache.Get <IRoomTemplate>(originId); IRoomTemplate destination = TemplateCache.Get <IRoomTemplate>(destinationId); string message = string.Empty; if (destination == null) { destination = new RoomTemplate { Name = "Room", Medium = origin.Medium, ParentLocation = origin.ParentLocation, Model = new DimensionalModel() { ModelTemplate = origin.Model.ModelTemplate, Composition = origin.Model.Composition, Height = origin.Model.Height, Length = origin.Model.Length, Width = origin.Model.Width, SurfaceCavitation = origin.Model.SurfaceCavitation, Vacuity = origin.Model.Vacuity } }; destination = (IRoomTemplate)destination.Create(authedUser.GameAccount, authedUser.GetStaffRank(User)); } if (destination != null) { IPathwayTemplate newObj = new PathwayTemplate { Name = "Pathway", Destination = destination, Origin = origin, InclineGrade = incline, DegreesFromNorth = direction, Model = new DimensionalModel() { ModelTemplate = origin.Model.ModelTemplate, Composition = origin.Model.Composition, Height = origin.Model.Height, Length = origin.Model.Length, Width = origin.Model.Width, SurfaceCavitation = origin.Model.SurfaceCavitation, Vacuity = origin.Model.Vacuity } }; if (newObj.Create(authedUser.GameAccount, authedUser.GetStaffRank(User)) == null) { message = "Error; Creation failed."; } else { PathwayTemplate reversePath = new PathwayTemplate { Name = newObj.Name, DegreesFromNorth = Utilities.ReverseDirection(newObj.DegreesFromNorth), Origin = newObj.Destination, Destination = newObj.Origin, Model = newObj.Model, InclineGrade = newObj.InclineGrade * -1 }; if (reversePath.Create(authedUser.GameAccount, authedUser.GetStaffRank(User)) == null) { message = "Reverse Path creation FAILED. Origin path creation SUCCESS."; } LoggingUtility.LogAdminCommandUsage("*WEB* - Quickbuild[" + newObj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); } } else { message = "Error; Creation failed."; } return(message); }