public static void LuaAddLookup(string lookupTable, string lookupEntry) { if (_lookupManager.HasLookup(lookupTable, lookupEntry)) { _logManager.Boot(new DuplicateEntryException("Lookup [{0}] \"{1}\" already exists", lookupTable, lookupEntry)); return; } _lookupManager.AddLookup(lookupTable, lookupEntry); _logManager.Boot("Lookup [{0}] \"{1}\" added", lookupTable, lookupEntry); }
public void Load() { try { if (!_dbContext.Auctions.Any()) { return; } var auctions = _dbContext.Auctions.Select(auction => new AuctionHistory { BuyerName = auction.BuyerName, ItemForSale = auction.ItemSoldId, SellerName = auction.SellerName, SoldFor = auction.SoldFor, SoldOn = auction.SoldOn }).ToList(); History = auctions.ToList(); _logManager.Boot("Loaded {0} Auctions", History.Count()); } catch (DbException ex) { _logManager.Error(ex); throw; } }
public void Initialize(TimeInfoData timeInfo, int height, int width) { try { if (!_dbContext.Weather.Any()) { return; } var cells = _dbContext.Weather.Select(cell => new WeatherCell(cell.Id) { XCoord = cell.CellXCoordinate, YCoord = cell.CellYCoordinate, Climate = cell.ClimateType, Hemisphere = cell.HemisphereType, CloudCover = cell.CloudCover, Energy = cell.Energy, Humidity = cell.Humidity, Precipitation = cell.Precipitation, Pressure = cell.Pressure, Temperature = cell.Temperature, WindSpeedX = cell.WindSpeedX, WindSpeedY = cell.WindSpeedY }).ToList(); Weather = new WeatherMap(timeInfo, width, height, cells); _logManager.Boot("Loaded {0} Weather Cells", cells.Count); } catch (DbException ex) { _logManager.Error(ex); throw; } }
public void Load() { try { if (!_dbContext.Bans.Any()) { return; } foreach (var newBan in _dbContext.Bans.Select(ban => new BanData { Id = ban.Id, Type = ban.BanType, BannedBy = ban.BannedBy, BannedOn = ban.BannedOn, Duration = ban.Duration, Level = ban.Level, Name = ban.Name, Note = ban.Note, Prefix = ban.IsPrefix, Suffix = ban.IsSuffix })) { Bans.ToList().Add(newBan); } _logManager.Boot("Loaded {0} Bans", Bans.Count()); } catch (DbException ex) { _logManager.Error(ex); throw; } }
public void Load() { try { if (!_dbContext.Boards.Any()) { return; } foreach (DAL.Models.Board board in _dbContext.Boards) { var newBoard = new BoardData(board.Id, board.BoardType) { Name = board.Name, ReadGroup = board.ReadGroup, PostGroup = board.PostGroup, ExtraReaders = board.ExtraReaders, ExtraRemovers = board.ExtraRemovers, OTakeMessage = board.OTakeMessage, OPostMessage = board.OTakeMessage, ORemoveMessage = board.ORemoveMessage, OCopyMessage = board.OCopyMessage, OListMessage = board.OListMessage, PostMessage = board.PostMessage, OReadMessage = board.OReadMessage, MinimumReadLevel = board.MinimumReadLevel, MinimumPostLevel = board.MinimumPostLevel, MinimumRemoveLevel = board.MinimumRemoveLevel, MaximumPosts = board.MaximumPosts, BoardObjectId = board.BoardObjectId }; Boards.ToList().Add(newBoard); foreach (var newNote in board.Notes.Select(note => new NoteData(note.Id) { Sender = note.Sender, DateSent = note.DateSent, RecipientList = note.RecipientList, Subject = note.Subject, IsPoll = note.IsPoll, Text = note.Text })) { newBoard.Notes.ToList().Add(newNote); } } _logManager.Boot("Loaded {0} Boards", Boards.Count()); } catch (DbException ex) { _logManager.Error(ex); throw; } }
public static MobileTemplate LuaCreateMob(string id, string name) { var mobId = Convert.ToInt64(id); var newMob = _dbManager.MOBILETEMPLATES.Create(mobId, name); _luaManager.Proxy.CreateTable("mobile"); LastObject = newMob; _logManager.Boot("Mob Template (id={0}, Name={1}) created.", id, name); return(newMob); }
public static RoomTemplate LuaCreateRoom(string id, string name) { var roomId = Convert.ToInt64(id); var newRoom = new RoomTemplate(roomId, name); _luaManager.Proxy.CreateTable("room"); _dbManager.ROOMS.CastAs <Repository <long, RoomTemplate> >().Add(roomId, newRoom); LastObject = newRoom; _logManager.Boot("Room Template (id={0}, name={1}) created", id, name); return(newRoom); }
public static ObjectTemplate LuaCreateObject(string id, string name) { var objId = Convert.ToInt64(id); var newObj = _dbManager.OBJECTTEMPLATES.Create(objId, name); _luaManager.Proxy.CreateTable("object"); LastObject = newObj; _logManager.Boot("Object Template (id={0}, Name={1}) created.", id, name); return(newObj); }
public static AreaData LuaCreateArea(int id, string name) { var areaId = Convert.ToInt64(id); var newArea = new AreaData(areaId, name); _luaManager.Proxy.CreateTable("area"); LastObject = newArea; _dbManager.AREAS.Add(areaId, newArea); _logManager.Boot("Area (id={0}, name={1}) created.", id, name); return(newArea); }
public void Initialize() { _systemData = _gameManager.SystemData; _logManager.Boot("Setting time and weather."); try { TimeInfoData timeInfo; var gameState = _dbContext.GameStates.FirstOrDefault(); if (gameState == null) { timeInfo = new TimeInfoData { Day = 28, Hour = 0, Month = 6, Year = 628 } } ; else { timeInfo = new TimeInfoData { Year = gameState.GameYear, Month = gameState.GameMonth, Day = gameState.GameDay, Hour = gameState.GameHour }; } UpdateGameTime(timeInfo); GameTime = timeInfo; } catch (Exception ex) { _logManager.Error(ex); } }
public void Load() { try { if (!_dbContext.News.Any()) { return; } foreach (DAL.Models.News news in _dbContext.News) { var newNews = new NewsData(news.Id) { Name = news.Name, Header = news.Header, Level = news.Level, CreatedBy = news.CreatedBy, CreatedOn = news.CreatedOn, Active = news.IsActive }; News.ToList().Add(newNews); foreach (DAL.Models.NewsEntry entry in news.Entries) { var newEntry = new NewsEntryData { Id = entry.Id, Title = entry.Title, Name = entry.Name, Text = entry.Text, PostedOn = entry.PostedOn, PostedBy = entry.PostedBy, Active = entry.IsActive }; newNews.Entries.ToList().Add(newEntry); } } _logManager.Boot("Loaded {0} News", News.Count()); } catch (DbException ex) { _logManager.Error(ex); throw; } }
public static ExitData LuaCreateExit(string direction, long destination, string name) { var dir = EnumerationExtensions.GetEnumIgnoreCase <DirectionTypes>(direction); var newExit = new ExitData((int)dir, name) { Destination = destination, Direction = dir, Keywords = direction }; _luaManager.Proxy.CreateTable("exit"); AddLastObject(newExit); _logManager.Boot("Exit '{0}' created in direction {1} to room {2}", name, direction, destination); return(newExit); }
public void Load() { try { if (!_dbContext.Clans.Any()) { return; } foreach (DAL.Models.Clan clan in _dbContext.Clans) { var newClan = new ClanData(clan.Id, clan.Name); newClan.Description = clan.Description; newClan.Board = clan.BoardId; newClan.ClanType = EnumerationExtensions.GetEnum <ClanTypes>(clan.ClanType); newClan.Motto = clan.Motto; newClan.Deity = clan.DeityName; newClan.Badge = clan.Badge; newClan.RecallRoom = clan.RecallRoomId; newClan.StoreRoom = clan.StoreRoomId; var clanStats = clan.Stats; newClan.PvEKills = clan.Stats.PvE_Kills; newClan.PvEDeaths = clan.Stats.PvE_Deaths; newClan.IllegalPvPKill = clan.Stats.Illegal_PvP_Kills; newClan.Score = clan.Stats.Score; newClan.Favour = clan.Stats.Favour; newClan.Strikes = clan.Stats.Strikes; newClan.MemberLimit = clan.Stats.MemberLimit; newClan.Alignment = clan.Stats.Alignment; var members = new List <RosterData>(); foreach (DAL.Models.ClanMember clanMember in clan.Members) { var newMember = new RosterData(); newMember.Name = clanMember.Name; newMember.Joined = clanMember.Joined; newMember.Class = clanMember.ClassId; newMember.Level = clanMember.Level; newMember.Kills = clanMember.Kills; newMember.Deaths = clanMember.Deaths; members.Add(newMember); } newClan.Members = members; newClan.LeaderRank = clan.Ranks.First(x => x.RankType == (int)ClanRanks.Leader).RankName; newClan.Leader = clan.Members.First(x => x.ClanRank == (int)ClanRanks.Leader).Name; newClan.NumberOneRank = clan.Ranks.First(x => x.RankType == (int)ClanRanks.NumberOne).RankName; var member = clan.Members.FirstOrDefault(x => x.ClanRank == (int)ClanRanks.NumberOne); newClan.NumberOne = member == null ? string.Empty : member.Name; newClan.NumberTwoRank = clan.Ranks.First(x => x.RankType == (int)ClanRanks.NumberTwo).RankName; member = clan.Members.FirstOrDefault(x => x.ClanRank == (int)ClanRanks.NumberTwo); newClan.NumberTwo = member == null ? string.Empty : member.Name; newClan.ClanObjects = clan.Items.Select(x => x.Id); Add(newClan); } _logManager.Boot("Loaded {0} Clans", Clans.Count()); } catch (DbException ex) { _logManager.Error(ex); throw; } }
public static void LuaBootLog(string txt) { _logManager.Boot(txt); }