Fix turtles roll

This commit is contained in:
brenoepic 2022-04-10 19:35:51 -03:00
parent 56677c2e15
commit 90fec0f18a

View File

@ -1,5 +1,6 @@
package com.eu.habbo.habbohotel.pets.actions; package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetTree; import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetTree;
import com.eu.habbo.habbohotel.pets.Pet; import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction; import com.eu.habbo.habbohotel.pets.PetAction;
@ -7,6 +8,7 @@ import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.pets.PetVocalsType; import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.RoomTileState;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -36,7 +38,7 @@ public class ActionRoll extends PetAction {
ArrayList<RoomTile> tileList = new ArrayList<>(); ArrayList<RoomTile> tileList = new ArrayList<>();
for (HabboItem petTree : petTrees) { for (HabboItem petTree : petTrees) {
if (petTree == null || petTree.getRoomId() != pet.getRoom().getId()) continue; if (petTree == null || !pet.getPetData().haveToyItem(petTree.getBaseItem())) continue;
tileList.addAll(petTree.getOccupyingTiles(pet.getRoom().getLayout())); tileList.addAll(petTree.getOccupyingTiles(pet.getRoom().getLayout()));
} }
@ -62,6 +64,17 @@ public class ActionRoll extends PetAction {
} else pet.getRoomUnit().setGoalLocation(goal); } else pet.getRoomUnit().setGoalLocation(goal);
return true; return true;
} else { } else {
if (pet.getPetData().getToyItems().stream().noneMatch(item -> item.getInteractionType().getType() == InteractionPetTree.class)) {
pet.getRoomUnit().setCanWalk(false);
pet.getRoomUnit().setStatus(RoomUnitStatus.ROLL, pet.getRoomUnit().getCurrentLocation().getStackHeight() + "");
Emulator.getThreading().run(() -> {
pet.getRoomUnit().setCanWalk(true);
pet.clearPosture();
}, 4000);
return true;
}
pet.say(pet.getPetData().randomVocal(PetVocalsType.DISOBEY)); pet.say(pet.getPetData().randomVocal(PetVocalsType.DISOBEY));
return false; return false;
} }