Merge branch 'fix/exploit-fixes' into 'dev'

Exploit fixes

See merge request morningstar/Arcturus-Community!413
This commit is contained in:
Remco 2021-03-07 12:24:56 +00:00
commit e4a10f5d60
2 changed files with 30 additions and 29 deletions

View File

@ -21,7 +21,7 @@ public class BuyRoomPromotionEvent extends MessageHandler {
int itemId = this.packet.readInt(); int itemId = this.packet.readInt();
int roomId = this.packet.readInt(); int roomId = this.packet.readInt();
String title = this.packet.readString(); String title = this.packet.readString();
boolean unknown1 = this.packet.readBoolean(); boolean extendedPromotion = this.packet.readBoolean();
String description = this.packet.readString(); String description = this.packet.readString();
int categoryId = this.packet.readInt(); int categoryId = this.packet.readInt();
@ -30,40 +30,41 @@ public class BuyRoomPromotionEvent extends MessageHandler {
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().getCatalogPage(pageId); CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().getCatalogPage(pageId);
if (page != null) { if (page == null || !page.getLayout().equals("roomads"))
CatalogItem item = page.getCatalogItem(itemId); return;
if (item != null) {
if (this.client.getHabbo().getHabboInfo().canBuy(item)) {
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId);
if (!(room.isOwner(this.client.getHabbo()) || room.hasRights(this.client.getHabbo()) || room.getGuildRightLevel(this.client.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) { CatalogItem item = page.getCatalogItem(itemId);
return; if (item != null) {
if (this.client.getHabbo().getHabboInfo().canBuy(item)) {
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId);
if (!(room.isOwner(this.client.getHabbo()) || room.hasRights(this.client.getHabbo()) || room.getGuildRightLevel(this.client.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) {
return;
}
if (room.isPromoted()) {
room.getPromotion().addEndTimestamp(120 * 60);
} else {
room.createPromotion(title, description, categoryId);
}
if (room.isPromoted()) {
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) {
this.client.getHabbo().giveCredits(-item.getCredits());
} }
if (room.isPromoted()) { if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) {
room.getPromotion().addEndTimestamp(120 * 60); this.client.getHabbo().givePoints(item.getPointsType(), -item.getPoints());
} else {
room.createPromotion(title, description, categoryId);
} }
if (room.isPromoted()) { this.client.sendResponse(new PurchaseOKComposer());
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { room.sendComposer(new RoomPromotionMessageComposer(room, room.getPromotion()).compose());
this.client.getHabbo().giveCredits(-item.getCredits());
}
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) { if (!this.client.getHabbo().getInventory().getBadgesComponent().hasBadge(BuyRoomPromotionEvent.ROOM_PROMOTION_BADGE)) {
this.client.getHabbo().givePoints(item.getPointsType(), -item.getPoints()); this.client.getHabbo().addBadge(BuyRoomPromotionEvent.ROOM_PROMOTION_BADGE);
}
this.client.sendResponse(new PurchaseOKComposer());
room.sendComposer(new RoomPromotionMessageComposer(room, room.getPromotion()).compose());
if (!this.client.getHabbo().getInventory().getBadgesComponent().hasBadge(BuyRoomPromotionEvent.ROOM_PROMOTION_BADGE)) {
this.client.getHabbo().addBadge(BuyRoomPromotionEvent.ROOM_PROMOTION_BADGE);
}
} else {
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
} }
} else {
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
} }
} }
} }

View File

@ -21,7 +21,7 @@ public class TradeOfferMultipleItemsEvent extends MessageHandler {
int count = this.packet.readInt(); int count = this.packet.readInt();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(this.packet.readInt()); HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(this.packet.readInt());
if (item != null) { if (item != null && item.getBaseItem().allowTrade()) {
items.add(item); items.add(item);
} }
} }