mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Merge branch 'fix-pets-finally' into 'fix-pets-finally'
Fix Pet ActionSit See merge request morningstar/Arcturus-Community!520
This commit is contained in:
commit
c32754d1dd
@ -1,5 +1,6 @@
|
||||
package com.eu.habbo.habbohotel.pets.actions;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.pets.Pet;
|
||||
import com.eu.habbo.habbohotel.pets.PetAction;
|
||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||
@ -10,18 +11,29 @@ import com.eu.habbo.habbohotel.users.Habbo;
|
||||
public class ActionDown extends PetAction {
|
||||
public ActionDown() {
|
||||
super(PetTasks.DOWN, true);
|
||||
this.statusToRemove.add(RoomUnitStatus.BEG);
|
||||
this.statusToRemove.add(RoomUnitStatus.MOVE);
|
||||
this.statusToRemove.add(RoomUnitStatus.SIT);
|
||||
this.statusToRemove.add(RoomUnitStatus.DEAD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Pet pet, Habbo habbo, String[] data) {
|
||||
pet.getRoomUnit().setStatus(RoomUnitStatus.LAY, pet.getRoom().getStackHeight(pet.getRoomUnit().getX(), pet.getRoomUnit().getY(), false) + "");
|
||||
if (pet.getTask() != PetTasks.DOWN && !pet.getRoomUnit().hasStatus(RoomUnitStatus.LAY)) {
|
||||
pet.getRoomUnit().cmdLay = true;
|
||||
pet.getRoomUnit().setStatus(RoomUnitStatus.LAY, pet.getRoomUnit().getCurrentLocation().getStackHeight() + "");
|
||||
|
||||
if (pet.getHappyness() > 50)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
|
||||
else
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
|
||||
Emulator.getThreading().run(() -> {
|
||||
pet.getRoomUnit().cmdLay = false;
|
||||
pet.clearPosture();
|
||||
}, 4000);
|
||||
|
||||
if (pet.getHappyness() > 50)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
|
||||
else
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -11,16 +11,14 @@ import com.eu.habbo.threading.runnables.PetFollowHabbo;
|
||||
|
||||
public class ActionFollow extends PetAction {
|
||||
public ActionFollow() {
|
||||
super(PetTasks.FOLLOW, true);
|
||||
this.statusToRemove.add(RoomUnitStatus.MOVE);
|
||||
this.statusToRemove.add(RoomUnitStatus.LAY);
|
||||
this.statusToRemove.add(RoomUnitStatus.DEAD);
|
||||
super(PetTasks.FOLLOW, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Pet pet, Habbo habbo, String[] data) {
|
||||
pet.clearPosture();
|
||||
|
||||
pet.clearPosture();
|
||||
pet.setTask(PetTasks.FOLLOW);
|
||||
Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, 0));
|
||||
|
||||
if (pet.getHappyness() > 75)
|
||||
|
@ -10,14 +10,13 @@ import com.eu.habbo.threading.runnables.PetFollowHabbo;
|
||||
|
||||
public class ActionFollowLeft extends PetAction {
|
||||
public ActionFollowLeft() {
|
||||
super(PetTasks.FOLLOW, true);
|
||||
super(PetTasks.FOLLOW, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Pet pet, Habbo habbo, String[] data) {
|
||||
//Follow left.
|
||||
pet.clearPosture();
|
||||
|
||||
pet.setTask(PetTasks.FOLLOW);
|
||||
Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, -2));
|
||||
|
||||
if (pet.getHappyness() > 75)
|
||||
|
@ -10,14 +10,13 @@ import com.eu.habbo.threading.runnables.PetFollowHabbo;
|
||||
|
||||
public class ActionFollowRight extends PetAction {
|
||||
public ActionFollowRight() {
|
||||
super(PetTasks.FOLLOW, true);
|
||||
super(PetTasks.FOLLOW, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Pet pet, Habbo habbo, String[] data) {
|
||||
//Follow right.
|
||||
pet.clearPosture();
|
||||
|
||||
pet.setTask(PetTasks.FOLLOW);
|
||||
Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, +2));
|
||||
|
||||
if (pet.getHappyness() > 75)
|
||||
|
@ -12,7 +12,6 @@ public class ActionPlayDead extends PetAction {
|
||||
super(PetTasks.PLAY_DEAD, true);
|
||||
this.statusToRemove.add(RoomUnitStatus.MOVE);
|
||||
this.statusToRemove.add(RoomUnitStatus.LAY);
|
||||
this.statusToRemove.add(RoomUnitStatus.DEAD);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.eu.habbo.habbohotel.pets.actions;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.pets.Pet;
|
||||
import com.eu.habbo.habbohotel.pets.PetAction;
|
||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||
@ -10,12 +11,22 @@ import com.eu.habbo.habbohotel.users.Habbo;
|
||||
public class ActionSit extends PetAction {
|
||||
public ActionSit() {
|
||||
super(PetTasks.SIT, true);
|
||||
this.statusToRemove.add(RoomUnitStatus.BEG);
|
||||
this.statusToRemove.add(RoomUnitStatus.MOVE);
|
||||
this.statusToRemove.add(RoomUnitStatus.LAY);
|
||||
this.statusToRemove.add(RoomUnitStatus.DEAD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Pet pet, Habbo habbo, String[] data) {
|
||||
if (pet.getTask() != PetTasks.SIT && !pet.getRoomUnit().hasStatus(RoomUnitStatus.SIT)) {
|
||||
pet.getRoomUnit().setStatus(RoomUnitStatus.SIT, pet.getRoom().getStackHeight(pet.getRoomUnit().getX(), pet.getRoomUnit().getY(), false) - 0.50 + "");
|
||||
pet.getRoomUnit().cmdSit = true;
|
||||
pet.getRoomUnit().setStatus(RoomUnitStatus.SIT, pet.getRoomUnit().getCurrentLocation().getStackHeight() + "");
|
||||
|
||||
Emulator.getThreading().run(() -> {
|
||||
pet.getRoomUnit().cmdSit = false;
|
||||
pet.clearPosture();
|
||||
}, 4000);
|
||||
|
||||
if (pet.getHappyness() > 75)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
|
||||
|
@ -39,7 +39,11 @@ public class PetFollowHabbo implements Runnable {
|
||||
this.pet.setTask(PetTasks.FOLLOW);
|
||||
}
|
||||
}
|
||||
Emulator.getThreading().run(this, 500);
|
||||
if(target.distance(this.pet.getRoomUnit().getCurrentLocation()) > 1) {
|
||||
Emulator.getThreading().run(this, 500);
|
||||
} else {
|
||||
this.pet.setTask(PetTasks.FREE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user