Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Oops, it appears that you have entered an invalid floor map
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="vdwestena" data-source="post: 457199" data-attributes="member: 82392"><p>Uhh, it's an edit of Plus named Quasar, only thing I know is that it's R2, this is my floorplan class:</p><p>[CODE=csharp]using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Data;</p><p>using System.Collections.Generic;</p><p></p><p>using Quasar.HabboHotel.Rooms;</p><p>using Quasar.Communication.Packets.Outgoing.Rooms.Session;</p><p>using Quasar.Communication.Packets.Outgoing.Rooms.Notifications;</p><p>using Quasar.Database.Interfaces;</p><p>using Quasar.HabboHotel.Items;</p><p></p><p>namespace Quasar.Communication.Packets.Incoming.Rooms.FloorPlan</p><p>{</p><p> class SaveFloorPlanModelEvent : IPacketEvent</p><p> {</p><p> public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)</p><p> {</p><p> if (!Session.GetHabbo().InRoom)</p><p> return;</p><p></p><p> Room Room = Session.GetHabbo().CurrentRoom;</p><p> if (Room == null || Session.GetHabbo().CurrentRoomId != Room.Id || !Room.CheckRights(Session, true))</p><p> return;</p><p></p><p> char[] validLetters =</p><p> {</p><p> '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g',</p><p> 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', '\r'</p><p> };</p><p></p><p> string Map = Packet.PopString().ToLower().TrimEnd();</p><p></p><p> if (Map.Length > 4159) //4096 + New Lines = 4159</p><p> {</p><p> Session.SendMessage(new RoomNotificationComposer("floorplan_editor.error", "errors1", "(%%%general%%%): %%%too_large_area%%% (%%%max%%% 2048 %%%tiles%%%)"));</p><p> return;</p><p> }</p><p></p><p> if (Map.Any(letter => !validLetters.Contains(letter)) || String.IsNullOrEmpty(Map))</p><p> {</p><p> Session.SendMessage(new RoomNotificationComposer("floorplan_editor.error", "errors2", "Oops, it appears that you have entered an invalid floor map!"));</p><p> return;</p><p> }</p><p></p><p> var modelData = Map.Split('\r');</p><p></p><p> int SizeY = modelData.Length;</p><p> int SizeX = modelData[0].Length;</p><p></p><p> if (SizeY > 128 || SizeX > 128)</p><p> {</p><p> Session.SendMessage(new RoomNotificationComposer("floorplan_editor.error", "errors3", "The maximum height and width of a model is 64x64!"));</p><p> return;</p><p> }</p><p></p><p> int lastLineLength = 0;</p><p> bool isValid = true;</p><p></p><p> for (int i = 0; i < modelData.Length; i++)</p><p> {</p><p> if (lastLineLength == 0)</p><p> {</p><p> lastLineLength = modelData[i].Length;</p><p> continue;</p><p> }</p><p></p><p> if (lastLineLength != modelData[i].Length)</p><p> {</p><p> isValid = false;</p><p> }</p><p> }</p><p></p><p> if (!isValid)</p><p> {</p><p> Session.SendMessage(new RoomNotificationComposer("floorplan_editor.error", "errors", "Oops, it appears that you have entered an invalid floor map!"));</p><p> return;</p><p> }</p><p></p><p> int DoorX = Packet.PopInt();</p><p> int DoorY = Packet.PopInt();</p><p> int DoorDirection = Packet.PopInt();</p><p> int WallThick = Packet.PopInt();</p><p> int FloorThick = Packet.PopInt();</p><p> int WallHeight = Packet.PopInt();</p><p></p><p> int DoorZ = 0;</p><p></p><p> try</p><p> {</p><p> DoorZ = parse(modelData[DoorY][DoorX]);</p><p> }</p><p> catch { }</p><p></p><p> if (WallThick > 1)</p><p> WallThick = 1;</p><p></p><p> if (WallThick < -2)</p><p> WallThick = -2;</p><p></p><p> if (FloorThick > 1)</p><p> FloorThick = 1;</p><p></p><p> if (FloorThick < -2)</p><p> WallThick = -2;</p><p></p><p> if (WallHeight < 0)</p><p> WallHeight = 0;</p><p></p><p> if (WallHeight > 15)</p><p> WallHeight = 15;</p><p></p><p> string ModelName = "model_fp_" + Room.Id;</p><p> Map += '\r' + new string('x', SizeX);</p><p></p><p> DataRow Row = null;</p><p> using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> dbClient.SetQuery("SELECT * FROM `room_models` WHERE `id` = @model AND `custom` = '1' LIMIT 1");</p><p> dbClient.AddParameter("model", "model_fp_" + Room.Id);</p><p> Row = dbClient.getRow();</p><p></p><p> if (Row == null)//The row is still null, let's insert instead.</p><p> {</p><p> dbClient.SetQuery("INSERT INTO `room_models` (`id`,`door_x`,`door_y`, `door_z`, `door_dir`,`heightmap`,`custom`,`wall_height`) VALUES (@ModelName, @DoorX, @DoorY, @DoorZ, @DoorDirection, @Map,'1',@WallHeight)");</p><p> dbClient.AddParameter("ModelName", "model_fp_" + Room.Id);</p><p> dbClient.AddParameter("DoorX", DoorX);</p><p> dbClient.AddParameter("DoorY", DoorY);</p><p> dbClient.AddParameter("DoorDirection", DoorDirection);</p><p> dbClient.AddParameter("DoorZ", DoorZ);</p><p> dbClient.AddParameter("Map", Map);</p><p> dbClient.AddParameter("WallHeight", WallHeight);</p><p> dbClient.RunQuery();</p><p> }</p><p> else</p><p> {</p><p> dbClient.SetQuery("UPDATE `room_models` SET `heightmap` = @Map, `door_x` = @DoorX, `door_y` = @DoorY, `door_z` = @DoorZ, `door_dir` = @DoorDirection, `wall_height` = @WallHeight WHERE `id` = @ModelName LIMIT 1");</p><p> dbClient.AddParameter("ModelName", "model_fp_" + Room.Id);</p><p> dbClient.AddParameter("Map", Map);</p><p> dbClient.AddParameter("DoorX", DoorX);</p><p> dbClient.AddParameter("DoorY", DoorY);</p><p> dbClient.AddParameter("DoorZ", DoorZ);</p><p> dbClient.AddParameter("DoorDirection", DoorDirection);</p><p> dbClient.AddParameter("WallHeight", WallHeight);</p><p> dbClient.RunQuery();</p><p> }</p><p></p><p> dbClient.SetQuery("UPDATE `rooms` SET `model_name` = @ModelName, `wallthick` = @WallThick, `floorthick` = @FloorThick WHERE `id` = @roomId LIMIT 1");</p><p> dbClient.AddParameter("roomId", Room.Id);</p><p> dbClient.AddParameter("ModelName", "model_fp_" + Room.Id);</p><p> dbClient.AddParameter("WallThick", WallThick);</p><p> dbClient.AddParameter("FloorThick", FloorThick);</p><p> dbClient.RunQuery();</p><p> }</p><p></p><p> Room.RoomData.ModelName = ModelName;</p><p> Room.RoomData.WallThickness = WallThick;</p><p> Room.RoomData.FloorThickness = FloorThick;</p><p></p><p> List<RoomUser> UsersToReturn = Room.GetRoomUserManager().GetRoomUsers().ToList();</p><p></p><p> QuasarEnvironment.GetGame().GetRoomManager().ReloadModel(ModelName);</p><p> QuasarEnvironment.GetGame().GetRoomManager().UnloadRoom(Room);</p><p></p><p></p><p> foreach (RoomUser User in UsersToReturn)</p><p> {</p><p> if (User == null || User.GetClient() == null)</p><p> continue;</p><p></p><p> User.GetClient().SendMessage(new RoomForwardComposer(Room.Id));</p><p> }</p><p> }</p><p></p><p> public static short parse(char input)</p><p> {</p><p></p><p> switch (input)</p><p> {</p><p> default:</p><p> case '0':</p><p> return 0;</p><p> case '1':</p><p> return 1;</p><p> case '2':</p><p> return 2;</p><p> case '3':</p><p> return 3;</p><p> case '4':</p><p> return 4;</p><p> case '5':</p><p> return 5;</p><p> case '6':</p><p> return 6;</p><p> case '7':</p><p> return 7;</p><p> case '8':</p><p> return 8;</p><p> case '9':</p><p> return 9;</p><p> case 'a':</p><p> return 10;</p><p> case 'b':</p><p> return 11;</p><p> case 'c':</p><p> return 12;</p><p> case 'd':</p><p> return 13;</p><p> case 'e':</p><p> return 14;</p><p> case 'f':</p><p> return 15;</p><p> case 'g':</p><p> return 16;</p><p> case 'h':</p><p> return 17;</p><p> case 'i':</p><p> return 18;</p><p> case 'j':</p><p> return 19;</p><p> case 'k':</p><p> return 20;</p><p> case 'l':</p><p> return 21;</p><p> case 'm':</p><p> return 22;</p><p> case 'n':</p><p> return 23;</p><p> case 'o':</p><p> return 24;</p><p> case 'p':</p><p> return 25;</p><p> case 'q':</p><p> return 26;</p><p> case 'r':</p><p> return 27;</p><p> case 's':</p><p> return 28;</p><p> case 't':</p><p> return 29;</p><p> case 'u':</p><p> return 30;</p><p> case 'v':</p><p> return 31;</p><p> case 'w':</p><p> return 32;</p><p> }</p><p> }</p><p> }</p><p>}[/CODE]</p><p></p><p>And these are my room_models fields: <a href="https://prnt.sc/rc7ga5" target="_blank">https://prnt.sc/rc7ga5</a></p><p>Strict mode is also off.</p></blockquote><p></p>
[QUOTE="vdwestena, post: 457199, member: 82392"] Uhh, it's an edit of Plus named Quasar, only thing I know is that it's R2, this is my floorplan class: [CODE=csharp]using System; using System.Linq; using System.Text; using System.Data; using System.Collections.Generic; using Quasar.HabboHotel.Rooms; using Quasar.Communication.Packets.Outgoing.Rooms.Session; using Quasar.Communication.Packets.Outgoing.Rooms.Notifications; using Quasar.Database.Interfaces; using Quasar.HabboHotel.Items; namespace Quasar.Communication.Packets.Incoming.Rooms.FloorPlan { class SaveFloorPlanModelEvent : IPacketEvent { public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; Room Room = Session.GetHabbo().CurrentRoom; if (Room == null || Session.GetHabbo().CurrentRoomId != Room.Id || !Room.CheckRights(Session, true)) return; char[] validLetters = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', '\r' }; string Map = Packet.PopString().ToLower().TrimEnd(); if (Map.Length > 4159) //4096 + New Lines = 4159 { Session.SendMessage(new RoomNotificationComposer("floorplan_editor.error", "errors1", "(%%%general%%%): %%%too_large_area%%% (%%%max%%% 2048 %%%tiles%%%)")); return; } if (Map.Any(letter => !validLetters.Contains(letter)) || String.IsNullOrEmpty(Map)) { Session.SendMessage(new RoomNotificationComposer("floorplan_editor.error", "errors2", "Oops, it appears that you have entered an invalid floor map!")); return; } var modelData = Map.Split('\r'); int SizeY = modelData.Length; int SizeX = modelData[0].Length; if (SizeY > 128 || SizeX > 128) { Session.SendMessage(new RoomNotificationComposer("floorplan_editor.error", "errors3", "The maximum height and width of a model is 64x64!")); return; } int lastLineLength = 0; bool isValid = true; for (int i = 0; i < modelData.Length; i++) { if (lastLineLength == 0) { lastLineLength = modelData[i].Length; continue; } if (lastLineLength != modelData[i].Length) { isValid = false; } } if (!isValid) { Session.SendMessage(new RoomNotificationComposer("floorplan_editor.error", "errors", "Oops, it appears that you have entered an invalid floor map!")); return; } int DoorX = Packet.PopInt(); int DoorY = Packet.PopInt(); int DoorDirection = Packet.PopInt(); int WallThick = Packet.PopInt(); int FloorThick = Packet.PopInt(); int WallHeight = Packet.PopInt(); int DoorZ = 0; try { DoorZ = parse(modelData[DoorY][DoorX]); } catch { } if (WallThick > 1) WallThick = 1; if (WallThick < -2) WallThick = -2; if (FloorThick > 1) FloorThick = 1; if (FloorThick < -2) WallThick = -2; if (WallHeight < 0) WallHeight = 0; if (WallHeight > 15) WallHeight = 15; string ModelName = "model_fp_" + Room.Id; Map += '\r' + new string('x', SizeX); DataRow Row = null; using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `room_models` WHERE `id` = @model AND `custom` = '1' LIMIT 1"); dbClient.AddParameter("model", "model_fp_" + Room.Id); Row = dbClient.getRow(); if (Row == null)//The row is still null, let's insert instead. { dbClient.SetQuery("INSERT INTO `room_models` (`id`,`door_x`,`door_y`, `door_z`, `door_dir`,`heightmap`,`custom`,`wall_height`) VALUES (@ModelName, @DoorX, @DoorY, @DoorZ, @DoorDirection, @Map,'1',@WallHeight)"); dbClient.AddParameter("ModelName", "model_fp_" + Room.Id); dbClient.AddParameter("DoorX", DoorX); dbClient.AddParameter("DoorY", DoorY); dbClient.AddParameter("DoorDirection", DoorDirection); dbClient.AddParameter("DoorZ", DoorZ); dbClient.AddParameter("Map", Map); dbClient.AddParameter("WallHeight", WallHeight); dbClient.RunQuery(); } else { dbClient.SetQuery("UPDATE `room_models` SET `heightmap` = @Map, `door_x` = @DoorX, `door_y` = @DoorY, `door_z` = @DoorZ, `door_dir` = @DoorDirection, `wall_height` = @WallHeight WHERE `id` = @ModelName LIMIT 1"); dbClient.AddParameter("ModelName", "model_fp_" + Room.Id); dbClient.AddParameter("Map", Map); dbClient.AddParameter("DoorX", DoorX); dbClient.AddParameter("DoorY", DoorY); dbClient.AddParameter("DoorZ", DoorZ); dbClient.AddParameter("DoorDirection", DoorDirection); dbClient.AddParameter("WallHeight", WallHeight); dbClient.RunQuery(); } dbClient.SetQuery("UPDATE `rooms` SET `model_name` = @ModelName, `wallthick` = @WallThick, `floorthick` = @FloorThick WHERE `id` = @roomId LIMIT 1"); dbClient.AddParameter("roomId", Room.Id); dbClient.AddParameter("ModelName", "model_fp_" + Room.Id); dbClient.AddParameter("WallThick", WallThick); dbClient.AddParameter("FloorThick", FloorThick); dbClient.RunQuery(); } Room.RoomData.ModelName = ModelName; Room.RoomData.WallThickness = WallThick; Room.RoomData.FloorThickness = FloorThick; List<RoomUser> UsersToReturn = Room.GetRoomUserManager().GetRoomUsers().ToList(); QuasarEnvironment.GetGame().GetRoomManager().ReloadModel(ModelName); QuasarEnvironment.GetGame().GetRoomManager().UnloadRoom(Room); foreach (RoomUser User in UsersToReturn) { if (User == null || User.GetClient() == null) continue; User.GetClient().SendMessage(new RoomForwardComposer(Room.Id)); } } public static short parse(char input) { switch (input) { default: case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9; case 'a': return 10; case 'b': return 11; case 'c': return 12; case 'd': return 13; case 'e': return 14; case 'f': return 15; case 'g': return 16; case 'h': return 17; case 'i': return 18; case 'j': return 19; case 'k': return 20; case 'l': return 21; case 'm': return 22; case 'n': return 23; case 'o': return 24; case 'p': return 25; case 'q': return 26; case 'r': return 27; case 's': return 28; case 't': return 29; case 'u': return 30; case 'v': return 31; case 'w': return 32; } } } }[/CODE] And these are my room_models fields: [URL]https://prnt.sc/rc7ga5[/URL] Strict mode is also off. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Oops, it appears that you have entered an invalid floor map
Top