
Originally Posted by
PEjump2
Well, now you need to code public room furni & public room user entering ;)
Anyways, goodjob, mind sharing some code snippets? And do you cache the heightmaps etc?
Your 9th lifetime saying Good Job? :P
The room user entering works very much indeed, all that needs done is public items and making that user visible.
I don't see the need to cache the height map or model since I only need to load it once for each user who enters a room.
Here is the snippet you requested, for entering a public room
PHP Code:
private void OpenConnectionMessageCompose()
{
//Remove garbage
Request.PopWiredInt32();
//Public room ID
int id = Request.PopWiredInt32();
using (DatabaseClient dbClient = AleedaEnvironment.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("id", id);
DataRow dRow = dbClient.ReadDataRow("SELECT * FROM public_rooms WHERE id = @id");
Response.Initialize(ResponseOpcodes.RoomReady); // AE
Response.AppendString((string)dRow["model"]);
Response.AppendInt32(0);
SendResponse();
//Checks if user is already in there, if so, deletes him!
ContainsRoomID(Session.GetHabbo().Username);
//Add user to Dictionary, Username being the key and the room id being the value
Room.Add(Session.GetHabbo().Username, Convert.ToUInt32(id));
//If it contains the type (private, public) get rid of it
ContainsType(Session.GetHabbo().Username);
//Add the room if the room is public (it is)
Type.Add(Session.GetHabbo().Username, "public");
Response.Initialize(ResponseOpcodes.Bf); // Bf
Response.AppendString("/client/public/" + Convert.ToString(dRow["model"]) + "/0");
SendResponse();
}
}