:up Added Delete Pet from inventory

This commit is contained in:
duckietm
2026-02-19 13:26:33 +01:00
parent af917ccc8a
commit 4803bbb284
4 changed files with 35 additions and 0 deletions
@@ -368,6 +368,7 @@ public class PacketManager {
this.registerHandler(Incoming.RequestInventoryItemsEvent, RequestInventoryItemsEvent.class);
this.registerHandler(Incoming.HotelViewInventoryEvent, RequestInventoryItemsEvent.class);
this.registerHandler(Incoming.RequestInventoryPetsEvent, RequestInventoryPetsEvent.class);
this.registerHandler(Incoming.RequestInventoryPetDelete, RequestInventoryPetDelete.class);
}
void registerRooms() throws Exception {
@@ -407,4 +407,5 @@ public class Incoming {
// CUSTOM
public static final int UpdateFurniturePositionEvent = 10019;
public static final int RequestInventoryPetDelete = 10030;
}
@@ -0,0 +1,33 @@
package com.eu.habbo.messages.incoming.inventory;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.inventory.InventoryPetsComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
public class RequestInventoryPetDelete extends MessageHandler {
public int getRatelimit() {
return 500;
}
public void handle() {
final int petId = this.packet.readInt();
final Habbo habbo = this.client.getHabbo();
if (habbo == null)
return;
final Pet pet = habbo.getInventory().getPetsComponent().getPet(petId);
if (pet == null)
return;
habbo.getInventory().getPetsComponent().removePet(pet);
Emulator.getGameEnvironment().getPetManager().deletePet(pet);
habbo.getClient().sendResponse(new InventoryRefreshComposer());
habbo.getClient().sendResponse(new InventoryPetsComposer(habbo));
}
}