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);
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

View File

@ -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);
}
}

View File

@ -2542,6 +2542,8 @@ public class Room implements Comparable<Room>, 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<Room>, ISerialize, Runnable {
this.roomSpecialTypes.removeUndefined(item);
} else if (item instanceof InteractionSnowboardSlope) {
this.roomSpecialTypes.removeUndefined(item);
} else if (item instanceof InteractionBuildArea) {
this.roomSpecialTypes.removeUndefined(item);
}
}
}

View File

@ -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;