Merge branch 'fix-pets-finally' of https://git.krews.org/brenoepic/Arcturus-Community into fix-pets-finally

This commit is contained in:
brenoepic 2022-04-09 15:30:15 -03:00
commit 930987d9fa
6 changed files with 49 additions and 6 deletions

View File

@ -52,6 +52,7 @@ public class PetManager {
this.put(15, new ActionFollowLeft());
this.put(16, new ActionFollowRight());
this.put(17, new ActionPlayFootball());
this.put(21, new ActionDance());
this.put(24, new ActionMoveForward());
this.put(25, new ActionTurnLeft());
this.put(26, new ActionTurnRight());
@ -59,6 +60,7 @@ public class PetManager {
this.put(28, new ActionCroak());
this.put(29, new ActionDip());
this.put(30, new ActionWave());
this.put(31, new ActionDance());
this.put(35, new ActionWings());
this.put(36, new ActionBreatheFire());
this.put(37, new ActionHang());

View File

@ -0,0 +1,32 @@
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.PetVocalsType;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.threading.runnables.PetClearPosture;
public class ActionDance extends PetAction {
public ActionDance() {
super(null, true);
this.minimumActionDuration = 3000;
this.statusToSet.add(RoomUnitStatus.DANCE);
}
// mambojambo works better than ur dancing skills
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data) {
if (pet.getHappyness() < 50) {
pet.say(pet.getPetData().randomVocal(PetVocalsType.DISOBEY));
return false;
} else {
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
}
Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.DANCE, null, false), this.minimumActionDuration);
return true;
}
}

View File

@ -14,6 +14,7 @@ public class ActionTurnLeft extends PetAction {
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data) {
pet.getRoomUnit().setBodyRotation(RoomUserRotation.values()[(pet.getRoomUnit().getBodyRotation().getValue() - 1 < 0 ? 7 : pet.getRoomUnit().getBodyRotation().getValue() - 1)]);
pet.getRoomUnit().setHeadRotation(RoomUserRotation.values()[(pet.getRoomUnit().getHeadRotation().getValue() - 1 < 0 ? 7 : pet.getRoomUnit().getHeadRotation().getValue() - 1)]);
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
return true;
}

View File

@ -14,6 +14,7 @@ public class ActionTurnRight extends PetAction {
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data) {
pet.getRoomUnit().setBodyRotation(RoomUserRotation.values()[(pet.getRoomUnit().getBodyRotation().getValue() + 1 > 7 ? 0 : pet.getRoomUnit().getBodyRotation().getValue() + 1)]);
pet.getRoomUnit().setHeadRotation(RoomUserRotation.values()[(pet.getRoomUnit().getHeadRotation().getValue() + 1 > 7 ? 0 : pet.getRoomUnit().getHeadRotation().getValue() + 1)]);
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
return true;
}

View File

@ -472,7 +472,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
b.setRoomUnit(new RoomUnit());
b.getRoomUnit().setPathFinderRoom(this);
b.getRoomUnit().setLocation(this.layout.getTile((short) set.getInt("x"), (short) set.getInt("y")));
if (b.getRoomUnit().getCurrentLocation() == null) {
if (b.getRoomUnit().getCurrentLocation() == null || b.getRoomUnit().getCurrentLocation().state == RoomTileState.INVALID) {
b.getRoomUnit().setZ(this.getLayout().getDoorTile().getStackHeight());
b.getRoomUnit().setLocation(this.getLayout().getDoorTile());
b.getRoomUnit().setRotation(RoomUserRotation.fromValue(this.getLayout().getDoorDirection()));
} else {
@ -507,7 +508,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
pet.setRoomUnit(new RoomUnit());
pet.getRoomUnit().setPathFinderRoom(this);
pet.getRoomUnit().setLocation(this.layout.getTile((short) set.getInt("x"), (short) set.getInt("y")));
if (pet.getRoomUnit().getCurrentLocation() == null) {
if (pet.getRoomUnit().getCurrentLocation() == null || pet.getRoomUnit().getCurrentLocation().state == RoomTileState.INVALID) {
pet.getRoomUnit().setZ(this.getLayout().getDoorTile().getStackHeight());
pet.getRoomUnit().setLocation(this.getLayout().getDoorTile());
pet.getRoomUnit().setRotation(RoomUserRotation.fromValue(this.getLayout().getDoorDirection()));
} else {

View File

@ -42,6 +42,11 @@ public enum RoomUnitStatus {
RELAX("rlx"),
WINGS("wng", true),
FLAME("flm"),
RINGOFFIRE("rng"), // ring of fire for dragon, toy undone
SWING("swg"), // same as roll but less energic, related to Dragon tree toy.
HANG("hg"), // hang, related to Dragon tree toy. just hangs under the branch
ROLL("rll"), // roll, related to Dragon tree toy. rolls around the branch
RIP("rip"),
GROW("grw"),
GROW_1("grw1"),
@ -66,10 +71,10 @@ public enum RoomUnitStatus {
SLEEP("slp", true),
SLEEP_OUT("slp-out"),
RINGOFFIRE("rng"), // ring of fire for dragon, toy undone
SWING("swg"), // same as roll but less energic, related to Dragon tree toy.
HANG("hg"), // hang, related to Dragon tree toy. just hangs under the branch
ROLL("rll"); // roll, related to Dragon tree toy. rolls around the branch
RINGOFFIRE("rng"),
SWING("swg"),
HANG("hg"),
ROLL("rll");
public final String key;
public final boolean removeWhenWalking;