mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-22 23:10:52 +01:00
Fixed BuyRoomPromotion exploit
This commit is contained in:
parent
b971ce1f83
commit
1685065b32
@ -30,40 +30,41 @@ public class BuyRoomPromotionEvent extends MessageHandler {
|
||||
|
||||
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().getCatalogPage(pageId);
|
||||
|
||||
if (page != null) {
|
||||
CatalogItem item = page.getCatalogItem(itemId);
|
||||
if (item != null) {
|
||||
if (this.client.getHabbo().getHabboInfo().canBuy(item)) {
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId);
|
||||
if (page == null || !page.getLayout().equals("roomads"))
|
||||
return;
|
||||
|
||||
if (!(room.isOwner(this.client.getHabbo()) || room.hasRights(this.client.getHabbo()) || room.getGuildRightLevel(this.client.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) {
|
||||
return;
|
||||
CatalogItem item = page.getCatalogItem(itemId);
|
||||
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()) {
|
||||
room.getPromotion().addEndTimestamp(120 * 60);
|
||||
} else {
|
||||
room.createPromotion(title, description, categoryId);
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) {
|
||||
this.client.getHabbo().givePoints(item.getPointsType(), -item.getPoints());
|
||||
}
|
||||
|
||||
if (room.isPromoted()) {
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) {
|
||||
this.client.getHabbo().giveCredits(-item.getCredits());
|
||||
}
|
||||
this.client.sendResponse(new PurchaseOKComposer());
|
||||
room.sendComposer(new RoomPromotionMessageComposer(room, room.getPromotion()).compose());
|
||||
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) {
|
||||
this.client.getHabbo().givePoints(item.getPointsType(), -item.getPoints());
|
||||
}
|
||||
|
||||
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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user