internal DynamicRoomModel(RoomModel pModel) { this.staticModel = pModel; this.DoorX = staticModel.DoorX; this.DoorY = staticModel.DoorY; this.DoorZ = staticModel.DoorZ; this.DoorOrientation = staticModel.DoorOrientation; this.Heightmap = staticModel.Heightmap; this.MapSizeX = staticModel.MapSizeX; this.MapSizeY = staticModel.MapSizeY; this.ClubOnly = staticModel.ClubOnly; Generate(); }
internal DynamicRoomModel(RoomModel pModel) { this.staticModel = pModel; this.DoorX = staticModel.DoorX; this.DoorY = staticModel.DoorY; this.DoorZ = staticModel.DoorZ; this.DoorOrientation = staticModel.DoorOrientation; this.Heightmap = staticModel.Heightmap; this.MapSizeX = staticModel.MapSizeX; this.MapSizeY = staticModel.MapSizeY; this.ClubOnly = staticModel.ClubOnly; Generate(); }
public Gamemap(Room room) { this.room = room; this.DiagonalEnabled = true; this.mStaticModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(room.ModelName, room.RoomId); if (mStaticModel == null) throw new Exception("No modeldata found for roomID " + room.RoomId); this.mDynamicModel = new DynamicRoomModel(this.mStaticModel); this.mCoordinatedItems = new Hashtable(); this.gotPublicPool = room.RoomData.Model.gotPublicPool; this.mGameMap = new byte[Model.MapSizeX, Model.MapSizeY]; this.mItemHeightMap = new double[Model.MapSizeX, Model.MapSizeY]; userMap = new Hashtable(); if (room.IsPublic) this.roomLinkInformation = ButterflyEnvironment.GetGame().GetRoomManager().getLinkedRoomData(room.RoomId); }
public void FillNull(int pId) { this.Id = pId; this.Name = "Unknown Room"; this.Description = "-"; this.OwnerName = "-"; this.Category = 0; this.UsersNow = 0; this.UsersMax = 0; this.ModelName = "model_a"; this.Score = 0; this.Tags = new List <string>(); this.AllowPets = true; this.AllowPetsEating = false; this.AllowWalkthrough = true; this.Hidewall = false; this.Password = ""; this.Wallpaper = "0.0"; this.Floor = "0.0"; this.Landscape = "0.0"; this.WallThickness = 0; this.FloorThickness = 0; this.MuteFuse = 0; this.WhoCanKick = 0; this.BanFuse = 0; this.ChatType = 0; this.ChatBalloon = 0; this.ChatSpeed = 0; this.ChatMaxDistance = 0; this.ChatFloodProtection = 0; this.GroupId = 0; this.TrocStatus = 2; this.Group = null; this.AllowRightsOverride = false; this.mModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(this.ModelName, pId); this.HideWireds = false; this.SellPrice = 0; }
public Gamemap(Room room) { this.room = room; this.ObliqueDisable = true; this.DiagonalEnabled = true; RoomModel mStaticModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(room.RoomData.ModelName, room.Id); if (mStaticModel == null) { throw new Exception("No modeldata found for roomID " + room.Id); } this.Model = new DynamicRoomModel(mStaticModel); this.CoordinatedItems = new ConcurrentDictionary <Point, List <Item> >(); this.userMap = new ConcurrentDictionary <Point, List <RoomUser> >(); this.GameMap = new byte[this.Model.MapSizeX, this.Model.MapSizeY]; this.mUserOnMap = new byte[this.Model.MapSizeX, this.Model.MapSizeY]; this.mSquareTaking = new byte[this.Model.MapSizeX, this.Model.MapSizeY]; this.ItemHeightMap = new double[this.Model.MapSizeX, this.Model.MapSizeY]; this.EffectMap = new byte[this.Model.MapSizeX, this.Model.MapSizeY]; }
public Gamemap(Room room) { this.room = room; this.DiagonalEnabled = true; this.mStaticModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(room.ModelName, room.RoomId); if (mStaticModel == null) { throw new Exception("No modeldata found for roomID " + room.RoomId); } this.mDynamicModel = new DynamicRoomModel(this.mStaticModel); this.mCoordinatedItems = new Hashtable(); this.gotPublicPool = room.RoomData.Model.gotPublicPool; this.mGameMap = new byte[Model.MapSizeX, Model.MapSizeY]; this.mItemHeightMap = new double[Model.MapSizeX, Model.MapSizeY]; userMap = new Hashtable(); if (room.IsPublic) { this.roomLinkInformation = ButterflyEnvironment.GetGame().GetRoomManager().getLinkedRoomData(room.RoomId); } }
internal void Destroy() { userMap.Clear(); mDynamicModel.Destroy(); mCoordinatedItems.Clear(); if (roomLinkInformation != null) { roomLinkInformation.Clear(); } Array.Clear(mGameMap, 0, mGameMap.Length); Array.Clear(mUserItemEffect, 0, mUserItemEffect.Length); Array.Clear(mItemHeightMap, 0, mItemHeightMap.Length); userMap = null; mGameMap = null; mUserItemEffect = null; mItemHeightMap = null; mCoordinatedItems = null; roomLinkInformation = null; mDynamicModel = null; room = null; mStaticModel = null; }
public Gamemap(Room room) { this.room = room; this.DiagonalEnabled = true; this.mStaticModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(room.ModelName, room.RoomId); if (mStaticModel == null) { Logging.LogMessage("The room model " + room.ModelName + " could not be found for room " + room.RoomId); room.ModelName = "model_a"; this.mStaticModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(room.ModelName, room.RoomId); } if (mStaticModel == null) throw new Exception("No modeldata found for roomID " + room.RoomId); if(room.ModelName == "custom") room.ModelName = "model_custom" + room.RoomId; this.mDynamicModel = new DynamicRoomModel(this.mStaticModel); this.mCoordinatedItems = new Hashtable(); this.coordinatedItemEvents = new Hashtable(); // this.gotPublicPool = room.RoomData.Model.gotPublicPool; this.mGameMap = new byte[Model.MapSizeX, Model.MapSizeY]; this.mItemHeightMap = new double[Model.MapSizeX, Model.MapSizeY]; userMap = new Hashtable(); }
internal void Destroy() { Array.Clear(SqState, 0, SqState.Length); Array.Clear(SqFloorHeight, 0, SqFloorHeight.Length); Array.Clear(SqSeatRot, 0, SqSeatRot.Length); staticModel = null; Heightmap = null; SqState = null; SqFloorHeight = null; SqSeatRot = null; }
internal void FillNull(UInt32 pId) { this.Id = pId; this.Name = "Unknown Room"; this.Description = "-"; this.Type = "private"; this.Owner = "-"; this.Category = 0; this.UsersNow = 0; this.UsersMax = 0; this.ModelName = "NO_MODEL"; this.CCTs = ""; this.Score = 0; this.Tags = new List<string>(); this.AllowPets = true; this.AllowPetsEating = false; this.AllowWalkthrough = true; this.Hidewall = false; this.Password = ""; this.Wallpaper = "0.0"; this.Floor = "0.0"; this.Landscape = "0.0"; this.WallThickness = 0; this.FloorThickness = 0; //this.Event = null; this.AllowRightsOverride = false; this.myIcon = new RoomIcon(1, 1, new Dictionary<int, int>()); mModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(ModelName, pId); }
internal void Fill(Room Room) { this.Id = Room.RoomId; this.Name = Room.Name; this.Description = Room.Description; this.Type = Room.Type; this.Owner = Room.Owner; this.Category = Room.Category; this.State = Room.State; this.UsersNow = Room.UsersNow; this.UsersMax = Room.UsersMax; this.ModelName = Room.ModelName; this.CCTs = Room.CCTs; this.Score = Room.Score; this.Tags = new List<string>(); foreach (string tag in Room.Tags.ToArray()) this.Tags.Add(tag); this.AllowPets = Room.AllowPets; this.AllowPetsEating = Room.AllowPetsEating; this.AllowWalkthrough = Room.AllowWalkthrough; this.Hidewall = Room.Hidewall; this.myIcon = Room.Icon; this.Password = Room.Password; this.Event = Room.Event; this.Wallpaper = Room.Wallpaper; this.Floor = Room.Floor; this.Landscape = Room.Landscape; this.FloorThickness = Room.FloorThickness; this.WallThickness = Room.WallThickness; mModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(ModelName, Id); }
internal void Fill(DataRow Row) { this.Id = Convert.ToUInt32(Row["id"]); this.Name = (string)Row["caption"]; this.Description = (string)Row["description"]; this.Type = (string)Row["roomtype"]; this.Owner = (string)Row["owner"]; switch (Row["state"].ToString().ToLower()) { case "open": this.State = 0; break; case "password": this.State = 2; break; case "locked": default: this.State = 1; break; } this.Category = (int)Row["category"]; if (!string.IsNullOrEmpty(Row["active_users"].ToString())) this.UsersNow = (int)Row["active_users"]; else this.UsersNow = 0; this.UsersMax = (int)Row["users_max"]; this.ModelName = (string)Row["model_name"]; this.CCTs = (string)Row["public_ccts"]; this.Score = (int)Row["score"]; this.Tags = new List<string>(); this.AllowPets = ButterflyEnvironment.EnumToBool(Row["allow_pets"].ToString()); this.AllowPetsEating = ButterflyEnvironment.EnumToBool(Row["allow_pets_eat"].ToString()); this.AllowWalkthrough = ButterflyEnvironment.EnumToBool(Row["allow_walkthrough"].ToString()); this.AllowRightsOverride = ButterflyEnvironment.EnumToBool(Row["allow_rightsoverride"].ToString()); this.Hidewall = ButterflyEnvironment.EnumToBool(Row["allow_hidewall"].ToString()); this.Password = (string)Row["password"]; this.Wallpaper = (string)Row["wallpaper"]; this.Floor = (string)Row["floor"]; this.Landscape = (string)Row["landscape"]; this.FloorThickness = (int)Row["floorthickness"]; this.WallThickness = (int)Row["wallthickness"]; //this.Event = null; Dictionary<int, int> IconItems = new Dictionary<int,int>(); if (!string.IsNullOrEmpty(Row["icon_items"].ToString())) { foreach (string Bit in Row["icon_items"].ToString().Split('|')) { if (string.IsNullOrEmpty(Bit)) continue; string[] tBit = Bit.Replace('.', ',').Split(','); int a = 0; int b = 0; int.TryParse(tBit[0], out a); if (tBit.Length > 1) int.TryParse(tBit[1], out b); try { if (!IconItems.ContainsKey(a)) IconItems.Add(a, b); } catch (Exception e) { Logging.LogException("Exception: " + e.ToString() + "[" + Bit + "]"); } } } this.myIcon = new RoomIcon((int)Row["icon_bg"], (int)Row["icon_fg"], IconItems); foreach (string Tag in Row["tags"].ToString().Split(',')) { this.Tags.Add(Tag); } mModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(ModelName, Id); }
internal void Destroy() { userMap.Clear(); mDynamicModel.Destroy(); mCoordinatedItems.Clear(); if (roomLinkInformation != null) roomLinkInformation.Clear(); Array.Clear(mGameMap, 0, mGameMap.Length); Array.Clear(mUserItemEffect, 0, mUserItemEffect.Length); Array.Clear(mItemHeightMap, 0, mItemHeightMap.Length); userMap = null; mGameMap = null; mUserItemEffect = null; mItemHeightMap = null; mCoordinatedItems = null; roomLinkInformation = null; mDynamicModel = null; room = null; mStaticModel = null; }
internal void Fill(DataRow Row) { this.Id = Convert.ToUInt32(Row["id"]); this.Name = (string)Row["caption"]; this.Description = (string)Row["description"]; this.Type = (string)Row["roomtype"]; this.Owner = (string)Row["owner"]; switch (Row["state"].ToString().ToLower()) { case "open": this.State = 0; break; case "password": this.State = 2; break; case "locked": default: this.State = 1; break; } this.Category = (int)Row["category"]; if (!string.IsNullOrEmpty(Row["active_users"].ToString())) { this.UsersNow = (int)Row["active_users"]; } else { this.UsersNow = 0; } this.UsersMax = (int)Row["users_max"]; this.ModelName = (string)Row["model_name"]; this.CCTs = (string)Row["public_ccts"]; this.Score = (int)Row["score"]; this.Tags = new List <string>(); this.AllowPets = ButterflyEnvironment.EnumToBool(Row["allow_pets"].ToString()); this.AllowPetsEating = ButterflyEnvironment.EnumToBool(Row["allow_pets_eat"].ToString()); this.AllowWalkthrough = ButterflyEnvironment.EnumToBool(Row["allow_walkthrough"].ToString()); this.AllowRightsOverride = ButterflyEnvironment.EnumToBool(Row["allow_rightsoverride"].ToString()); this.Hidewall = ButterflyEnvironment.EnumToBool(Row["allow_hidewall"].ToString()); this.Password = (string)Row["password"]; this.Wallpaper = (string)Row["wallpaper"]; this.Floor = (string)Row["floor"]; this.Landscape = (string)Row["landscape"]; this.FloorThickness = (int)Row["floorthickness"]; this.WallThickness = (int)Row["wallthickness"]; //this.Event = null; Dictionary <int, int> IconItems = new Dictionary <int, int>(); if (!string.IsNullOrEmpty(Row["icon_items"].ToString())) { foreach (string Bit in Row["icon_items"].ToString().Split('|')) { if (string.IsNullOrEmpty(Bit)) { continue; } string[] tBit = Bit.Replace('.', ',').Split(','); int a = 0; int b = 0; int.TryParse(tBit[0], out a); if (tBit.Length > 1) { int.TryParse(tBit[1], out b); } try { if (!IconItems.ContainsKey(a)) { IconItems.Add(a, b); } } catch (Exception e) { Logging.LogException("Exception: " + e.ToString() + "[" + Bit + "]"); } } } this.myIcon = new RoomIcon((int)Row["icon_bg"], (int)Row["icon_fg"], IconItems); foreach (string Tag in Row["tags"].ToString().Split(',')) { this.Tags.Add(Tag); } mModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(ModelName, Id); }
public void Fill(DataRow Row) { this.Id = Convert.ToInt32(Row["id"]); this.Name = (string)Row["caption"]; this.Description = (string)Row["description"]; this.OwnerName = (string)Row["owner"]; this.OwnerId = 0; this.Langue = Language.FRANCAIS; using (IQueryAdapter queryreactor = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) { queryreactor.SetQuery("SELECT id, langue FROM users WHERE username = @owner"); queryreactor.AddParameter("owner", this.OwnerName); DataRow UserRow = queryreactor.GetRow(); if (UserRow != null) { this.OwnerId = Convert.ToInt32(UserRow["id"]); this.Langue = LanguageManager.ParseLanguage(UserRow["langue"].ToString()); } } switch (Row["state"].ToString().ToLower()) { case "open": this.State = 0; break; case "password": this.State = 2; break; case "hide": this.State = 3; break; default: this.State = 1; break; } this.Category = (int)Row["category"]; this.UsersNow = (int)Row["users_now"]; this.UsersMax = (int)Row["users_max"]; this.ModelName = (string)Row["model_name"]; this.Score = (int)Row["score"]; this.Tags = new List <string>(); this.AllowPets = ButterflyEnvironment.EnumToBool(Row["allow_pets"].ToString()); this.AllowPetsEating = ButterflyEnvironment.EnumToBool(Row["allow_pets_eat"].ToString()); this.AllowWalkthrough = ButterflyEnvironment.EnumToBool(Row["allow_walkthrough"].ToString()); this.AllowRightsOverride = ButterflyEnvironment.EnumToBool(Row["allow_rightsoverride"].ToString()); this.Hidewall = ButterflyEnvironment.EnumToBool(Row["allow_hidewall"].ToString()); this.Password = (string)Row["password"]; this.Wallpaper = (string)Row["wallpaper"]; this.Floor = (string)Row["floor"]; this.Landscape = (string)Row["landscape"]; this.FloorThickness = (int)Row["floorthick"]; this.WallThickness = (int)Row["wallthick"]; this.ChatType = (int)Row["chat_type"]; this.ChatBalloon = (int)Row["chat_balloon"]; this.ChatSpeed = (int)Row["chat_speed"]; this.ChatMaxDistance = (int)Row["chat_max_distance"]; this.ChatFloodProtection = (int)Row["chat_flood_protection"]; this.MuteFuse = Convert.ToInt32((string)Row["moderation_mute_fuse"]); this.WhoCanKick = Convert.ToInt32((string)Row["moderation_kick_fuse"]); this.BanFuse = Convert.ToInt32((string)Row["moderation_ban_fuse"]); this.GroupId = (int)Row["groupId"]; Group Group; ButterflyEnvironment.GetGame().GetGroupManager().TryGetGroup(this.GroupId, out Group); this.Group = Group; this.HideWireds = ButterflyEnvironment.EnumToBool(Row["allow_hidewireds"].ToString()); this.TrocStatus = Convert.ToInt32((string)Row["TrocStatus"]); Dictionary <int, int> Items = new Dictionary <int, int>(); if (!string.IsNullOrEmpty(Row["icon_items"].ToString())) { string str1 = Row["icon_items"].ToString(); char[] chArray = new char[1] { '|' }; foreach (string str2 in str1.Split(chArray)) { if (!string.IsNullOrEmpty(str2)) { string[] strArray = str2.Replace('.', ',').Split(new char[1] { ',' }); int result1 = 0; int result2 = 0; int.TryParse(strArray[0], out result1); if (strArray.Length > 1) { int.TryParse(strArray[1], out result2); } try { if (!Items.ContainsKey(result1)) { Items.Add(result1, result2); } } catch (Exception ex) { Logging.LogException("Exception: " + (ex).ToString() + "[" + str2 + "]"); } } } } string str3 = Row["tags"].ToString(); char[] chArray1 = new char[1] { ',' }; foreach (string str1 in str3.Split(chArray1)) { this.Tags.Add(str1); } this.SellPrice = (int)Row["price"]; this.mModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(this.ModelName, this.Id); }
private static RoomModel GetCustomData(UInt32 roomID) { using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT * FROM room_models_customs WHERE roomid = @roomid LIMIT 1;"); dbClient.addParameter("roomid", roomID); DataRow RoomData = dbClient.getRow(); if (RoomData == null) return null; string Modeldata = (string)RoomData["modeldata"]; RoomModel roomModelData = new RoomModel((int)RoomData["doorx"], (int)RoomData["doory"], (double)RoomData["height"], 0, Modeldata, "", false, string.Empty); SquareState state = roomModelData.SqState[roomModelData.DoorX, roomModelData.DoorY]; if (state != SquareState.BLOCKED) { short Z = roomModelData.SqFloorHeight[roomModelData.DoorX, roomModelData.DoorY]; roomModelData.DoorZ = Z; } return roomModelData; } }
internal void Fill(DataRow Row, uint modelId = 0) { Id = modelId != 0 ? modelId : Convert.ToUInt32(Row["id"]); Name = (string)Row["caption"]; Description = (string)Row["description"]; Type = (string)Row["roomtype"]; Owner = (string)Row["owner"]; OwnerId = UsersCache.getIdByUsername(Owner); State = (int)Row["state"]; Category = (int)Row["category"]; UsersNow = 0; UsersMax = Convert.ToUInt32(Row["users_max"]); ModelName = (string)Row["model_name"]; LastModelName = ModelName; Score = (int)Row["score"]; Tags = new List <string>(); TradeSettings = (int)Row["trade_settings"]; AllowPets = OtanixEnvironment.EnumToBool(Row["allow_pets"].ToString()); AllowPetsEating = OtanixEnvironment.EnumToBool(Row["allow_pets_eat"].ToString()); AllowWalkthrough = OtanixEnvironment.EnumToBool(Row["allow_walkthrough"].ToString()); AllowRightsOverride = OtanixEnvironment.EnumToBool(Row["allow_rightsoverride"].ToString()); AllowDiagonalEnabled = OtanixEnvironment.EnumToBool(Row["allow_diagonals"].ToString()); AntiFloodSettings = (int)Row["antiflood_settings"]; ChatDistance = (int)Row["chat_distance"]; Hidewall = OtanixEnvironment.EnumToBool(Row["allow_hidewall"].ToString()); Password = (string)Row["password"]; Wallpaper = (string)Row["wallpaper"]; Floor = (string)Row["floor"]; Landscape = (string)Row["landscape"]; FloorThickness = (int)Row["floorthickness"]; WallThickness = (int)Row["wallthickness"]; MuteFuse = Convert.ToInt32((string)Row["moderation_mute_fuse"]); KickFuse = Convert.ToInt32((string)Row["moderation_kick_fuse"]); BanFuse = Convert.ToInt32((string)Row["moderation_ban_fuse"]); GroupId = Convert.ToUInt32(Row["groupId"]); BubbleMode = Convert.ToInt32((string)Row["bubble_mode"]); BubbleType = Convert.ToInt32((string)Row["bubble_type"]); BubbleScroll = Convert.ToInt32((string)Row["bubble_scroll"]); WallHeight = Convert.ToInt32(Row["wall_height"]); RollerSpeed = Convert.ToUInt32(Row["roller_speed"]); temEmblema = (string)Row["temEmblema"]; DisabledCommands = new List <int>(); foreach (string StrCommandId in Row["disable_commands"].ToString().Split(',')) { int CommandId = -1; if (!int.TryParse(StrCommandId, out CommandId)) { continue; } if (!DisabledCommands.Contains(CommandId)) { DisabledCommands.Add(CommandId); } } foreach (var Tag in Row["tags"].ToString().Split(',')) { Tags.Add(Tag); } mModel = OtanixEnvironment.GetGame().GetRoomManager().GetModel(ModelName, Id); }