From a storage point of view, both boolean/tinyint(1) and enum(online,offline) take up one byte.I'm personally an advocate for clarity / readable code over micro optimizations.
That said, enum values are stored in a single byte (for up to 255 entries), 2 bytes for more etc. They are not stored as string values for every entry.
You got more issues on your hands if a couple MB at most for a big hotel is what you're trying to safe on diskspace.
Thank you for your hard work, I have enjoyed many hours of nostalgia using your emulator.
Is it possible to add the DJ Turntable to the Rares section? I tried adding this to the database but I wasn't sure what to use for the sprite ID and got stuck.
The sprite id column isn't used by the server. I converted one of my private projects' catalogue for Kepler and I accidentally left the sprite id column in there.:
Haven't had any luck getting this done. Are you able to point me in the right direction? Quite rusty with this stuff and need DJ Decks for some stacking nostalgia.
<?php
sendRcon("127.0.0.1", "12309", build("hotel_alert", array(
"message" => "Hello, World!",
"sender" => "Alex"
)));
sendRcon("127.0.0.1", "12309", build("hotel_alert", array(
"message" => "Hello, World!"
)));
sendRcon("127.0.0.1", "12309", build("refresh_looks", array(
"userId" => "1"
)));
sendRcon("127.0.0.1", "12309", build("refresh_hand", array(
"userId" => "1"
)));
sendRcon("127.0.0.1", "12309", build("refresh_club", array(
"userId" => "1"
)));
sendRcon("127.0.0.1", "12309", build("refresh_credits", array(
"userId" => "1"
)));
function build($header, $parameters) {
$message = "";
$message .= pack('N', strlen($header));
$message .= $header;
$message .= pack('N', count($parameters));
foreach ($parameters as $key => $value) {
$message .= pack('N', strlen($key));
$message .= $key;
$message .= pack('N', strlen($value));
$message .= $value;
}
$buffer = "";
$buffer .= pack('N', strlen($message));
$buffer .= $message;
return $buffer;
}
function sendRcon($ip, $port, $command) {
$socket = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
socket_connect($socket, $ip, $port);
socket_send($socket, $command, strlen($command), MSG_DONTROUTE);
socket_close($socket);
}
?>
public class RconCommand {
private final RconHeader header;
private final Map<String, Object> parameters;
public RconCommand(RconHeader header, Map<String, Object> parameters) {
this.header = header;
this.parameters = parameters;
}
public void send() {
try (Socket socket = new Socket(ServerConfiguration.getString("rcon.ip"), ServerConfiguration.getInteger("rcon.port"))) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream daos = new DataOutputStream(baos);
daos.writeInt(header.getRawHeader().length());
daos.write(header.getRawHeader().getBytes(StringUtil.getCharset()));
daos.writeInt(parameters.size());
for (var entry : parameters.entrySet()) {
daos.writeInt(entry.getKey().length());
daos.write(entry.getKey().getBytes(StringUtil.getCharset()));
daos.writeInt(entry.getValue().toString().length());
daos.write(entry.getValue().toString().getBytes(StringUtil.getCharset()));
}
try (DataOutputStream dataOutputStream = new DataOutputStream(socket.getOutputStream())) {
byte[] message = baos.toByteArray();
dataOutputStream.writeInt(message.length);
dataOutputStream.write(message);
dataOutputStream.flush();
baos.close();
daos.close();
socket.close();
} catch (IOException ignored) {
}
} catch (IOException ignored) {
}
}
}
Yesterday I merged your branch into mine and I just want to report back that its works and I couldnt be happier.
I also want thank you for your contributions to the Habbo Retro community this year, its been truly an amazing year and your contributions arent going unnoticed.
I personally hope the community next year will show a more collaborative and supportive spirit so we can continue the retro journey together. Together as a community we can achieve much more.
Hi there!
First, thank you for your hard work @Quackster, the result really looks nice !
Though, I'm having an issue connecting to the server from the client..
I'm starting the server from the BAT file, and connecting to localhost using the Basilisk browser (Shockwave is working on some online demos).
I've also ran the SQL file into MySQL.
The issue is when trying to connect with Basilisk, I'm getting the result below when trying to connect (takes a long minute of loading before displaying that):
View attachment 168798
No error in the server command line but I see a connection attempt (screenshot below).
View attachment 168799
Thank you for your help!
Okay you are like the tenth person to try and load the Habbo TCP port in the browser, are you all the same person?
You have to use a loader with DCRS on an HTML file that connects to the server. I'm fed up with being asked the same question over the span of a year or more.
Thank you guys, didn't find this info anywhere before
Sorry for the bother Quackster ..