From a0193c48b38c6708ab8b3146761fc0155bd3be3c Mon Sep 17 00:00:00 2001 From: brenoepic <59066707+brenoepics@users.noreply.github.com> Date: Sun, 10 Apr 2022 00:11:14 -0300 Subject: [PATCH] Pet Fixes + fix conflicts --- .../interactions/pets/InteractionPetTree.java | 5 ++--- .../com/eu/habbo/habbohotel/pets/PetManager.java | 9 +++------ .../java/com/eu/habbo/habbohotel/rooms/Room.java | 4 ++++ .../eu/habbo/habbohotel/rooms/RoomUnitStatus.java | 15 +++++---------- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTree.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTree.java index 3369312c..26eaed36 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTree.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTree.java @@ -46,14 +46,13 @@ public class InteractionPetTree extends InteractionDefault { super.onWalkOn(roomUnit, room, objects); Pet pet = room.getPet(roomUnit); - if (pet != null && pet.getPetData().getType() == 12 && this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getGoal())) { + if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem()) && this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getGoal())) { RoomUnitStatus task = RoomUnitStatus.HANG; switch(pet.getTask()){ case RING_OF_FIRE: task = RoomUnitStatus.RINGOFFIRE; break; case SWING: task = RoomUnitStatus.SWING; break; case ROLL: task = RoomUnitStatus.ROLL; break; } - if (pet.getEnergy() >= 35 && task != RoomUnitStatus.HANG) { pet.getRoomUnit().setCanWalk(false); @@ -99,7 +98,7 @@ public class InteractionPetTree extends InteractionDefault { @Override public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) { Pet pet = room.getPet(roomUnit); - return roomUnit.getRoomUnitType() == RoomUnitType.PET && pet != null; + return roomUnit.getRoomUnitType() == RoomUnitType.PET && pet != null && pet.getPetData().haveToyItem(this.getBaseItem()); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java b/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java index 9cc4f85f..3e38702e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java @@ -3,10 +3,7 @@ package com.eu.habbo.habbohotel.pets; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.items.interactions.pets.InteractionNest; -import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetDrink; -import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetFood; -import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetToy; +import com.eu.habbo.habbohotel.items.interactions.pets.*; import com.eu.habbo.habbohotel.pets.actions.*; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; @@ -207,7 +204,7 @@ public class PetManager { PetData.generalFoodItems.add(baseItem); else if (baseItem.getInteractionType().getType() == InteractionPetDrink.class) PetData.generalDrinkItems.add(baseItem); - else if (baseItem.getInteractionType().getType() == InteractionPetToy.class) + else if (baseItem.getInteractionType().getType() == InteractionPetToy.class || baseItem.getInteractionType().getType() == InteractionPetTree.class) PetData.generalToyItems.add(baseItem); } else { PetData data = this.getPetData(set.getInt("pet_id")); @@ -219,7 +216,7 @@ public class PetManager { data.addFoodItem(baseItem); else if (baseItem.getInteractionType().getType() == InteractionPetDrink.class) data.addDrinkItem(baseItem); - else if (baseItem.getInteractionType().getType() == InteractionPetToy.class) + else if (baseItem.getInteractionType().getType() == InteractionPetToy.class || baseItem.getInteractionType().getType() == InteractionPetTree.class) data.addToyItem(baseItem); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 3e49173a..42d3b428 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -2542,6 +2542,8 @@ public class Room implements Comparable, ISerialize, Runnable { this.roomSpecialTypes.removePetDrink((InteractionPetDrink) item); } else if (item instanceof InteractionPetFood) { this.roomSpecialTypes.removePetFood((InteractionPetFood) item); + } else if (item instanceof InteractionPetTree) { + this.roomSpecialTypes.removeUndefined(item); } else if (item instanceof InteractionMoodLight) { this.roomSpecialTypes.removeUndefined(item); } else if (item instanceof InteractionPyramid) { @@ -2578,6 +2580,8 @@ public class Room implements Comparable, ISerialize, Runnable { this.roomSpecialTypes.removeUndefined(item); } else if (item instanceof InteractionSnowboardSlope) { this.roomSpecialTypes.removeUndefined(item); + } else if (item instanceof InteractionBuildArea) { + this.roomSpecialTypes.removeUndefined(item); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitStatus.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitStatus.java index 10e07c18..44fa79b1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitStatus.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitStatus.java @@ -42,10 +42,10 @@ public enum RoomUnitStatus { RELAX("rlx"), WINGS("wng", true), FLAME("flm"), - RINGOFFIRE("rng"), // ring of fire for dragon, toy undone - SWING("swg"), // same as roll but less energic, related to Dragon tree toy. - HANG("hg"), // hang, related to Dragon tree toy. just hangs under the branch - ROLL("rll"), // roll, related to Dragon tree toy. rolls around the branch + RINGOFFIRE("rng", true), + SWING("swg", true), + HANG("hg", true), + ROLL("rll", true), RIP("rip"), GROW("grw"), @@ -69,12 +69,7 @@ public enum RoomUnitStatus { SLEEP_IN("slp-in"), SLEEP("slp", true), - SLEEP_OUT("slp-out"), - - RINGOFFIRE("rng"), - SWING("swg"), - HANG("hg"), - ROLL("rll"); + SLEEP_OUT("slp-out"); public final String key; public final boolean removeWhenWalking;