🆙 Add some love to the beds when there is a male/female in the bed

This commit is contained in:
duckietm
2026-03-16 08:42:48 +01:00
parent 9c7067b5a2
commit 1669847805
2 changed files with 43 additions and 8 deletions
@@ -435,11 +435,11 @@ public class RoomCycleManager {
if (!unit.isWalking() && !unit.cmdSit) {
// Don't override special pet statuses with SIT
boolean hasSpecialPetStatus = unit.hasStatus(RoomUnitStatus.HANG)
|| unit.hasStatus(RoomUnitStatus.SWING)
|| unit.hasStatus(RoomUnitStatus.FLAME)
|| unit.hasStatus(RoomUnitStatus.PLAY);
boolean hasSpecialPetStatus = unit.hasStatus(RoomUnitStatus.HANG)
|| unit.hasStatus(RoomUnitStatus.SWING)
|| unit.hasStatus(RoomUnitStatus.FLAME)
|| unit.hasStatus(RoomUnitStatus.PLAY);
RoomTile thisTile = this.room.getLayout().getTile(unit.getX(), unit.getY());
HabboItem topItem = this.room.getTallestChair(thisTile);
@@ -473,12 +473,16 @@ public class RoomCycleManager {
BedProfile bedProfile = new BedProfile(topItem);
double layHeight = Item.getCurrentHeight(topItem) * 1.0D + bedProfile.getLayZOffset();
LOGGER.info("[BedProfile] item={} stackHeight={} isFlat={} isDouble={} X={} Y={} Z={}",
topItem.getBaseItem().getName(), topItem.getBaseItem().getHeight(),
bedProfile.isFlat(), bedProfile.isDouble(),
bedProfile.getLayXOffset(), bedProfile.getLayYOffset(), bedProfile.getLayZOffset());
topItem.getBaseItem().getName(), topItem.getBaseItem().getHeight(),
bedProfile.isFlat(), bedProfile.isDouble(),
bedProfile.getLayXOffset(), bedProfile.getLayYOffset(), bedProfile.getLayZOffset());
unit.setStatus(RoomUnitStatus.LAY, layHeight + ";" + bedProfile.getLayXOffset() + ";" + bedProfile.getLayYOffset());
unit.setRotation(RoomUserRotation.values()[topItem.getRotation() % 4]);
unit.setLocation(bedProfile.snapToLay(this.room, topItem, unit.getX(), unit.getY()));
// Check love effect when a user enters a bed
this.room.getUnitManager().checkBedLoveEffect(topItem);
update = true;
}
}
@@ -10,6 +10,7 @@ import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.pets.RideablePet;
import com.eu.habbo.habbohotel.users.DanceType;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.core.WiredManager;
import com.eu.habbo.messages.outgoing.generic.alerts.GenericErrorMessagesComposer;
@@ -42,6 +43,7 @@ import java.util.stream.Collectors;
*/
public class RoomUnitManager {
private static final Logger LOGGER = LoggerFactory.getLogger(RoomUnitManager.class);
static final int BED_LOVE_EFFECT_ID = 9;
private final Room room;
@@ -420,6 +422,10 @@ public class RoomUnitManager {
}
this.room.sendComposer(new RoomUserStatusComposer(roomUnits, true).compose());
}
if (topItem != null && topItem.getBaseItem().allowLay()) {
this.checkBedLoveEffect(topItem);
}
}
// ==================== HABBO QUEUE ====================
@@ -1164,6 +1170,31 @@ public class RoomUnitManager {
}
}
public void checkBedLoveEffect(HabboItem bed) {
if (bed == null || !bed.getBaseItem().allowLay()) return;
BedProfile bedProfile = new BedProfile(bed);
if (!bedProfile.isDouble()) return;
THashSet<Habbo> habbosOnBed = this.getHabbosOnItem(bed);
Habbo male = null;
Habbo female = null;
for (Habbo h : habbosOnBed) {
if (h.getRoomUnit() == null || !h.getRoomUnit().hasStatus(RoomUnitStatus.LAY)) continue;
if (h.getHabboInfo().getGender() == HabboGender.M && male == null) {
male = h;
} else if (h.getHabboInfo().getGender() == HabboGender.F && female == null) {
female = h;
}
}
if (male != null && female != null) {
this.giveEffect(male.getRoomUnit(), BED_LOVE_EFFECT_ID, 5);
this.giveEffect(female.getRoomUnit(), BED_LOVE_EFFECT_ID, 5);
}
}
/**
* Gives a hand item to a Habbo.
*/