mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-22 23:10:52 +01:00
Room.java clean-up
This commit is contained in:
parent
a46b38920e
commit
4c5b362b87
@ -2,8 +2,10 @@ package com.eu.habbo.habbohotel.bots;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.rooms.*;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUserAction;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomBot;
|
||||
import com.eu.habbo.habbohotel.units.Unit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -412,19 +414,6 @@ public class Bot extends Unit implements Runnable {
|
||||
this.canWalk = canWalk;
|
||||
}
|
||||
|
||||
public void lookAt(Habbo habbo) {
|
||||
this.lookAt(habbo.getRoomUnit().getCurrentPosition());
|
||||
}
|
||||
|
||||
public void lookAt(RoomUnit roomUnit) {
|
||||
this.lookAt(roomUnit.getCurrentPosition());
|
||||
}
|
||||
|
||||
public void lookAt(RoomTile tile) {
|
||||
this.getRoomUnit().lookAtPoint(tile);
|
||||
this.getRoomUnit().setStatusUpdateNeeded(true);
|
||||
}
|
||||
|
||||
public void onPlaceUpdate() {
|
||||
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);
|
||||
|
@ -86,7 +86,7 @@ public class ButlerBot extends Bot {
|
||||
final Bot bot = this;
|
||||
|
||||
// Step 1: Look at Habbo
|
||||
bot.lookAt(serveEvent.getHabbo());
|
||||
bot.getRoomUnit().lookAtPoint(serveEvent.getHabbo().getRoomUnit().getCurrentPosition());
|
||||
|
||||
// Step 2: Prepare tasks for when the Bot (carrying the handitem) reaches the Habbo
|
||||
final List<Runnable> tasks = new ArrayList<>();
|
||||
|
@ -3,8 +3,8 @@ package com.eu.habbo.habbohotel.catalog.marketplace;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.database.DatabaseConstants;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.catalog.marketplace.GetMarketplaceOffersEvent;
|
||||
import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceBuyOfferResultComposer;
|
||||
@ -281,7 +281,7 @@ public class MarketPlace {
|
||||
}
|
||||
event.price = calculateCommision(event.price);
|
||||
|
||||
item.setUserId(client.getHabbo().getHabboInfo().getId());
|
||||
item.setOwnerId(client.getHabbo().getHabboInfo().getId());
|
||||
item.needsUpdate(true);
|
||||
Emulator.getThreading().run(item);
|
||||
|
||||
@ -362,7 +362,7 @@ public class MarketPlace {
|
||||
MarketPlaceOffer offer = new MarketPlaceOffer(event.getItem(), event.getPrice(), client.getHabbo());
|
||||
client.getHabbo().getInventory().addMarketplaceOffer(offer);
|
||||
client.getHabbo().getInventory().getItemsComponent().removeHabboItem(event.getItem());
|
||||
item.setUserId(-1);
|
||||
item.setOwnerId(-1);
|
||||
item.needsUpdate(true);
|
||||
Emulator.getThreading().run(item);
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class RedeemCommand extends Command {
|
||||
TIntIntMap points = new TIntIntHashMap();
|
||||
|
||||
for (RoomItem item : gameClient.getHabbo().getInventory().getItemsComponent().getItemsAsValueCollection()) {
|
||||
if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_") || item.getBaseItem().getName().startsWith("DF_") || item.getBaseItem().getName().startsWith("PF_")) && item.getUserId() == gameClient.getHabbo().getHabboInfo().getId()) {
|
||||
if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_") || item.getBaseItem().getName().startsWith("DF_") || item.getBaseItem().getName().startsWith("PF_")) && item.getOwnerId() == gameClient.getHabbo().getHabboInfo().getId()) {
|
||||
items.add(item);
|
||||
if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_")) && !item.getBaseItem().getName().contains("_diamond_")) {
|
||||
try {
|
||||
|
@ -17,7 +17,7 @@ public class RoomSitCommand extends Command {
|
||||
} else if (habbo.getRoomUnit().hasStatus(RoomUnitStatus.SIT)) {
|
||||
return;
|
||||
}
|
||||
gameClient.getHabbo().getRoomUnit().getRoom().makeSit(habbo);
|
||||
gameClient.getHabbo().getRoomUnit().makeSit();
|
||||
});
|
||||
|
||||
return true;
|
||||
|
@ -11,7 +11,7 @@ public class SitCommand extends Command {
|
||||
@Override
|
||||
public boolean handle(GameClient gameClient, String[] params) {
|
||||
if (gameClient.getHabbo().getHabboInfo().getRiding() == null) //TODO Make this an event plugin which fires that can be cancelled
|
||||
gameClient.getHabbo().getRoomUnit().getRoom().makeSit(gameClient.getHabbo());
|
||||
gameClient.getHabbo().getRoomUnit().makeSit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public class StandCommand extends Command {
|
||||
@Override
|
||||
public boolean handle(GameClient gameClient, String[] params) {
|
||||
if (gameClient.getHabbo().getHabboInfo().getRiding() == null)
|
||||
gameClient.getHabbo().getRoomUnit().getRoom().makeStand(gameClient.getHabbo());
|
||||
gameClient.getHabbo().getRoomUnit().makeStand();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -24,10 +24,10 @@ public class InteractionBlackHole extends InteractionGate {
|
||||
Achievement holeCountAchievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHoleFurniCount");
|
||||
|
||||
int holesCountProgress = 0;
|
||||
Habbo owner = room.getRoomUnitManager().getRoomHabboById(this.getUserId());
|
||||
Habbo owner = room.getRoomUnitManager().getRoomHabboById(this.getOwnerId());
|
||||
|
||||
if (owner == null) {
|
||||
holesCountProgress = AchievementManager.getAchievementProgressForHabbo(this.getUserId(), holeCountAchievement);
|
||||
holesCountProgress = AchievementManager.getAchievementProgressForHabbo(this.getOwnerId(), holeCountAchievement);
|
||||
} else {
|
||||
holesCountProgress = owner.getHabboStats().getAchievementProgress(holeCountAchievement);
|
||||
}
|
||||
@ -37,7 +37,7 @@ public class InteractionBlackHole extends InteractionGate {
|
||||
if (owner != null) {
|
||||
AchievementManager.progressAchievement(owner, holeCountAchievement, holeDifference);
|
||||
} else {
|
||||
AchievementManager.progressAchievement(this.getUserId(), holeCountAchievement, holeDifference);
|
||||
AchievementManager.progressAchievement(this.getOwnerId(), holeCountAchievement, holeDifference);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
|
||||
for (RoomTile tile : this.tiles) {
|
||||
THashSet<RoomItem> tileItems = room.getItemsAt(tile);
|
||||
for (RoomItem tileItem : tileItems) {
|
||||
if (canBuild.contains(tileItem.getUserId()) && tileItem != this) {
|
||||
if (canBuild.contains(tileItem.getOwnerId()) && tileItem != this) {
|
||||
room.getRoomItemManager().pickUpItem(tileItem, null);
|
||||
}
|
||||
}
|
||||
@ -130,7 +130,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
|
||||
THashSet<RoomItem> tileItems = room.getItemsAt(tile);
|
||||
if (newTiles.contains(tile)) continue;
|
||||
for (RoomItem tileItem : tileItems) {
|
||||
if (canBuild.contains(tileItem.getUserId()) && tileItem != this) {
|
||||
if (canBuild.contains(tileItem.getOwnerId()) && tileItem != this) {
|
||||
room.getRoomItemManager().pickUpItem(tileItem, null);
|
||||
}
|
||||
}
|
||||
@ -204,7 +204,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
|
||||
for (RoomTile tile : oldTiles) {
|
||||
THashSet<RoomItem> tileItems = room.getItemsAt(tile);
|
||||
for (RoomItem tileItem : tileItems) {
|
||||
if (canBuild.contains(tileItem.getUserId()) && tileItem != this) {
|
||||
if (canBuild.contains(tileItem.getOwnerId()) && tileItem != this) {
|
||||
room.getRoomItemManager().pickUpItem(tileItem, null);
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class InteractionCrackable extends RoomItem {
|
||||
public void onTick(Habbo habbo, Room room) {
|
||||
if (this.cracked) return;
|
||||
|
||||
if (this.allowAnyone() || this.getUserId() == habbo.getHabboInfo().getId()) {
|
||||
if (this.allowAnyone() || this.getOwnerId() == habbo.getHabboInfo().getId()) {
|
||||
CrackableReward rewardData = Emulator.getGameEnvironment().getItemManager().getCrackableData(this.getBaseItem().getId());
|
||||
|
||||
if (rewardData != null) {
|
||||
|
@ -4,8 +4,8 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.users.HabboGender;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||
import com.eu.habbo.habbohotel.users.HabboGender;
|
||||
import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
|
||||
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
|
||||
|
||||
@ -25,7 +25,7 @@ public class InteractionFXBox extends InteractionDefault {
|
||||
|
||||
@Override
|
||||
public void onClick(GameClient client, Room room, Object[] objects) {
|
||||
if (client != null && this.getUserId() == client.getHabbo().getHabboInfo().getId()) {
|
||||
if (client != null && this.getOwnerId() == client.getHabbo().getHabboInfo().getId()) {
|
||||
if(this.getExtradata().equals("1"))
|
||||
return;
|
||||
|
||||
|
@ -166,7 +166,7 @@ public class InteractionRentableSpace extends RoomItem {
|
||||
}
|
||||
|
||||
for (RoomItem item : items) {
|
||||
if (item.getUserId() == this.renterId) {
|
||||
if (item.getOwnerId() == this.renterId) {
|
||||
room.getRoomItemManager().pickUpItem(item, null);
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class InteractionVikingCotie extends InteractionDefault {
|
||||
this.setExtradata("0");
|
||||
}
|
||||
|
||||
if (client != null && client.getHabbo().getHabboInfo().getId() == this.getUserId()) {
|
||||
if (client != null && client.getHabbo().getHabboInfo().getId() == this.getOwnerId()) {
|
||||
if (client.getHabbo().getRoomUnit().getEffectId() == 172 || client.getHabbo().getRoomUnit().getEffectId() == 173) {
|
||||
int state = Integer.parseInt(this.getExtradata());
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class InteractionBunnyrunField extends InteractionTagField {
|
||||
public void onPlace(Room room) {
|
||||
super.onPlace(room);
|
||||
|
||||
Habbo itemOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.getUserId());
|
||||
Habbo itemOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.getOwnerId());
|
||||
|
||||
if (itemOwner != null) {
|
||||
AchievementManager.progressAchievement(itemOwner, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RbBunnyTag"));
|
||||
|
@ -48,7 +48,7 @@ public class InteractionIceTagField extends InteractionTagField {
|
||||
public void onPlace(Room room) {
|
||||
super.onPlace(room);
|
||||
|
||||
Habbo itemOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.getUserId());
|
||||
Habbo itemOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.getOwnerId());
|
||||
|
||||
if (itemOwner != null) {
|
||||
AchievementManager.progressAchievement(itemOwner, Emulator.getGameEnvironment().getAchievementManager().getAchievement("TagA"));
|
||||
|
@ -48,7 +48,7 @@ public class InteractionRollerskateField extends InteractionTagField {
|
||||
public void onPlace(Room room) {
|
||||
super.onPlace(room);
|
||||
|
||||
Habbo itemOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.getUserId());
|
||||
Habbo itemOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.getOwnerId());
|
||||
|
||||
if (itemOwner != null) {
|
||||
AchievementManager.progressAchievement(itemOwner, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RbTagA"));
|
||||
|
@ -31,7 +31,7 @@ public class InteractionTotemPlanet extends InteractionDefault {
|
||||
|
||||
@Override
|
||||
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
||||
if(client.getHabbo().getHabboInfo().getId() != this.getUserId()) {
|
||||
if(client.getHabbo().getHabboInfo().getId() != this.getOwnerId()) {
|
||||
super.onClick(client, room, objects);
|
||||
return;
|
||||
}
|
||||
|
@ -1453,17 +1453,17 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
|
||||
synchronized (this.furniOwnerCount) {
|
||||
this.furniOwnerCount.put(item.getUserId(), this.furniOwnerCount.get(item.getUserId()) + 1);
|
||||
this.furniOwnerCount.put(item.getOwnerId(), this.furniOwnerCount.get(item.getOwnerId()) + 1);
|
||||
}
|
||||
|
||||
synchronized (this.furniOwnerNames) {
|
||||
if (!this.furniOwnerNames.containsKey(item.getUserId())) {
|
||||
HabboInfo habbo = HabboManager.getOfflineHabboInfo(item.getUserId());
|
||||
if (!this.furniOwnerNames.containsKey(item.getOwnerId())) {
|
||||
HabboInfo habbo = HabboManager.getOfflineHabboInfo(item.getOwnerId());
|
||||
|
||||
if (habbo != null) {
|
||||
this.furniOwnerNames.put(item.getUserId(), habbo.getUsername());
|
||||
this.furniOwnerNames.put(item.getOwnerId(), habbo.getUsername());
|
||||
} else {
|
||||
log.error("Failed to find username for item (ID: {}, UserID: {})", item.getId(), item.getUserId());
|
||||
log.error("Failed to find username for item (ID: {}, UserID: {})", item.getId(), item.getOwnerId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1610,13 +1610,13 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
if (i != null) {
|
||||
synchronized (this.furniOwnerCount) {
|
||||
synchronized (this.furniOwnerNames) {
|
||||
int count = this.furniOwnerCount.get(i.getUserId());
|
||||
int count = this.furniOwnerCount.get(i.getOwnerId());
|
||||
|
||||
if (count > 1)
|
||||
this.furniOwnerCount.put(i.getUserId(), count - 1);
|
||||
this.furniOwnerCount.put(i.getOwnerId(), count - 1);
|
||||
else {
|
||||
this.furniOwnerCount.remove(i.getUserId());
|
||||
this.furniOwnerNames.remove(i.getUserId());
|
||||
this.furniOwnerCount.remove(i.getOwnerId());
|
||||
this.furniOwnerNames.remove(i.getOwnerId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2176,8 +2176,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
public THashSet<RoomItem> getItemsAt(RoomTile tile, boolean returnOnFirst) {
|
||||
THashSet<RoomItem> items = new THashSet<>(0);
|
||||
|
||||
if (tile == null)
|
||||
if (tile == null) {
|
||||
return items;
|
||||
}
|
||||
|
||||
if (this.loaded) {
|
||||
THashSet<RoomItem> cachedItems = this.tileCache.get(tile);
|
||||
@ -2497,8 +2498,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
return tallestItem.getBaseItem().allowSit();
|
||||
}
|
||||
|
||||
public boolean canLayAt(int x, int y) {
|
||||
return this.canLayAt(this.getItemsAt(x, y));
|
||||
public boolean canLayAt(RoomTile tile) {
|
||||
return this.canLayAt(this.getItemsAt(tile));
|
||||
}
|
||||
|
||||
boolean canLayAt(THashSet<RoomItem> items) {
|
||||
@ -2535,14 +2536,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
public void sendComposerToHabbosWithRights(ServerMessage message) {
|
||||
for (Habbo habbo : this.roomUnitManager.getRoomHabbos()) {
|
||||
if (this.hasRights(habbo)) {
|
||||
habbo.getClient().sendResponse(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void petChat(ServerMessage message) {
|
||||
for (Habbo habbo : this.roomUnitManager.getRoomHabbos()) {
|
||||
if (!habbo.getHabboStats().isIgnorePets())
|
||||
@ -2788,32 +2781,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
this.bannedHabbos.put(roomBan.getUserId(), roomBan);
|
||||
}
|
||||
|
||||
public void makeSit(Habbo habbo) {
|
||||
if (habbo.getRoomUnit() == null) return;
|
||||
|
||||
if (habbo.getRoomUnit().hasStatus(RoomUnitStatus.SIT) || !habbo.getRoomUnit().canForcePosture()) {
|
||||
return;
|
||||
}
|
||||
|
||||
habbo.getRoomUnit().setDance(DanceType.NONE);
|
||||
habbo.getRoomUnit().setCmdSitEnabled(true);
|
||||
habbo.getRoomUnit().setBodyRotation(RoomRotation.values()[habbo.getRoomUnit().getBodyRotation().getValue() - habbo.getRoomUnit().getBodyRotation().getValue() % 2]);
|
||||
habbo.getRoomUnit().setStatus(RoomUnitStatus.SIT, 0.5 + "");
|
||||
this.sendComposer(new UserUpdateComposer(habbo.getRoomUnit()).compose());
|
||||
}
|
||||
|
||||
public void makeStand(Habbo habbo) {
|
||||
if (habbo.getRoomUnit() == null) return;
|
||||
|
||||
RoomItem item = this.getTopItemAt(habbo.getRoomUnit().getCurrentPosition().getX(), habbo.getRoomUnit().getCurrentPosition().getY());
|
||||
if (item == null || !item.getBaseItem().allowSit() || !item.getBaseItem().allowLay()) {
|
||||
habbo.getRoomUnit().setCmdStandEnabled(true);
|
||||
habbo.getRoomUnit().setBodyRotation(RoomRotation.values()[habbo.getRoomUnit().getBodyRotation().getValue() - habbo.getRoomUnit().getBodyRotation().getValue() % 2]);
|
||||
habbo.getRoomUnit().removeStatus(RoomUnitStatus.SIT);
|
||||
this.sendComposer(new UserUpdateComposer(habbo.getRoomUnit()).compose());
|
||||
}
|
||||
}
|
||||
|
||||
public void updateItem(RoomItem item) {
|
||||
if (!this.isLoaded()) {
|
||||
return;
|
||||
@ -2856,7 +2823,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
THashSet<Item> items = new THashSet<>();
|
||||
|
||||
for (RoomItem item : this.roomItems.valueCollection()) {
|
||||
if (!items.contains(item.getBaseItem()) && item.getUserId() == userId) items.add(item.getBaseItem());
|
||||
if (!items.contains(item.getBaseItem()) && item.getOwnerId() == userId) items.add(item.getBaseItem());
|
||||
}
|
||||
|
||||
return items.size();
|
||||
@ -2874,7 +2841,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
break;
|
||||
}
|
||||
|
||||
if (iterator.value().getUserId() == userId) {
|
||||
if (iterator.value().getOwnerId() == userId) {
|
||||
items.add(iterator.value());
|
||||
iterator.value().setRoomId(0);
|
||||
}
|
||||
@ -2892,11 +2859,11 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
public void ejectAll() {
|
||||
this.ejectAll(null);
|
||||
public void ejectAllFurni() {
|
||||
this.ejectAllFurni(null);
|
||||
}
|
||||
|
||||
public void ejectAll(Habbo habbo) {
|
||||
public void ejectAllFurni(Habbo habbo) {
|
||||
THashMap<Integer, THashSet<RoomItem>> userItemsMap = new THashMap<>();
|
||||
|
||||
synchronized (this.roomItems) {
|
||||
@ -2909,13 +2876,13 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
break;
|
||||
}
|
||||
|
||||
if (habbo != null && iterator.value().getUserId() == habbo.getHabboInfo().getId())
|
||||
if (habbo != null && iterator.value().getOwnerId() == habbo.getHabboInfo().getId())
|
||||
continue;
|
||||
|
||||
if (iterator.value() instanceof InteractionPostIt)
|
||||
continue;
|
||||
|
||||
userItemsMap.computeIfAbsent(iterator.value().getUserId(), k -> new THashSet<>()).add(iterator.value());
|
||||
userItemsMap.computeIfAbsent(iterator.value().getOwnerId(), k -> new THashSet<>()).add(iterator.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,7 @@ public class RoomItemManager {
|
||||
item.onPlace(this.room);
|
||||
this.room.updateTiles(occupiedTiles);
|
||||
|
||||
this.room.sendComposer(new ObjectAddMessageComposer(item, this.room.getFurniOwnerName(item.getUserId())).compose());
|
||||
this.room.sendComposer(new ObjectAddMessageComposer(item, this.room.getFurniOwnerName(item.getOwnerId())).compose());
|
||||
|
||||
for (RoomTile t : occupiedTiles) {
|
||||
this.room.updateHabbosAt(t);
|
||||
@ -339,10 +339,10 @@ public class RoomItemManager {
|
||||
}
|
||||
|
||||
item.setWallPosition(wallPosition);
|
||||
if (!this.room.getFurniOwnerNames().containsKey(item.getUserId()) && owner != null) {
|
||||
this.room.getFurniOwnerNames().put(item.getUserId(), owner.getHabboInfo().getUsername());
|
||||
if (!this.room.getFurniOwnerNames().containsKey(item.getOwnerId()) && owner != null) {
|
||||
this.room.getFurniOwnerNames().put(item.getOwnerId(), owner.getHabboInfo().getUsername());
|
||||
}
|
||||
this.room.sendComposer(new ItemAddMessageComposer(item, this.room.getFurniOwnerName(item.getUserId())).compose());
|
||||
this.room.sendComposer(new ItemAddMessageComposer(item, this.room.getFurniOwnerName(item.getOwnerId())).compose());
|
||||
item.needsUpdate(true);
|
||||
this.addRoomItem(item);
|
||||
item.setRoomId(this.room.getRoomInfo().getId());
|
||||
@ -565,7 +565,7 @@ public class RoomItemManager {
|
||||
this.room.sendComposer(new ItemRemoveMessageComposer(item).compose());
|
||||
}
|
||||
|
||||
Habbo habbo = (picker != null && picker.getHabboInfo().getId() == item.getId() ? picker : Emulator.getGameServer().getGameClientManager().getHabbo(item.getUserId()));
|
||||
Habbo habbo = (picker != null && picker.getHabboInfo().getId() == item.getId() ? picker : Emulator.getGameServer().getGameClientManager().getHabbo(item.getOwnerId()));
|
||||
if (habbo != null) {
|
||||
habbo.getInventory().getItemsComponent().addItem(item);
|
||||
habbo.getClient().sendResponse(new UnseenItemsComposer(item));
|
||||
|
@ -183,7 +183,7 @@ public class RoomTrade {
|
||||
try (PreparedStatement statement = connection.prepareStatement("UPDATE items SET user_id = ? WHERE id = ? LIMIT 1")) {
|
||||
try (PreparedStatement stmt = connection.prepareStatement("INSERT INTO room_trade_log_items (id, item_id, user_id) VALUES (?, ?, ?)")) {
|
||||
for (RoomItem item : userOne.getItems()) {
|
||||
item.setUserId(userTwoId);
|
||||
item.setOwnerId(userTwoId);
|
||||
statement.setInt(1, userTwoId);
|
||||
statement.setInt(2, item.getId());
|
||||
statement.addBatch();
|
||||
@ -197,7 +197,7 @@ public class RoomTrade {
|
||||
}
|
||||
|
||||
for (RoomItem item : userTwo.getItems()) {
|
||||
item.setUserId(userOneId);
|
||||
item.setOwnerId(userOneId);
|
||||
statement.setInt(1, userOneId);
|
||||
statement.setInt(2, item.getId());
|
||||
statement.addBatch();
|
||||
|
@ -298,7 +298,7 @@ public class TraxManager implements Disposable {
|
||||
musicDisc.needsUpdate(true);
|
||||
Emulator.getThreading().run(musicDisc);
|
||||
|
||||
Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(musicDisc.getUserId());
|
||||
Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(musicDisc.getOwnerId());
|
||||
|
||||
if (owner != null) {
|
||||
owner.getInventory().getItemsComponent().addItem(musicDisc);
|
||||
@ -328,7 +328,7 @@ public class TraxManager implements Disposable {
|
||||
musicDisc.needsUpdate(true);
|
||||
Emulator.getThreading().run(musicDisc);
|
||||
|
||||
Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(musicDisc.getUserId());
|
||||
Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(musicDisc.getOwnerId());
|
||||
|
||||
if (owner != null) {
|
||||
owner.getInventory().getItemsComponent().addItem(musicDisc);
|
||||
|
@ -46,20 +46,11 @@ import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
public abstract class RoomItem implements Runnable, IEventTriggers {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final Class[] TOGGLING_INTERACTIONS = new Class[]{
|
||||
InteractionGameTimer.class,
|
||||
InteractionWired.class,
|
||||
InteractionWiredHighscore.class,
|
||||
InteractionMultiHeight.class
|
||||
};
|
||||
|
||||
@Getter
|
||||
private final int id;
|
||||
@Getter
|
||||
@Setter
|
||||
private int userId;
|
||||
private int ownerId;
|
||||
@Getter
|
||||
@Setter
|
||||
private int roomId;
|
||||
@ -89,10 +80,17 @@ public abstract class RoomItem implements Runnable, IEventTriggers {
|
||||
private boolean needsUpdate = false;
|
||||
private boolean needsDelete = false;
|
||||
private boolean isFromGift = false;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final Class[] TOGGLING_INTERACTIONS = new Class[]{
|
||||
InteractionGameTimer.class,
|
||||
InteractionWired.class,
|
||||
InteractionWiredHighscore.class,
|
||||
InteractionMultiHeight.class
|
||||
};
|
||||
|
||||
public RoomItem(ResultSet set, Item baseItem) throws SQLException {
|
||||
this.id = set.getInt("id");
|
||||
this.userId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.ownerId = set.getInt(DatabaseConstants.USER_ID);
|
||||
this.roomId = set.getInt("room_id");
|
||||
this.baseItem = baseItem;
|
||||
this.wallPosition = set.getString("wall_pos");
|
||||
@ -109,9 +107,9 @@ public abstract class RoomItem implements Runnable, IEventTriggers {
|
||||
}
|
||||
}
|
||||
|
||||
public RoomItem(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
public RoomItem(int id, int ownerId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
this.id = id;
|
||||
this.userId = userId;
|
||||
this.ownerId = ownerId;
|
||||
this.roomId = 0;
|
||||
this.baseItem = item;
|
||||
this.wallPosition = "";
|
||||
@ -163,7 +161,7 @@ public abstract class RoomItem implements Runnable, IEventTriggers {
|
||||
serverMessage.appendString(this.extradata);
|
||||
serverMessage.appendInt(-1);
|
||||
serverMessage.appendInt(this.isUsable());
|
||||
serverMessage.appendInt(this.getUserId());
|
||||
serverMessage.appendInt(this.getOwnerId());
|
||||
}
|
||||
|
||||
public int getGiftAdjustedId() {
|
||||
@ -216,7 +214,7 @@ public abstract class RoomItem implements Runnable, IEventTriggers {
|
||||
}
|
||||
} else if (this.needsUpdate) {
|
||||
try (PreparedStatement statement = connection.prepareStatement("UPDATE items SET user_id = ?, room_id = ?, wall_pos = ?, x = ?, y = ?, z = ?, rot = ?, extra_data = ?, limited_data = ? WHERE id = ?")) {
|
||||
statement.setInt(1, this.userId);
|
||||
statement.setInt(1, this.ownerId);
|
||||
statement.setInt(2, this.roomId);
|
||||
statement.setString(3, this.wallPosition);
|
||||
statement.setInt(4, this.x);
|
||||
@ -299,21 +297,21 @@ public abstract class RoomItem implements Runnable, IEventTriggers {
|
||||
public void onPlace(Room room) {
|
||||
//TODO: IMPORTANT: MAKE THIS GENERIC. (HOLES, ICE SKATE PATCHES, BLACK HOLE, BUNNY RUN FIELD, FOOTBALL FIELD)
|
||||
Achievement roomDecoAchievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoFurniCount");
|
||||
Habbo owner = room.getRoomUnitManager().getRoomHabboById(this.getUserId());
|
||||
Habbo owner = room.getRoomUnitManager().getRoomHabboById(this.getOwnerId());
|
||||
|
||||
int furniCollecterProgress;
|
||||
if (owner == null) {
|
||||
furniCollecterProgress = AchievementManager.getAchievementProgressForHabbo(this.getUserId(), roomDecoAchievement);
|
||||
furniCollecterProgress = AchievementManager.getAchievementProgressForHabbo(this.getOwnerId(), roomDecoAchievement);
|
||||
} else {
|
||||
furniCollecterProgress = owner.getHabboStats().getAchievementProgress(roomDecoAchievement);
|
||||
}
|
||||
|
||||
int difference = room.getUserFurniCount(this.getUserId()) - furniCollecterProgress;
|
||||
int difference = room.getUserFurniCount(this.getOwnerId()) - furniCollecterProgress;
|
||||
if (difference > 0) {
|
||||
if (owner != null) {
|
||||
AchievementManager.progressAchievement(owner, roomDecoAchievement, difference);
|
||||
} else {
|
||||
AchievementManager.progressAchievement(this.getUserId(), roomDecoAchievement, difference);
|
||||
AchievementManager.progressAchievement(this.getOwnerId(), roomDecoAchievement, difference);
|
||||
}
|
||||
}
|
||||
|
||||
@ -321,17 +319,17 @@ public abstract class RoomItem implements Runnable, IEventTriggers {
|
||||
|
||||
int uniqueFurniCollecterProgress;
|
||||
if (owner == null) {
|
||||
uniqueFurniCollecterProgress = AchievementManager.getAchievementProgressForHabbo(this.getUserId(), roomDecoUniqueAchievement);
|
||||
uniqueFurniCollecterProgress = AchievementManager.getAchievementProgressForHabbo(this.getOwnerId(), roomDecoUniqueAchievement);
|
||||
} else {
|
||||
uniqueFurniCollecterProgress = owner.getHabboStats().getAchievementProgress(roomDecoUniqueAchievement);
|
||||
}
|
||||
|
||||
int uniqueDifference = room.getUserUniqueFurniCount(this.getUserId()) - uniqueFurniCollecterProgress;
|
||||
int uniqueDifference = room.getUserUniqueFurniCount(this.getOwnerId()) - uniqueFurniCollecterProgress;
|
||||
if (uniqueDifference > 0) {
|
||||
if (owner != null) {
|
||||
AchievementManager.progressAchievement(owner, roomDecoUniqueAchievement, uniqueDifference);
|
||||
} else {
|
||||
AchievementManager.progressAchievement(this.getUserId(), roomDecoUniqueAchievement, uniqueDifference);
|
||||
AchievementManager.progressAchievement(this.getOwnerId(), roomDecoUniqueAchievement, uniqueDifference);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,9 @@ import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.RoomEntity;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.RoomRotation;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar;
|
||||
import com.eu.habbo.habbohotel.users.DanceType;
|
||||
import com.eu.habbo.messages.outgoing.rooms.users.UserUpdateComposer;
|
||||
import com.eu.habbo.plugin.Event;
|
||||
import com.eu.habbo.plugin.events.roomunit.RoomUnitLookAtPointEvent;
|
||||
import com.eu.habbo.plugin.events.roomunit.RoomUnitSetGoalEvent;
|
||||
@ -144,6 +147,7 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
public void setRotation(RoomRotation rotation) {
|
||||
this.bodyRotation = rotation;
|
||||
this.headRotation = rotation;
|
||||
this.statusUpdateNeeded = true;
|
||||
}
|
||||
|
||||
public void clearWalking() {
|
||||
@ -157,7 +161,7 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
public void stopWalking() {
|
||||
synchronized (this.statuses) {
|
||||
this.statuses.remove(RoomUnitStatus.MOVE);
|
||||
this.setStatusUpdateNeeded(true);
|
||||
this.statusUpdateNeeded = true;
|
||||
this.setGoalLocation(this.getCurrentPosition());
|
||||
}
|
||||
}
|
||||
@ -249,12 +253,14 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
|
||||
public RoomUnit removeStatus(RoomUnitStatus key) {
|
||||
this.statuses.remove(key);
|
||||
this.statusUpdateNeeded = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setStatus(RoomUnitStatus key, String value) {
|
||||
if (key != null && value != null) {
|
||||
this.statuses.put(key, value);
|
||||
this.statusUpdateNeeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,6 +268,32 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
return this.statuses.containsKey(key);
|
||||
}
|
||||
|
||||
public void makeStand() {
|
||||
RoomItem item = this.getRoom().getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY());
|
||||
if (item == null || !item.getBaseItem().allowSit() || !item.getBaseItem().allowLay()) {
|
||||
this.setCmdStandEnabled(true);
|
||||
this.setBodyRotation(RoomRotation.values()[this.getBodyRotation().getValue() - this.getBodyRotation().getValue() % 2]);
|
||||
this.removeStatus(RoomUnitStatus.SIT);
|
||||
this.getRoom().sendComposer(new UserUpdateComposer(this).compose());
|
||||
}
|
||||
}
|
||||
|
||||
public void makeSit() {
|
||||
if (this.hasStatus(RoomUnitStatus.SIT) || !this.canForcePosture()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setCmdSitEnabled(true);
|
||||
this.setBodyRotation(RoomRotation.values()[this.getBodyRotation().getValue() - this.getBodyRotation().getValue() % 2]);
|
||||
this.setStatus(RoomUnitStatus.SIT, 0.5 + "");
|
||||
|
||||
if(this instanceof RoomAvatar roomAvatar) {
|
||||
roomAvatar.setDance(DanceType.NONE);
|
||||
}
|
||||
|
||||
this.getRoom().sendComposer(new UserUpdateComposer(this).compose());
|
||||
}
|
||||
|
||||
public void clearStatuses() {
|
||||
this.statuses.clear();
|
||||
}
|
||||
@ -311,10 +343,6 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
return this.idleTicks > Room.IDLE_CYCLES; //Amount of room cycles / 2 = seconds.
|
||||
}
|
||||
|
||||
public int getIdleTicks() {
|
||||
return this.idleTicks;
|
||||
}
|
||||
|
||||
public void resetIdleTimer() {
|
||||
this.idleTicks = 0;
|
||||
}
|
||||
@ -324,7 +352,9 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
}
|
||||
|
||||
public void lookAtPoint(RoomTile location) {
|
||||
if (!this.isCanRotate()) return;
|
||||
if (!this.isCanRotate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Emulator.getPluginManager().isRegistered(RoomUnitLookAtPointEvent.class, false)) {
|
||||
Event lookAtPointEvent = new RoomUnitLookAtPointEvent(this.getRoom(), this, location);
|
||||
@ -338,15 +368,17 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.statuses.containsKey(RoomUnitStatus.SIT)) {
|
||||
this.bodyRotation = (RoomRotation.values()[Rotation.Calculate(this.getCurrentPosition().getX(), this.getCurrentPosition().getY(), location.getX(), location.getY())]);
|
||||
}
|
||||
|
||||
RoomRotation rotation = (RoomRotation.values()[Rotation.Calculate(this.getCurrentPosition().getX(), this.getCurrentPosition().getY(), location.getX(), location.getY())]);
|
||||
|
||||
if (!this.statuses.containsKey(RoomUnitStatus.SIT)) {
|
||||
this.bodyRotation = rotation;
|
||||
}
|
||||
|
||||
if (Math.abs(rotation.getValue() - this.bodyRotation.getValue()) <= 1) {
|
||||
this.headRotation = rotation;
|
||||
}
|
||||
|
||||
this.statusUpdateNeeded = true;
|
||||
}
|
||||
|
||||
public boolean canOverrideTile(RoomTile tile) {
|
||||
|
@ -8,4 +8,4 @@ import lombok.Setter;
|
||||
@Setter
|
||||
public class Unit {
|
||||
private RoomUnit roomUnit;
|
||||
}
|
||||
}
|
@ -40,7 +40,7 @@ public class CallForHelpFromPhotoEvent extends MessageHandler {
|
||||
|
||||
if (!(item instanceof InteractionExternalImage)) return;
|
||||
|
||||
HabboInfo photoOwner = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(item.getUserId());
|
||||
HabboInfo photoOwner = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(item.getOwnerId());
|
||||
|
||||
if (photoOwner == null) return;
|
||||
|
||||
|
@ -37,8 +37,8 @@ public class AddSpamWallPostItEvent extends MessageHandler {
|
||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||
RoomItem sticky = room.getHabboItem(itemId);
|
||||
|
||||
if (sticky != null && sticky.getUserId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||
sticky.setUserId(room.getRoomInfo().getOwnerInfo().getId());
|
||||
if (sticky != null && sticky.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||
sticky.setOwnerId(room.getRoomInfo().getOwnerInfo().getId());
|
||||
|
||||
if (color.equalsIgnoreCase(PostItColor.YELLOW.hexColor)) {
|
||||
color = PostItColor.randomColorNotYellow().hexColor;
|
||||
@ -47,7 +47,7 @@ public class AddSpamWallPostItEvent extends MessageHandler {
|
||||
text = InteractionPostIt.STICKYPOLE_PREFIX_TEXT.replace("\\r", "\r").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%timestamp%", LocalDate.now().toString()) + text;
|
||||
}
|
||||
|
||||
sticky.setUserId(room.getRoomInfo().getOwnerInfo().getId());
|
||||
sticky.setOwnerId(room.getRoomInfo().getOwnerInfo().getId());
|
||||
sticky.setExtradata(color + " " + text);
|
||||
sticky.needsUpdate(true);
|
||||
room.updateItem(sticky);
|
||||
|
@ -25,7 +25,7 @@ public class CreditFurniRedeemEvent extends MessageHandler {
|
||||
if (room != null) {
|
||||
RoomItem item = room.getHabboItem(itemId);
|
||||
|
||||
if (item != null && this.client.getHabbo().getHabboInfo().getId() == item.getUserId()) {
|
||||
if (item != null && this.client.getHabbo().getHabboInfo().getId() == item.getOwnerId()) {
|
||||
boolean furnitureRedeemEventRegistered = Emulator.getPluginManager().isRegistered(FurnitureRedeemedEvent.class, true);
|
||||
FurnitureRedeemedEvent furniRedeemEvent = new FurnitureRedeemedEvent(item, this.client.getHabbo(), 0, FurnitureRedeemedEvent.CREDITS);
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class CustomizeAvatarWithFurniEvent extends MessageHandler {
|
||||
this.client.getHabbo().getRoomUnit().getRoom().hasRights(this.client.getHabbo())) {
|
||||
RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getHabboItem(itemId);
|
||||
|
||||
if (item != null && item.getUserId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||
if (item != null && item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||
if (item instanceof InteractionClothing) {
|
||||
ClothItem clothing = Emulator.getGameEnvironment().getCatalogManager().getClothing(item.getBaseItem().getName());
|
||||
|
||||
|
@ -24,15 +24,15 @@ public class PickupObjectEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getUserId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||
if (item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||
room.getRoomItemManager().pickUpItem(item, this.client.getHabbo());
|
||||
} else {
|
||||
if (room.hasRights(this.client.getHabbo())) {
|
||||
if (this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
||||
item.setUserId(this.client.getHabbo().getHabboInfo().getId());
|
||||
item.setOwnerId(this.client.getHabbo().getHabboInfo().getId());
|
||||
} else {
|
||||
if (!room.getRoomInfo().isRoomOwner(this.client.getHabbo())) {
|
||||
if (item.getUserId() == room.getRoomInfo().getOwnerInfo().getId()) {
|
||||
if (item.getOwnerId() == room.getRoomInfo().getOwnerInfo().getId()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class PlacePostItEvent extends MessageHandler {
|
||||
item.setExtradata("FFFF33");
|
||||
item.setRoomId(this.client.getHabbo().getRoomUnit().getRoom().getRoomInfo().getId());
|
||||
item.setWallPosition(location);
|
||||
item.setUserId(this.client.getHabbo().getHabboInfo().getId());
|
||||
item.setOwnerId(this.client.getHabbo().getHabboInfo().getId());
|
||||
item.needsUpdate(true);
|
||||
room.sendComposer(new ItemAddMessageComposer(item, this.client.getHabbo().getHabboInfo().getUsername()).compose());
|
||||
this.client.getHabbo().getInventory().getItemsComponent().removeHabboItem(item);
|
||||
|
@ -23,7 +23,7 @@ public class RemoveItemEvent extends MessageHandler {
|
||||
RoomItem item = room.getHabboItem(itemId);
|
||||
|
||||
if (item instanceof InteractionPostIt || item instanceof InteractionExternalImage) {
|
||||
if (item.getUserId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
||||
if (item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasRight(Permission.ACC_ANYROOMOWNER)) {
|
||||
item.setRoomId(0);
|
||||
room.removeHabboItem(item);
|
||||
room.sendComposer(new ItemRemoveMessageComposer(item).compose());
|
||||
|
@ -22,7 +22,7 @@ public class OpenPetPackageEvent extends MessageHandler {
|
||||
|
||||
if (room != null) {
|
||||
RoomItem item = room.getHabboItem(itemId);
|
||||
if (item != null && item.getUserId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||
if (item != null && item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) {
|
||||
if (!name.matches("^[a-zA-Z0-9]*$")) {
|
||||
this.client.sendResponse(new PerkAllowancesComposer(itemId, PerkAllowancesComposer.CONTAINS_INVALID_CHARS, name.replaceAll("^[a-zA-Z0-9]*$", "")));
|
||||
return;
|
||||
@ -66,7 +66,7 @@ public class OpenPetPackageEvent extends MessageHandler {
|
||||
RoomTile tile = room.getLayout().getTile(item.getX(), item.getY());
|
||||
room.updateTile(room.getLayout().getTile(item.getX(), item.getY()));
|
||||
room.sendComposer(new HeightMapUpdateMessageComposer(tile.getX(), tile.getY(), tile.getZ(), tile.relativeHeight()).compose());
|
||||
item.setUserId(0);
|
||||
item.setOwnerId(0);
|
||||
} else {
|
||||
this.client.sendResponse(new PurchaseErrorMessageComposer(PurchaseErrorMessageComposer.SERVER_ERROR));
|
||||
}
|
||||
|
@ -11,7 +11,8 @@ public class ChangePostureEvent extends MessageHandler {
|
||||
if (this.client.getHabbo().getRoomUnit().isWalking()) {
|
||||
this.client.getHabbo().getRoomUnit().stopWalking();
|
||||
}
|
||||
this.client.getHabbo().getRoomUnit().getRoom().makeSit(this.client.getHabbo());
|
||||
|
||||
this.client.getHabbo().getRoomUnit().makeSit();
|
||||
|
||||
UserIdleEvent event = new UserIdleEvent(this.client.getHabbo(), UserIdleEvent.IdleReason.WALKED, false);
|
||||
Emulator.getPluginManager().fireEvent(event);
|
||||
|
@ -51,8 +51,6 @@ public class LookToEvent extends MessageHandler {
|
||||
|
||||
if (tile != null) {
|
||||
roomUnit.lookAtPoint(tile);
|
||||
roomUnit.setStatusUpdateNeeded(true);
|
||||
//room.sendComposer(new RoomUserStatusComposer(roomUnit).compose());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class MoveAvatarEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (room.canLayAt(tile.getX(), tile.getY())) {
|
||||
if (room.canLayAt(tile)) {
|
||||
RoomItem bed = room.getTopItemAt(tile.getX(), tile.getY());
|
||||
|
||||
if (bed != null && bed.getBaseItem().allowLay()) {
|
||||
@ -138,7 +138,7 @@ public class MoveAvatarEvent extends MessageHandler {
|
||||
default -> room.getLayout().getTile(bed.getX(), bed.getY());
|
||||
};
|
||||
|
||||
if (pillow != null && room.canLayAt(pillow.getX(), pillow.getY())) {
|
||||
if (pillow != null && room.canLayAt(pillow)) {
|
||||
roomUnit.setGoalLocation(pillow);
|
||||
return;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class ItemRemoveMessageComposer extends MessageComposer {
|
||||
protected ServerMessage composeInternal() {
|
||||
this.response.init(Outgoing.itemRemoveMessageComposer);
|
||||
this.response.appendString(this.item.getId() + "");
|
||||
this.response.appendInt(this.item.getUserId());
|
||||
this.response.appendInt(this.item.getOwnerId());
|
||||
return this.response;
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class ItemUpdateMessageComposer extends MessageComposer {
|
||||
protected ServerMessage composeInternal() {
|
||||
this.response.init(Outgoing.itemUpdateMessageComposer);
|
||||
this.item.serializeWallData(this.response);
|
||||
this.response.appendString(this.item.getUserId() + "");
|
||||
this.response.appendString(this.item.getOwnerId() + "");
|
||||
return this.response;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class ObjectAddMessageComposer extends MessageComposer {
|
||||
this.item.serializeExtradata(this.response);
|
||||
this.response.appendInt(-1);
|
||||
this.response.appendInt(this.item instanceof InteractionTeleport || this.item instanceof InteractionSwitch || this.item instanceof InteractionSwitchRemoteControl || this.item instanceof InteractionVendingMachine || this.item instanceof InteractionInformationTerminal || this.item instanceof InteractionPostIt || this.item instanceof InteractionSpinningBottle || this.item instanceof InteractionPuzzleBox ? 2 : this.item.isUsable() ? 1 : 0);
|
||||
this.response.appendInt(this.item.getUserId());
|
||||
this.response.appendInt(this.item.getOwnerId());
|
||||
this.response.appendString(this.itemOwnerName);
|
||||
return this.response;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class ObjectUpdateMessageComposer extends MessageComposer {
|
||||
this.item.serializeExtradata(this.response);
|
||||
this.response.appendInt(-1);
|
||||
this.response.appendInt(0);
|
||||
this.response.appendInt(this.item.getUserId());
|
||||
this.response.appendInt(this.item.getOwnerId());
|
||||
return this.response;
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class ObjectsMessageComposer extends MessageComposer {
|
||||
item.serializeExtradata(this.response);
|
||||
this.response.appendInt(-1);
|
||||
this.response.appendInt(item instanceof InteractionTeleport || item instanceof InteractionSwitch || item instanceof InteractionSwitchRemoteControl || item instanceof InteractionVendingMachine || item instanceof InteractionInformationTerminal || item instanceof InteractionPostIt || item instanceof InteractionSpinningBottle || item instanceof InteractionPuzzleBox ? 2 : item.isUsable() ? 1 : 0);
|
||||
this.response.appendInt(item.getUserId());
|
||||
this.response.appendInt(item.getOwnerId());
|
||||
}
|
||||
return this.response;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class RemoveFloorItemComposer extends MessageComposer {
|
||||
|
||||
this.response.appendString(this.item.getId() + "");
|
||||
this.response.appendBoolean(false);
|
||||
this.response.appendInt(this.noUser ? 0 : this.item.getUserId());
|
||||
this.response.appendInt(this.noUser ? 0 : this.item.getOwnerId());
|
||||
this.response.appendInt(0);
|
||||
|
||||
return this.response;
|
||||
|
@ -4,8 +4,8 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionRentableSpace;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -21,7 +21,7 @@ public class ClearRentedSpace implements Runnable {
|
||||
|
||||
for (RoomTile t : this.room.getLayout().getTilesAt(this.room.getLayout().getTile(this.item.getX(), this.item.getY()), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation())) {
|
||||
for (RoomItem i : this.room.getItemsAt(t)) {
|
||||
if (i.getUserId() == this.item.getRenterId()) {
|
||||
if (i.getOwnerId() == this.item.getRenterId()) {
|
||||
items.add(i);
|
||||
i.setRoomId(0);
|
||||
i.needsUpdate(true);
|
||||
|
@ -40,7 +40,7 @@ public class CrackableExplode implements Runnable {
|
||||
Item rewardItem = Emulator.getGameEnvironment().getItemManager().getCrackableReward(this.habboItem.getBaseItem().getId());
|
||||
|
||||
if (rewardItem != null) {
|
||||
RoomItem newItem = Emulator.getGameEnvironment().getItemManager().createItem(this.habboItem.allowAnyone() ? this.habbo.getHabboInfo().getId() : this.habboItem.getUserId(), rewardItem, 0, 0, "");
|
||||
RoomItem newItem = Emulator.getGameEnvironment().getItemManager().createItem(this.habboItem.allowAnyone() ? this.habbo.getHabboInfo().getId() : this.habboItem.getOwnerId(), rewardItem, 0, 0, "");
|
||||
|
||||
if (newItem != null) {
|
||||
//Add to inventory in case if isn't possible place the item or in case is wall item
|
||||
@ -56,7 +56,7 @@ public class CrackableExplode implements Runnable {
|
||||
newItem.needsUpdate(true);
|
||||
this.room.addHabboItem(newItem);
|
||||
this.room.updateItem(newItem);
|
||||
this.room.sendComposer(new ObjectAddMessageComposer(newItem, this.room.getFurniOwnerNames().get(newItem.getUserId())).compose());
|
||||
this.room.sendComposer(new ObjectAddMessageComposer(newItem, this.room.getFurniOwnerNames().get(newItem.getOwnerId())).compose());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ public class HabboGiveHandItemToHabbo implements Runnable {
|
||||
this.from.getRoomUnit().setHandItem(0);
|
||||
this.from.getRoomUnit().getRoom().sendComposer(new CarryObjectMessageComposer(this.from.getRoomUnit()).compose());
|
||||
this.target.getRoomUnit().lookAtPoint(this.from.getRoomUnit().getCurrentPosition());
|
||||
this.target.getRoomUnit().setStatusUpdateNeeded(true);
|
||||
this.target.getClient().sendResponse(new HandItemReceivedMessageComposer(this.from.getRoomUnit(), itemId));
|
||||
this.target.getRoomUnit().setHandItem(itemId);
|
||||
this.target.getRoomUnit().getRoom().sendComposer(new CarryObjectMessageComposer(this.target.getRoomUnit()).compose());
|
||||
|
@ -4,8 +4,8 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionGift;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.messages.outgoing.inventory.FurniListAddOrUpdateComposer;
|
||||
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
||||
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
|
||||
@ -37,7 +37,7 @@ public class OpenGift implements Runnable {
|
||||
if (inside == null)
|
||||
inside = i;
|
||||
|
||||
i.setUserId(this.habbo.getHabboInfo().getId());
|
||||
i.setOwnerId(this.habbo.getHabboInfo().getId());
|
||||
i.needsUpdate(true);
|
||||
i.run();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user