Give badge when purchasing a room ad

This commit is contained in:
Alejandro 2020-01-28 00:17:31 +02:00
parent 6b0043317a
commit a5f4df51ac
3 changed files with 18 additions and 3 deletions

View File

@ -7,4 +7,6 @@ ADD COLUMN `start_timestamp` int(11) NOT NULL DEFAULT -1 AFTER `end_timestamp`;
ALTER TABLE `room_promotions`
ADD COLUMN `category` int(11) NOT NULL DEFAULT 0 AFTER `start_timestamp`;
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('navigator.eventcategories', '1,Hottest Events,false;2,Parties & Music,true;3,Role Play,true;4,Help Desk,true;5,Trading,true;6,Games,true;7,Debates & Discussions,true;8,Grand Openings,true;9,Friending,true;10,Jobs,true;11,Group Events,true');
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('navigator.eventcategories', '1,Hottest Events,false;2,Parties & Music,true;3,Role Play,true;4,Help Desk,true;5,Trading,true;6,Games,true;7,Debates & Discussions,true;8,Grand Openings,true;9,Friending,true;10,Jobs,true;11,Group Events,true');
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('room.promotion.badge', 'RADZZ');

View File

@ -11,6 +11,8 @@ import com.eu.habbo.messages.outgoing.navigator.NewNavigatorEventCategoriesCompo
import com.eu.habbo.messages.outgoing.rooms.promotions.RoomPromotionMessageComposer;
public class BuyRoomPromotionEvent extends MessageHandler {
public static String ROOM_PROMOTION_BADGE = "RADZZ";
@Override
public void handle() throws Exception {
int pageId = this.packet.readInt();
@ -43,12 +45,20 @@ public class BuyRoomPromotionEvent extends MessageHandler {
}
if (room.isPromoted()) {
if (!this.client.getHabbo().hasPermission("acc_infinite_credits"))
if (!this.client.getHabbo().hasPermission("acc_infinite_credits")) {
this.client.getHabbo().giveCredits(-item.getCredits());
if (!this.client.getHabbo().hasPermission("acc_infinite_points"))
}
if (!this.client.getHabbo().hasPermission("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));
}

View File

@ -27,6 +27,7 @@ import com.eu.habbo.messages.incoming.camera.CameraPublishToWebEvent;
import com.eu.habbo.messages.incoming.camera.CameraPurchaseEvent;
import com.eu.habbo.messages.incoming.floorplaneditor.FloorPlanEditorSaveEvent;
import com.eu.habbo.messages.incoming.hotelview.HotelViewRequestLTDAvailabilityEvent;
import com.eu.habbo.messages.incoming.rooms.promotions.BuyRoomPromotionEvent;
import com.eu.habbo.messages.incoming.users.ChangeNameCheckUsernameEvent;
import com.eu.habbo.messages.outgoing.catalog.DiscountComposer;
import com.eu.habbo.messages.outgoing.navigator.NewNavigatorEventCategoriesComposer;
@ -134,6 +135,8 @@ public class PluginManager {
CameraPurchaseEvent.CAMERA_PURCHASE_POINTS = Emulator.getConfig().getInt("camera.price.points", 5);
CameraPurchaseEvent.CAMERA_PURCHASE_POINTS_TYPE = Emulator.getConfig().getInt("camera.price.points.type", 0);
BuyRoomPromotionEvent.ROOM_PROMOTION_BADGE = Emulator.getConfig().getValue("room.promotion.badge", "RADZZ");
NewNavigatorEventCategoriesComposer.CATEGORIES.clear();
for (String category : Emulator.getConfig().getValue("navigator.eventcategories", "").split(";")) {
try {