Merge branch 'fix-pets-finally' into 'fix-pets-finally'

Fix Pet ActionSit

See merge request morningstar/Arcturus-Community!520
This commit is contained in:
Harmonic 2022-04-08 09:21:22 +00:00
commit c32754d1dd
7 changed files with 42 additions and 20 deletions

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.pets.Pet; import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction; import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks; import com.eu.habbo.habbohotel.pets.PetTasks;
@ -10,13 +11,21 @@ import com.eu.habbo.habbohotel.users.Habbo;
public class ActionDown extends PetAction { public class ActionDown extends PetAction {
public ActionDown() { public ActionDown() {
super(PetTasks.DOWN, true); super(PetTasks.DOWN, true);
this.statusToRemove.add(RoomUnitStatus.BEG);
this.statusToRemove.add(RoomUnitStatus.MOVE); this.statusToRemove.add(RoomUnitStatus.MOVE);
this.statusToRemove.add(RoomUnitStatus.SIT); this.statusToRemove.add(RoomUnitStatus.DEAD);
} }
@Override @Override
public boolean apply(Pet pet, Habbo habbo, String[] data) { 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() + "");
Emulator.getThreading().run(() -> {
pet.getRoomUnit().cmdLay = false;
pet.clearPosture();
}, 4000);
if (pet.getHappyness() > 50) if (pet.getHappyness() > 50)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL)); pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
@ -25,4 +34,7 @@ public class ActionDown extends PetAction {
return true; return true;
} }
return true;
}
} }

View File

@ -11,16 +11,14 @@ import com.eu.habbo.threading.runnables.PetFollowHabbo;
public class ActionFollow extends PetAction { public class ActionFollow extends PetAction {
public ActionFollow() { public ActionFollow() {
super(PetTasks.FOLLOW, true); super(PetTasks.FOLLOW, false);
this.statusToRemove.add(RoomUnitStatus.MOVE);
this.statusToRemove.add(RoomUnitStatus.LAY);
this.statusToRemove.add(RoomUnitStatus.DEAD);
} }
@Override @Override
public boolean apply(Pet pet, Habbo habbo, String[] data) { 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)); Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, 0));
if (pet.getHappyness() > 75) if (pet.getHappyness() > 75)

View File

@ -10,14 +10,13 @@ import com.eu.habbo.threading.runnables.PetFollowHabbo;
public class ActionFollowLeft extends PetAction { public class ActionFollowLeft extends PetAction {
public ActionFollowLeft() { public ActionFollowLeft() {
super(PetTasks.FOLLOW, true); super(PetTasks.FOLLOW, false);
} }
@Override @Override
public boolean apply(Pet pet, Habbo habbo, String[] data) { public boolean apply(Pet pet, Habbo habbo, String[] data) {
//Follow left.
pet.clearPosture(); pet.clearPosture();
pet.setTask(PetTasks.FOLLOW);
Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, -2)); Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, -2));
if (pet.getHappyness() > 75) if (pet.getHappyness() > 75)

View File

@ -10,14 +10,13 @@ import com.eu.habbo.threading.runnables.PetFollowHabbo;
public class ActionFollowRight extends PetAction { public class ActionFollowRight extends PetAction {
public ActionFollowRight() { public ActionFollowRight() {
super(PetTasks.FOLLOW, true); super(PetTasks.FOLLOW, false);
} }
@Override @Override
public boolean apply(Pet pet, Habbo habbo, String[] data) { public boolean apply(Pet pet, Habbo habbo, String[] data) {
//Follow right.
pet.clearPosture(); pet.clearPosture();
pet.setTask(PetTasks.FOLLOW);
Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, +2)); Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, +2));
if (pet.getHappyness() > 75) if (pet.getHappyness() > 75)

View File

@ -12,7 +12,6 @@ public class ActionPlayDead extends PetAction {
super(PetTasks.PLAY_DEAD, true); super(PetTasks.PLAY_DEAD, true);
this.statusToRemove.add(RoomUnitStatus.MOVE); this.statusToRemove.add(RoomUnitStatus.MOVE);
this.statusToRemove.add(RoomUnitStatus.LAY); this.statusToRemove.add(RoomUnitStatus.LAY);
this.statusToRemove.add(RoomUnitStatus.DEAD);
} }
@Override @Override

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.pets.Pet; import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction; import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks; import com.eu.habbo.habbohotel.pets.PetTasks;
@ -10,12 +11,22 @@ import com.eu.habbo.habbohotel.users.Habbo;
public class ActionSit extends PetAction { public class ActionSit extends PetAction {
public ActionSit() { public ActionSit() {
super(PetTasks.SIT, true); 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 @Override
public boolean apply(Pet pet, Habbo habbo, String[] data) { public boolean apply(Pet pet, Habbo habbo, String[] data) {
if (pet.getTask() != PetTasks.SIT && !pet.getRoomUnit().hasStatus(RoomUnitStatus.SIT)) { 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) if (pet.getHappyness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL)); pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));

View File

@ -39,7 +39,11 @@ public class PetFollowHabbo implements Runnable {
this.pet.setTask(PetTasks.FOLLOW); this.pet.setTask(PetTasks.FOLLOW);
} }
} }
if(target.distance(this.pet.getRoomUnit().getCurrentLocation()) > 1) {
Emulator.getThreading().run(this, 500); Emulator.getThreading().run(this, 500);
} else {
this.pet.setTask(PetTasks.FREE);
}
} }
} }
} }