mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-22 15:00:52 +01:00
Merge branch 'dev' of https://git.krews.org/morningstar/Arcturus-Community into dev
This commit is contained in:
commit
b0683f524a
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@ -0,0 +1,19 @@
|
||||
FROM maven:latest AS builder
|
||||
|
||||
# Copy the Emulator sources to the container
|
||||
COPY . .
|
||||
# Package it
|
||||
RUN mvn package && mv /target/Habbo*-with-dependencies.jar /target/Habbo.jar
|
||||
|
||||
# Use Java 8 for running
|
||||
FROM java:8 AS runner
|
||||
|
||||
# Copy the generated source
|
||||
COPY --from=builder /target/Habbo.jar /
|
||||
|
||||
# Save the script to wait for the database, among running the Arcturus Emulator
|
||||
RUN echo "#!/bin/bash \n java -Dfile.encoding=UTF-8 -jar /Habbo.jar" > /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
# Run the Emulator with Java
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
@ -124,7 +124,7 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_roombad
|
||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.description.cmd_roombadge', ':roombadge <badge>');
|
||||
|
||||
-- Making items.wired_data column bigger since wired data is saved as JSON now
|
||||
ALTER TABLE `items` MODIFY COLUMN `wired_data` varchar(10000)
|
||||
ALTER TABLE `items` MODIFY COLUMN `wired_data` varchar(10000);
|
||||
|
||||
-- Mute area sqls
|
||||
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('room.chat.mutearea.allow_whisper', 'false');
|
||||
|
6
sqlupdates/3_0_BETA_1 to 3_0_0-RC-1.sql
Normal file
6
sqlupdates/3_0_BETA_1 to 3_0_0-RC-1.sql
Normal file
@ -0,0 +1,6 @@
|
||||
-- Wired variables for bots
|
||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.name', '%name%');
|
||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.roomname', '%roomname%');
|
||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.user_count', '%user_count%');
|
||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.owner', '%owner%');
|
||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('wired.variable.item_count', '%item_count%');
|
@ -144,8 +144,8 @@ public class CleanerThread implements Runnable {
|
||||
|
||||
if (Emulator.isReady) {
|
||||
for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) {
|
||||
habbo.getHabboStats().petRespectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect");
|
||||
habbo.getHabboStats().respectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect.pets");
|
||||
habbo.getHabboStats().respectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect");
|
||||
habbo.getHabboStats().petRespectPointsToGive = Emulator.getConfig().getInt("hotel.daily.respect.pets");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -194,11 +194,11 @@ public class Bot implements Runnable {
|
||||
}
|
||||
|
||||
String message = this.chatLines.get(this.lastChatIndex)
|
||||
.replace("%owner%", this.room.getOwnerName())
|
||||
.replace("%item_count%", this.room.itemCount() + "")
|
||||
.replace("%name%", this.name)
|
||||
.replace("%roomname%", this.room.getName())
|
||||
.replace("%user_count%", this.room.getUserCount() + "");
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.owner", "%owner%"), this.room.getOwnerName())
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.item_count", "%item_count%"), this.room.itemCount() + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.name", "%name%"), this.name)
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.roomname", "%roomname%"), this.room.getName())
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.user_count", "%user_count%"), this.room.getUserCount() + "");
|
||||
|
||||
if(!WiredHandler.handle(WiredTriggerType.SAY_SOMETHING, this.getRoomUnit(), room, new Object[]{ message })) {
|
||||
this.talk(message);
|
||||
|
@ -45,7 +45,7 @@ public class UserInfoCommand extends Command {
|
||||
Emulator.getTexts().getValue("command.cmd_userinfo.online") + ": " + (onlineHabbo == null ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" +
|
||||
((habbo.getRank().hasPermission(Permission.ACC_HIDE_MAIL, true)) ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.email") + ": " + habbo.getMail() + "\r") +
|
||||
((habbo.getRank().hasPermission(Permission.ACC_HIDE_IP, true)) ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_register") + ": " + habbo.getIpRegister() + "\r") +
|
||||
((habbo.getRank().hasPermission(Permission.ACC_HIDE_IP, true)) || onlineHabbo == null ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_current") + ": " + onlineHabbo.getClient().getChannel().remoteAddress().toString() + "\r") +
|
||||
((habbo.getRank().hasPermission(Permission.ACC_HIDE_IP, true)) || onlineHabbo == null ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_current") + ": " + onlineHabbo.getHabboInfo().getIpLogin() + "\r") +
|
||||
(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.achievement_score") + ": " + onlineHabbo.getHabboStats().achievementScore + "\r" : ""));
|
||||
|
||||
ModToolBan ban = Emulator.getGameEnvironment().getModToolManager().checkForBan(habbo.getId());
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -18,7 +19,7 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WiredConditionMatchStatePosition extends InteractionWiredCondition {
|
||||
public class WiredConditionMatchStatePosition extends InteractionWiredCondition implements InteractionWiredMatchFurniSettings {
|
||||
public static final WiredConditionType type = WiredConditionType.MATCH_SSHOT;
|
||||
|
||||
private THashSet<WiredMatchFurniSetting> settings;
|
||||
@ -205,6 +206,26 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public THashSet<WiredMatchFurniSetting> getMatchFurniSettings() {
|
||||
return this.settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldMatchState() {
|
||||
return this.state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldMatchRotation() {
|
||||
return this.direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldMatchPosition() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
boolean state;
|
||||
boolean position;
|
||||
|
@ -1,212 +1,32 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.habbohotel.wired.WiredMatchFurniSetting;
|
||||
import com.eu.habbo.messages.ClientMessage;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WiredConditionNotMatchStatePosition extends InteractionWiredCondition {
|
||||
public class WiredConditionNotMatchStatePosition extends WiredConditionMatchStatePosition {
|
||||
public static final WiredConditionType type = WiredConditionType.NOT_MATCH_SSHOT;
|
||||
|
||||
private THashSet<WiredMatchFurniSetting> settings;
|
||||
|
||||
private boolean state;
|
||||
private boolean position;
|
||||
private boolean rotation;
|
||||
|
||||
public WiredConditionNotMatchStatePosition(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
this.settings = new THashSet<>();
|
||||
}
|
||||
|
||||
public WiredConditionNotMatchStatePosition(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||
this.settings = new THashSet<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||
if (this.settings.isEmpty())
|
||||
return true;
|
||||
|
||||
THashSet<WiredMatchFurniSetting> s = new THashSet<>();
|
||||
|
||||
for (WiredMatchFurniSetting setting : this.settings) {
|
||||
HabboItem item = room.getHabboItem(setting.item_id);
|
||||
|
||||
if (item != null) {
|
||||
boolean stateMatches = !this.state || item.getExtradata().equals(setting.state);
|
||||
boolean positionMatches = !this.position || (setting.x == item.getX() && setting.y == item.getY());
|
||||
boolean directionMatches = !this.rotation || setting.rotation == item.getRotation();
|
||||
|
||||
if (!stateMatches || !positionMatches || !directionMatches)
|
||||
return true;
|
||||
} else {
|
||||
s.add(setting);
|
||||
}
|
||||
}
|
||||
|
||||
if (!s.isEmpty()) {
|
||||
for (WiredMatchFurniSetting setting : s) {
|
||||
this.settings.remove(setting);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWiredData() {
|
||||
return WiredHandler.getGsonBuilder().create().toJson(new WiredConditionMatchStatePosition.JsonData(
|
||||
this.state,
|
||||
this.position,
|
||||
this.rotation,
|
||||
new ArrayList<>(this.settings)
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||
String wiredData = set.getString("wired_data");
|
||||
|
||||
if (wiredData.startsWith("{")) {
|
||||
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
||||
this.state = data.state;
|
||||
this.position = data.position;
|
||||
this.rotation = data.direction;
|
||||
this.settings.addAll(data.settings);
|
||||
} else {
|
||||
String[] data = wiredData.split(":");
|
||||
|
||||
int itemCount = Integer.parseInt(data[0]);
|
||||
|
||||
String[] items = data[1].split(";");
|
||||
|
||||
for (int i = 0; i < itemCount; i++) {
|
||||
String[] stuff = items[i].split("-");
|
||||
|
||||
if (stuff.length >= 5)
|
||||
this.settings.add(new WiredMatchFurniSetting(Integer.parseInt(stuff[0]), stuff[1], Integer.parseInt(stuff[2]), Integer.parseInt(stuff[3]), Integer.parseInt(stuff[4])));
|
||||
}
|
||||
|
||||
this.state = data[2].equals("1");
|
||||
this.rotation = data[3].equals("1");
|
||||
this.position = data[4].equals("1");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickUp() {
|
||||
this.settings.clear();
|
||||
this.state = false;
|
||||
this.rotation = false;
|
||||
this.position = false;
|
||||
return !super.execute(roomUnit, room, stuff);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WiredConditionType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeWiredData(ServerMessage message, Room room) {
|
||||
this.refresh();
|
||||
|
||||
message.appendBoolean(false);
|
||||
message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION);
|
||||
message.appendInt(this.settings.size());
|
||||
|
||||
for (WiredMatchFurniSetting item : this.settings)
|
||||
message.appendInt(item.item_id);
|
||||
|
||||
message.appendInt(this.getBaseItem().getSpriteId());
|
||||
message.appendInt(this.getId());
|
||||
message.appendString("");
|
||||
message.appendInt(4);
|
||||
message.appendInt(this.state ? 1 : 0);
|
||||
message.appendInt(this.rotation ? 1 : 0);
|
||||
message.appendInt(this.position ? 1 : 0);
|
||||
message.appendInt(10);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.getType().code);
|
||||
message.appendInt(0);
|
||||
message.appendInt(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(ClientMessage packet) {
|
||||
packet.readInt();
|
||||
|
||||
this.state = packet.readInt() == 1;
|
||||
this.rotation = packet.readInt() == 1;
|
||||
this.position = packet.readInt() == 1;
|
||||
|
||||
packet.readString();
|
||||
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
|
||||
|
||||
if (room == null)
|
||||
return true;
|
||||
|
||||
int count = packet.readInt();
|
||||
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
|
||||
|
||||
this.settings.clear();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
int itemId = packet.readInt();
|
||||
HabboItem item = room.getHabboItem(itemId);
|
||||
|
||||
if (item != null)
|
||||
this.settings.add(new WiredMatchFurniSetting(item.getId(), item.getExtradata(), item.getRotation(), item.getX(), item.getY()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void refresh() {
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
|
||||
|
||||
if (room != null) {
|
||||
THashSet<WiredMatchFurniSetting> remove = new THashSet<>();
|
||||
|
||||
for (WiredMatchFurniSetting setting : this.settings) {
|
||||
HabboItem item = room.getHabboItem(setting.item_id);
|
||||
if (item == null) {
|
||||
remove.add(setting);
|
||||
}
|
||||
}
|
||||
|
||||
for (WiredMatchFurniSetting setting : remove) {
|
||||
this.settings.remove(setting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
boolean state;
|
||||
boolean position;
|
||||
boolean direction;
|
||||
List<WiredMatchFurniSetting> settings;
|
||||
|
||||
public JsonData(boolean state, boolean position, boolean direction, List<WiredMatchFurniSetting> settings) {
|
||||
this.state = state;
|
||||
this.position = position;
|
||||
this.direction = direction;
|
||||
this.settings = settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,10 +97,15 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
|
||||
Habbo habbo = room.getHabbo(roomUnit);
|
||||
|
||||
if (habbo != null) {
|
||||
message = message.replace(Emulator.getTexts().getValue("wired.variable.username"), habbo.getHabboInfo().getUsername())
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.credits"), habbo.getHabboInfo().getCredits() + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.pixels"), habbo.getHabboInfo().getPixels() + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.points"), habbo.getHabboInfo().getCurrencyAmount(Emulator.getConfig().getInt("seasonal.primary.type")) + "");
|
||||
message = message.replace(Emulator.getTexts().getValue("wired.variable.username", "%username%"), habbo.getHabboInfo().getUsername())
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.credits", "%credits%"), habbo.getHabboInfo().getCredits() + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.pixels", "%pixels%"), habbo.getHabboInfo().getPixels() + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.points", "%points%"), habbo.getHabboInfo().getCurrencyAmount(Emulator.getConfig().getInt("seasonal.primary.type")) + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.owner", "%owner%"), room.getOwnerName())
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.item_count", "%item_count%"), room.itemCount() + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.name", "%name%"), this.botName)
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.roomname", "%roomname%"), room.getName())
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.user_count", "%user_count%"), room.getUserCount() + "");
|
||||
}
|
||||
|
||||
List<Bot> bots = room.getBots(this.botName);
|
||||
|
@ -116,10 +116,15 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
|
||||
|
||||
if (habbo != null) {
|
||||
String m = this.message;
|
||||
m = m.replace(Emulator.getTexts().getValue("wired.variable.username"), habbo.getHabboInfo().getUsername())
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.credits"), habbo.getHabboInfo().getCredits() + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.pixels"), habbo.getHabboInfo().getPixels() + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.points"), habbo.getHabboInfo().getCurrencyAmount(Emulator.getConfig().getInt("seasonal.primary.type")) + "");
|
||||
m = m.replace(Emulator.getTexts().getValue("wired.variable.username", "%username%"), habbo.getHabboInfo().getUsername())
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.credits", "%credits%"), habbo.getHabboInfo().getCredits() + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.pixels", "%pixels%"), habbo.getHabboInfo().getPixels() + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.points", "%points%"), habbo.getHabboInfo().getCurrencyAmount(Emulator.getConfig().getInt("seasonal.primary.type")) + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.owner", "%owner%"), room.getOwnerName())
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.item_count", "%item_count%"), room.itemCount() + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.name", "%name%"), this.botName)
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.roomname", "%roomname%"), room.getName())
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.user_count", "%user_count%"), room.getUserCount() + "");
|
||||
|
||||
List<Bot> bots = room.getBots(this.botName);
|
||||
|
||||
|
@ -2,9 +2,9 @@ package com.eu.habbo.habbohotel.items.interactions.wired.effects;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.*;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
@ -24,7 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class WiredEffectMatchFurni extends InteractionWiredEffect {
|
||||
public class WiredEffectMatchFurni extends InteractionWiredEffect implements InteractionWiredMatchFurniSettings {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectMatchFurni.class);
|
||||
|
||||
private static final WiredEffectType type = WiredEffectType.MATCH_SSHOT;
|
||||
@ -241,6 +241,26 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public THashSet<WiredMatchFurniSetting> getMatchFurniSettings() {
|
||||
return this.settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldMatchState() {
|
||||
return this.state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldMatchRotation() {
|
||||
return this.direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldMatchPosition() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
boolean state;
|
||||
boolean direction;
|
||||
|
@ -0,0 +1,11 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions.wired.interfaces;
|
||||
|
||||
import com.eu.habbo.habbohotel.wired.WiredMatchFurniSetting;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
|
||||
public interface InteractionWiredMatchFurniSettings {
|
||||
public THashSet<WiredMatchFurniSetting> getMatchFurniSettings();
|
||||
public boolean shouldMatchState();
|
||||
public boolean shouldMatchRotation();
|
||||
public boolean shouldMatchPosition();
|
||||
}
|
@ -505,6 +505,7 @@ public class ModToolManager {
|
||||
return ban;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean hasIPBan(Channel habbo) {
|
||||
if (habbo == null)
|
||||
return false;
|
||||
@ -512,9 +513,13 @@ public class ModToolManager {
|
||||
if (habbo.remoteAddress() == null || ((InetSocketAddress) habbo.remoteAddress()).getAddress() == null)
|
||||
return false;
|
||||
|
||||
return this.hasIPBan(((InetSocketAddress) habbo.remoteAddress()).getAddress().getHostAddress());
|
||||
}
|
||||
|
||||
public boolean hasIPBan(String ipAddress) {
|
||||
boolean banned = false;
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM bans WHERE ip = ? AND (type = 'ip' OR type = 'super') AND ban_expire > ? LIMIT 1")) {
|
||||
statement.setString(1, ((InetSocketAddress) habbo.remoteAddress()).getAddress().getHostAddress());
|
||||
statement.setString(1, ipAddress);
|
||||
statement.setInt(2, Emulator.getIntUnixTimestamp());
|
||||
|
||||
try (ResultSet set = statement.executeQuery()) {
|
||||
@ -525,7 +530,6 @@ public class ModToolManager {
|
||||
} catch (SQLException e) {
|
||||
LOGGER.error("Caught SQL exception", e);
|
||||
}
|
||||
|
||||
return banned;
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,10 @@ import com.eu.habbo.messages.outgoing.rooms.FloodCounterComposer;
|
||||
import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer;
|
||||
import com.eu.habbo.messages.outgoing.rooms.users.*;
|
||||
import com.eu.habbo.messages.outgoing.users.*;
|
||||
import com.eu.habbo.plugin.events.furniture.FurnitureBuildheightEvent;
|
||||
import com.eu.habbo.plugin.events.users.UserCreditsEvent;
|
||||
import com.eu.habbo.plugin.events.users.UserDisconnectEvent;
|
||||
import com.eu.habbo.plugin.events.users.UserGetIPAddressEvent;
|
||||
import com.eu.habbo.plugin.events.users.UserPointsEvent;
|
||||
import gnu.trove.TIntCollection;
|
||||
import gnu.trove.map.hash.THashMap;
|
||||
@ -114,11 +116,31 @@ public class Habbo implements Runnable {
|
||||
}
|
||||
|
||||
|
||||
public void connect() {
|
||||
public boolean connect() {
|
||||
String ip = "";
|
||||
|
||||
if (!Emulator.getConfig().getBoolean("networking.tcp.proxy") && this.client.getChannel().remoteAddress() != null) {
|
||||
SocketAddress address = this.client.getChannel().remoteAddress();
|
||||
ip = ((InetSocketAddress) address).getAddress().getHostAddress();
|
||||
}
|
||||
|
||||
if (address != null) this.habboInfo.setIpLogin(((InetSocketAddress) address).getAddress().getHostAddress());
|
||||
if (Emulator.getPluginManager().isRegistered(UserGetIPAddressEvent.class, true)) {
|
||||
UserGetIPAddressEvent event = Emulator.getPluginManager().fireEvent(new UserGetIPAddressEvent(this, ip));
|
||||
if (event.hasChangedIP()) {
|
||||
ip = event.getUpdatedIp();
|
||||
}
|
||||
}
|
||||
|
||||
if (!ip.isEmpty()) {
|
||||
this.habboInfo.setIpLogin(ip);
|
||||
}
|
||||
|
||||
if (Emulator.getGameEnvironment().getModToolManager().hasMACBan(this.client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Emulator.getGameEnvironment().getModToolManager().hasIPBan(this.habboInfo.getIpLogin())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.habboInfo.setMachineID(this.client.getMachineId());
|
||||
@ -128,6 +150,7 @@ public class Habbo implements Runnable {
|
||||
|
||||
Emulator.getGameEnvironment().getRoomManager().loadRoomsForHabbo(this);
|
||||
LOGGER.info("{} logged in from IP {}", this.habboInfo.getUsername(), this.habboInfo.getIpLogin());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -205,7 +205,7 @@ public class HabboManager {
|
||||
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM users WHERE ip_register = ? OR ip_current = ? AND id != ? ORDER BY id DESC LIMIT ?")) {
|
||||
statement.setString(1, habbo.getHabboInfo().getIpRegister());
|
||||
statement.setString(2, habbo.getClient().getChannel().remoteAddress().toString());
|
||||
statement.setString(2, habbo.getHabboInfo().getIpLogin());
|
||||
statement.setInt(3, habbo.getHabboInfo().getId());
|
||||
statement.setInt(4, limit);
|
||||
|
||||
|
@ -64,6 +64,7 @@ import com.eu.habbo.messages.incoming.trading.*;
|
||||
import com.eu.habbo.messages.incoming.unknown.RequestResolutionEvent;
|
||||
import com.eu.habbo.messages.incoming.unknown.UnknownEvent1;
|
||||
import com.eu.habbo.messages.incoming.users.*;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredApplySetConditionsEvent;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredConditionSaveDataEvent;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredEffectSaveDataEvent;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredTriggerSaveDataEvent;
|
||||
@ -579,6 +580,7 @@ public class PacketManager {
|
||||
this.registerHandler(Incoming.WiredTriggerSaveDataEvent, WiredTriggerSaveDataEvent.class);
|
||||
this.registerHandler(Incoming.WiredEffectSaveDataEvent, WiredEffectSaveDataEvent.class);
|
||||
this.registerHandler(Incoming.WiredConditionSaveDataEvent, WiredConditionSaveDataEvent.class);
|
||||
this.registerHandler(Incoming.WiredApplySetConditionsEvent, WiredApplySetConditionsEvent.class);
|
||||
}
|
||||
|
||||
void registerUnknown() throws Exception {
|
||||
|
@ -155,6 +155,7 @@ public class Incoming {
|
||||
public static final int RequestInventoryItemsEvent = 3150;
|
||||
public static final int ModToolRoomAlertEvent = 3842;
|
||||
public static final int WiredEffectSaveDataEvent = 2281;
|
||||
public static final int WiredApplySetConditionsEvent = 3373;
|
||||
public static final int CheckPetNameEvent = 2109;
|
||||
public static final int SecureLoginEvent = 2419;
|
||||
public static final int BotSaveSettingsEvent = 2624;
|
||||
|
@ -77,19 +77,13 @@ public class SecureLoginEvent extends MessageHandler {
|
||||
if (this.client.getHabbo() == null) {
|
||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().loadHabbo(sso);
|
||||
if (habbo != null) {
|
||||
if (Emulator.getGameEnvironment().getModToolManager().hasMACBan(this.client)) {
|
||||
Emulator.getGameServer().getGameClientManager().disposeClient(this.client);
|
||||
return;
|
||||
}
|
||||
if (Emulator.getGameEnvironment().getModToolManager().hasIPBan(this.client.getChannel())) {
|
||||
Emulator.getGameServer().getGameClientManager().disposeClient(this.client);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
habbo.setClient(this.client);
|
||||
this.client.setHabbo(habbo);
|
||||
this.client.getHabbo().connect();
|
||||
if(!this.client.getHabbo().connect()) {
|
||||
Emulator.getGameServer().getGameClientManager().disposeClient(this.client);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.client.getHabbo().getHabboInfo() == null) {
|
||||
Emulator.getGameServer().getGameClientManager().disposeClient(this.client);
|
||||
@ -191,7 +185,7 @@ public class SecureLoginEvent extends MessageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
Emulator.getPluginManager().fireEvent(new UserLoginEvent(habbo, this.client.getChannel().localAddress()));
|
||||
Emulator.getPluginManager().fireEvent(new UserLoginEvent(habbo, this.client.getHabbo().getHabboInfo().getIpLogin()));
|
||||
|
||||
if (Emulator.getConfig().getBoolean("hotel.welcome.alert.enabled")) {
|
||||
final Habbo finalHabbo = habbo;
|
||||
|
@ -1,89 +0,0 @@
|
||||
package com.eu.habbo.messages.incoming.handshake;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.friends.FriendsComposer;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
|
||||
import com.eu.habbo.messages.outgoing.habboway.nux.NewUserIdentityComposer;
|
||||
import com.eu.habbo.messages.outgoing.handshake.DebugConsoleComposer;
|
||||
import com.eu.habbo.messages.outgoing.handshake.SecureLoginOKComposer;
|
||||
import com.eu.habbo.messages.outgoing.handshake.SessionRightsComposer;
|
||||
import com.eu.habbo.messages.outgoing.modtool.ModToolComposer;
|
||||
import com.eu.habbo.messages.outgoing.navigator.*;
|
||||
import com.eu.habbo.messages.outgoing.users.*;
|
||||
import com.eu.habbo.plugin.events.users.UserLoginEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SecureLoginEvent_BACKUP extends MessageHandler {
|
||||
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
|
||||
if (!Emulator.isReady)
|
||||
return;
|
||||
|
||||
String sso = this.packet.readString();
|
||||
|
||||
if (this.client.getHabbo() == null) {
|
||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().loadHabbo(sso);
|
||||
if (habbo != null) {
|
||||
habbo.setClient(this.client);
|
||||
this.client.setHabbo(habbo);
|
||||
this.client.getHabbo().connect();
|
||||
//this.client.sendResponse(new DebugConsoleComposer());
|
||||
Emulator.getThreading().run(habbo);
|
||||
Emulator.getGameEnvironment().getHabboManager().addHabbo(habbo);
|
||||
|
||||
ArrayList<ServerMessage> messages = new ArrayList<>();
|
||||
|
||||
|
||||
messages.add(new SecureLoginOKComposer().compose());
|
||||
messages.add(new UserHomeRoomComposer(this.client.getHabbo().getHabboInfo().getHomeRoom(), 0).compose());
|
||||
messages.add(new UserPermissionsComposer(this.client.getHabbo()).compose());
|
||||
messages.add(new UserClubComposer(this.client.getHabbo()).compose());
|
||||
messages.add(new DebugConsoleComposer(Emulator.debugging).compose());
|
||||
messages.add(new UserAchievementScoreComposer(this.client.getHabbo()).compose());
|
||||
messages.add(new NewUserIdentityComposer(habbo).compose());
|
||||
messages.add(new UserPerksComposer(habbo).compose());
|
||||
messages.add(new SessionRightsComposer().compose());
|
||||
messages.add(new FavoriteRoomsCountComposer(habbo).compose());
|
||||
//messages.add(new FriendsComposer(this.client.getHabbo()).compose());
|
||||
//messages.add(new NewUserIdentityComposer().compose());
|
||||
//messages.add(new UserDataComposer(this.client.getHabbo()).compose());
|
||||
//messages.add(new SessionRightsComposer().compose());
|
||||
//messages.add(new MinimailCountComposer().compose());
|
||||
//messages.add(new MessengerInitComposer(this.client.getHabbo()).compose());
|
||||
//messages.add(new FriendsComposer(this.client.getHabbo()).compose());
|
||||
|
||||
if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) {
|
||||
messages.add(new ModToolComposer(this.client.getHabbo()).compose());
|
||||
}
|
||||
|
||||
this.client.sendResponses(messages);
|
||||
|
||||
//Hardcoded
|
||||
this.client.sendResponse(new NewNavigatorMetaDataComposer());
|
||||
this.client.sendResponse(new NewNavigatorLiftedRoomsComposer());
|
||||
this.client.sendResponse(new NewNavigatorCollapsedCategoriesComposer());
|
||||
this.client.sendResponse(new NewNavigatorSavedSearchesComposer(this.client.getHabbo().getHabboInfo().getSavedSearches()));
|
||||
this.client.sendResponse(new NewNavigatorEventCategoriesComposer());
|
||||
//this.client.sendResponse(new HotelViewComposer());
|
||||
//this.client.sendResponse(new UserHomeRoomComposer(this.client.getHabbo().getHabboInfo().getHomeRoom(), this.client.getHabbo().getHabboInfo().getHomeRoom()));
|
||||
//this.client.sendResponse(new UserEffectsListComposer());
|
||||
|
||||
|
||||
Emulator.getPluginManager().fireEvent(new UserLoginEvent(habbo, this.client.getChannel().localAddress()));
|
||||
|
||||
} else {
|
||||
this.client.sendResponse(new GenericAlertComposer("Can't connect *sadpanda*"));
|
||||
|
||||
this.client.getChannel().close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package com.eu.habbo.messages.incoming.wired;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.FurnitureMovementError;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTileState;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class WiredApplySetConditionsEvent extends MessageHandler {
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int itemId = this.packet.readInt();
|
||||
|
||||
// Executing Habbo has to be in a Room
|
||||
if (!this.client.getHabbo().getRoomUnit().isInRoom()) {
|
||||
this.client.sendResponse(new BubbleAlertComposer(
|
||||
BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key,
|
||||
FurnitureMovementError.NO_RIGHTS.errorCode
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
||||
|
||||
if (room != null) {
|
||||
|
||||
// Executing Habbo should be able to edit wireds
|
||||
if (room.hasRights(this.client.getHabbo()) || room.isOwner(this.client.getHabbo())) {
|
||||
|
||||
List<HabboItem> wireds = new ArrayList<>();
|
||||
wireds.addAll(room.getRoomSpecialTypes().getConditions());
|
||||
wireds.addAll(room.getRoomSpecialTypes().getEffects());
|
||||
|
||||
// Find the item with the given ID in the room
|
||||
Optional<HabboItem> item = wireds.stream()
|
||||
.filter(wired -> wired.getId() == itemId)
|
||||
.findFirst();
|
||||
|
||||
// If the item exists
|
||||
if (item.isPresent()) {
|
||||
HabboItem wiredItem = item.get();
|
||||
|
||||
// The item should have settings to match furni state, position and rotation
|
||||
if (wiredItem instanceof InteractionWiredMatchFurniSettings) {
|
||||
|
||||
InteractionWiredMatchFurniSettings wired = (InteractionWiredMatchFurniSettings) wiredItem;
|
||||
|
||||
// Try to apply the set settings to each item
|
||||
wired.getMatchFurniSettings().forEach(setting -> {
|
||||
HabboItem matchItem = room.getHabboItem(setting.item_id);
|
||||
|
||||
// Match state
|
||||
if (wired.shouldMatchState() && matchItem.allowWiredResetState()) {
|
||||
if (!setting.state.equals(" ") && !matchItem.getExtradata().equals(setting.state)) {
|
||||
matchItem.setExtradata(setting.state);
|
||||
room.updateItemState(matchItem);
|
||||
}
|
||||
}
|
||||
|
||||
RoomTile oldLocation = room.getLayout().getTile(matchItem.getX(), matchItem.getY());
|
||||
double oldZ = matchItem.getZ();
|
||||
|
||||
// Match Position & Rotation
|
||||
if(wired.shouldMatchRotation() && !wired.shouldMatchPosition()) {
|
||||
if(matchItem.getRotation() != setting.rotation && room.furnitureFitsAt(oldLocation, matchItem, setting.rotation, false) == FurnitureMovementError.NONE) {
|
||||
room.moveFurniTo(matchItem, oldLocation, setting.rotation, null, true);
|
||||
}
|
||||
}
|
||||
else if(wired.shouldMatchPosition()) {
|
||||
boolean slideAnimation = !wired.shouldMatchRotation() || matchItem.getRotation() == setting.rotation;
|
||||
RoomTile newLocation = room.getLayout().getTile((short) setting.x, (short) setting.y);
|
||||
int newRotation = wired.shouldMatchRotation() ? setting.rotation : matchItem.getRotation();
|
||||
|
||||
if(newLocation != null && newLocation.state != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != matchItem.getRotation()) && room.furnitureFitsAt(newLocation, matchItem, newRotation, true) == FurnitureMovementError.NONE) {
|
||||
if(room.moveFurniTo(matchItem, newLocation, newRotation, null, !slideAnimation) == FurnitureMovementError.NONE) {
|
||||
if(slideAnimation) {
|
||||
room.sendComposer(new FloorItemOnRollerComposer(matchItem, null, oldLocation, oldZ, newLocation, matchItem.getZ(), 0, room).compose());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.eu.habbo.plugin.events.users;
|
||||
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
|
||||
public class UserGetIPAddressEvent extends UserEvent{
|
||||
public final String oldIp;
|
||||
|
||||
private String updatedIp;
|
||||
private boolean changedIP = false;
|
||||
|
||||
public UserGetIPAddressEvent(Habbo habbo, String ip) {
|
||||
super(habbo);
|
||||
this.oldIp = ip;
|
||||
}
|
||||
|
||||
public void setUpdatedIp(String updatedIp) {
|
||||
this.updatedIp = updatedIp;
|
||||
this.changedIP = true;
|
||||
}
|
||||
|
||||
public boolean hasChangedIP() {
|
||||
return changedIP;
|
||||
}
|
||||
|
||||
public String getUpdatedIp() {
|
||||
return updatedIp;
|
||||
}
|
||||
}
|
@ -6,10 +6,9 @@ import java.net.SocketAddress;
|
||||
|
||||
public class UserLoginEvent extends UserEvent {
|
||||
|
||||
public final SocketAddress ip;
|
||||
public final String ip;
|
||||
|
||||
|
||||
public UserLoginEvent(Habbo habbo, SocketAddress ip) {
|
||||
public UserLoginEvent(Habbo habbo, String ip) {
|
||||
super(habbo);
|
||||
|
||||
this.ip = ip;
|
||||
|
Loading…
Reference in New Issue
Block a user