You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-20 15:36:17 +00:00
🆙 Add some love to the beds when there is a male/female in the bed
This commit is contained in:
@@ -435,11 +435,11 @@ public class RoomCycleManager {
|
|||||||
|
|
||||||
if (!unit.isWalking() && !unit.cmdSit) {
|
if (!unit.isWalking() && !unit.cmdSit) {
|
||||||
// Don't override special pet statuses with SIT
|
// Don't override special pet statuses with SIT
|
||||||
boolean hasSpecialPetStatus = unit.hasStatus(RoomUnitStatus.HANG)
|
boolean hasSpecialPetStatus = unit.hasStatus(RoomUnitStatus.HANG)
|
||||||
|| unit.hasStatus(RoomUnitStatus.SWING)
|
|| unit.hasStatus(RoomUnitStatus.SWING)
|
||||||
|| unit.hasStatus(RoomUnitStatus.FLAME)
|
|| unit.hasStatus(RoomUnitStatus.FLAME)
|
||||||
|| unit.hasStatus(RoomUnitStatus.PLAY);
|
|| unit.hasStatus(RoomUnitStatus.PLAY);
|
||||||
|
|
||||||
RoomTile thisTile = this.room.getLayout().getTile(unit.getX(), unit.getY());
|
RoomTile thisTile = this.room.getLayout().getTile(unit.getX(), unit.getY());
|
||||||
HabboItem topItem = this.room.getTallestChair(thisTile);
|
HabboItem topItem = this.room.getTallestChair(thisTile);
|
||||||
|
|
||||||
@@ -473,12 +473,16 @@ public class RoomCycleManager {
|
|||||||
BedProfile bedProfile = new BedProfile(topItem);
|
BedProfile bedProfile = new BedProfile(topItem);
|
||||||
double layHeight = Item.getCurrentHeight(topItem) * 1.0D + bedProfile.getLayZOffset();
|
double layHeight = Item.getCurrentHeight(topItem) * 1.0D + bedProfile.getLayZOffset();
|
||||||
LOGGER.info("[BedProfile] item={} stackHeight={} isFlat={} isDouble={} X={} Y={} Z={}",
|
LOGGER.info("[BedProfile] item={} stackHeight={} isFlat={} isDouble={} X={} Y={} Z={}",
|
||||||
topItem.getBaseItem().getName(), topItem.getBaseItem().getHeight(),
|
topItem.getBaseItem().getName(), topItem.getBaseItem().getHeight(),
|
||||||
bedProfile.isFlat(), bedProfile.isDouble(),
|
bedProfile.isFlat(), bedProfile.isDouble(),
|
||||||
bedProfile.getLayXOffset(), bedProfile.getLayYOffset(), bedProfile.getLayZOffset());
|
bedProfile.getLayXOffset(), bedProfile.getLayYOffset(), bedProfile.getLayZOffset());
|
||||||
unit.setStatus(RoomUnitStatus.LAY, layHeight + ";" + bedProfile.getLayXOffset() + ";" + bedProfile.getLayYOffset());
|
unit.setStatus(RoomUnitStatus.LAY, layHeight + ";" + bedProfile.getLayXOffset() + ";" + bedProfile.getLayYOffset());
|
||||||
unit.setRotation(RoomUserRotation.values()[topItem.getRotation() % 4]);
|
unit.setRotation(RoomUserRotation.values()[topItem.getRotation() % 4]);
|
||||||
unit.setLocation(bedProfile.snapToLay(this.room, topItem, unit.getX(), unit.getY()));
|
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;
|
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.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.HabboGender;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.GenericErrorMessagesComposer;
|
import com.eu.habbo.messages.outgoing.generic.alerts.GenericErrorMessagesComposer;
|
||||||
@@ -42,6 +43,7 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
public class RoomUnitManager {
|
public class RoomUnitManager {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(RoomUnitManager.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(RoomUnitManager.class);
|
||||||
|
static final int BED_LOVE_EFFECT_ID = 9;
|
||||||
|
|
||||||
private final Room room;
|
private final Room room;
|
||||||
|
|
||||||
@@ -420,6 +422,10 @@ public class RoomUnitManager {
|
|||||||
}
|
}
|
||||||
this.room.sendComposer(new RoomUserStatusComposer(roomUnits, true).compose());
|
this.room.sendComposer(new RoomUserStatusComposer(roomUnits, true).compose());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (topItem != null && topItem.getBaseItem().allowLay()) {
|
||||||
|
this.checkBedLoveEffect(topItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== HABBO QUEUE ====================
|
// ==================== 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.
|
* Gives a hand item to a Habbo.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user