Fixed pet action ActionPlayFootball

This commit is contained in:
Beny 2019-05-26 23:44:10 +01:00
parent ef84be59d0
commit 61d7b0e66d

View File

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