Pet Fixes + fix conflicts

This commit is contained in:
brenoepic 2022-04-10 00:11:14 -03:00
parent 930987d9fa
commit a0193c48b3
4 changed files with 14 additions and 19 deletions

View File

@ -46,14 +46,13 @@ public class InteractionPetTree extends InteractionDefault {
super.onWalkOn(roomUnit, room, objects); super.onWalkOn(roomUnit, room, objects);
Pet pet = room.getPet(roomUnit); 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; RoomUnitStatus task = RoomUnitStatus.HANG;
switch(pet.getTask()){ switch(pet.getTask()){
case RING_OF_FIRE: task = RoomUnitStatus.RINGOFFIRE; break; case RING_OF_FIRE: task = RoomUnitStatus.RINGOFFIRE; break;
case SWING: task = RoomUnitStatus.SWING; break; case SWING: task = RoomUnitStatus.SWING; break;
case ROLL: task = RoomUnitStatus.ROLL; break; case ROLL: task = RoomUnitStatus.ROLL; break;
} }
if (pet.getEnergy() >= 35 && task != RoomUnitStatus.HANG) { if (pet.getEnergy() >= 35 && task != RoomUnitStatus.HANG) {
pet.getRoomUnit().setCanWalk(false); pet.getRoomUnit().setCanWalk(false);
@ -99,7 +98,7 @@ public class InteractionPetTree extends InteractionDefault {
@Override @Override
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) { public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) {
Pet pet = room.getPet(roomUnit); 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 @Override

View File

@ -3,10 +3,7 @@ package com.eu.habbo.habbohotel.pets;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionNest; import com.eu.habbo.habbohotel.items.interactions.pets.*;
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.pets.actions.*; import com.eu.habbo.habbohotel.pets.actions.*;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
@ -207,7 +204,7 @@ public class PetManager {
PetData.generalFoodItems.add(baseItem); PetData.generalFoodItems.add(baseItem);
else if (baseItem.getInteractionType().getType() == InteractionPetDrink.class) else if (baseItem.getInteractionType().getType() == InteractionPetDrink.class)
PetData.generalDrinkItems.add(baseItem); 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); PetData.generalToyItems.add(baseItem);
} else { } else {
PetData data = this.getPetData(set.getInt("pet_id")); PetData data = this.getPetData(set.getInt("pet_id"));
@ -219,7 +216,7 @@ public class PetManager {
data.addFoodItem(baseItem); data.addFoodItem(baseItem);
else if (baseItem.getInteractionType().getType() == InteractionPetDrink.class) else if (baseItem.getInteractionType().getType() == InteractionPetDrink.class)
data.addDrinkItem(baseItem); 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); data.addToyItem(baseItem);
} }
} }

View File

@ -2542,6 +2542,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.roomSpecialTypes.removePetDrink((InteractionPetDrink) item); this.roomSpecialTypes.removePetDrink((InteractionPetDrink) item);
} else if (item instanceof InteractionPetFood) { } else if (item instanceof InteractionPetFood) {
this.roomSpecialTypes.removePetFood((InteractionPetFood) item); this.roomSpecialTypes.removePetFood((InteractionPetFood) item);
} else if (item instanceof InteractionPetTree) {
this.roomSpecialTypes.removeUndefined(item);
} else if (item instanceof InteractionMoodLight) { } else if (item instanceof InteractionMoodLight) {
this.roomSpecialTypes.removeUndefined(item); this.roomSpecialTypes.removeUndefined(item);
} else if (item instanceof InteractionPyramid) { } else if (item instanceof InteractionPyramid) {
@ -2578,6 +2580,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
this.roomSpecialTypes.removeUndefined(item); this.roomSpecialTypes.removeUndefined(item);
} else if (item instanceof InteractionSnowboardSlope) { } else if (item instanceof InteractionSnowboardSlope) {
this.roomSpecialTypes.removeUndefined(item); this.roomSpecialTypes.removeUndefined(item);
} else if (item instanceof InteractionBuildArea) {
this.roomSpecialTypes.removeUndefined(item);
} }
} }
} }

View File

@ -42,10 +42,10 @@ public enum RoomUnitStatus {
RELAX("rlx"), RELAX("rlx"),
WINGS("wng", true), WINGS("wng", true),
FLAME("flm"), FLAME("flm"),
RINGOFFIRE("rng"), // ring of fire for dragon, toy undone RINGOFFIRE("rng", true),
SWING("swg"), // same as roll but less energic, related to Dragon tree toy. SWING("swg", true),
HANG("hg"), // hang, related to Dragon tree toy. just hangs under the branch HANG("hg", true),
ROLL("rll"), // roll, related to Dragon tree toy. rolls around the branch ROLL("rll", true),
RIP("rip"), RIP("rip"),
GROW("grw"), GROW("grw"),
@ -69,12 +69,7 @@ public enum RoomUnitStatus {
SLEEP_IN("slp-in"), SLEEP_IN("slp-in"),
SLEEP("slp", true), SLEEP("slp", true),
SLEEP_OUT("slp-out"), SLEEP_OUT("slp-out");
RINGOFFIRE("rng"),
SWING("swg"),
HANG("hg"),
ROLL("rll");
public final String key; public final String key;
public final boolean removeWhenWalking; public final boolean removeWhenWalking;