Merge branch 'implementToggleStaffPickEvent' into 'ms4/dev'

Reimplemented the ToggleStaffPickEvent (used to be RoomStaffPickEvent)

See merge request morningstar/Arcturus-Community!30
This commit is contained in:
brenoepic 2023-01-12 08:40:33 +00:00
commit bf2ee66942
3 changed files with 48 additions and 2 deletions

View File

@ -344,6 +344,7 @@ public class PacketManager {
this.registerHandler(Incoming.navigatorRemoveCollapsedCategoryEvent, NavigatorRemoveCollapsedCategoryEvent.class); this.registerHandler(Incoming.navigatorRemoveCollapsedCategoryEvent, NavigatorRemoveCollapsedCategoryEvent.class);
this.registerHandler(Incoming.navigatorAddSavedSearchEvent, NavigatorAddSavedSearchEvent.class); this.registerHandler(Incoming.navigatorAddSavedSearchEvent, NavigatorAddSavedSearchEvent.class);
this.registerHandler(Incoming.navigatorDeleteSavedSearchEvent, NavigatorDeleteSavedSearchEvent.class); this.registerHandler(Incoming.navigatorDeleteSavedSearchEvent, NavigatorDeleteSavedSearchEvent.class);
this.registerHandler(Incoming.toggleStaffPickEvent, ToggleStaffPickEvent.class);
} }
private void registerHotelview() throws Exception { private void registerHotelview() throws Exception {

View File

@ -331,6 +331,7 @@ public class Incoming {
public static final int throwDiceEvent = 1990; public static final int throwDiceEvent = 1990;
public static final int togglePetBreedingPermissionEvent = 3379; public static final int togglePetBreedingPermissionEvent = 3379;
public static final int togglePetRidingPermissionEvent = 1472; public static final int togglePetRidingPermissionEvent = 1472;
public static final int toggleStaffPickEvent = 1918;
public static final int unacceptTradingEvent = 1444; public static final int unacceptTradingEvent = 1444;
public static final int unbanUserFromRoomEvent = 992; public static final int unbanUserFromRoomEvent = 992;
public static final int unignoreUserEvent = 2061; public static final int unignoreUserEvent = 2061;
@ -463,7 +464,6 @@ public class Incoming {
public static final int setRoomSessionTagsEvent = 3305; public static final int setRoomSessionTagsEvent = 3305;
public static final int shopTargetedOfferViewedEvent = 3483; public static final int shopTargetedOfferViewedEvent = 3483;
public static final int startCampaignEvent = 1697; public static final int startCampaignEvent = 1697;
public static final int toggleStaffPickEvent = 1918;
public static final int tryPhoneNumberEvent = 790; public static final int tryPhoneNumberEvent = 790;
public static final int unblockGroupMemberEvent = 2864; public static final int unblockGroupMemberEvent = 2864;
public static final int updateForumReadMarkerEvent = 1855; public static final int updateForumReadMarkerEvent = 1855;

View File

@ -0,0 +1,45 @@
package com.eu.habbo.messages.incoming.rooms;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.navigation.NavigatorPublicCategory;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.rooms.GetGuestRoomResultComposer;
public class ToggleStaffPickEvent extends MessageHandler {
@Override
public void handle() throws Exception {
if (this.client.getHabbo().hasPermission(Permission.ACC_STAFF_PICK)) {
int roomId = this.packet.readInt();
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId);
if (room != null) {
room.setStaffPromotedRoom(!room.isStaffPromotedRoom());
room.setNeedsUpdate(true);
NavigatorPublicCategory publicCategory = Emulator.getGameEnvironment().getNavigatorManager().publicCategories.get(Emulator.getConfig().getInt("hotel.navigator.staffpicks.categoryid"));
if (room.isStaffPromotedRoom()) {
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(room.getOwnerId());
if (habbo != null) {
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("Spr"));
}
if (publicCategory != null) {
publicCategory.addRoom(room);
}
} else {
if (publicCategory != null) {
publicCategory.removeRoom(room);
}
}
this.client.sendResponse(new GetGuestRoomResultComposer(room, this.client.getHabbo(), true, false));
}
}
}
}