mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-27 00:40:52 +01:00
fix previous enable
This commit is contained in:
parent
a23fb4f8cd
commit
0fb8dad0ea
@ -48,7 +48,7 @@ public class InteractionDefault extends HabboItem {
|
|||||||
public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) {
|
public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) {
|
||||||
super.onMove(room, oldLocation, newLocation);
|
super.onMove(room, oldLocation, newLocation);
|
||||||
|
|
||||||
if(room.getItemsAt(oldLocation).stream().noneMatch(item -> item.getClass().isAssignableFrom(InteractionRoller.class))) {
|
if (room.getItemsAt(oldLocation).stream().noneMatch(item -> item.getClass().isAssignableFrom(InteractionRoller.class))) {
|
||||||
for (RoomUnit unit : room.getRoomUnits()) {
|
for (RoomUnit unit : room.getRoomUnits()) {
|
||||||
if (!oldLocation.unitIsOnFurniOnTile(unit, this.getBaseItem()))
|
if (!oldLocation.unitIsOnFurniOnTile(unit, this.getBaseItem()))
|
||||||
continue; // If the unit was previously on the furni...
|
continue; // If the unit was previously on the furni...
|
||||||
@ -101,37 +101,43 @@ public class InteractionDefault extends HabboItem {
|
|||||||
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
super.onWalkOn(roomUnit, room, objects);
|
super.onWalkOn(roomUnit, room, objects);
|
||||||
|
|
||||||
if (roomUnit != null) {
|
if (roomUnit == null || (this.getBaseItem().getEffectF() == 0 && this.getBaseItem().getEffectM() == 0)) return;
|
||||||
if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
|
|
||||||
if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER)) {
|
if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER)) {
|
||||||
Habbo habbo = room.getHabbo(roomUnit);
|
Habbo habbo = room.getHabbo(roomUnit);
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo == null) return;
|
||||||
|
|
||||||
if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM()) {
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM()) {
|
||||||
|
if (roomUnit.getEffectId() > 0)
|
||||||
|
roomUnit.setPreviousEffectId(roomUnit.getEffectId(), roomUnit.getPreviousEffectEndTimestamp());
|
||||||
room.giveEffect(habbo, this.getBaseItem().getEffectM(), -1);
|
room.giveEffect(habbo, this.getBaseItem().getEffectM(), -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectF()) {
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectF()) {
|
||||||
|
if (roomUnit.getEffectId() > 0)
|
||||||
|
roomUnit.setPreviousEffectId(roomUnit.getEffectId(), roomUnit.getPreviousEffectEndTimestamp());
|
||||||
room.giveEffect(habbo, this.getBaseItem().getEffectF(), -1);
|
room.giveEffect(habbo, this.getBaseItem().getEffectF(), -1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) {
|
} else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) {
|
||||||
Bot bot = room.getBot(roomUnit);
|
Bot bot = room.getBot(roomUnit);
|
||||||
|
|
||||||
if (bot != null) {
|
if (bot == null) return;
|
||||||
|
|
||||||
if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && roomUnit.getEffectId() != this.getBaseItem().getEffectM()) {
|
if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && roomUnit.getEffectId() != this.getBaseItem().getEffectM()) {
|
||||||
|
if (roomUnit.getEffectId() > 0)
|
||||||
|
roomUnit.setPreviousEffectId(roomUnit.getEffectId(), roomUnit.getPreviousEffectEndTimestamp());
|
||||||
room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectM(), -1);
|
room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectM(), -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && roomUnit.getEffectId() != this.getBaseItem().getEffectF()) {
|
if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && roomUnit.getEffectId() != this.getBaseItem().getEffectF()) {
|
||||||
|
if (roomUnit.getEffectId() > 0)
|
||||||
|
roomUnit.setPreviousEffectId(roomUnit.getEffectId(), roomUnit.getPreviousEffectEndTimestamp());
|
||||||
room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectF(), -1);
|
room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectF(), -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
@ -141,6 +147,7 @@ public class InteractionDefault extends HabboItem {
|
|||||||
if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
|
if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
|
||||||
int nextEffectM = 0;
|
int nextEffectM = 0;
|
||||||
int nextEffectF = 0;
|
int nextEffectF = 0;
|
||||||
|
int nextEffectDuration = -1;
|
||||||
|
|
||||||
if (objects != null && objects.length == 2) {
|
if (objects != null && objects.length == 2) {
|
||||||
if (objects[0] instanceof RoomTile && objects[1] instanceof RoomTile) {
|
if (objects[0] instanceof RoomTile && objects[1] instanceof RoomTile) {
|
||||||
@ -151,9 +158,13 @@ public class InteractionDefault extends HabboItem {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(topItem != null) {
|
if (topItem != null) {
|
||||||
nextEffectM = topItem.getBaseItem().getEffectM();
|
nextEffectM = topItem.getBaseItem().getEffectM();
|
||||||
nextEffectF = topItem.getBaseItem().getEffectF();
|
nextEffectF = topItem.getBaseItem().getEffectF();
|
||||||
|
} else if (roomUnit.getPreviousEffectId() > 0) {
|
||||||
|
nextEffectF = roomUnit.getPreviousEffectId();
|
||||||
|
nextEffectM = roomUnit.getPreviousEffectId();
|
||||||
|
nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,12 +175,12 @@ public class InteractionDefault extends HabboItem {
|
|||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
|
|
||||||
if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
|
||||||
room.giveEffect(habbo, nextEffectM, -1);
|
room.giveEffect(habbo, nextEffectM, nextEffectDuration);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) {
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) {
|
||||||
room.giveEffect(habbo, nextEffectF, -1);
|
room.giveEffect(habbo, nextEffectF, nextEffectDuration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) {
|
} else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) {
|
||||||
@ -177,12 +188,12 @@ public class InteractionDefault extends HabboItem {
|
|||||||
|
|
||||||
if (bot != null) {
|
if (bot != null) {
|
||||||
if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
|
if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
|
||||||
room.giveEffect(roomUnit, nextEffectM, -1);
|
room.giveEffect(roomUnit, nextEffectM, nextEffectDuration);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) {
|
if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) {
|
||||||
room.giveEffect(roomUnit, nextEffectF, -1);
|
room.giveEffect(roomUnit, nextEffectF, nextEffectDuration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,8 @@ package com.eu.habbo.habbohotel.rooms;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.bots.Bot;
|
import com.eu.habbo.habbohotel.bots.Bot;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.*;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionWater;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.InteractionWaterItem;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.interfaces.ConditionalGate;
|
import com.eu.habbo.habbohotel.items.interactions.interfaces.ConditionalGate;
|
||||||
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.pets.RideablePet;
|
||||||
@ -35,6 +36,7 @@ public class RoomUnit {
|
|||||||
|
|
||||||
public boolean isWiredTeleporting = false;
|
public boolean isWiredTeleporting = false;
|
||||||
public boolean isLeavingTeleporter = false;
|
public boolean isLeavingTeleporter = false;
|
||||||
|
public boolean isSwimming = false;
|
||||||
private final ConcurrentHashMap<RoomUnitStatus, String> status;
|
private final ConcurrentHashMap<RoomUnitStatus, String> status;
|
||||||
private final THashMap<String, Object> cacheable;
|
private final THashMap<String, Object> cacheable;
|
||||||
public boolean canRotate = true;
|
public boolean canRotate = true;
|
||||||
@ -72,6 +74,8 @@ public class RoomUnit {
|
|||||||
private int walkTimeOut;
|
private int walkTimeOut;
|
||||||
private int effectId;
|
private int effectId;
|
||||||
private int effectEndTimestamp;
|
private int effectEndTimestamp;
|
||||||
|
private int previousEffectId;
|
||||||
|
private int previousEffectEndTimestamp;
|
||||||
private ScheduledFuture moveBlockingTask;
|
private ScheduledFuture moveBlockingTask;
|
||||||
private int timeInRoom;
|
private int timeInRoom;
|
||||||
|
|
||||||
@ -92,6 +96,8 @@ public class RoomUnit {
|
|||||||
this.handItemTimestamp = 0;
|
this.handItemTimestamp = 0;
|
||||||
this.walkTimeOut = Emulator.getIntUnixTimestamp();
|
this.walkTimeOut = Emulator.getIntUnixTimestamp();
|
||||||
this.effectId = 0;
|
this.effectId = 0;
|
||||||
|
this.previousEffectId = 0;
|
||||||
|
this.previousEffectEndTimestamp = -1;
|
||||||
this.isKicked = false;
|
this.isKicked = false;
|
||||||
this.overridableTiles = new THashSet<>();
|
this.overridableTiles = new THashSet<>();
|
||||||
this.timeInRoom = 0;
|
this.timeInRoom = 0;
|
||||||
@ -252,7 +258,7 @@ public class RoomUnit {
|
|||||||
this.status.remove(RoomUnitStatus.MOVE);
|
this.status.remove(RoomUnitStatus.MOVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
next = (RoomTile)this.path.pop();
|
next = (RoomTile) this.path.pop();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -498,8 +504,7 @@ public class RoomUnit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setGoalLocation(RoomTile goalLocation, boolean noReset) {
|
public void setGoalLocation(RoomTile goalLocation, boolean noReset) {
|
||||||
if (Emulator.getPluginManager().isRegistered(RoomUnitSetGoalEvent.class, false))
|
if (Emulator.getPluginManager().isRegistered(RoomUnitSetGoalEvent.class, false)) {
|
||||||
{
|
|
||||||
Event event = new RoomUnitSetGoalEvent(this.room, this, goalLocation);
|
Event event = new RoomUnitSetGoalEvent(this.room, this, goalLocation);
|
||||||
Emulator.getPluginManager().fireEvent(event);
|
Emulator.getPluginManager().fireEvent(event);
|
||||||
|
|
||||||
@ -553,8 +558,7 @@ public class RoomUnit {
|
|||||||
this.room = room;
|
this.room = room;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void findPath()
|
public void findPath() {
|
||||||
{
|
|
||||||
if (this.room != null && this.room.getLayout() != null && this.goalLocation != null && (this.goalLocation.isWalkable() || this.room.canSitOrLayAt(this.goalLocation.x, this.goalLocation.y) || this.canOverrideTile(this.goalLocation))) {
|
if (this.room != null && this.room.getLayout() != null && this.goalLocation != null && (this.goalLocation.isWalkable() || this.room.canSitOrLayAt(this.goalLocation.x, this.goalLocation.y) || this.canOverrideTile(this.goalLocation))) {
|
||||||
Deque<RoomTile> path = this.room.getLayout().findPath(this.currentLocation, this.goalLocation, this.goalLocation, this);
|
Deque<RoomTile> path = this.room.getLayout().findPath(this.currentLocation, this.goalLocation, this.goalLocation, this);
|
||||||
if (path != null) this.path = path;
|
if (path != null) this.path = path;
|
||||||
@ -624,6 +628,7 @@ public class RoomUnit {
|
|||||||
return this.effectId;
|
return this.effectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setEffectId(int effectId, int endTimestamp) {
|
public void setEffectId(int effectId, int endTimestamp) {
|
||||||
this.effectId = effectId;
|
this.effectId = effectId;
|
||||||
this.effectEndTimestamp = endTimestamp;
|
this.effectEndTimestamp = endTimestamp;
|
||||||
@ -633,6 +638,19 @@ public class RoomUnit {
|
|||||||
return this.effectEndTimestamp;
|
return this.effectEndTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPreviousEffectId() {
|
||||||
|
return this.previousEffectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPreviousEffectId(int effectId, int endTimestamp) {
|
||||||
|
this.previousEffectId = effectId;
|
||||||
|
this.previousEffectEndTimestamp = endTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPreviousEffectEndTimestamp() {
|
||||||
|
return this.previousEffectEndTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
public int getWalkTimeOut() {
|
public int getWalkTimeOut() {
|
||||||
return this.walkTimeOut;
|
return this.walkTimeOut;
|
||||||
}
|
}
|
||||||
@ -780,7 +798,7 @@ public class RoomUnit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public RoomTile getClosestAdjacentTile(short x, short y, boolean diagonal) {
|
public RoomTile getClosestAdjacentTile(short x, short y, boolean diagonal) {
|
||||||
if(room == null) return null;
|
if (room == null) return null;
|
||||||
|
|
||||||
RoomTile baseTile = room.getLayout().getTile(x, y);
|
RoomTile baseTile = room.getLayout().getTile(x, y);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user