mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 07:20:50 +01:00
Perfected horses and made RideablePet class - ability for other pets to be ridden through Plugin API
This commit is contained in:
parent
0c61542a25
commit
8716d42df9
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item;
|
|||||||
import com.eu.habbo.habbohotel.pets.HorsePet;
|
import com.eu.habbo.habbohotel.pets.HorsePet;
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||||
|
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
||||||
@ -67,27 +68,24 @@ public class InteractionNest extends HabboItem
|
|||||||
|
|
||||||
Pet pet = room.getPet(roomUnit);
|
Pet pet = room.getPet(roomUnit);
|
||||||
|
|
||||||
if(pet != null)
|
if(pet == null)
|
||||||
{
|
return;
|
||||||
if(pet instanceof HorsePet)
|
|
||||||
{
|
|
||||||
if(((HorsePet) pet).getRider() != null)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pet.getPetData().haveNest(this))
|
if(pet instanceof RideablePet && ((RideablePet) pet).getRider() != null)
|
||||||
{
|
return;
|
||||||
if (pet.getEnergy() <= 85)
|
|
||||||
{
|
if(!pet.getPetData().haveNest(this))
|
||||||
pet.setTask(PetTasks.NEST);
|
return;
|
||||||
pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getX(), this.getY()));
|
|
||||||
pet.getRoomUnit().clearStatus();
|
if(pet.getEnergy() > 85)
|
||||||
pet.getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
|
return;
|
||||||
pet.getRoomUnit().setStatus(RoomUnitStatus.LAY, room.getStackHeight(this.getX(), this.getY(), false) + "");
|
|
||||||
room.sendComposer(new RoomUserStatusComposer(roomUnit).compose());
|
pet.setTask(PetTasks.NEST);
|
||||||
}
|
pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getX(), this.getY()));
|
||||||
}
|
pet.getRoomUnit().clearStatus();
|
||||||
}
|
pet.getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
|
||||||
|
pet.getRoomUnit().setStatus(RoomUnitStatus.LAY, room.getStackHeight(this.getX(), this.getY(), false) + "");
|
||||||
|
room.sendComposer(new RoomUserStatusComposer(roomUnit).compose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,31 +1,24 @@
|
|||||||
package com.eu.habbo.habbohotel.pets;
|
package com.eu.habbo.habbohotel.pets;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class HorsePet extends Pet
|
public class HorsePet extends RideablePet
|
||||||
{
|
{
|
||||||
private int hairColor;
|
private int hairColor;
|
||||||
private int hairStyle;
|
private int hairStyle;
|
||||||
|
|
||||||
private boolean hasSaddle;
|
|
||||||
private boolean anyoneCanRide;
|
|
||||||
|
|
||||||
private Habbo rider;
|
|
||||||
|
|
||||||
public HorsePet(ResultSet set) throws SQLException
|
public HorsePet(ResultSet set) throws SQLException
|
||||||
{
|
{
|
||||||
super(set);
|
super(set);
|
||||||
this.hairColor = set.getInt("hair_color");
|
this.hairColor = set.getInt("hair_color");
|
||||||
this.hairStyle = set.getInt("hair_style");
|
this.hairStyle = set.getInt("hair_style");
|
||||||
this.hasSaddle = set.getString("saddle").equalsIgnoreCase("1");
|
this.hasSaddle(set.getString("saddle").equalsIgnoreCase("1"));
|
||||||
this.anyoneCanRide = set.getString("ride").equalsIgnoreCase("1");
|
this.setAnyoneCanRide(set.getString("ride").equalsIgnoreCase("1"));
|
||||||
this.rider = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public HorsePet(int type, int race, String color, String name, int userId)
|
public HorsePet(int type, int race, String color, String name, int userId)
|
||||||
@ -33,9 +26,8 @@ public class HorsePet extends Pet
|
|||||||
super(type, race, color, name, userId);
|
super(type, race, color, name, userId);
|
||||||
this.hairColor = 0;
|
this.hairColor = 0;
|
||||||
this.hairStyle = -1;
|
this.hairStyle = -1;
|
||||||
this.hasSaddle = false;
|
this.hasSaddle(false);
|
||||||
this.anyoneCanRide = false;
|
this.setAnyoneCanRide(false);
|
||||||
this.rider = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -47,8 +39,8 @@ public class HorsePet extends Pet
|
|||||||
{
|
{
|
||||||
statement.setInt(1, this.hairStyle);
|
statement.setInt(1, this.hairStyle);
|
||||||
statement.setInt(2, this.hairColor);
|
statement.setInt(2, this.hairColor);
|
||||||
statement.setString(3, this.hasSaddle ? "1" : "0");
|
statement.setString(3, this.hasSaddle() ? "1" : "0");
|
||||||
statement.setString(4, this.anyoneCanRide ? "1" : "0");
|
statement.setString(4, this.anyoneCanRide() ? "1" : "0");
|
||||||
statement.setInt(5, super.getId());
|
statement.setInt(5, super.getId());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
}
|
}
|
||||||
@ -80,34 +72,4 @@ public class HorsePet extends Pet
|
|||||||
{
|
{
|
||||||
this.hairStyle = hairStyle;
|
this.hairStyle = hairStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSaddle()
|
|
||||||
{
|
|
||||||
return this.hasSaddle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hasSaddle(boolean hasSaddle)
|
|
||||||
{
|
|
||||||
this.hasSaddle = hasSaddle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean anyoneCanRide()
|
|
||||||
{
|
|
||||||
return this.anyoneCanRide;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAnyoneCanRide(boolean anyoneCanRide)
|
|
||||||
{
|
|
||||||
this.anyoneCanRide = anyoneCanRide;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Habbo getRider()
|
|
||||||
{
|
|
||||||
return this.rider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRider(Habbo rider)
|
|
||||||
{
|
|
||||||
this.rider = rider;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
53
src/main/java/com/eu/habbo/habbohotel/pets/RideablePet.java
Normal file
53
src/main/java/com/eu/habbo/habbohotel/pets/RideablePet.java
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
package com.eu.habbo.habbohotel.pets;
|
||||||
|
|
||||||
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class RideablePet extends Pet {
|
||||||
|
|
||||||
|
private Habbo rider;
|
||||||
|
private boolean hasSaddle;
|
||||||
|
private boolean anyoneCanRide;
|
||||||
|
|
||||||
|
public RideablePet(ResultSet set) throws SQLException {
|
||||||
|
super(set);
|
||||||
|
this.rider = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RideablePet(int type, int race, String color, String name, int userId) {
|
||||||
|
super(type, race, color, name, userId);
|
||||||
|
this.rider = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasSaddle()
|
||||||
|
{
|
||||||
|
return this.hasSaddle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hasSaddle(boolean hasSaddle)
|
||||||
|
{
|
||||||
|
this.hasSaddle = hasSaddle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean anyoneCanRide()
|
||||||
|
{
|
||||||
|
return this.anyoneCanRide;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnyoneCanRide(boolean anyoneCanRide)
|
||||||
|
{
|
||||||
|
this.anyoneCanRide = anyoneCanRide;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Habbo getRider()
|
||||||
|
{
|
||||||
|
return this.rider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRider(Habbo rider)
|
||||||
|
{
|
||||||
|
this.rider = rider;
|
||||||
|
}
|
||||||
|
}
|
@ -22,10 +22,8 @@ import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
|
|||||||
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob;
|
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob;
|
||||||
import com.eu.habbo.habbohotel.messenger.MessengerBuddy;
|
import com.eu.habbo.habbohotel.messenger.MessengerBuddy;
|
||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.pets.HorsePet;
|
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
import com.eu.habbo.habbohotel.pets.PetManager;
|
import com.eu.habbo.habbohotel.pets.PetManager;
|
||||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
|
||||||
import com.eu.habbo.habbohotel.users.*;
|
import com.eu.habbo.habbohotel.users.*;
|
||||||
import com.eu.habbo.habbohotel.wired.*;
|
import com.eu.habbo.habbohotel.wired.*;
|
||||||
import com.eu.habbo.messages.ISerialize;
|
import com.eu.habbo.messages.ISerialize;
|
||||||
@ -1569,21 +1567,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
|
|||||||
pet.packetUpdate = false;
|
pet.packetUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pet.getTask() == PetTasks.RIDE)
|
|
||||||
{
|
|
||||||
if (pet instanceof HorsePet)
|
|
||||||
{
|
|
||||||
HorsePet horse = ((HorsePet) pet);
|
|
||||||
if (horse.getRider() != null)
|
|
||||||
{
|
|
||||||
if (!horse.getRider().getRoomUnit().getCurrentLocation().equals(horse.getRoomUnit().getCurrentLocation()))
|
|
||||||
{
|
|
||||||
horse.getRoomUnit().setGoalLocation(horse.getRider().getRoomUnit().getCurrentLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pet.getRoomUnit().isWalking() && pet.getRoomUnit().getPath().size() == 1 && pet.getRoomUnit().hasStatus(RoomUnitStatus.GESTURE))
|
if (pet.getRoomUnit().isWalking() && pet.getRoomUnit().getPath().size() == 1 && pet.getRoomUnit().hasStatus(RoomUnitStatus.GESTURE))
|
||||||
{
|
{
|
||||||
pet.getRoomUnit().removeStatus(RoomUnitStatus.GESTURE);
|
pet.getRoomUnit().removeStatus(RoomUnitStatus.GESTURE);
|
||||||
|
@ -654,6 +654,28 @@ public class RoomLayout
|
|||||||
return tiles;
|
return tiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<RoomTile> getWalkableTilesAround(RoomTile tile) {
|
||||||
|
return getWalkableTilesAround(tile, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RoomTile> getWalkableTilesAround(RoomTile tile, int directionOffset) {
|
||||||
|
List<RoomTile> availableTiles = new ArrayList<>(this.getTilesAround(tile, directionOffset));
|
||||||
|
|
||||||
|
List<RoomTile> toRemove = new ArrayList<>();
|
||||||
|
|
||||||
|
for(RoomTile t : availableTiles) {
|
||||||
|
if(t == null || t.state != RoomTileState.OPEN || !t.isWalkable()) {
|
||||||
|
toRemove.add(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(RoomTile t : toRemove) {
|
||||||
|
availableTiles.remove(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
return availableTiles;
|
||||||
|
}
|
||||||
|
|
||||||
public static Rectangle getRectangle(int x, int y, int width, int length, int rotation)
|
public static Rectangle getRectangle(int x, int y, int width, int length, int rotation)
|
||||||
{
|
{
|
||||||
rotation = (rotation % 8);
|
rotation = (rotation % 8);
|
||||||
|
@ -6,8 +6,8 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionGuildGate;
|
|||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionMultiHeight;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionMultiHeight;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionTeleport;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionTeleport;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeBlock;
|
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeBlock;
|
||||||
import com.eu.habbo.habbohotel.pets.HorsePet;
|
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
|
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||||
import com.eu.habbo.habbohotel.users.DanceType;
|
import com.eu.habbo.habbohotel.users.DanceType;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
@ -117,15 +117,15 @@ public class RoomUnit
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean isHorse = false;
|
Boolean isRiding = false;
|
||||||
Pet pet = room.getPet(this);
|
Pet pet = room.getPet(this);
|
||||||
if(pet != null) {
|
if(pet != null) {
|
||||||
if(pet instanceof HorsePet) {
|
if(pet instanceof RideablePet) {
|
||||||
isHorse = true;
|
isRiding = true;
|
||||||
if (((HorsePet) pet).getRider() != null) {
|
if (((RideablePet) pet).getRider() != null) {
|
||||||
if(!((HorsePet) pet).getRider().getRoomUnit().isWalking()) {
|
if(!((RideablePet) pet).getRider().getRoomUnit().isWalking()) {
|
||||||
this.status.remove(RoomUnitStatus.MOVE);
|
this.status.remove(RoomUnitStatus.MOVE);
|
||||||
this.setCurrentLocation(((HorsePet) pet).getRider().getRoomUnit().getPreviousLocation());
|
this.setCurrentLocation(((RideablePet) pet).getRider().getRoomUnit().getPreviousLocation());
|
||||||
if (this.status.remove(RoomUnitStatus.MOVE) != null) this.statusUpdate = true;
|
if (this.status.remove(RoomUnitStatus.MOVE) != null) this.statusUpdate = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ public class RoomUnit
|
|||||||
|
|
||||||
if (next != null && room.hasHabbosAt(next.x, next.y))
|
if (next != null && room.hasHabbosAt(next.x, next.y))
|
||||||
{
|
{
|
||||||
if(!isHorse) {
|
if(!isRiding) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ public class RoomUnit
|
|||||||
|
|
||||||
double zHeight = 0.0D;
|
double zHeight = 0.0D;
|
||||||
|
|
||||||
if (((habbo != null && habbo.getHabboInfo().getRiding() != null) || isHorse) && next.equals(this.goalLocation) && (next.state == RoomTileState.SIT || next.state == RoomTileState.LAY)) {
|
if (((habbo != null && habbo.getHabboInfo().getRiding() != null) || isRiding) && next.equals(this.goalLocation) && (next.state == RoomTileState.SIT || next.state == RoomTileState.LAY)) {
|
||||||
this.status.remove(RoomUnitStatus.MOVE);
|
this.status.remove(RoomUnitStatus.MOVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -368,14 +368,14 @@ public class RoomUnit
|
|||||||
|
|
||||||
if (ridingUnit != null)
|
if (ridingUnit != null)
|
||||||
{
|
{
|
||||||
|
ridingUnit.setPreviousLocationZ(this.getZ());
|
||||||
this.setZ(zHeight - 1.0);
|
this.setZ(zHeight - 1.0);
|
||||||
ridingUnit.setRotation(RoomUserRotation.values()[Rotation.Calculate(this.getX(), this.getY(), next.x, next.y)]);
|
ridingUnit.setRotation(RoomUserRotation.values()[Rotation.Calculate(this.getX(), this.getY(), next.x, next.y)]);
|
||||||
ridingUnit.setPreviousLocation(this.getCurrentLocation());
|
ridingUnit.setPreviousLocation(this.getCurrentLocation());
|
||||||
ridingUnit.setGoalLocation(this.getGoal());
|
ridingUnit.setGoalLocation(this.getGoal());
|
||||||
ridingUnit.setStatus(RoomUnitStatus.MOVE, next.x + "," + next.y + "," + (zHeight - 1.0));
|
ridingUnit.setStatus(RoomUnitStatus.MOVE, next.x + "," + next.y + "," + (zHeight - 1.0));
|
||||||
ridingUnit.setZ(zHeight - 1.0);
|
|
||||||
room.sendComposer(new RoomUserStatusComposer(ridingUnit).compose());
|
room.sendComposer(new RoomUserStatusComposer(ridingUnit).compose());
|
||||||
|
//ridingUnit.setZ(zHeight - 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,13 @@ import com.eu.habbo.habbohotel.games.Game;
|
|||||||
import com.eu.habbo.habbohotel.games.GamePlayer;
|
import com.eu.habbo.habbohotel.games.GamePlayer;
|
||||||
import com.eu.habbo.habbohotel.permissions.Rank;
|
import com.eu.habbo.habbohotel.permissions.Rank;
|
||||||
import com.eu.habbo.habbohotel.pets.HorsePet;
|
import com.eu.habbo.habbohotel.pets.HorsePet;
|
||||||
|
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||||
|
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
|
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
|
||||||
|
import com.eu.habbo.threading.runnables.RoomUnitRidePet;
|
||||||
import gnu.trove.map.hash.TIntIntHashMap;
|
import gnu.trove.map.hash.TIntIntHashMap;
|
||||||
import gnu.trove.procedure.TIntIntProcedure;
|
import gnu.trove.procedure.TIntIntProcedure;
|
||||||
|
|
||||||
@ -14,6 +20,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class HabboInfo implements Runnable
|
public class HabboInfo implements Runnable
|
||||||
{
|
{
|
||||||
@ -40,7 +48,7 @@ public class HabboInfo implements Runnable
|
|||||||
private Room currentRoom;
|
private Room currentRoom;
|
||||||
private int roomQueueId;
|
private int roomQueueId;
|
||||||
|
|
||||||
private HorsePet riding;
|
private RideablePet riding;
|
||||||
|
|
||||||
private Class<? extends Game> currentGame;
|
private Class<? extends Game> currentGame;
|
||||||
private TIntIntHashMap currencies;
|
private TIntIntHashMap currencies;
|
||||||
@ -357,12 +365,49 @@ public class HabboInfo implements Runnable
|
|||||||
this.roomQueueId = roomQueueId;
|
this.roomQueueId = roomQueueId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HorsePet getRiding()
|
public RideablePet getRiding()
|
||||||
{
|
{
|
||||||
return this.riding;
|
return this.riding;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRiding(HorsePet riding)
|
public void dismountPet() {
|
||||||
|
this.dismountPet(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dismountPet(boolean isRemoving) {
|
||||||
|
if(this.getRiding() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Habbo habbo = this.getCurrentRoom().getHabbo(this.getId());
|
||||||
|
if(habbo == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RideablePet riding = this.getRiding();
|
||||||
|
|
||||||
|
riding.setRider(null);
|
||||||
|
riding.setTask(PetTasks.FREE);
|
||||||
|
this.setRiding(null);
|
||||||
|
|
||||||
|
Room room = this.getCurrentRoom();
|
||||||
|
if(room != null)
|
||||||
|
room.giveEffect(habbo, 0, -1);
|
||||||
|
|
||||||
|
RoomUnit roomUnit = habbo.getRoomUnit();
|
||||||
|
if(roomUnit == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
roomUnit.setZ(riding.getRoomUnit().getZ());
|
||||||
|
roomUnit.setPreviousLocationZ(riding.getRoomUnit().getZ());
|
||||||
|
roomUnit.stopWalking();
|
||||||
|
room.sendComposer(new RoomUserStatusComposer(roomUnit).compose());
|
||||||
|
List<RoomTile> availableTiles = isRemoving ? new ArrayList<>() : this.getCurrentRoom().getLayout().getWalkableTilesAround(roomUnit.getCurrentLocation());
|
||||||
|
|
||||||
|
RoomTile tile = availableTiles.isEmpty() ? roomUnit.getCurrentLocation() : availableTiles.get(0);
|
||||||
|
roomUnit.setGoalLocation(tile);
|
||||||
|
roomUnit.statusUpdate(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRiding(RideablePet riding)
|
||||||
{
|
{
|
||||||
this.riding = riding;
|
this.riding = riding;
|
||||||
}
|
}
|
||||||
|
@ -549,9 +549,9 @@ public class PacketManager
|
|||||||
this.registerHandler(Incoming.PetPickupEvent, PetPickupEvent.class);
|
this.registerHandler(Incoming.PetPickupEvent, PetPickupEvent.class);
|
||||||
this.registerHandler(Incoming.ScratchPetEvent, ScratchPetEvent.class);
|
this.registerHandler(Incoming.ScratchPetEvent, ScratchPetEvent.class);
|
||||||
this.registerHandler(Incoming.RequestPetTrainingPanelEvent, RequestPetTrainingPanelEvent.class);
|
this.registerHandler(Incoming.RequestPetTrainingPanelEvent, RequestPetTrainingPanelEvent.class);
|
||||||
this.registerHandler(Incoming.HorseUseItemEvent, HorseUseItemEvent.class);
|
this.registerHandler(Incoming.HorseUseItemEvent, PetUseItemEvent.class);
|
||||||
this.registerHandler(Incoming.HorseRideSettingsEvent, HorseRideSettingsEvent.class);
|
this.registerHandler(Incoming.HorseRideSettingsEvent, PetRideSettingsEvent.class);
|
||||||
this.registerHandler(Incoming.HorseRideEvent, HorseRideEvent.class);
|
this.registerHandler(Incoming.HorseRideEvent, PetRideEvent.class);
|
||||||
this.registerHandler(Incoming.ToggleMonsterplantBreedableEvent, ToggleMonsterplantBreedableEvent.class);
|
this.registerHandler(Incoming.ToggleMonsterplantBreedableEvent, ToggleMonsterplantBreedableEvent.class);
|
||||||
this.registerHandler(Incoming.CompostMonsterplantEvent, CompostMonsterplantEvent.class);
|
this.registerHandler(Incoming.CompostMonsterplantEvent, CompostMonsterplantEvent.class);
|
||||||
this.registerHandler(Incoming.BreedMonsterplantsEvent, BreedMonsterplantsEvent.class);
|
this.registerHandler(Incoming.BreedMonsterplantsEvent, BreedMonsterplantsEvent.class);
|
||||||
|
@ -396,9 +396,9 @@ public class PacketManager_1006
|
|||||||
this.registerHandler(Incoming.PetPickupEvent, PetPickupEvent.class);
|
this.registerHandler(Incoming.PetPickupEvent, PetPickupEvent.class);
|
||||||
this.registerHandler(Incoming.ScratchPetEvent, ScratchPetEvent.class);
|
this.registerHandler(Incoming.ScratchPetEvent, ScratchPetEvent.class);
|
||||||
this.registerHandler(Incoming.RequestPetTrainingPanelEvent, RequestPetTrainingPanelEvent.class);
|
this.registerHandler(Incoming.RequestPetTrainingPanelEvent, RequestPetTrainingPanelEvent.class);
|
||||||
this.registerHandler(Incoming.HorseUseItemEvent, HorseUseItemEvent.class);
|
this.registerHandler(Incoming.HorseUseItemEvent, PetUseItemEvent.class);
|
||||||
this.registerHandler(Incoming.HorseRideSettingsEvent, HorseRideSettingsEvent.class);
|
this.registerHandler(Incoming.HorseRideSettingsEvent, PetRideSettingsEvent.class);
|
||||||
this.registerHandler(Incoming.HorseRideEvent, HorseRideEvent.class);
|
this.registerHandler(Incoming.HorseRideEvent, PetRideEvent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerWired()
|
void registerWired()
|
||||||
|
@ -1,76 +0,0 @@
|
|||||||
package com.eu.habbo.messages.incoming.rooms.pets;
|
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
|
||||||
import com.eu.habbo.habbohotel.pets.HorsePet;
|
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
|
||||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserEffectComposer;
|
|
||||||
import com.eu.habbo.threading.runnables.RoomUnitRideHorse;
|
|
||||||
|
|
||||||
public class HorseRideEvent extends MessageHandler
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void handle() throws Exception
|
|
||||||
{
|
|
||||||
int petId = this.packet.readInt();
|
|
||||||
|
|
||||||
if(this.client.getHabbo().getHabboInfo().getCurrentRoom() == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Pet pet = this.client.getHabbo().getHabboInfo().getCurrentRoom().getPet(petId);
|
|
||||||
|
|
||||||
if(!(pet instanceof HorsePet))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(this.client.getHabbo().getHabboInfo().getRiding() == null)
|
|
||||||
{
|
|
||||||
if (((HorsePet) pet).anyoneCanRide() || this.client.getHabbo().getHabboInfo().getId() == pet.getUserId())
|
|
||||||
{
|
|
||||||
if (((HorsePet) pet).getRider() != null)
|
|
||||||
{
|
|
||||||
if (this.client.getHabbo().getHabboInfo().getId() == pet.getUserId())
|
|
||||||
{
|
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(((HorsePet) pet).getRider(), 0, -1);
|
|
||||||
((HorsePet) pet).getRider().getHabboInfo().setRiding(null);
|
|
||||||
((HorsePet) pet).setRider(null);
|
|
||||||
pet.setTask(PetTasks.FREE);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
//TODO: Say somebody else is already riding.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RoomTile goalTile = this.client.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(this.client.getHabbo().getRoomUnit().getCurrentLocation(), this.client.getHabbo().getRoomUnit().getBodyRotation().getValue());
|
|
||||||
|
|
||||||
if (goalTile != null)
|
|
||||||
{
|
|
||||||
if (goalTile.equals(this.client.getHabbo().getRoomUnit().getCurrentLocation()))
|
|
||||||
{
|
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(this.client.getHabbo(), 77, -1);
|
|
||||||
this.client.getHabbo().getHabboInfo().setRiding((HorsePet) pet);
|
|
||||||
((HorsePet) pet).setRider(this.client.getHabbo());
|
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserEffectComposer(this.client.getHabbo().getRoomUnit()).compose());
|
|
||||||
pet.setTask(PetTasks.RIDE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pet.getRoomUnit().setGoalLocation(goalTile);
|
|
||||||
Emulator.getThreading().run(new RoomUnitRideHorse((HorsePet) pet, this.client.getHabbo(), goalTile));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// TODO : THIS IS NOT THE CORRECT WAY OF HANDLING MOUNTING. CHECK HABBO.COM. THE HORSE SHOULD NOT COME TO YOU. YOU SHOULD GO TO THE HORSE.
|
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(this.client.getHabbo(), 0, -1);
|
|
||||||
((HorsePet) pet).setRider(null);
|
|
||||||
pet.setTask(PetTasks.FREE);
|
|
||||||
this.client.getHabbo().getHabboInfo().setRiding(null);
|
|
||||||
this.client.getHabbo().getRoomUnit().setGoalLocation(this.client.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(this.client.getHabbo().getRoomUnit().getCurrentLocation(), this.client.getHabbo().getRoomUnit().getBodyRotation().getValue()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
package com.eu.habbo.messages.incoming.rooms.pets;
|
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.pets.HorsePet;
|
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
|
||||||
import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetHorseFigureComposer;
|
|
||||||
|
|
||||||
public class HorseRideSettingsEvent extends MessageHandler
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void handle() throws Exception
|
|
||||||
{
|
|
||||||
int petId = this.packet.readInt();
|
|
||||||
|
|
||||||
if(this.client.getHabbo().getHabboInfo().getCurrentRoom() == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Pet pet = this.client.getHabbo().getHabboInfo().getCurrentRoom().getPet(petId);
|
|
||||||
|
|
||||||
if(pet == null || pet.getUserId() != this.client.getHabbo().getHabboInfo().getId() || !(pet instanceof HorsePet))
|
|
||||||
return;
|
|
||||||
|
|
||||||
((HorsePet) pet).setAnyoneCanRide(!((HorsePet) pet).anyoneCanRide());
|
|
||||||
((HorsePet) pet).needsUpdate = true;
|
|
||||||
|
|
||||||
this.client.sendResponse(new RoomPetHorseFigureComposer((HorsePet) pet));
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,6 +3,7 @@ package com.eu.habbo.messages.incoming.rooms.pets;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
|
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
@ -35,6 +36,14 @@ public class PetPickupEvent extends MessageHandler
|
|||||||
this.client.sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(Emulator.getTexts().getValue("error.pets.max.inventory"), this.client.getHabbo(), this.client.getHabbo(), RoomChatMessageBubbles.ALERT)));
|
this.client.sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(Emulator.getTexts().getValue("error.pets.max.inventory"), this.client.getHabbo(), this.client.getHabbo(), RoomChatMessageBubbles.ALERT)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(pet instanceof RideablePet) {
|
||||||
|
RideablePet rideablePet = (RideablePet)pet;
|
||||||
|
if(rideablePet.getRider() != null) {
|
||||||
|
rideablePet.getRider().getHabboInfo().dismountPet(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
room.sendComposer(new RoomUserRemoveComposer(pet.getRoomUnit()).compose());
|
room.sendComposer(new RoomUserRemoveComposer(pet.getRoomUnit()).compose());
|
||||||
room.removePet(petId);
|
room.removePet(petId);
|
||||||
pet.setRoomUnit(null);
|
pet.setRoomUnit(null);
|
||||||
|
@ -0,0 +1,60 @@
|
|||||||
|
package com.eu.habbo.messages.incoming.rooms.pets;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
|
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||||
|
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
|
import com.eu.habbo.threading.runnables.RoomUnitRidePet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PetRideEvent extends MessageHandler
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void handle() throws Exception
|
||||||
|
{
|
||||||
|
int petId = this.packet.readInt();
|
||||||
|
Habbo habbo = this.client.getHabbo();
|
||||||
|
Room room = habbo.getHabboInfo().getCurrentRoom();
|
||||||
|
|
||||||
|
if(room == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Pet pet = room.getPet(petId);
|
||||||
|
|
||||||
|
if(!(pet instanceof RideablePet))
|
||||||
|
return;
|
||||||
|
|
||||||
|
RideablePet rideablePet = (RideablePet)pet;
|
||||||
|
|
||||||
|
//dismount
|
||||||
|
if(habbo.getHabboInfo().getRiding() != null)
|
||||||
|
{
|
||||||
|
habbo.getHabboInfo().dismountPet();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// someone is already on it
|
||||||
|
if(rideablePet.getRider() != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// check if able to ride
|
||||||
|
if(!rideablePet.anyoneCanRide() && habbo.getHabboInfo().getId() != rideablePet.getUserId())
|
||||||
|
return;
|
||||||
|
|
||||||
|
List<RoomTile> availableTiles = room.getLayout().getWalkableTilesAround(pet.getRoomUnit().getCurrentLocation());
|
||||||
|
|
||||||
|
// if cant reach it then cancel
|
||||||
|
if(availableTiles.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
RoomTile goalTile = availableTiles.get(0);
|
||||||
|
habbo.getRoomUnit().setGoalLocation(goalTile);
|
||||||
|
Emulator.getThreading().run(new RoomUnitRidePet(rideablePet, habbo, goalTile));
|
||||||
|
rideablePet.getRoomUnit().setWalkTimeOut(3 + Emulator.getIntUnixTimestamp());
|
||||||
|
rideablePet.getRoomUnit().stopWalking();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.eu.habbo.messages.incoming.rooms.pets;
|
||||||
|
|
||||||
|
import com.eu.habbo.habbohotel.pets.HorsePet;
|
||||||
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
|
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||||
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
|
import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetHorseFigureComposer;
|
||||||
|
|
||||||
|
public class PetRideSettingsEvent extends MessageHandler
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void handle() throws Exception
|
||||||
|
{
|
||||||
|
int petId = this.packet.readInt();
|
||||||
|
|
||||||
|
if(this.client.getHabbo().getHabboInfo().getCurrentRoom() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Pet pet = this.client.getHabbo().getHabboInfo().getCurrentRoom().getPet(petId);
|
||||||
|
|
||||||
|
if(pet == null || pet.getUserId() != this.client.getHabbo().getHabboInfo().getId() || !(pet instanceof RideablePet))
|
||||||
|
return;
|
||||||
|
|
||||||
|
RideablePet rideablePet = ((RideablePet) pet);
|
||||||
|
|
||||||
|
rideablePet.setAnyoneCanRide(!rideablePet.anyoneCanRide());
|
||||||
|
rideablePet.needsUpdate = true;
|
||||||
|
|
||||||
|
if(!rideablePet.anyoneCanRide() && rideablePet.getRider() != null && rideablePet.getRider().getHabboInfo().getId() != this.client.getHabbo().getHabboInfo().getId()) {
|
||||||
|
rideablePet.getRider().getHabboInfo().dismountPet();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pet instanceof HorsePet) {
|
||||||
|
this.client.sendResponse(new RoomPetHorseFigureComposer((HorsePet) pet));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -15,7 +15,7 @@ import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetHorseFigureComposer;
|
|||||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
|
||||||
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
|
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
|
||||||
|
|
||||||
public class HorseUseItemEvent extends MessageHandler
|
public class PetUseItemEvent extends MessageHandler
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception
|
public void handle() throws Exception
|
@ -1,10 +1,7 @@
|
|||||||
package com.eu.habbo.messages.outgoing.rooms.pets;
|
package com.eu.habbo.messages.outgoing.rooms.pets;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.pets.HorsePet;
|
import com.eu.habbo.habbohotel.pets.*;
|
||||||
import com.eu.habbo.habbohotel.pets.MonsterplantPet;
|
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
|
||||||
import com.eu.habbo.habbohotel.pets.PetManager;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||||
@ -57,10 +54,10 @@ public class PetInformationComposer extends MessageComposer
|
|||||||
this.response.appendString(this.room.getFurniOwnerName(this.pet.getUserId())); //Owner name
|
this.response.appendString(this.room.getFurniOwnerName(this.pet.getUserId())); //Owner name
|
||||||
|
|
||||||
this.response.appendInt(this.pet instanceof MonsterplantPet ? ((MonsterplantPet) this.pet).getRarity() : 0);
|
this.response.appendInt(this.pet instanceof MonsterplantPet ? ((MonsterplantPet) this.pet).getRarity() : 0);
|
||||||
this.response.appendBoolean(this.pet instanceof HorsePet && ((HorsePet) this.pet).hasSaddle());
|
this.response.appendBoolean(this.pet instanceof RideablePet && ((RideablePet) this.pet).hasSaddle());
|
||||||
this.response.appendBoolean(this.pet instanceof HorsePet && ((HorsePet) this.pet).getRider() != null);
|
this.response.appendBoolean(this.pet instanceof RideablePet && ((RideablePet) this.pet).getRider() != null);
|
||||||
this.response.appendInt(0);
|
this.response.appendInt(0);
|
||||||
this.response.appendInt(this.pet instanceof HorsePet && ((HorsePet) this.pet).anyoneCanRide() ? 1 : 0);
|
this.response.appendInt(this.pet instanceof RideablePet && ((RideablePet) this.pet).anyoneCanRide() ? 1 : 0);
|
||||||
this.response.appendBoolean(this.pet instanceof MonsterplantPet && ((MonsterplantPet) this.pet).canBreed()); //State Grown
|
this.response.appendBoolean(this.pet instanceof MonsterplantPet && ((MonsterplantPet) this.pet).canBreed()); //State Grown
|
||||||
this.response.appendBoolean(!(this.pet instanceof MonsterplantPet && ((MonsterplantPet) this.pet).isFullyGrown())); //unknown 1
|
this.response.appendBoolean(!(this.pet instanceof MonsterplantPet && ((MonsterplantPet) this.pet).isFullyGrown())); //unknown 1
|
||||||
this.response.appendBoolean(this.pet instanceof MonsterplantPet && ((MonsterplantPet) this.pet).isDead()); //Dead
|
this.response.appendBoolean(this.pet instanceof MonsterplantPet && ((MonsterplantPet) this.pet).isDead()); //Dead
|
||||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.messages.outgoing.rooms.pets;
|
|||||||
import com.eu.habbo.habbohotel.pets.HorsePet;
|
import com.eu.habbo.habbohotel.pets.HorsePet;
|
||||||
import com.eu.habbo.habbohotel.pets.MonsterplantPet;
|
import com.eu.habbo.habbohotel.pets.MonsterplantPet;
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
|
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.Outgoing;
|
import com.eu.habbo.messages.outgoing.Outgoing;
|
||||||
@ -21,7 +22,7 @@ public class PetStatusUpdateComposer extends MessageComposer
|
|||||||
{
|
{
|
||||||
this.response.init(Outgoing.PetStatusUpdateComposer);
|
this.response.init(Outgoing.PetStatusUpdateComposer);
|
||||||
this.response.appendInt(this.pet.getRoomUnit().getId());
|
this.response.appendInt(this.pet.getRoomUnit().getId());
|
||||||
this.response.appendInt(this.pet instanceof HorsePet && ((HorsePet) this.pet).anyoneCanRide() ? 1 : 0);
|
this.response.appendInt(this.pet instanceof RideablePet && ((RideablePet) this.pet).anyoneCanRide() ? 1 : 0);
|
||||||
this.response.appendBoolean((this.pet instanceof MonsterplantPet && ((MonsterplantPet) this.pet).canBreed())); //unknown 1
|
this.response.appendBoolean((this.pet instanceof MonsterplantPet && ((MonsterplantPet) this.pet).canBreed())); //unknown 1
|
||||||
this.response.appendBoolean((this.pet instanceof MonsterplantPet && !((MonsterplantPet) this.pet).isFullyGrown()));
|
this.response.appendBoolean((this.pet instanceof MonsterplantPet && !((MonsterplantPet) this.pet).isFullyGrown()));
|
||||||
this.response.appendBoolean(this.pet instanceof MonsterplantPet && ((MonsterplantPet) this.pet).isDead()); //State Grown
|
this.response.appendBoolean(this.pet instanceof MonsterplantPet && ((MonsterplantPet) this.pet).isDead()); //State Grown
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package com.eu.habbo.messages.outgoing.rooms.pets;
|
package com.eu.habbo.messages.outgoing.rooms.pets;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.pets.HorsePet;
|
import com.eu.habbo.habbohotel.pets.*;
|
||||||
import com.eu.habbo.habbohotel.pets.IPetLook;
|
|
||||||
import com.eu.habbo.habbohotel.pets.MonsterplantPet;
|
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.Outgoing;
|
import com.eu.habbo.messages.outgoing.Outgoing;
|
||||||
@ -59,7 +56,7 @@ public class RoomPetComposer extends MessageComposer implements TIntObjectProced
|
|||||||
this.response.appendInt(pet.getUserId());
|
this.response.appendInt(pet.getUserId());
|
||||||
this.response.appendString(pet.getRoom().getFurniOwnerNames().get(pet.getUserId()));
|
this.response.appendString(pet.getRoom().getFurniOwnerNames().get(pet.getUserId()));
|
||||||
this.response.appendInt(pet instanceof MonsterplantPet ? ((MonsterplantPet) pet).getRarity() : 1);
|
this.response.appendInt(pet instanceof MonsterplantPet ? ((MonsterplantPet) pet).getRarity() : 1);
|
||||||
this.response.appendBoolean(pet instanceof HorsePet && ((HorsePet) pet).hasSaddle());
|
this.response.appendBoolean(pet instanceof RideablePet && ((RideablePet) pet).hasSaddle());
|
||||||
this.response.appendBoolean(false);
|
this.response.appendBoolean(false);
|
||||||
this.response.appendBoolean((pet instanceof MonsterplantPet && ((MonsterplantPet) pet).canBreed())); //Has breeasasd//
|
this.response.appendBoolean((pet instanceof MonsterplantPet && ((MonsterplantPet) pet).canBreed())); //Has breeasasd//
|
||||||
this.response.appendBoolean(!(pet instanceof MonsterplantPet && ((MonsterplantPet) pet).isFullyGrown())); //unknown 1
|
this.response.appendBoolean(!(pet instanceof MonsterplantPet && ((MonsterplantPet) pet).isFullyGrown())); //unknown 1
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
package com.eu.habbo.threading.runnables;
|
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
|
||||||
import com.eu.habbo.habbohotel.pets.HorsePet;
|
|
||||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
|
||||||
|
|
||||||
public class RoomUnitRideHorse implements Runnable
|
|
||||||
{
|
|
||||||
private HorsePet pet;
|
|
||||||
private Habbo habbo;
|
|
||||||
private RoomTile goalTile;
|
|
||||||
|
|
||||||
public RoomUnitRideHorse(HorsePet pet, Habbo habbo, RoomTile goalTile)
|
|
||||||
{
|
|
||||||
this.pet = pet;
|
|
||||||
this.habbo = habbo;
|
|
||||||
this.goalTile = goalTile;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
if(!(this.habbo.getRoomUnit() != null && this.habbo.getHabboInfo().getCurrentRoom() == this.pet.getRoom() && this.habbo.getHabboInfo().getRiding() == null) && this.goalTile != null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(this.habbo.getHabboInfo().getCurrentRoom().getLayout().getTileInFront(this.habbo.getRoomUnit().getCurrentLocation(), this.habbo.getRoomUnit().getBodyRotation().getValue()).equals(this.goalTile))
|
|
||||||
{
|
|
||||||
if(this.goalTile.x == this.pet.getRoomUnit().getX() && this.goalTile.y == this.pet.getRoomUnit().getY())
|
|
||||||
{
|
|
||||||
this.habbo.getRoomUnit().setGoalLocation(this.pet.getRoomUnit().getCurrentLocation());
|
|
||||||
this.habbo.getHabboInfo().getCurrentRoom().giveEffect(this.habbo, 77, -1);
|
|
||||||
this.habbo.getHabboInfo().setRiding(this.pet);
|
|
||||||
this.pet.setRider(this.habbo);
|
|
||||||
this.pet.setTask(PetTasks.RIDE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Emulator.getThreading().run(this, 500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.eu.habbo.threading.runnables;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||||
|
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserEffectComposer;
|
||||||
|
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
|
||||||
|
|
||||||
|
public class RoomUnitRidePet implements Runnable
|
||||||
|
{
|
||||||
|
private RideablePet pet;
|
||||||
|
private Habbo habbo;
|
||||||
|
private RoomTile goalTile;
|
||||||
|
|
||||||
|
public RoomUnitRidePet(RideablePet pet, Habbo habbo, RoomTile goalTile)
|
||||||
|
{
|
||||||
|
this.pet = pet;
|
||||||
|
this.habbo = habbo;
|
||||||
|
this.goalTile = goalTile;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
if(this.habbo.getRoomUnit() == null || this.pet.getRoomUnit() == null || this.pet.getRoom() != this.habbo.getHabboInfo().getCurrentRoom() || this.goalTile == null || this.habbo.getRoomUnit().getGoal() != this.goalTile)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (habbo.getRoomUnit().getCurrentLocation().distance(pet.getRoomUnit().getCurrentLocation()) <= 1)
|
||||||
|
{
|
||||||
|
habbo.getRoomUnit().stopWalking();
|
||||||
|
habbo.getHabboInfo().getCurrentRoom().giveEffect(habbo, 77, -1);
|
||||||
|
habbo.getHabboInfo().setRiding(pet);
|
||||||
|
habbo.getRoomUnit().setCurrentLocation(this.pet.getRoomUnit().getCurrentLocation());
|
||||||
|
habbo.getRoomUnit().setPreviousLocation(this.pet.getRoomUnit().getCurrentLocation());
|
||||||
|
habbo.getRoomUnit().setZ(this.pet.getRoomUnit().getZ() + 1);
|
||||||
|
habbo.getRoomUnit().setPreviousLocationZ(this.pet.getRoomUnit().getZ() + 1);
|
||||||
|
habbo.getRoomUnit().setRotation(this.pet.getRoomUnit().getBodyRotation());
|
||||||
|
habbo.getRoomUnit().statusUpdate(true);
|
||||||
|
pet.setRider(habbo);
|
||||||
|
habbo.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserStatusComposer(habbo.getRoomUnit()).compose());
|
||||||
|
habbo.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserEffectComposer(habbo.getRoomUnit()).compose());
|
||||||
|
pet.setTask(PetTasks.RIDE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pet.getRoomUnit().setWalkTimeOut(3 + Emulator.getIntUnixTimestamp());
|
||||||
|
pet.getRoomUnit().stopWalking();
|
||||||
|
habbo.getRoomUnit().setGoalLocation(goalTile);
|
||||||
|
Emulator.getThreading().run(this, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user