mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 07:20:50 +01:00
Bots can now be set a bubble. Closes #390
This commit is contained in:
parent
96ecbfa8c2
commit
9e7abc9d41
@ -101,3 +101,7 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('subscriptions.hc.payday.m
|
|||||||
|
|
||||||
-- OPTIONAL HC MIGRATION
|
-- 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();
|
-- 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`;
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ public class Bot implements Runnable {
|
|||||||
private int chatTimeOut;
|
private int chatTimeOut;
|
||||||
private int chatTimestamp;
|
private int chatTimestamp;
|
||||||
private short lastChatIndex;
|
private short lastChatIndex;
|
||||||
|
private int bubble;
|
||||||
|
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
@ -73,6 +74,7 @@ public class Bot implements Runnable {
|
|||||||
this.chatLines = new ArrayList<>();
|
this.chatLines = new ArrayList<>();
|
||||||
this.type = "generic_bot";
|
this.type = "generic_bot";
|
||||||
this.room = null;
|
this.room = null;
|
||||||
|
this.bubble = RoomChatMessageBubbles.BOT_RENTABLE.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bot(ResultSet set) throws SQLException {
|
public Bot(ResultSet set) throws SQLException {
|
||||||
@ -94,6 +96,7 @@ public class Bot implements Runnable {
|
|||||||
this.roomUnit = null;
|
this.roomUnit = null;
|
||||||
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
|
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
|
||||||
this.needsUpdate = false;
|
this.needsUpdate = false;
|
||||||
|
this.bubble = set.getInt("bubble_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bot(Bot bot) {
|
public Bot(Bot bot) {
|
||||||
@ -110,6 +113,7 @@ public class Bot implements Runnable {
|
|||||||
this.chatLines = new ArrayList<>(Arrays.asList("Default Message :D"));
|
this.chatLines = new ArrayList<>(Arrays.asList("Default Message :D"));
|
||||||
this.type = bot.getType();
|
this.type = bot.getType();
|
||||||
this.effect = bot.getEffect();
|
this.effect = bot.getEffect();
|
||||||
|
this.bubble = bot.getBubbleId();
|
||||||
|
|
||||||
this.needsUpdate = false;
|
this.needsUpdate = false;
|
||||||
}
|
}
|
||||||
@ -133,7 +137,7 @@ public class Bot implements Runnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (this.needsUpdate) {
|
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 = ? WHERE id = ?")) {
|
||||||
statement.setString(1, this.name);
|
statement.setString(1, this.name);
|
||||||
statement.setString(2, this.motto);
|
statement.setString(2, this.motto);
|
||||||
statement.setString(3, this.figure);
|
statement.setString(3, this.figure);
|
||||||
@ -155,7 +159,8 @@ public class Bot implements Runnable {
|
|||||||
statement.setString(15, this.chatRandom ? "1" : "0");
|
statement.setString(15, this.chatRandom ? "1" : "0");
|
||||||
statement.setInt(16, this.chatDelay);
|
statement.setInt(16, this.chatDelay);
|
||||||
statement.setInt(17, this.effect);
|
statement.setInt(17, this.effect);
|
||||||
statement.setInt(18, this.id);
|
statement.setInt(18, this.bubble);
|
||||||
|
statement.setInt(19, this.id);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
this.needsUpdate = false;
|
this.needsUpdate = false;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@ -208,7 +213,7 @@ public class Bot implements Runnable {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
this.chatTimestamp = Emulator.getIntUnixTimestamp();
|
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/")) {
|
if (message.equals("o/") || message.equals("_o/")) {
|
||||||
this.room.sendComposer(new RoomUserActionComposer(this.roomUnit, RoomUserAction.WAVE).compose());
|
this.room.sendComposer(new RoomUserActionComposer(this.roomUnit, RoomUserAction.WAVE).compose());
|
||||||
@ -223,7 +228,7 @@ public class Bot implements Runnable {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
this.chatTimestamp = Emulator.getIntUnixTimestamp();
|
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/")) {
|
if (message.equals("o/") || message.equals("_o/")) {
|
||||||
this.room.sendComposer(new RoomUserActionComposer(this.roomUnit, RoomUserAction.WAVE).compose());
|
this.room.sendComposer(new RoomUserActionComposer(this.roomUnit, RoomUserAction.WAVE).compose());
|
||||||
@ -238,7 +243,7 @@ public class Bot implements Runnable {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
this.chatTimestamp = Emulator.getIntUnixTimestamp();
|
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;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBubbleId() {
|
||||||
|
return bubble;
|
||||||
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.needsUpdate = true;
|
this.needsUpdate = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user