public ActionResult RemoveDescriptive(long id = -1, string authorize = "") { string message = string.Empty; long zoneId = -1; if (string.IsNullOrWhiteSpace(authorize)) { message = "You must check the proper authorize radio button first."; } else { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); string[] values = authorize.Split(new string[] { "|||" }, StringSplitOptions.RemoveEmptyEntries); if (values.Count() != 2) { message = "You must check the proper authorize radio button first."; } else { string type = values[0]; string phrase = values[1]; IZoneTemplate obj = TemplateCache.Get <IZoneTemplate>(id); if (obj == null) { message = "That does not exist"; } else { GrammaticalType grammaticalType = (GrammaticalType)Enum.Parse(typeof(GrammaticalType), type); ISensoryEvent existingOccurrence = obj.Descriptives.FirstOrDefault(occurrence => occurrence.Event.Role == grammaticalType && occurrence.Event.Phrase.Equals(phrase, StringComparison.InvariantCultureIgnoreCase)); zoneId = obj.Id; if (existingOccurrence != null) { obj.Descriptives.Remove(existingOccurrence); if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - RemoveDescriptive[" + id.ToString() + "|" + type.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Delete Successful."; } else { message = "Error; Removal failed."; } } else { message = "That does not exist"; } } } } return(RedirectToAction("Edit", new { Message = message, id = zoneId })); }
public ActionResult EditUIModule(long id, AddEditUIModuleViewModel vModel) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IUIModule obj = TemplateCache.Get <IUIModule>(id); string message; if (obj == null) { message = "That does not exist"; return(RedirectToAction("UIModules", new { Message = message })); } obj.Name = vModel.Name; obj.BodyHtml = vModel.BodyHtml; obj.Height = vModel.Height; obj.Width = vModel.Width; obj.HelpText = vModel.HelpText; if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - EditUIModule[" + obj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Edit Successful."; } else { message = "Error; Edit failed."; } return(RedirectToAction("UIModules", new { Message = message })); }
public ActionResult Edit(AddEditZoneTemplateViewModel vModel, long id) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IZoneTemplate obj = TemplateCache.Get <IZoneTemplate>(id); string message; if (obj == null) { message = "That does not exist"; return(RedirectToAction("Index", new { Message = message })); } obj.Name = vModel.DataObject.Name; obj.BaseElevation = vModel.DataObject.BaseElevation; obj.PressureCoefficient = vModel.DataObject.PressureCoefficient; obj.TemperatureCoefficient = vModel.DataObject.TemperatureCoefficient; obj.Hemisphere = vModel.DataObject.Hemisphere; obj.World = vModel.DataObject.World; obj.FloraResourceSpawn = vModel.DataObject.FloraResourceSpawn; obj.FaunaResourceSpawn = vModel.DataObject.FaunaResourceSpawn; obj.MineralResourceSpawn = vModel.DataObject.MineralResourceSpawn; if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - EditZone[" + obj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Edit Successful."; } else { message = "Error; Edit failed."; } return(RedirectToAction("Index", new { Message = message })); }
public ActionResult Edit(long id, AddEditPathwayTemplateViewModel vModel) { string message = string.Empty; ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IPathwayTemplate obj = TemplateCache.Get <IPathwayTemplate>(id); if (obj == null) { return(View("~/Views/GameAdmin/Pathway/AddEdit.cshtml", vModel)); } obj.Name = vModel.DataObject.Name; obj.DegreesFromNorth = vModel.DataObject.DegreesFromNorth; obj.InclineGrade = vModel.DataObject.InclineGrade; obj.Origin = vModel.DataObject.Origin; obj.Destination = vModel.DataObject.Destination; if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - EditPathwayTemplate[" + obj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); } else { message = "Error; Edit failed."; } return(RedirectToRoute("ModalErrorOrClose", new { Message = message })); }
public ActionResult Edit(long zoneId, AddEditLocaleTemplateViewModel vModel, long id) { IZoneTemplate zone = TemplateCache.Get <IZoneTemplate>(zoneId); if (zone == null) { return(RedirectToAction("Index", "Zone", new { Id = zoneId, Message = "Invalid zone" })); } ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); ILocaleTemplate obj = TemplateCache.Get <ILocaleTemplate>(id); string message; if (obj == null) { message = "That does not exist"; return(RedirectToAction("Index", new { Message = message })); } obj.Name = vModel.DataObject.Name; obj.AlwaysDiscovered = vModel.DataObject.AlwaysDiscovered; if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - EditLocale[" + obj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Edit Successful."; } else { message = "Error; Edit failed."; } return(RedirectToAction("Index", "Zone", new { Id = zoneId, Message = message })); }
private static void FillRoomDimensions(long[,,] coordinatePlane) { if (coordinatePlane == null) { return; } int x, y, z; for (x = 0; x <= coordinatePlane.GetUpperBound(0); x++) { for (y = 0; y <= coordinatePlane.GetUpperBound(1); y++) { for (z = 0; z <= coordinatePlane.GetUpperBound(2); z++) { if (coordinatePlane[x, y, z] < 0) { continue; } IRoomTemplate room = TemplateCache.Get <IRoomTemplate>(coordinatePlane[x, y, z]); if (room == null) { continue; } room.Coordinates = new Coordinate(x, y, z); } } } }
public ActionResult Add(long localeId) { ILocaleTemplate myLocale = TemplateCache.Get <ILocaleTemplate>(localeId); if (myLocale == null) { return(RedirectToAction("Index", new { Message = "Invalid Locale" })); } AddEditRoomTemplateViewModel vModel = new AddEditRoomTemplateViewModel { AuthedUser = UserManager.FindById(User.Identity.GetUserId()), ValidMaterials = TemplateCache.GetAll <IMaterial>(), ValidModels = TemplateCache.GetAll <IDimensionalModelData>(), ValidZones = TemplateCache.GetAll <IZoneTemplate>(), ValidRooms = TemplateCache.GetAll <IRoomTemplate>(), ValidLocales = TemplateCache.GetAll <ILocaleTemplate>().Where(locale => locale.Id != localeId), ZonePathway = new PathwayTemplate() { Destination = myLocale.ParentLocation }, LocaleRoomPathway = new PathwayTemplate(), LocaleRoomPathwayDestinationLocale = new LocaleTemplate(), DataObject = new RoomTemplate() { ParentLocation = myLocale } }; return(View("~/Views/GameAdmin/Room/Add.cshtml", "_chromelessLayout", vModel)); }
public ActionResult EditLocalePathway(long id, AddEditZonePathwayTemplateViewModel vModel) { string message = string.Empty; ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IPathwayTemplate obj = TemplateCache.Get <IPathwayTemplate>(id); if (obj == null) { message = "That does not exist"; return(RedirectToAction("Edit", new { Message = message, id })); } obj.Name = vModel.DataObject.Name; obj.DegreesFromNorth = vModel.DataObject.DegreesFromNorth; obj.InclineGrade = vModel.DataObject.InclineGrade; obj.Destination = TemplateCache.Get <IRoomTemplate>(vModel.DestinationRoom.Id); if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - EditPathwayTemplate[" + obj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); } else { message = "Error; Edit failed."; } return(RedirectToAction("Edit", new { Message = message, obj.Origin.Id })); }
public ActionResult RemoveUIModule(long ID, string authorize) { string message; if (string.IsNullOrWhiteSpace(authorize) || !ID.ToString().Equals(authorize)) { message = "You must check the proper authorize radio button first."; } else { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IUIModule obj = TemplateCache.Get <IUIModule>(ID); if (obj == null) { message = "That does not exist"; } else if (obj.Remove(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - RemoveUIModule[" + ID.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Delete Successful."; } else { message = "Error; Removal failed."; } } return(RedirectToAction("UIModules", new { Message = message })); }
public ActionResult Edit(long zoneId, long id) { IZoneTemplate zone = TemplateCache.Get <IZoneTemplate>(zoneId); if (zone == null) { return(RedirectToAction("Index", "Zone", new { Id = zoneId, Message = "Invalid zone" })); } AddEditLocaleTemplateViewModel vModel = new AddEditLocaleTemplateViewModel { AuthedUser = UserManager.FindById(User.Identity.GetUserId()) }; ILocaleTemplate obj = TemplateCache.Get <ILocaleTemplate>(id); if (obj == null) { string message = "That does not exist"; return(RedirectToAction("Index", "Zone", new { Id = zoneId, Message = message })); } vModel.DataObject = obj; return(View("~/Views/GameAdmin/Locale/Edit.cshtml", vModel)); }
public ActionResult Edit(long id) { AddEditUIModuleViewModel vModel = new AddEditUIModuleViewModel { AuthedUser = UserManager.FindById(User.Identity.GetUserId()) }; IUIModule obj = TemplateCache.Get <IUIModule>(id); if (obj == null) { string message = "That does not exist"; return(RedirectToAction("Index", new { Message = message })); } vModel.DataObject = obj; vModel.Name = obj.Name; vModel.BodyHtml = obj.BodyHtml.Value; vModel.Height = obj.Height; vModel.Width = obj.Width; vModel.HelpText = obj.HelpText.Value; vModel.SystemDefault = obj.SystemDefault; return(View("~/Views/GameAdmin/UIModules/Edit.cshtml", vModel)); }
public ActionResult Add(long zoneId, AddEditLocaleTemplateViewModel vModel) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IZoneTemplate zone = TemplateCache.Get <IZoneTemplate>(zoneId); if (zone == null) { return(RedirectToAction("Index", "Zone", new { Id = zoneId, Message = "Invalid zone" })); } LocaleTemplate newObj = new LocaleTemplate { Name = vModel.DataObject.Name, AlwaysDiscovered = vModel.DataObject.AlwaysDiscovered, ParentLocation = zone }; string message; if (newObj.Create(authedUser.GameAccount, authedUser.GetStaffRank(User)) == null) { message = "Error; Creation failed."; } else { LoggingUtility.LogAdminCommandUsage("*WEB* - AddLocale[" + newObj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Creation Successful."; } return(RedirectToAction("Index", "Zone", new { Id = zoneId, Message = message })); }
public ActionResult Edit(int id, AddEditGenderViewModel vModel) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IGender obj = TemplateCache.Get <IGender>(id); string message; if (obj == null) { message = "That does not exist"; return(RedirectToAction("Index", new { Message = message })); } obj.Name = vModel.DataObject.Name; obj.Adult = vModel.DataObject.Adult; obj.Child = vModel.DataObject.Child; obj.Collective = vModel.DataObject.Collective; obj.Possessive = vModel.DataObject.Possessive; obj.Base = vModel.DataObject.Base; obj.Feminine = vModel.DataObject.Feminine; if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - EditGenderData[" + obj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Edit Successful."; } else { message = "Error; Edit failed."; } return(RedirectToAction("Index", new { Message = message })); }
public ActionResult AddEditDescriptive(long id, OccurrenceViewModel vModel) { string message = string.Empty; ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IRoomTemplate obj = TemplateCache.Get <IRoomTemplate>(id); if (obj == null) { message = "That does not exist"; return(RedirectToRoute("ModalErrorOrClose", new { Message = message })); } ISensoryEvent existingOccurrence = obj.Descriptives.FirstOrDefault(occurrence => occurrence.Event.Role == vModel.SensoryEventDataObject.Event.Role && occurrence.Event.Phrase.Equals(vModel.SensoryEventDataObject.Event.Phrase, StringComparison.InvariantCultureIgnoreCase)); if (existingOccurrence == null) { existingOccurrence = new SensoryEvent(vModel.SensoryEventDataObject.SensoryType) { Strength = vModel.SensoryEventDataObject.Strength, Event = new Lexica(vModel.SensoryEventDataObject.Event.Type, vModel.SensoryEventDataObject.Event.Role, vModel.SensoryEventDataObject.Event.Phrase, new LexicalContext(null)) { Modifiers = vModel.SensoryEventDataObject.Event.Modifiers } }; } else { existingOccurrence.Strength = vModel.SensoryEventDataObject.Strength; existingOccurrence.SensoryType = vModel.SensoryEventDataObject.SensoryType; existingOccurrence.Event = new Lexica(vModel.SensoryEventDataObject.Event.Type, vModel.SensoryEventDataObject.Event.Role, vModel.SensoryEventDataObject.Event.Phrase, new LexicalContext(null)) { Modifiers = vModel.SensoryEventDataObject.Event.Modifiers }; } obj.Descriptives.RemoveWhere(occurrence => occurrence.Event.Role == vModel.SensoryEventDataObject.Event.Role && occurrence.Event.Phrase.Equals(vModel.SensoryEventDataObject.Event.Phrase, StringComparison.InvariantCultureIgnoreCase)); obj.Descriptives.Add(existingOccurrence); if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - Room AddEditDescriptive[" + obj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); } else { message = "Error; Edit failed."; } return(RedirectToRoute("ModalErrorOrClose", new { Message = message })); }
public ActionResult Edit(int id) { string message = string.Empty; IRoomTemplate obj = TemplateCache.Get <IRoomTemplate>(id); if (obj == null) { message = "That does not exist"; return(RedirectToRoute("ErrorOrClose", new { Message = message })); } AddEditRoomTemplateViewModel vModel = new AddEditRoomTemplateViewModel { AuthedUser = UserManager.FindById(User.Identity.GetUserId()), ValidMaterials = TemplateCache.GetAll <IMaterial>(), ValidZones = TemplateCache.GetAll <IZoneTemplate>(), ValidLocales = TemplateCache.GetAll <ILocaleTemplate>().Where(locale => locale.Id != obj.ParentLocation.Id), ValidLocaleRooms = TemplateCache.GetAll <IRoomTemplate>().Where(room => room.Id != obj.Id && room.ParentLocation.Id == obj.ParentLocation.Id), ValidRooms = TemplateCache.GetAll <IRoomTemplate>().Where(room => room.Id != obj.Id), ValidModels = TemplateCache.GetAll <IDimensionalModelData>(), DataObject = obj, }; IPathwayTemplate zoneDestination = obj.GetZonePathways().FirstOrDefault(); if (zoneDestination != null) { vModel.ZonePathway = zoneDestination; } else { vModel.ZonePathway = new PathwayTemplate() { Destination = obj.ParentLocation.ParentLocation, Origin = obj }; } IPathwayTemplate localeRoomPathway = obj.GetLocalePathways().FirstOrDefault(); if (localeRoomPathway != null) { vModel.LocaleRoomPathway = localeRoomPathway; vModel.LocaleRoomPathwayDestinationLocale = ((IRoomTemplate)localeRoomPathway.Destination).ParentLocation; vModel.ValidLocaleRooms = TemplateCache.GetAll <IRoomTemplate>().Where(room => localeRoomPathway.Id == room.ParentLocation.Id); } else { vModel.LocaleRoomPathway = new PathwayTemplate() { Origin = obj }; vModel.LocaleRoomPathwayDestinationLocale = new LocaleTemplate(); } return(View("~/Views/GameAdmin/Room/Edit.cshtml", "_chromelessLayout", vModel)); }
public ActionResult Map(long ID) { RoomMapViewModel vModel = new RoomMapViewModel { Here = TemplateCache.Get <IRoomTemplate>(ID) }; return(View("~/Views/GameAdmin/Room/Map.cshtml", vModel)); }
public ActionResult Add(long id, long originRoomId, long destinationRoomId, int degreesFromNorth = 0, int incline = 0) { //New room or existing room if (destinationRoomId.Equals(-1)) { IRoomTemplate origin = TemplateCache.Get <IRoomTemplate>(originRoomId); AddPathwayWithRoomTemplateViewModel vModel = new AddPathwayWithRoomTemplateViewModel { AuthedUser = UserManager.FindById(User.Identity.GetUserId()), ValidMaterials = TemplateCache.GetAll <IMaterial>(), ValidModels = TemplateCache.GetAll <IDimensionalModelData>().Where(model => model.ModelType == DimensionalModelType.Flat), ValidRooms = TemplateCache.GetAll <IRoomTemplate>(), Origin = origin, DataObject = new PathwayTemplate() { DegreesFromNorth = degreesFromNorth, InclineGrade = incline }, Destination = new RoomTemplate() { ParentLocation = origin.ParentLocation } }; vModel.Destination.ParentLocation = vModel.Origin.ParentLocation; return(View("~/Views/GameAdmin/Pathway/AddWithRoom.cshtml", "_chromelessLayout", vModel)); } else { IRoomTemplate origin = TemplateCache.Get <IRoomTemplate>(originRoomId); IRoomTemplate destination = TemplateCache.Get <IRoomTemplate>(destinationRoomId); IPathwayTemplate pathwayTemplate = TemplateCache.Get <IPathwayTemplate>(id); if (pathwayTemplate == null) { pathwayTemplate = new PathwayTemplate() { Origin = origin, Destination = destination, DegreesFromNorth = degreesFromNorth, InclineGrade = incline }; } AddEditPathwayTemplateViewModel vModel = new AddEditPathwayTemplateViewModel { AuthedUser = UserManager.FindById(User.Identity.GetUserId()), ValidMaterials = TemplateCache.GetAll <IMaterial>(), ValidModels = TemplateCache.GetAll <IDimensionalModelData>().Where(model => model.ModelType == DimensionalModelType.Flat), ValidRooms = TemplateCache.GetAll <IRoomTemplate>().Where(rm => !rm.Id.Equals(originRoomId)), DataObject = pathwayTemplate }; return(View("~/Views/GameAdmin/Pathway/AddEdit.cshtml", "_chromelessLayout", vModel)); } }
public string[] GetDimensionalData(long id) { IDimensionalModelData model = TemplateCache.Get <IDimensionalModelData>(id); if (model == null) { return(new string[0]); } return(model.ModelPlanes.Select(plane => plane.TagName).Distinct().ToArray()); }
public override object Convert(object input) { string stringInput = input.ToString(); if (string.IsNullOrWhiteSpace(stringInput)) { return(null); } return(TemplateCache.Get <IHelp>(long.Parse(stringInput))); }
/// <summary> /// Turn a comma delimited list of planes into the modelplane set /// </summary> /// <param name="delimitedPlanes">comma delimited list of planes</param> private void SerializeModelFromDelimitedList(string delimitedPlanes) { //don't need to serialize nothing if (ModelType == DimensionalModelType.None) { return; } try { short yCount = 21; foreach (string myString in delimitedPlanes.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) { DimensionalModelPlane newPlane = new DimensionalModelPlane(); string[] currentLineNodes = myString.Split(new char[] { ',' }); //Name is first newPlane.TagName = currentLineNodes[0]; newPlane.YAxis = yCount; short xCount = 1; foreach (string nodeString in currentLineNodes.Skip(1)) { DimensionalModelNode newNode = new DimensionalModelNode(); string[] nodeStringComponents = nodeString.Split(new char[] { '|' }); newNode.XAxis = xCount; newNode.YAxis = yCount; newNode.Style = string.IsNullOrWhiteSpace(nodeStringComponents[0]) ? DamageType.None : Render.CharacterToDamageType(nodeStringComponents[0]); //May not always indicate material id if (nodeStringComponents.Count() > 1 && string.IsNullOrWhiteSpace(nodeStringComponents[1])) { newNode.Composition = TemplateCache.Get <IMaterial>(long.Parse(nodeStringComponents[1])); } newPlane.ModelNodes.Add(newNode); xCount++; } //This ensures the linecount is always 21 for flats ModelPlanes.Add(newPlane); yCount--; } } catch (Exception ex) { LoggingUtility.LogError(ex); throw new FormatException("Invalid delimitedPlanes format.", ex); } }
public string GetEntityModelView(long modelId) { IDimensionalModelData model = TemplateCache.Get <IDimensionalModelData>(modelId); if (model == null) { return(string.Empty); } return(Render.FlattenModelForWeb(model)); }
public string RenderRoomForEditWithRadius(long id, int radius) { IRoomTemplate centerRoom = TemplateCache.Get <IRoomTemplate>(id); if (centerRoom == null || radius < 0) { return("Invalid inputs."); } return(Rendering.RenderRadiusMap(centerRoom, radius)); }
public override object Convert(object input) { string stringInput = input.ToString(); if (string.IsNullOrWhiteSpace(stringInput)) { return null; } long id = long.Parse(stringInput); return TemplateCache.Get<IFlora>(id); }
public ActionResult Edit(long id, AddEditDimensionalModelDataViewModel vModel) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IDimensionalModelData obj = TemplateCache.Get <IDimensionalModelData>(id); string message; if (obj == null) { message = "That does not exist"; return(RedirectToAction("Index", new { Message = message })); } try { foreach (IDimensionalModelPlane plane in vModel.DataObject.ModelPlanes) { foreach (IDimensionalModelNode node in plane.ModelNodes) { node.YAxis = plane.YAxis; } } if (vModel.DataObject.IsModelValid()) { obj.Name = vModel.DataObject.Name; obj.ModelType = vModel.DataObject.ModelType; obj.ModelPlanes = vModel.DataObject.ModelPlanes; obj.Vacuity = vModel.DataObject.Vacuity; if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - EditDimensionalModelData[" + obj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Edit Successful."; } else { message = "Error; Edit failed."; } } else { message = "Invalid model; Models must contain 21 planes of a tag name followed by 21 rows of 21 nodes."; } } catch (Exception ex) { LoggingUtility.LogError(ex, false); message = "Error; Creation failed."; } return(RedirectToAction("Index", new { Message = message })); }
public ActionResult FightingArtEdit(int id, AddEditFightingArtViewModel vModel) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IFightingArt obj = TemplateCache.Get <IFightingArt>(id); if (obj == null) { string message = "That does not exist"; return(RedirectToRoute("Index", new { StatusMessage = message })); } if (vModel.DataObject.CalculateCostRatio() > 0) { ViewData.Add("Message", "The Calculated Cost must be equal to or below zero."); return(View("~/Views/Manage/FightingArtEdit.cshtml", vModel)); } obj.Name = vModel.DataObject.Name; obj.ActorCriteria = vModel.DataObject.ActorCriteria; obj.Aim = vModel.DataObject.Aim; obj.Armor = vModel.DataObject.Armor; obj.DistanceChange = vModel.DataObject.DistanceChange; obj.DistanceRange = vModel.DataObject.DistanceRange; obj.Health = vModel.DataObject.Health; obj.HelpText = vModel.DataObject.HelpText; obj.Impact = vModel.DataObject.Impact; obj.PositionResult = vModel.DataObject.PositionResult; obj.Recovery = vModel.DataObject.Recovery; obj.RekkaKey = vModel.DataObject.RekkaKey; obj.RekkaPosition = vModel.DataObject.RekkaPosition; obj.Setup = vModel.DataObject.Setup; obj.Stamina = vModel.DataObject.Stamina; obj.VictimCriteria = vModel.DataObject.VictimCriteria; obj.ResultQuality = vModel.DataObject.ResultQuality; obj.AdditiveQuality = vModel.DataObject.AdditiveQuality; obj.QualityValue = vModel.DataObject.QualityValue; obj.Readiness = vModel.DataObject.Readiness; obj.ActionVerb = vModel.DataObject.ActionVerb; obj.ActionPredicate = vModel.DataObject.ActionPredicate; if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - EditFightingArt[" + obj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); } else { } return(RedirectToAction("Index")); }
public string[] RenderLocaleMapForEdit(long id, int zIndex) { ILocaleTemplate locale = TemplateCache.Get <ILocaleTemplate>(id); if (locale == null) { return(new string[] { "Invalid inputs." }); } System.Tuple <string, string, string> maps = Rendering.RenderRadiusMap(locale, 10, zIndex); return(new string[] { maps.Item1, maps.Item2, maps.Item3 }); }
public override object Convert(object input) { string stringInput = input.ToString(); if (string.IsNullOrWhiteSpace(stringInput)) { return(null); } long id = long.Parse(stringInput); return(TemplateCache.Get <IMineral>(id) as INaturalResource); }
public ActionResult Remove(long removeId = -1, string authorizeRemove = "", long unapproveId = -1, string authorizeUnapprove = "") { string message; if (!string.IsNullOrWhiteSpace(authorizeRemove) && removeId.ToString().Equals(authorizeRemove)) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IGender obj = TemplateCache.Get <IGender>(removeId); if (obj == null) { message = "That does not exist"; } else if (obj.Remove(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - RemoveGender[" + removeId.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Delete Successful."; } else { message = "Error; Removal failed."; } } else if (!string.IsNullOrWhiteSpace(authorizeUnapprove) && unapproveId.ToString().Equals(authorizeUnapprove)) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IGender obj = TemplateCache.Get <IGender>(unapproveId); if (obj == null) { message = "That does not exist"; } else if (obj.ChangeApprovalStatus(authedUser.GameAccount, authedUser.GetStaffRank(User), ApprovalState.Returned)) { LoggingUtility.LogAdminCommandUsage("*WEB* - UnapproveGender[" + unapproveId.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Unapproval Successful."; } else { message = "Error; Unapproval failed."; } } else { message = "You must check the proper remove or unapprove authorization radio button first."; } return(RedirectToAction("Index", new { Message = message })); }
/// <summary> /// Isolates the main world map to just one zone /// </summary> /// <param name="fullMap">the world map</param> /// <param name="zoneId">the zone to isolate</param> /// <param name="recenter">recenter the map or not, defaults to not</param> /// <returns>the zone's map</returns> public static long[,,] GetLocaleMap(long[,,] fullMap, long localeId, bool recenter = false) { long[,,] newMap = new long[fullMap.GetUpperBound(0) + 1, fullMap.GetUpperBound(1) + 1, fullMap.GetUpperBound(2) + 1]; newMap.Populate(-1); int x, y, z, xLowest = 0, yLowest = 0, zLowest = 0; for (x = 0; x <= fullMap.GetUpperBound(0); x++) { for (y = 0; y <= fullMap.GetUpperBound(1); y++) { for (z = 0; z <= fullMap.GetUpperBound(2); z++) { IRoomTemplate room = TemplateCache.Get <IRoomTemplate>(fullMap[x, y, z]); if (room == null || room.ParentLocation == null || !room.ParentLocation.Id.Equals(localeId)) { continue; } newMap[x, y, z] = fullMap[x, y, z]; if (xLowest > x) { xLowest = x; } if (yLowest > y) { yLowest = y; } if (zLowest > z) { zLowest = z; } } } } //Maps were the same size or we didnt want to shrink if (!false || (xLowest <= 0 && yLowest <= 0 && zLowest <= 0)) { return(newMap); } return(ShrinkMap(newMap, xLowest, yLowest, zLowest , new Tuple <int, int>(newMap.GetLowerBound(0), newMap.GetUpperBound(0)) , new Tuple <int, int>(newMap.GetLowerBound(1), newMap.GetUpperBound(1)) , new Tuple <int, int>(newMap.GetLowerBound(2), newMap.GetUpperBound(2)))); }
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 })); }