コード例 #1
0
        public void GetFromWorldOrSpawn()
        {
            //Try to see if they are already there
            IGaia me = LiveCache.Get <IGaia>(TemplateId, typeof(GaiaTemplate));

            //Isn't in the world currently
            if (me == default(IGaia))
            {
                SpawnNewInWorld();
            }
            else
            {
                BirthMark           = me.BirthMark;
                Birthdate           = me.Birthdate;
                TemplateId          = me.TemplateId;
                Keywords            = me.Keywords;
                CurrentLocation     = null;
                CurrentTimeOfDay    = me.CurrentTimeOfDay;
                MeterologicalFronts = me.MeterologicalFronts;
                Macroeconomy        = me.Macroeconomy;
                CelestialPositions  = me.CelestialPositions;
                RotationalAngle     = me.RotationalAngle;

                Qualities = me.Qualities;

                CurrentLocation = null;
                KickoffProcesses();
            }
        }
コード例 #2
0
        public ActionResult EditWorld(string birthMark, ViewGaiaViewModel vModel)
        {
            ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId());

            IGaia  obj = LiveCache.Get <IGaia>(new LiveCacheKey(typeof(Gaia), birthMark));
            string message;

            if (obj == null)
            {
                message = "That does not exist";
                return(RedirectToAction("Index", new { Message = message }));
            }

            obj.RotationalAngle     = vModel.DataObject.RotationalAngle;
            obj.OrbitalPosition     = vModel.DataObject.OrbitalPosition;
            obj.Macroeconomy        = vModel.DataObject.Macroeconomy;
            obj.CelestialPositions  = vModel.DataObject.CelestialPositions;
            obj.MeterologicalFronts = vModel.DataObject.MeterologicalFronts;
            obj.CurrentTimeOfDay    = vModel.DataObject.CurrentTimeOfDay;

            obj.Qualities = vModel.DataObject.Qualities;

            if (obj.Save())
            {
                LoggingUtility.LogAdminCommandUsage("*WEB* - LIVE DATA - EditGaia[" + obj.BirthMark + "]", authedUser.GameAccount.GlobalIdentityHandle);
                message = "Edit Successful.";
            }
            else
            {
                message = "Error; Edit failed.";
            }

            return(RedirectToAction("World", new { Message = message, birthMark }));
        }
コード例 #3
0
        private static void FillRoomDimensions(string[,,] 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 (string.IsNullOrWhiteSpace(coordinatePlane[x, y, z]))
                        {
                            continue;
                        }

                        IRoom room = LiveCache.Get <IRoom>(new LiveCacheKey(typeof(IRoom), coordinatePlane[x, y, z]));

                        if (room == null)
                        {
                            continue;
                        }

                        room.Coordinates = new Coordinate(x, y, z);
                    }
                }
            }
        }
コード例 #4
0
ファイル: Player.cs プロジェクト: Cloudxtreme/NetMud
        /// <summary>
        /// Spawn this new into the live world
        /// </summary>
        public override void SpawnNewInWorld()
        {
            var ch = (ICharacter)DataTemplate;
            var locationAssembly = Assembly.GetAssembly(typeof(ILocation));

            if (ch.LastKnownLocationType == null)
            {
                ch.LastKnownLocationType = typeof(IRoom).Name;
            }

            var lastKnownLocType = locationAssembly.DefinedTypes.FirstOrDefault(tp => tp.Name.Equals(ch.LastKnownLocationType));

            ILocation lastKnownLoc = null;

            if (lastKnownLocType != null && !string.IsNullOrWhiteSpace(ch.LastKnownLocation))
            {
                if (lastKnownLocType.GetInterfaces().Contains(typeof(ISpawnAsSingleton)))
                {
                    long lastKnownLocID = long.Parse(ch.LastKnownLocation);
                    lastKnownLoc = LiveCache.Get <ILocation>(lastKnownLocID, lastKnownLocType);
                }
                else
                {
                    var cacheKey = new LiveCacheKey(lastKnownLocType, ch.LastKnownLocation);
                    lastKnownLoc = LiveCache.Get <ILocation>(cacheKey);
                }
            }

            SpawnNewInWorld(lastKnownLoc);
        }
コード例 #5
0
ファイル: Player.cs プロジェクト: Cloudxtreme/NetMud
        /// <summary>
        /// Tries to find this entity in the world based on its ID or gets a new one from the db and puts it in the world
        /// </summary>
        public void GetFromWorldOrSpawn()
        {
            //Try to see if they are already there
            var me = LiveCache.Get <Player>(DataTemplate.ID);

            //Isn't in the world currently
            if (me == default(IPlayer))
            {
                SpawnNewInWorld();
            }
            else
            {
                BirthMark    = me.BirthMark;
                Birthdate    = me.Birthdate;
                DataTemplate = me.DataTemplate;
                Inventory    = me.Inventory;
                Keywords     = me.Keywords;

                if (me.CurrentLocation == null)
                {
                    var newLoc = GetBaseSpawn();
                    newLoc.MoveInto <IPlayer>(this);
                }
                else
                {
                    me.CurrentLocation.MoveInto <IPlayer>(this);
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// Spawn this into the world and live cache
        /// </summary>
        public override void SpawnNewInWorld(IGlobalPosition spawnTo)
        {
            //We can't even try this until we know if the data is there
            ILocaleTemplate bS = Template <ILocaleTemplate>() ?? throw new InvalidOperationException("Missing backing data store on locale spawn event.");

            Keywords         = new string[] { bS.Name.ToLower() };
            AlwaysDiscovered = bS.AlwaysDiscovered;
            Descriptives     = bS.Descriptives;

            if (string.IsNullOrWhiteSpace(BirthMark))
            {
                BirthMark = LiveCache.GetUniqueIdentifier(bS);
                Birthdate = DateTime.Now;
            }

            UpsertToLiveWorldCache(true);

            ParentLocation = LiveCache.Get <IZone>(bS.ParentLocation.Id);

            if (spawnTo?.CurrentZone == null)
            {
                spawnTo = new GlobalPosition(ParentLocation, this);
            }

            CurrentLocation = spawnTo;

            UpsertToLiveWorldCache(true);
        }
コード例 #7
0
        public ActionResult RemoveZoneDescriptive(string id = "", string authorize = "")
        {
            string message = string.Empty;
            string zoneId  = "";

            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];

                    IZone obj = LiveCache.Get <IZone>(new LiveCacheKey(typeof(IZone), 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.BirthMark;

                        if (existingOccurrence != null)
                        {
                            obj.Descriptives.Remove(existingOccurrence);

                            if (obj.Save())
                            {
                                LoggingUtility.LogAdminCommandUsage("*WEB* - LIVE DATA - RemoveDescriptive[" + id.ToString() + "|" + type.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle);
                                message = "Delete Successful.";
                            }
                            else
                            {
                                message = "Error; Removal failed.";
                            }
                        }
                        else
                        {
                            message = "That does not exist";
                        }
                    }
                }
            }

            return(RedirectToAction("Zone", new { Message = message, birthMark = id }));
        }
コード例 #8
0
        public ActionResult EditZone(string birthMark, ViewZoneViewModel vModel)
        {
            ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId());

            IZone  obj = LiveCache.Get <IZone>(new LiveCacheKey(typeof(Zone), birthMark));
            string message;

            if (obj == null)
            {
                message = "That does not exist";
                return(RedirectToAction("Index", new { Message = message }));
            }

            obj.BaseElevation = vModel.DataObject.BaseElevation;
            obj.Hemisphere    = vModel.DataObject.Hemisphere;
            obj.Humidity      = vModel.DataObject.Humidity;
            obj.Temperature   = vModel.DataObject.Temperature;

            //obj.NaturalResources = vModel.DataObject.NaturalResources;
            obj.Qualities = vModel.DataObject.Qualities;

            if (obj.Save())
            {
                LoggingUtility.LogAdminCommandUsage("*WEB* - LIVE DATA - EditZone[" + obj.BirthMark + "]", authedUser.GameAccount.GlobalIdentityHandle);
                message = "Edit Successful.";
            }
            else
            {
                message = "Error; Edit failed.";
            }

            return(RedirectToAction("Zone", new { Message = message, birthMark }));
        }
コード例 #9
0
ファイル: Player.cs プロジェクト: Cloudxtreme/NetMud
        /// <summary>
        /// Find the emergency we dont know where to spawn this guy spawn location
        /// </summary>
        /// <returns>The emergency spawn location</returns>
        private IContains GetBaseSpawn()
        {
            var chr = (Character)DataTemplate;

            var roomId = chr.StillANoob ? chr.RaceData.StartingLocation.ID : chr.RaceData.EmergencyLocation.ID;

            return(LiveCache.Get <Room>(roomId));
        }
コード例 #10
0
        public ActionResult AddEditZoneDescriptive(string birthMark, LiveOccurrenceViewModel vModel)
        {
            string          message    = string.Empty;
            ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId());

            IZone obj = LiveCache.Get <IZone>(new LiveCacheKey(typeof(Zone), birthMark));

            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())
            {
                LoggingUtility.LogAdminCommandUsage("*WEB* - LIVE DATA - Zone AddEditDescriptive[" + obj.BirthMark + "]", authedUser.GameAccount.GlobalIdentityHandle);
            }
            else
            {
                message = "Error; Edit failed.";
            }

            return(RedirectToRoute("ModalErrorOrClose", new { Message = message }));
        }
コード例 #11
0
        /// <summary>
        /// Spawn this new into the live world into a specified container
        /// </summary>
        /// <param name="spawnTo">the location/container this should spawn into</param>
        public override void SpawnNewInWorld(IContains spawnTo)
        {
            var bS = (IPathwayData)DataTemplate;
            var locationAssembly = Assembly.GetAssembly(typeof(Room));

            MovementDirection = MessagingUtility.TranslateDegreesToDirection(bS.DegreesFromNorth);

            BirthMark = Birthmarker.GetBirthmark(bS);
            Keywords  = new string[] { bS.Name.ToLower(), MovementDirection.ToString().ToLower() };
            Birthdate = DateTime.Now;

            //paths need two locations
            ILocation fromLocation     = null;
            var       fromLocationType = locationAssembly.DefinedTypes.FirstOrDefault(tp => tp.Name.Equals(bS.FromLocationType));

            if (fromLocationType != null && !string.IsNullOrWhiteSpace(bS.FromLocationID))
            {
                if (fromLocationType.GetInterfaces().Contains(typeof(ISpawnAsSingleton)))
                {
                    long fromLocationID = long.Parse(bS.FromLocationID);
                    fromLocation = LiveCache.Get <ILocation>(fromLocationID, fromLocationType);
                }
                else
                {
                    var cacheKey = new LiveCacheKey(fromLocationType, bS.FromLocationID);
                    fromLocation = LiveCache.Get <ILocation>(cacheKey);
                }
            }

            ILocation toLocation     = null;
            var       toLocationType = locationAssembly.DefinedTypes.FirstOrDefault(tp => tp.Name.Equals(bS.ToLocationType));

            if (toLocationType != null && !string.IsNullOrWhiteSpace(bS.ToLocationID))
            {
                if (toLocationType.GetInterfaces().Contains(typeof(ISpawnAsSingleton)))
                {
                    long toLocationID = long.Parse(bS.ToLocationID);
                    toLocation = LiveCache.Get <ILocation>(toLocationID, toLocationType);
                }
                else
                {
                    var cacheKey = new LiveCacheKey(toLocationType, bS.ToLocationID);
                    toLocation = LiveCache.Get <ILocation>(cacheKey);
                }
            }

            FromLocation    = fromLocation;
            ToLocation      = toLocation;
            CurrentLocation = fromLocation;

            Enter = new MessageCluster(new string[] { bS.MessageToActor }, new string[] { "$A$ enters you" }, new string[] { }, new string[] { bS.MessageToOrigin }, new string[] { bS.MessageToDestination });
            Enter.ToSurrounding.Add(bS.VisibleStrength, new Tuple <MessagingType, IEnumerable <string> >(MessagingType.Visible, new string[] { bS.VisibleToSurroundings }));
            Enter.ToSurrounding.Add(bS.AudibleStrength, new Tuple <MessagingType, IEnumerable <string> >(MessagingType.Visible, new string[] { bS.AudibleToSurroundings }));

            fromLocation.MoveInto <IPathway>(this);
        }
コード例 #12
0
        public string RenderLiveRoomForEditWithRadius(string birthMark, int radius)
        {
            IRoom centerRoom = LiveCache.Get <IRoom>(new LiveCacheKey(typeof(IRoom), birthMark));

            if (centerRoom == null || radius < 0)
            {
                return("Invalid inputs.");
            }

            return(Rendering.RenderRadiusMap(centerRoom, radius));
        }
コード例 #13
0
        /// <summary>
        /// Get this from the world or make a new one and put it in
        /// </summary>
        public void GetFromWorldOrSpawn()
        {
            //Try to see if they are already there
            ILocale me = LiveCache.Get <ILocale>(TemplateId, typeof(LocaleTemplate));

            //Isn't in the world currently
            if (me == default(ILocale))
            {
                SpawnNewInWorld();
            }
        }
コード例 #14
0
        /// <summary>
        /// Tries to find this entity in the world based on its Id or gets a new one from the db and puts it in the world
        /// </summary>
        public void GetFromWorldOrSpawn()
        {
            //Try to see if they are already there
            Pathway me = LiveCache.Get <Pathway>(TemplateId);

            //Isn't in the world currently
            if (me == default(Pathway))
            {
                SpawnNewInWorld();
            }
        }
コード例 #15
0
        public string[] RenderLiveLocaleMapForEdit(string birthMark, int zIndex)
        {
            ILocale locale = LiveCache.Get <ILocale>(new LiveCacheKey(typeof(ILocale), birthMark));

            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 });
        }
コード例 #16
0
        /// <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 string[,,] GetLocaleMap(string[,,] fullMap, string localeId, bool recenter = false)
        {
            string[,,] newMap = new string[fullMap.GetUpperBound(0) + 1, fullMap.GetUpperBound(1) + 1, fullMap.GetUpperBound(2) + 1];
            newMap.Populate("");

            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++)
                    {
                        IRoom room = LiveCache.Get <IRoom>(new LiveCacheKey(typeof(IRoom), fullMap[x, y, z]));

                        if (room == null || room.ParentLocation == null || !room.ParentLocation.BirthMark.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))));
        }
コード例 #17
0
        /// <summary>
        /// Spawn this new into the live world into a specified container
        /// </summary>
        /// <param name="spawnTo">the location/container this should spawn into</param>
        public override void SpawnNewInWorld(IGlobalPosition spawnTo)
        {
            //We can't even try this until we know if the data is there
            IRoomTemplate bS = Template <IRoomTemplate>() ?? throw new InvalidOperationException("Missing backing data store on room spawn event.");

            Keywords     = new string[] { bS.Name.ToLower() };
            Model        = bS.Model;
            Descriptives = bS.Descriptives;
            Qualities    = bS.Qualities;

            if (FloraNaturalResources == null)
            {
                FloraNaturalResources = new HashSet <INaturalResourceSpawn <IFlora> >();
            }

            if (FaunaNaturalResources == null)
            {
                FaunaNaturalResources = new HashSet <INaturalResourceSpawn <IFauna> >();
            }

            if (MineralNaturalResources == null)
            {
                MineralNaturalResources = new HashSet <INaturalResourceSpawn <IMineral> >();
            }

            if (string.IsNullOrWhiteSpace(BirthMark))
            {
                BirthMark = LiveCache.GetUniqueIdentifier(bS);
                Birthdate = DateTime.Now;
            }

            UpsertToLiveWorldCache(true);

            ParentLocation        = LiveCache.Get <ILocale>(bS.ParentLocation.Id);
            spawnTo.CurrentLocale = ParentLocation;
            spawnTo.CurrentZone   = ParentLocation.ParentLocation;

            if (spawnTo?.CurrentLocale == null || spawnTo?.CurrentZone == null)
            {
                spawnTo = new GlobalPosition(this);
            }

            CurrentLocation = spawnTo;

            UpsertToLiveWorldCache(true);

            Save();
        }
コード例 #18
0
        /// <summary>
        /// Handles initial connection
        /// </summary>
        protected override void OnOpen()
        {
            var authTicketValue = Context.CookieCollection[".AspNet.ApplicationCookie"].Value;

            GetUserIDFromCookie(authTicketValue);

            UserManager = new ApplicationUserManager(new UserStore <ApplicationUser>(new ApplicationDbContext()));

            var authedUser = UserManager.FindById(_userId);

            var currentCharacter = authedUser.GameAccount.Characters.FirstOrDefault(ch => ch.ID.Equals(authedUser.GameAccount.CurrentlySelectedCharacter));

            if (currentCharacter == null)
            {
                Send("<p>No character selected</p>");
                return;
            }

            //Try to see if they are already live
            _currentPlayer = LiveCache.Get <Player>(currentCharacter.ID);

            //Check the backup
            if (_currentPlayer == null)
            {
                var hotBack = new HotBackup(System.Web.Hosting.HostingEnvironment.MapPath("/HotBackup/"));
                _currentPlayer = hotBack.RestorePlayer(currentCharacter.AccountHandle, currentCharacter.ID);
            }

            //else new them up
            if (_currentPlayer == null)
            {
                _currentPlayer = new Player(currentCharacter);
            }

            _currentPlayer.Descriptor = this;

            //We need to barf out to the connected client the welcome message. The client will only indicate connection has been established.
            var welcomeMessage = new List <String>();

            welcomeMessage.Add(string.Format("Welcome to alpha phase twinMUD, {0}", currentCharacter.FullName()));
            welcomeMessage.Add("Please feel free to LOOK around.");

            _currentPlayer.WriteTo(welcomeMessage);

            //Send the look command in
            Interpret.Render("look", _currentPlayer);
        }
コード例 #19
0
        /// <summary>
        /// Processes the CDR
        /// </summary>
        /// <returns>Returns task to wait for</returns>
        private async Task _Process()
        {
            // Calculate Gatway Price
            if (this.callDataRecord.CLGatewayRatePerMin.HasValue)
            {
                this.callDataRecord.CLGatewayRateTotal = this.callDataRecord.CLGatewayRatePerMin * (((decimal)this.callDataRecord.YBilltime) / 1000 / 60);
            }

            // Calculate Customer Price
            if (this.callDataRecord.CLCustomerRatePerMin.HasValue)
            {
                this.callDataRecord.CLCustomerRateTotal = this.callDataRecord.CLCustomerRatePerMin * (((decimal)this.callDataRecord.YBilltime) / 1000 / 60);
            }

            /// Retrieve routing tree prepared in <see cref="CallRouteWorker"/> if CDR is of incoming leg
            Utilities.RoutingTree.Root routingTree = null;

            if (callDataRecord.YDirection == Direction.Incoming)
            {
                object data;
                string key = $"routingTree-{this.Node.Id}-{this.callDataRecord.YBillId}";

                data = LiveCache.Get(key);
                if (data != null && data is Utilities.RoutingTree.Root)
                {
                    routingTree = data as Utilities.RoutingTree.Root;
                }

                if (this.callDataRecord.YEnded)
                {
                    LiveCache.Remove(key);
                }

                if (routingTree != null)
                {
                    this.callDataRecord.RoutingTree = JsonConvert.SerializeObject(routingTree, Formatting.None);
                }
            }

            this.isHandled = await this.database.WriteCDR(this.callDataRecord).ConfigureAwait(false);

            this._Acknowledge();
        }
コード例 #20
0
        //We have to render our pathway out, an empty space for the potential pathway back and the destination room
        private static string[,,] AddDirectionToMap(string[,,] dataMap, MovementDirectionType transversalDirection, IRoom origin, int diameter, int centerX, int centerY, int centerZ, HashSet <IRoom> roomPool)
        {
            IEnumerable <IPathway> pathways         = origin.GetPathways(true);
            Tuple <int, int, int>  directionalSteps = Utilities.GetDirectionStep(transversalDirection);

            int xStepped = centerX + directionalSteps.Item1;
            int yStepped = centerY + directionalSteps.Item2;
            int zStepped = centerZ + directionalSteps.Item3;

            //If we're not over diameter budget and there is nothing there already (we might have already rendered the path and room) then render it
            //When the next room tries to render backwards it'll run into the existant path it came from and stop the chain here
            if (xStepped > 0 && xStepped <= diameter &&
                yStepped > 0 && yStepped <= diameter &&
                zStepped > 0 && zStepped <= diameter &&
                string.IsNullOrWhiteSpace(dataMap[xStepped - 1, yStepped - 1, zStepped - 1]))
            {
                IPathway thisPath = pathways.FirstOrDefault(path =>
                                                            (path.DirectionType == transversalDirection && path.Origin.Equals(origin) && path.Destination.GetType().GetInterfaces().Contains(typeof(IRoom))) ||
                                                            (path.DirectionType == Utilities.ReverseDirection(transversalDirection) && path.Destination.Equals(origin) && path.Origin.GetType().GetInterfaces().Contains(typeof(IRoom)))
                                                            );
                if (thisPath != null)
                {
                    string locId = thisPath.Destination.BirthMark;

                    if (thisPath.Destination.BirthMark.Equals(origin.BirthMark))
                    {
                        locId = thisPath.Origin.BirthMark;
                    }

                    IRoom passdownOrigin = LiveCache.Get <IRoom>(new LiveCacheKey(typeof(IRoom), locId));

                    if (passdownOrigin != null)
                    {
                        dataMap[xStepped - 1, yStepped - 1, zStepped - 1] = passdownOrigin.BirthMark;
                        dataMap = AddFullRoomToMap(dataMap, passdownOrigin, diameter, xStepped, yStepped, zStepped, roomPool);
                    }
                }
            }

            return(dataMap);
        }
コード例 #21
0
        public ActionResult AddEditZoneDescriptive(string birthMark, short descriptiveType, string phrase)
        {
            string message = string.Empty;

            IZone obj = LiveCache.Get <IZone>(new LiveCacheKey(typeof(Zone), birthMark));

            if (obj == null)
            {
                message = "That does not exist";
                return(RedirectToRoute("ModalErrorOrClose", new { Message = message }));
            }

            LiveOccurrenceViewModel vModel = new LiveOccurrenceViewModel
            {
                AuthedUser    = UserManager.FindById(User.Identity.GetUserId()),
                DataObject    = obj,
                AdminTypeName = "LiveAdmin/Zone"
            };

            if (descriptiveType > -1)
            {
                GrammaticalType grammaticalType = (GrammaticalType)descriptiveType;
                vModel.SensoryEventDataObject = obj.Descriptives.FirstOrDefault(occurrence => occurrence.Event.Role == grammaticalType &&
                                                                                occurrence.Event.Phrase.Equals(phrase, StringComparison.InvariantCultureIgnoreCase));
            }

            if (vModel.SensoryEventDataObject != null)
            {
                vModel.LexicaDataObject = vModel.SensoryEventDataObject.Event;
            }
            else
            {
                vModel.SensoryEventDataObject = new SensoryEvent
                {
                    Event = new Lexica()
                };
            }

            return(View("~/Views/LiveAdmin/Zone/SensoryEvent.cshtml", "_chromelessLayout", vModel));
        }
コード例 #22
0
ファイル: Room.cs プロジェクト: Cloudxtreme/NetMud
        /// <summary>
        /// Tries to find this entity in the world based on its ID or gets a new one from the db and puts it in the world
        /// </summary>
        public void GetFromWorldOrSpawn()
        {
            //Try to see if they are already there
            var me = LiveCache.Get <IRoom>(DataTemplate.ID, typeof(IRoom));

            //Isn't in the world currently
            if (me == default(IRoom))
            {
                SpawnNewInWorld();
            }
            else
            {
                BirthMark       = me.BirthMark;
                Birthdate       = me.Birthdate;
                DataTemplate    = me.DataTemplate;
                ObjectsInRoom   = me.ObjectsInRoom;
                MobilesInside   = me.MobilesInside;
                Pathways        = me.Pathways;
                Keywords        = me.Keywords;
                CurrentLocation = me.CurrentLocation;
            }
        }
コード例 #23
0
        public override void OnClose()
        {
            IEnumerable <IPlayer> validPlayers = LiveCache.GetAll <IPlayer>().Where(player => player.Descriptor != null &&
                                                                                    player.Template <IPlayerTemplate>().Account.Config.WantsNotification(_currentPlayer.AccountHandle, false, AcquaintenceNotifications.LeaveGame));

            foreach (IPlayer player in validPlayers)
            {
                player.WriteTo(new string[] { string.Format("{0} has left the game.", _currentPlayer.AccountHandle) });
            }

            if (_currentPlayer != null && _currentPlayer.Template <IPlayerTemplate>().Account.Config.GossipSubscriber)
            {
                GossipClient gossipClient = LiveCache.Get <GossipClient>("GossipWebClient");

                if (gossipClient != null)
                {
                    gossipClient.SendNotification(_currentPlayer.AccountHandle, Notifications.LeaveGame);
                }
            }

            base.OnClose();
        }
コード例 #24
0
        /// <summary>
        /// Tries to find this entity in the world based on its ID or gets a new one from the db and puts it in the world
        /// </summary>
        public void GetFromWorldOrSpawn()
        {
            //Try to see if they are already there
            var me = LiveCache.Get <Pathway>(DataTemplate.ID);

            //Isn't in the world currently
            if (me == default(IPathway))
            {
                SpawnNewInWorld();
            }
            else
            {
                BirthMark         = me.BirthMark;
                Keywords          = me.Keywords;
                Birthdate         = me.Birthdate;
                CurrentLocation   = me.CurrentLocation;
                DataTemplate      = me.DataTemplate;
                FromLocation      = me.FromLocation;
                ToLocation        = me.ToLocation;
                Enter             = me.Enter;
                MovementDirection = me.MovementDirection;
            }
        }
コード例 #25
0
        /// <summary>
        /// Get this from the world or make a new one and put it in
        /// </summary>
        public void GetFromWorldOrSpawn()
        {
            //Try to see if they are already there
            IZone me = LiveCache.Get <IZone>(TemplateId, typeof(ZoneTemplate));

            //Isn't in the world currently
            if (me == default(IZone))
            {
                SpawnNewInWorld();
            }
            else
            {
                BirthMark       = me.BirthMark;
                Birthdate       = me.Birthdate;
                TemplateId      = me.TemplateId;
                Keywords        = me.Keywords;
                CurrentLocation = new GlobalPosition(this, null, null);
                Descriptives    = me.Descriptives;

                Qualities = me.Qualities;
                PopulateMap();
                KickoffProcesses();
            }
        }
コード例 #26
0
        /// <summary>
        /// Renders a map from a single z,y plane
        /// </summary>
        /// <param name="map">The map to render</param>
        /// <param name="forAdmin">is this for admin (with edit links)</param>
        /// <param name="withPathways">include pathway symbols</param>
        /// <param name="centerRoom">the room considered "center"</param>
        /// <returns>the rendered map</returns>
        public static string RenderMap(string[,] map, bool visibileOnly, bool forAdmin, bool withPathways, IRoom centerRoom, MapRenderMode renderMode = MapRenderMode.Normal)
        {
            StringBuilder sb = new StringBuilder();

            if (!withPathways)
            {
                int x, y;
                for (y = map.GetUpperBound(1); y >= 0; y--)
                {
                    string rowString = string.Empty;
                    for (x = 0; x < map.GetUpperBound(0); x++)
                    {
                        IRoom Room = LiveCache.Get <IRoom>(new LiveCacheKey(typeof(IRoom), map[x, y]));

                        if (Room != null)
                        {
                            rowString += RenderRoomToAscii(Room, Room.GetPathways().Any(), Room.GetLocalePathways().Any(), !forAdmin && Room.BirthMark == centerRoom.BirthMark, forAdmin);
                        }
                        else
                        {
                            rowString += "&nbsp;";
                        }
                    }

                    if (!string.IsNullOrWhiteSpace(rowString.Replace("&nbsp;", "")))
                    {
                        sb.AppendLine(rowString);
                    }
                }
            }
            else
            {
                string[,] expandedMap = new string[(map.GetUpperBound(0) + 1) * 3 + 1, (map.GetUpperBound(1) + 1) * 3 + 1];

                int x, y;
                int xMax = 0;
                for (y = map.GetUpperBound(1); y >= 0; y--)
                {
                    for (x = 0; x <= map.GetUpperBound(0); x++)
                    {
                        IRoom Room = LiveCache.Get <IRoom>(new LiveCacheKey(typeof(IRoom), map[x, y]));

                        if (Room != null)
                        {
                            if (x > xMax)
                            {
                                xMax = x;
                            }

                            expandedMap = RenderRoomAndPathwaysForMapNode(x, y, Room, centerRoom, expandedMap, Room.BirthMark == centerRoom.BirthMark, forAdmin, renderMode);
                        }
                    }
                }

                //3 for inflation
                if (withPathways)
                {
                    xMax += 3;
                }

                for (y = expandedMap.GetUpperBound(1); y >= 0; y--)
                {
                    string rowString = string.Empty;
                    for (x = 0; x <= expandedMap.GetUpperBound(0); x++)
                    {
                        string xString = expandedMap[x, y];
                        if (string.IsNullOrWhiteSpace(xString))
                        {
                            if (!forAdmin || x <= xMax)
                            {
                                rowString += "&nbsp;";
                            }
                        }
                        else
                        {
                            rowString += expandedMap[x, y];
                        }
                    }

                    if (!string.IsNullOrWhiteSpace(rowString.Replace("&nbsp;", "")))
                    {
                        sb.AppendLine(rowString);
                    }
                }
            }

            return(sb.ToString());
        }
コード例 #27
0
        /// <summary>
        /// Finds the central room of a given map
        /// </summary>
        /// <param name="map">the map x,y,z</param>
        /// <param name="zIndex">If > -1 we're looking for the x,y center of the single plane as opposed to the actual x,y,z center of the whole map</param>
        /// <returns>the central room</returns>
        public static IRoom FindCenterOfMap(string[,,] map, int zIndex = -1)
        {
            int zCenter = zIndex;

            //If we want a specific z index thats fine, otherwise we find the middle Z
            if (zIndex == -1)
            {
                zCenter = (map.GetUpperBound(2) - map.GetLowerBound(2)) / 2 + map.GetLowerBound(2);
            }

            int xCenter = (map.GetUpperBound(0) - map.GetLowerBound(0)) / 2 + map.GetLowerBound(0);
            int yCenter = (map.GetUpperBound(1) - map.GetLowerBound(1)) / 2 + map.GetLowerBound(1);

            string roomId = map[xCenter, yCenter, zCenter];

            if (string.IsNullOrWhiteSpace(roomId))
            {
                for (int variance = 1;
                     variance <= xCenter - map.GetLowerBound(0) && variance <= map.GetUpperBound(0) - xCenter &&
                     variance <= yCenter - map.GetLowerBound(1) && variance <= map.GetUpperBound(1) - yCenter
                     ; variance++)
                {
                    //Check around it
                    if (!string.IsNullOrWhiteSpace(map[xCenter - variance, yCenter, zCenter]))
                    {
                        roomId = map[xCenter - variance, yCenter, zCenter];
                    }
                    else if (!string.IsNullOrWhiteSpace(map[xCenter + variance, yCenter, zCenter]))
                    {
                        roomId = map[xCenter + variance, yCenter, zCenter];
                    }
                    else if (!string.IsNullOrWhiteSpace(map[xCenter, yCenter - variance, zCenter]))
                    {
                        roomId = map[xCenter, yCenter - variance, zCenter];
                    }
                    else if (!string.IsNullOrWhiteSpace(map[xCenter, yCenter + variance, zCenter]))
                    {
                        roomId = map[xCenter, yCenter + variance, zCenter];
                    }
                    else if (!string.IsNullOrWhiteSpace(map[xCenter - variance, yCenter - variance, zCenter]))
                    {
                        roomId = map[xCenter - variance, yCenter - variance, zCenter];
                    }
                    else if (!string.IsNullOrWhiteSpace(map[xCenter - variance, yCenter + variance, zCenter]))
                    {
                        roomId = map[xCenter - variance, yCenter + variance, zCenter];
                    }
                    else if (!string.IsNullOrWhiteSpace(map[xCenter + variance, yCenter - variance, zCenter]))
                    {
                        roomId = map[xCenter + variance, yCenter - variance, zCenter];
                    }
                    else if (!string.IsNullOrWhiteSpace(map[xCenter + variance, yCenter + variance, zCenter]))
                    {
                        roomId = map[xCenter + variance, yCenter + variance, zCenter];
                    }

                    if (!string.IsNullOrWhiteSpace(roomId))
                    {
                        break;
                    }
                }
            }

            //Well, no valid rooms on this Z so try another Z unless all we got was this one Z
            if (string.IsNullOrWhiteSpace(roomId) && zIndex == -1)
            {
                IRoom returnRoom = null;

                for (int variance = 1;
                     variance < zCenter - map.GetLowerBound(2) && variance < map.GetUpperBound(2) - zCenter
                     ; variance++)
                {
                    returnRoom = FindCenterOfMap(map, zCenter - variance);

                    if (returnRoom != null)
                    {
                        break;
                    }

                    returnRoom = FindCenterOfMap(map, zCenter + variance);

                    if (returnRoom != null)
                    {
                        break;
                    }
                }

                return(returnRoom);
            }

            return(LiveCache.Get <IRoom>(new LiveCacheKey(typeof(IRoom), roomId)));
        }
コード例 #28
0
 /// <summary>
 /// Get the live version of this in the world
 /// </summary>
 /// <returns>The live data</returns>
 public ILocale GetLiveInstance()
 {
     return(LiveCache.Get <ILocale>(Id));
 }
コード例 #29
0
ファイル: HotBackup.cs プロジェクト: envis10n/Warrens
        /// <summary>
        /// Restores live entity backup from Current
        /// </summary>
        /// <returns>Success state</returns>
        public bool RestoreLiveBackup()
        {
            LiveData liveDataAccessor = new LiveData();

            string currentBackupDirectory = liveDataAccessor.BaseDirectory + liveDataAccessor.CurrentDirectoryName;

            //No backup directory? No live data.
            if (!Directory.Exists(currentBackupDirectory))
            {
                return(false);
            }

            LoggingUtility.Log("World restored from current live INITIATED.", LogChannels.Backup, false);

            try
            {
                //dont load players here
                List <IEntity>     entitiesToLoad   = new List <IEntity>();
                IEnumerable <Type> implimentedTypes = typeof(EntityPartial).Assembly.GetTypes().Where(ty => ty.GetInterfaces().Contains(typeof(IEntity)) &&
                                                                                                      ty.IsClass &&
                                                                                                      !ty.IsAbstract &&
                                                                                                      !ty.GetCustomAttributes <IgnoreAutomatedBackupAttribute>().Any());

                foreach (Type type in implimentedTypes.OrderByDescending(type => type == typeof(Gaia) ? 6 :
                                                                         type == typeof(Zone) ? 5 :
                                                                         type == typeof(Locale) ? 3 :
                                                                         type == typeof(Room) ? 3 :
                                                                         type == typeof(Pathway) ? 2 : 0))
                {
                    if (!Directory.Exists(currentBackupDirectory + type.Name))
                    {
                        continue;
                    }

                    DirectoryInfo entityFilesDirectory = new DirectoryInfo(currentBackupDirectory + type.Name);

                    foreach (FileInfo file in entityFilesDirectory.EnumerateFiles())
                    {
                        entitiesToLoad.Add(liveDataAccessor.ReadEntity(file, type));
                    }
                }

                //Check we found actual data
                if (!entitiesToLoad.Any(ent => ent.GetType() == typeof(Gaia)))
                {
                    throw new Exception("No Worlds found, failover.");
                }

                if (!entitiesToLoad.Any(ent => ent.GetType() == typeof(Zone)))
                {
                    throw new Exception("No zones found, failover.");
                }

                //Shove them all into the live system first
                foreach (IEntity entity in entitiesToLoad.OrderBy(ent => ent.Birthdate))
                {
                    entity.UpsertToLiveWorldCache();
                    entity.KickoffProcesses();
                }

                //We need to pick up any places that aren't already live from the file system incase someone added them during the last session\
                foreach (IGaiaTemplate thing in TemplateCache.GetAll <IGaiaTemplate>().Where(dt => !entitiesToLoad.Any(ent => ent.TemplateId.Equals(dt.Id) && ent.Birthdate >= dt.LastRevised)))
                {
                    IGaia entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as IGaia;

                    entityThing.SpawnNewInWorld();
                }

                foreach (IZoneTemplate thing in TemplateCache.GetAll <IZoneTemplate>().Where(dt => !entitiesToLoad.Any(ent => ent.TemplateId.Equals(dt.Id) && ent.Birthdate >= dt.LastRevised)))
                {
                    IZone entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as IZone;

                    entityThing.SpawnNewInWorld();
                }

                foreach (ILocaleTemplate thing in TemplateCache.GetAll <ILocaleTemplate>().Where(dt => !entitiesToLoad.Any(ent => ent.TemplateId.Equals(dt.Id) && ent.Birthdate >= dt.LastRevised)))
                {
                    ILocale entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as ILocale;

                    entityThing.ParentLocation = entityThing.ParentLocation.GetLiveInstance();
                    entityThing.SpawnNewInWorld();
                }

                foreach (IRoomTemplate thing in TemplateCache.GetAll <IRoomTemplate>().Where(dt => !entitiesToLoad.Any(ent => ent.TemplateId.Equals(dt.Id) && ent.Birthdate >= dt.LastRevised)))
                {
                    IRoom entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as IRoom;

                    entityThing.ParentLocation = entityThing.Template <IRoomTemplate>().ParentLocation.GetLiveInstance();
                    entityThing.SpawnNewInWorld();
                }

                foreach (IPathwayTemplate thing in TemplateCache.GetAll <IPathwayTemplate>().Where(dt => !entitiesToLoad.Any(ent => ent.TemplateId.Equals(dt.Id) && ent.Birthdate >= dt.LastRevised)))
                {
                    IPathway entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as IPathway;

                    entityThing.SpawnNewInWorld();
                }

                //We have the containers contents and the birthmarks from the deserial
                //I don't know how we can even begin to do this type agnostically since the collections are held on type specific objects without some super ugly reflection
                foreach (Room entity in entitiesToLoad.Where(ent => ent.GetType() == typeof(Room)))
                {
                    foreach (IInanimate obj in entity.Contents.EntitiesContained())
                    {
                        IInanimate fullObj = LiveCache.Get <IInanimate>(new LiveCacheKey(obj));
                        entity.MoveFrom(obj);
                        entity.MoveInto(fullObj);
                    }

                    foreach (INonPlayerCharacter obj in entity.MobilesInside.EntitiesContained())
                    {
                        INonPlayerCharacter fullObj = LiveCache.Get <INonPlayerCharacter>(new LiveCacheKey(obj));
                        entity.MoveFrom(obj);
                        entity.MoveInto(fullObj);
                    }
                }

                foreach (NonPlayerCharacter entity in entitiesToLoad.Where(ent => ent.GetType() == typeof(NonPlayerCharacter)))
                {
                    foreach (IInanimate obj in entity.Inventory.EntitiesContained())
                    {
                        IInanimate fullObj = LiveCache.Get <IInanimate>(new LiveCacheKey(obj));
                        entity.MoveFrom(obj);
                        entity.MoveInto(fullObj);
                    }
                }

                foreach (Inanimate entity in entitiesToLoad.Where(ent => ent.GetType() == typeof(Inanimate)))
                {
                    foreach (Tuple <string, IInanimate> obj in entity.Contents.EntitiesContainedByName())
                    {
                        IInanimate fullObj = LiveCache.Get <IInanimate>(new LiveCacheKey(obj.Item2));
                        entity.MoveFrom(obj.Item2);
                        entity.MoveInto(fullObj, obj.Item1);
                    }

                    foreach (Tuple <string, IInanimate> obj in entity.Contents.EntitiesContainedByName())
                    {
                        INonPlayerCharacter fullObj = LiveCache.Get <INonPlayerCharacter>(new LiveCacheKey(obj.Item2));
                        entity.MoveFrom((INonPlayerCharacter)obj.Item2);
                        entity.MoveInto(fullObj, obj.Item1);
                    }
                }

                //We need to poll the WorldMaps here and give all the rooms their coordinates as well as the zones their sub-maps
                ParseDimension();

                LoggingUtility.Log("World restored from current live.", LogChannels.Backup, false);
                return(true);
            }
            catch (Exception ex)
            {
                LoggingUtility.LogError(ex);
            }

            return(false);
        }
コード例 #30
0
ファイル: HotBackup.cs プロジェクト: Cloudxtreme/NetMud
        /// <summary>
        /// Restores one character from their Current backup
        /// </summary>
        /// <param name="accountHandle">Global Account Handle for the account</param>
        /// <param name="charID">Which character to load</param>
        /// <returns></returns>
        public Player RestorePlayer(string accountHandle, long charID)
        {
            Player newPlayerToLoad = null;

            try
            {
                var currentBackupDirectory = BaseDirectory + "Players/" + accountHandle + "/" + charID.ToString() + "/Current/";

                //No backup directory? No live data.
                if (!Directory.Exists(currentBackupDirectory))
                {
                    return(null);
                }

                var playerDirectory = new DirectoryInfo(currentBackupDirectory);

                //no player file to load, derp
                if (!File.Exists(playerDirectory + charID.ToString() + ".Player"))
                {
                    return(null);
                }

                var blankEntity = Activator.CreateInstance(typeof(Player)) as Player;

                using (var stream = File.OpenRead(playerDirectory + charID.ToString() + ".Player"))
                {
                    byte[] bytes = new byte[stream.Length];
                    stream.Read(bytes, 0, (int)stream.Length);
                    newPlayerToLoad = (Player)blankEntity.DeSerialize(bytes);
                }

                //bad load, dump it
                if (newPlayerToLoad == null)
                {
                    return(null);
                }

                //abstract this out to a helper maybe?
                var locationAssembly = Assembly.GetAssembly(typeof(EntityPartial));

                var ch = (ICharacter)newPlayerToLoad.DataTemplate;
                if (ch.LastKnownLocationType == null)
                {
                    ch.LastKnownLocationType = typeof(Room).Name;
                }

                var lastKnownLocType = locationAssembly.DefinedTypes.FirstOrDefault(tp => tp.Name.Equals(ch.LastKnownLocationType));

                ILocation lastKnownLoc = null;
                if (lastKnownLocType != null && !string.IsNullOrWhiteSpace(ch.LastKnownLocation))
                {
                    if (lastKnownLocType.GetInterfaces().Contains(typeof(ISpawnAsSingleton)))
                    {
                        long lastKnownLocID = long.Parse(ch.LastKnownLocation);
                        lastKnownLoc = LiveCache.Get <ILocation>(lastKnownLocID, lastKnownLocType);
                    }
                    else
                    {
                        var cacheKey = new LiveCacheKey(lastKnownLocType, ch.LastKnownLocation);
                        lastKnownLoc = LiveCache.Get <ILocation>(cacheKey);
                    }
                }

                newPlayerToLoad.CurrentLocation = lastKnownLoc;

                //We have the player in live cache now so make it move to the right place
                newPlayerToLoad.GetFromWorldOrSpawn();

                newPlayerToLoad.UpsertToLiveWorldCache();

                //We'll need one of these per container on players
                if (Directory.Exists(playerDirectory + "Inventory/"))
                {
                    var inventoryDirectory = new DirectoryInfo(playerDirectory + "Inventory/");

                    foreach (var file in inventoryDirectory.EnumerateFiles())
                    {
                        var blankObject = Activator.CreateInstance(typeof(Inanimate)) as Inanimate;

                        using (var stream = file.Open(FileMode.Open))
                        {
                            byte[] bytes = new byte[stream.Length];
                            stream.Read(bytes, 0, (int)stream.Length);
                            var newObj = (IInanimate)blankObject.DeSerialize(bytes);
                            newObj.UpsertToLiveWorldCache();
                            newPlayerToLoad.MoveInto <IInanimate>(newObj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingUtility.LogError(ex);
            }

            return(newPlayerToLoad);
        }