From 61d7b0e66d6b2a88979c5fe61379b1a876ab038c Mon Sep 17 00:00:00 2001 From: Beny Date: Sun, 26 May 2019 23:44:10 +0100 Subject: [PATCH] Fixed pet action ActionPlayFootball --- .../pets/actions/ActionPlayFootball.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionPlayFootball.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionPlayFootball.java index 7f8cc949..3f11cdc1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionPlayFootball.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionPlayFootball.java @@ -1,9 +1,12 @@ package com.eu.habbo.habbohotel.pets.actions; +import com.eu.habbo.habbohotel.items.interactions.InteractionPushable; import com.eu.habbo.habbohotel.pets.Pet; import com.eu.habbo.habbohotel.pets.PetAction; import com.eu.habbo.habbohotel.pets.PetVocalsType; +import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboItem; public class ActionPlayFootball extends PetAction { public ActionPlayFootball() { @@ -12,6 +15,25 @@ public class ActionPlayFootball extends PetAction { @Override public boolean apply(Pet pet, Habbo habbo, String[] data) { + + Room room = pet.getRoom(); + + if(room == null || room.getLayout() == null) + return false; + + HabboItem foundBall = null; + + for(HabboItem item : room.getFloorItems()) { + if(item instanceof InteractionPushable) { + foundBall = item; + } + } + + if(foundBall == null) + return false; + + pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(foundBall.getX(), foundBall.getY())); + if (pet.getHappyness() > 75) pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL)); else