Use batch item update packet to sync banzai tile flickering (closes #339)

This commit is contained in:
Alejandro 2020-01-28 00:11:47 +02:00
parent ae9e6cfa62
commit 1e24df5b61
3 changed files with 12 additions and 6 deletions

View File

@ -118,13 +118,13 @@ public final class Emulator {
Emulator.texts = new TextsManager();
new CleanerThread();
Emulator.gameServer = new GameServer(getConfig().getValue("game.host", "127.0.0.1"), getConfig().getInt("game.port", 30000));
Emulator.rconServer = new RCONServer(getConfig().getValue("rcon.host", "127.0.0.1"), getConfig().getInt("rcon.port", 30001));
//Emulator.rconServer = new RCONServer(getConfig().getValue("rcon.host", "127.0.0.1"), getConfig().getInt("rcon.port", 30001));
Emulator.gameEnvironment = new GameEnvironment();
Emulator.gameEnvironment.load();
Emulator.gameServer.initializePipeline();
Emulator.gameServer.connect();
Emulator.rconServer.initializePipeline();
Emulator.rconServer.connect();
//Emulator.rconServer.initializePipeline();
//Emulator.rconServer.connect();
Emulator.badgeImager = new BadgeImager();
Emulator.getLogging().logStart("Arcturus Morningstar has succesfully loaded. You're running: " + Emulator.version);
Emulator.getLogging().logStart("System launched in: " + (System.nanoTime() - startTime) / 1e6 + "ms. Using: " + (Runtime.getRuntime().availableProcessors() * 2) + " threads!");

View File

@ -6,11 +6,12 @@ import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.Outgoing;
import java.util.List;
import java.util.Set;
public class ItemsDataUpdateComposer extends MessageComposer {
private final List<HabboItem> items;
private final Set<HabboItem> items;
public ItemsDataUpdateComposer(List<HabboItem> items) {
public ItemsDataUpdateComposer(Set<HabboItem> items) {
this.items = items;
}
@ -18,9 +19,12 @@ public class ItemsDataUpdateComposer extends MessageComposer {
public ServerMessage compose() {
this.response.init(Outgoing.ItemsDataUpdateComposer);
this.response.appendInt(this.items.size());
for (HabboItem item : this.items) {
this.response.appendInt(item.getId());
item.serializeExtradata(this.response);
}
return this.response;
}
}

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.games.GameTeamColors;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiSphere;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.outgoing.rooms.items.ItemsDataUpdateComposer;
import gnu.trove.set.hash.THashSet;
public class BattleBanzaiTilesFlicker implements Runnable {
@ -36,9 +37,10 @@ public class BattleBanzaiTilesFlicker implements Runnable {
for (HabboItem item : this.items) {
item.setExtradata(state + "");
this.room.updateItem(item);
}
this.room.sendComposer(new ItemsDataUpdateComposer(this.items).compose());
if (this.count == 5) {
for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) {
item.setExtradata("0");