This commit is contained in:
Remco 2020-11-03 00:37:55 +01:00
commit 9ae0e26de0
4 changed files with 70 additions and 45 deletions

View File

@ -78,6 +78,8 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.auto.points.hc_mo
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.auto.credits.hc_modifier', '1');
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.auto.gotwpoints.hc_modifier', '1');
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('room.chat.mutearea.allow_whisper', '1');
DELETE FROM `emulator_settings` WHERE `key` IN ('hotel.max.rooms.per.user', 'hotel.max.rooms.user', 'hotel.max.rooms.vip', 'max.friends', 'hotel.max.friends', 'max.friends.hc', 'hotel.max.friends.hc');
ALTER TABLE `users_settings` ADD COLUMN `max_friends` int(10) NULL DEFAULT 300 AFTER `has_gotten_default_saved_searches`;
@ -101,3 +103,7 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('subscriptions.hc.payday.m
-- OPTIONAL HC MIGRATION
-- INSERT INTO users_subscriptions SELECT NULL, user_id, 'HABBO_CLUB' as `subscription_type`, UNIX_TIMESTAMP() AS `timestamp_start`, (club_expire_timestamp - UNIX_TIMESTAMP()) AS `duration`, 1 AS `active` FROM users_settings WHERE club_expire_timestamp > UNIX_TIMESTAMP();
ALTER TABLE `bots`
ADD COLUMN `bubble_id` int(3) NULL DEFAULT 31 AFTER `effect`;

View File

@ -44,6 +44,7 @@ public class Bot implements Runnable {
private int chatTimeOut;
private int chatTimestamp;
private short lastChatIndex;
private int bubble;
private String type;
@ -73,6 +74,7 @@ public class Bot implements Runnable {
this.chatLines = new ArrayList<>();
this.type = "generic_bot";
this.room = null;
this.bubble = RoomChatMessageBubbles.BOT_RENTABLE.getType();
}
public Bot(ResultSet set) throws SQLException {
@ -94,6 +96,7 @@ public class Bot implements Runnable {
this.roomUnit = null;
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
this.needsUpdate = false;
this.bubble = set.getInt("bubble_id");
}
public Bot(Bot bot) {
@ -110,6 +113,7 @@ public class Bot implements Runnable {
this.chatLines = new ArrayList<>(Arrays.asList("Default Message :D"));
this.type = bot.getType();
this.effect = bot.getEffect();
this.bubble = bot.getBubbleId();
this.needsUpdate = false;
}
@ -133,7 +137,7 @@ public class Bot implements Runnable {
@Override
public void run() {
if (this.needsUpdate) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE bots SET name = ?, motto = ?, figure = ?, gender = ?, user_id = ?, room_id = ?, x = ?, y = ?, z = ?, rot = ?, dance = ?, freeroam = ?, chat_lines = ?, chat_auto = ?, chat_random = ?, chat_delay = ?, effect = ? WHERE id = ?")) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE bots SET name = ?, motto = ?, figure = ?, gender = ?, user_id = ?, room_id = ?, x = ?, y = ?, z = ?, rot = ?, dance = ?, freeroam = ?, chat_lines = ?, chat_auto = ?, chat_random = ?, chat_delay = ?, effect = ?, bubble_id = ? WHERE id = ?")) {
statement.setString(1, this.name);
statement.setString(2, this.motto);
statement.setString(3, this.figure);
@ -155,7 +159,8 @@ public class Bot implements Runnable {
statement.setString(15, this.chatRandom ? "1" : "0");
statement.setInt(16, this.chatDelay);
statement.setInt(17, this.effect);
statement.setInt(18, this.id);
statement.setInt(18, this.bubble);
statement.setInt(19, this.id);
statement.execute();
this.needsUpdate = false;
} catch (SQLException e) {
@ -208,7 +213,7 @@ public class Bot implements Runnable {
return;
this.chatTimestamp = Emulator.getIntUnixTimestamp();
this.room.botChat(new RoomUserTalkComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT_RENTABLE)).compose());
this.room.botChat(new RoomUserTalkComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.getBubble(this.getBubbleId()))).compose());
if (message.equals("o/") || message.equals("_o/")) {
this.room.sendComposer(new RoomUserActionComposer(this.roomUnit, RoomUserAction.WAVE).compose());
@ -223,7 +228,7 @@ public class Bot implements Runnable {
return;
this.chatTimestamp = Emulator.getIntUnixTimestamp();
this.room.botChat(new RoomUserShoutComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT_RENTABLE)).compose());
this.room.botChat(new RoomUserShoutComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.getBubble(this.getBubbleId()))).compose());
if (message.equals("o/") || message.equals("_o/")) {
this.room.sendComposer(new RoomUserActionComposer(this.roomUnit, RoomUserAction.WAVE).compose());
@ -238,7 +243,7 @@ public class Bot implements Runnable {
return;
this.chatTimestamp = Emulator.getIntUnixTimestamp();
event.target.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT_RENTABLE)));
event.target.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.getBubble(this.getBubbleId()))));
}
}
@ -270,6 +275,10 @@ public class Bot implements Runnable {
return this.name;
}
public int getBubbleId() {
return bubble;
}
public void setName(String name) {
this.name = name;
this.needsUpdate = true;

View File

@ -1,5 +1,6 @@
package com.eu.habbo.habbohotel.users.clothingvalidation;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@ -57,12 +58,14 @@ public class Figuredata {
for(int i = 0; i < palettesList.getLength(); i++) {
Node nNode = palettesList.item(i);
if(nNode.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) nNode;
int paletteId = Integer.parseInt(element.getAttribute("id"));
FiguredataPalette palette = new FiguredataPalette(paletteId);
NodeList colorsList = nNode.getChildNodes();
for (int ii = 0; ii < colorsList.getLength(); ii++) {
if(colorsList.item(ii).getNodeType() == Node.ELEMENT_NODE) {
Element colorElement = (Element) colorsList.item(ii);
FiguredataPaletteColor color = new FiguredataPaletteColor(
Integer.parseInt(colorElement.getAttribute("id")),
@ -73,12 +76,16 @@ public class Figuredata {
);
palette.addColor(color);
}
}
palettes.put(palette.id, palette);
}
}
for(int i = 0; i < settypesList.getLength(); i++) {
Node nNode = settypesList.item(i);
if(nNode.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) nNode;
String type = element.getAttribute("type");
@ -92,6 +99,7 @@ public class Figuredata {
NodeList setsList = nNode.getChildNodes();
for (int ii = 0; ii < setsList.getLength(); ii++) {
if(setsList.item(ii).getNodeType() == Node.ELEMENT_NODE) {
Element setElement = (Element) setsList.item(ii);
FiguredataSettypeSet set = new FiguredataSettypeSet(
Integer.parseInt(setElement.getAttribute("id")),
@ -104,9 +112,11 @@ public class Figuredata {
);
settype.addSet(set);
}
}
settypes.put(settype.type, settype);
}
}
}
}

View File

@ -27,7 +27,7 @@ public class RequestGuildBuyEvent extends MessageHandler {
if(name.length() > 29 || description.length() > 254)
return;
if (Emulator.getConfig().getBoolean("catalog.guild.hc_required", true) && this.client.getHabbo().getHabboStats().getClubExpireTimestamp() < Emulator.getIntUnixTimestamp()) {
if (Emulator.getConfig().getBoolean("catalog.guild.hc_required", true) && !this.client.getHabbo().getHabboStats().hasActiveClub()) {
this.client.sendResponse(new GuildEditFailComposer(GuildEditFailComposer.HC_REQUIRED));
return;
}