mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-26 08:20:51 +01:00
3.5.4 commit for some bug fixes
This commit is contained in:
parent
2e576809e0
commit
dfb97f37e9
@ -16,7 +16,7 @@ Arcturus Morningstar is as a fork of Arcturus Emulator by TheGeneral. Arcturus M
|
||||
[![image](https://img.shields.io/discord/557240155040251905?style=for-the-badge&logo=discord&color=7289DA&label=KREWS&logoColor=fff)](https://discord.gg/BzfFsTp)
|
||||
|
||||
## Download ##
|
||||
[![image](https://img.shields.io/badge/STABLE%20RELEASES-3.5.3-success.svg?style=for-the-badge&logo=appveyor)](https://git.krews.org/morningstar/Arcturus-Community/-/releases)
|
||||
[![image](https://img.shields.io/badge/STABLE%20RELEASES-3.5.4-success.svg?style=for-the-badge&logo=appveyor)](https://git.krews.org/morningstar/Arcturus-Community/-/releases)
|
||||
|
||||
[![image](https://img.shields.io/badge/DEVELOPER%20BUILDS-4.0-red.svg?style=for-the-badge&logo=appveyor)](https://git.krews.org/morningstar/Arcturus-Community/-/jobs) *
|
||||
|
||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.eu.habbo</groupId>
|
||||
<artifactId>Habbo</artifactId>
|
||||
<version>3.5.3</version>
|
||||
<version>3.5.4</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -37,7 +37,7 @@ public final class Emulator {
|
||||
|
||||
public final static int MAJOR = 3;
|
||||
public final static int MINOR = 5;
|
||||
public final static int BUILD = 3;
|
||||
public final static int BUILD = 4;
|
||||
public final static String PREVIEW = "";
|
||||
|
||||
public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + " " + PREVIEW;
|
||||
@ -49,7 +49,7 @@ public final class Emulator {
|
||||
"██║╚██╔╝██║██║ ██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║╚════██║ ██║ ██╔══██║██╔══██╗\n" +
|
||||
"██║ ╚═╝ ██║╚██████╔╝██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝███████║ ██║ ██║ ██║██║ ██║\n" +
|
||||
"╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝\n" +
|
||||
"Still Rocking in 2023.\n";
|
||||
"Still Rocking in 2024.\n";
|
||||
|
||||
public static String build = "";
|
||||
public static boolean isReady = false;
|
||||
|
@ -902,7 +902,9 @@ public class CatalogManager {
|
||||
boolean badgeFound = false;
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
if(item.isLimited()) {
|
||||
habbo.getHabboStats().addLtdLog(item.getId(), Emulator.getIntUnixTimestamp());
|
||||
}
|
||||
|
||||
for (Item baseItem : item.getBaseItems()) {
|
||||
for (int k = 0; k < item.getItemAmount(baseItem.getId()); k++) {
|
||||
|
@ -62,7 +62,7 @@ public class CommandHandler {
|
||||
|
||||
|
||||
public static boolean handleCommand(GameClient gameClient, String commandLine) {
|
||||
if (gameClient != null) {
|
||||
if (gameClient != null && commandLine != null) {
|
||||
if (commandLine.startsWith(":")) {
|
||||
commandLine = commandLine.replaceFirst(":", "");
|
||||
|
||||
|
@ -16,11 +16,12 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public abstract class InteractionWired extends InteractionDefault {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionWired.class);
|
||||
private long cooldown;
|
||||
private TLongLongHashMap userExecutionCache = new TLongLongHashMap(3);
|
||||
private final HashMap<Long,Long> userExecutionCache = new HashMap<>();
|
||||
|
||||
InteractionWired(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
@ -76,8 +77,10 @@ public abstract class InteractionWired extends InteractionDefault {
|
||||
}
|
||||
|
||||
public void activateBox(Room room, RoomUnit roomUnit, long millis) {
|
||||
if(!room.isHideWired()) {
|
||||
this.setExtradata(this.getExtradata().equals("1") ? "0" : "1");
|
||||
room.sendComposer(new ItemStateComposer(this).compose());
|
||||
}
|
||||
if (roomUnit != null) {
|
||||
this.addUserExecutionCache(roomUnit.getId(), millis);
|
||||
}
|
||||
@ -112,7 +115,7 @@ public abstract class InteractionWired extends InteractionDefault {
|
||||
} else {
|
||||
if (this.userExecutionCache.containsKey((long)roomUnitId)) {
|
||||
long lastTimestamp = this.userExecutionCache.get((long)roomUnitId);
|
||||
if (timestamp - lastTimestamp < 100L) {
|
||||
if (timestamp - lastTimestamp < Math.max(100L, this.requiredCooldown())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -125,10 +125,16 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICy
|
||||
@Override
|
||||
public void cycle(Room room) {
|
||||
this.counter += 500;
|
||||
if (this.counter >= this.repeatTime) {
|
||||
long currentMillis = System.currentTimeMillis();
|
||||
String Key = Double.toString(this.getX()) + Double.toString(this.getY());
|
||||
|
||||
room.repeatersLastTick.putIfAbsent(Key, currentMillis);
|
||||
|
||||
if (this.counter >= this.repeatTime && room.repeatersLastTick.get(Key) < currentMillis - 450) {
|
||||
this.counter = 0;
|
||||
if (this.getRoomId() != 0) {
|
||||
if (room.isLoaded()) {
|
||||
room.repeatersLastTick.put(Key, currentMillis);
|
||||
WiredHandler.handle(this, null, room, new Object[]{this});
|
||||
}
|
||||
}
|
||||
|
@ -119,10 +119,16 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements
|
||||
@Override
|
||||
public void cycle(Room room) {
|
||||
this.counter += 500;
|
||||
if (this.counter >= this.repeatTime) {
|
||||
long currentMillis = System.currentTimeMillis();
|
||||
String Key = Double.toString(this.getX()) + Double.toString(this.getY());
|
||||
|
||||
room.repeatersLastTick.putIfAbsent(Key, currentMillis);
|
||||
|
||||
if (this.counter >= this.repeatTime && room.repeatersLastTick.get(Key) < currentMillis - 4950) {
|
||||
this.counter = 0;
|
||||
if (this.getRoomId() != 0) {
|
||||
if (room.isLoaded()) {
|
||||
room.repeatersLastTick.put(Key, currentMillis);
|
||||
WiredHandler.handle(this, null, room, new Object[]{this});
|
||||
}
|
||||
}
|
||||
|
@ -194,6 +194,10 @@ public class WordFilter {
|
||||
}
|
||||
}
|
||||
|
||||
public THashSet<WordFilterWord> getWords() {
|
||||
return new THashSet<>(this.words);
|
||||
}
|
||||
|
||||
public void addWord(WordFilterWord word) {
|
||||
this.words.add(word);
|
||||
}
|
||||
|
@ -213,6 +213,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
private TraxManager traxManager;
|
||||
private boolean cycleOdd;
|
||||
private long cycleTimestamp;
|
||||
public Map<String, Long> repeatersLastTick = new HashMap<>();
|
||||
|
||||
public Room(ResultSet set) throws SQLException {
|
||||
this.id = set.getInt("id");
|
||||
|
@ -294,6 +294,10 @@ public class RoomManager {
|
||||
public Room loadRoom(int id, boolean loadData) {
|
||||
Room room = null;
|
||||
|
||||
if(id == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (this.activeRooms.containsKey(id)) {
|
||||
room = this.activeRooms.get(id);
|
||||
|
||||
@ -414,7 +418,7 @@ public class RoomManager {
|
||||
|
||||
public RoomLayout loadLayout(String name, Room room) {
|
||||
RoomLayout layout = null;
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_models WHERE name LIKE ? LIMIT 1")) {
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_models WHERE name = ? LIMIT 1")) {
|
||||
statement.setString(1, name);
|
||||
try (ResultSet set = statement.executeQuery()) {
|
||||
if (set.next()) {
|
||||
|
@ -448,17 +448,22 @@ public class Habbo implements Runnable {
|
||||
}
|
||||
|
||||
public void clearCaches() {
|
||||
int timestamp = Emulator.getIntUnixTimestamp();
|
||||
int currentTimestamp = Emulator.getIntUnixTimestamp();
|
||||
int twentyFourHoursInSeconds = 24 * 60 * 60; // 24 hours in seconds
|
||||
|
||||
THashMap<Integer, List<Integer>> newLog = new THashMap<>();
|
||||
|
||||
for (Map.Entry<Integer, List<Integer>> ltdLog : this.habboStats.ltdPurchaseLog.entrySet()) {
|
||||
List<Integer> filteredTimestamps = new ArrayList<>();
|
||||
|
||||
for (Integer time : ltdLog.getValue()) {
|
||||
if (time > timestamp) {
|
||||
if (!newLog.containsKey(ltdLog.getKey())) {
|
||||
newLog.put(ltdLog.getKey(), new ArrayList<>());
|
||||
if (currentTimestamp - time <= twentyFourHoursInSeconds) {
|
||||
filteredTimestamps.add(time);
|
||||
}
|
||||
}
|
||||
|
||||
newLog.get(ltdLog.getKey()).add(time);
|
||||
}
|
||||
if (!filteredTimestamps.isEmpty()) {
|
||||
newLog.put(ltdLog.getKey(), filteredTimestamps);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class HabboStats implements Runnable {
|
||||
public THashSet<Subscription> subscriptions;
|
||||
|
||||
private HabboStats(ResultSet set, HabboInfo habboInfo) throws SQLException {
|
||||
this.cache = new THashMap<>(0);
|
||||
this.cache = new THashMap<>(1000);
|
||||
this.achievementProgress = new THashMap<>(0);
|
||||
this.achievementCache = new THashMap<>(0);
|
||||
this.recentPurchases = new THashMap<>(0);
|
||||
|
@ -234,7 +234,7 @@ public class WiredHandler {
|
||||
executed = true;
|
||||
if (!effect.requiresTriggeringUser() || (roomUnit != null && effect.requiresTriggeringUser())) {
|
||||
Emulator.getThreading().run(() -> {
|
||||
if (room.isLoaded()) {
|
||||
if (room.isLoaded() && room.getHabbos().size() > 0) {
|
||||
try {
|
||||
if (!effect.execute(roomUnit, room, stuff)) return;
|
||||
effect.setCooldown(millis);
|
||||
|
@ -154,6 +154,18 @@ public class WiredHighscoreManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public HashMap<Integer, List<WiredHighscoreDataEntry>> getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public List<WiredHighscoreDataEntry> getEntriesForItemId(int itemId) {
|
||||
return this.data.get(itemId);
|
||||
}
|
||||
|
||||
public void setEntriesForItemId(int itemId, List<WiredHighscoreDataEntry> entries) {
|
||||
this.data.put(itemId, entries);
|
||||
}
|
||||
|
||||
private long getTodayStartTimestamp() {
|
||||
return LocalDateTime.now().with(LocalTime.MIDNIGHT).atZone(zoneId).toEpochSecond();
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||
import com.eu.habbo.messages.outgoing.Outgoing;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class UpdateStackHeightComposer extends MessageComposer {
|
||||
private int x;
|
||||
private int y;
|
||||
@ -34,6 +36,7 @@ public class UpdateStackHeightComposer extends MessageComposer {
|
||||
//TODO: maybe do this another way? doesn't seem to be very clean but gets the job done
|
||||
this.response.init(Outgoing.UpdateStackHeightComposer);
|
||||
if (this.updateTiles != null) {
|
||||
this.updateTiles.removeIf(Objects::isNull);
|
||||
// prevent overflow. Byte max value is 127
|
||||
if(this.updateTiles.size() > 127) {
|
||||
RoomTile[] tiles = this.updateTiles.toArray(new RoomTile[updateTiles.size()]);
|
||||
|
Loading…
Reference in New Issue
Block a user