mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-26 16:30:52 +01:00
Removed cycleRoomUnit for RoomAvatars
This commit is contained in:
parent
4fee1bccf3
commit
9f40ce0a43
@ -57,8 +57,12 @@ public class Bot extends Unit implements Runnable {
|
|||||||
private boolean chatRandom;
|
private boolean chatRandom;
|
||||||
@Getter
|
@Getter
|
||||||
private short chatDelay;
|
private short chatDelay;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
private int chatTimeOut;
|
private int chatTimeOut;
|
||||||
private int chatTimestamp;
|
private int chatTimestamp;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
private short lastChatIndex;
|
private short lastChatIndex;
|
||||||
private final int bubble;
|
private final int bubble;
|
||||||
@Getter
|
@Getter
|
||||||
@ -445,4 +449,11 @@ public class Bot extends Unit implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementLastChatIndex() {
|
||||||
|
this.lastChatIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetLastChatIndex() {
|
||||||
|
this.lastChatIndex = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,6 @@ public class BotManager {
|
|||||||
log.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bot.cycle(false);
|
|
||||||
} else {
|
} else {
|
||||||
habbo.getClient().sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.getKey(), FurnitureMovementError.NO_RIGHTS.getErrorCode()));
|
habbo.getClient().sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.getKey(), FurnitureMovementError.NO_RIGHTS.getErrorCode()));
|
||||||
}
|
}
|
||||||
|
@ -816,10 +816,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bot.cycle(this.allowBotsWalk);
|
bot.getRoomUnit().cycle(this);
|
||||||
|
|
||||||
|
if(bot.getRoomUnit().isStatusUpdateNeeded()) {
|
||||||
if (this.cycleRoomUnit(bot.getRoomUnit())) {
|
|
||||||
bot.getRoomUnit().setStatusUpdateNeeded(false);
|
bot.getRoomUnit().setStatusUpdateNeeded(false);
|
||||||
updatedUnit.add(bot.getRoomUnit());
|
updatedUnit.add(bot.getRoomUnit());
|
||||||
}
|
}
|
||||||
|
@ -320,8 +320,6 @@ public class RoomAvatar extends RoomUnit {
|
|||||||
public void giveEffect(int effectId, int duration, boolean forceEffect) {
|
public void giveEffect(int effectId, int duration, boolean forceEffect) {
|
||||||
if (!this.isInRoom()) {
|
if (!this.isInRoom()) {
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
RoomAvatar roomAvatar = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this instanceof RoomHabbo) {
|
if(this instanceof RoomHabbo) {
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package com.eu.habbo.habbohotel.rooms.entities.units.types;
|
package com.eu.habbo.habbohotel.rooms.entities.units.types;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.bots.Bot;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType;
|
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType;
|
||||||
|
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||||
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ -9,6 +14,60 @@ public class RoomBot extends RoomAvatar {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean cycle(Room room) {
|
||||||
|
Bot bot = this.getRoom().getRoomUnitManager().getBotByRoomUnit(this);
|
||||||
|
|
||||||
|
if(bot == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.getRoom().isAllowBotsWalk()) {
|
||||||
|
if(bot.canWalk()) {
|
||||||
|
if (!this.isWalking()) {
|
||||||
|
if (this.getWalkTimeOut() < Emulator.getIntUnixTimestamp() && bot.getFollowingHabboId() == 0) {
|
||||||
|
this.setGoalLocation(Emulator.getConfig().getBoolean("hotel.bot.limit.walking.distance", true) ? this.getRoom().getLayout().getRandomWalkableTilesAround(this, this.getRoom().getLayout().getTile(this.getBotStartLocation().getX(), this.getBotStartLocation().getY()), this.getRoom(), Emulator.getConfig().getInt("hotel.bot.limit.walking.distance.radius", 5)) : this.getRoom().getRandomWalkableTile());
|
||||||
|
int timeOut = Emulator.getRandom().nextInt(20) * 2;
|
||||||
|
this.setWalkTimeOut((timeOut < 10 ? 5 : timeOut) + Emulator.getIntUnixTimestamp());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bot.getChatLines().isEmpty() && bot.getChatTimeOut() <= Emulator.getIntUnixTimestamp() && bot.isChatAuto()) {
|
||||||
|
if (this.getRoom() != null) {
|
||||||
|
short test = 0;
|
||||||
|
|
||||||
|
if(bot.isChatRandom()) {
|
||||||
|
bot.setLastChatIndex((short) Emulator.getRandom().nextInt(bot.getChatLines().size()));
|
||||||
|
} else if(bot.getLastChatIndex() == bot.getChatLines().size() - 1) {
|
||||||
|
bot.resetLastChatIndex();
|
||||||
|
} else {
|
||||||
|
bot.incrementLastChatIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bot.getLastChatIndex() >= bot.getChatLines().size()) {
|
||||||
|
bot.resetLastChatIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
String message = bot.getChatLines().get(bot.getLastChatIndex())
|
||||||
|
.replace(Emulator.getTexts().getValue("wired.variable.owner", "%owner%"), this.getRoom().getRoomInfo().getOwnerInfo().getUsername())
|
||||||
|
.replace(Emulator.getTexts().getValue("wired.variable.item_count", "%item_count%"), String.valueOf(this.getRoom().getRoomItemManager().getCurrentItems().size()))
|
||||||
|
.replace(Emulator.getTexts().getValue("wired.variable.name", "%name%"), bot.getName())
|
||||||
|
.replace(Emulator.getTexts().getValue("wired.variable.roomname", "%roomname%"), this.getRoom().getRoomInfo().getName())
|
||||||
|
.replace(Emulator.getTexts().getValue("wired.variable.user_count", "%user_count%"), String.valueOf(this.getRoom().getRoomUnitManager().getRoomHabbosCount()));
|
||||||
|
|
||||||
|
if(!WiredHandler.handle(WiredTriggerType.SAY_SOMETHING, this, room, new Object[]{ message })) {
|
||||||
|
bot.talk(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
bot.setChatTimeOut(Emulator.getIntUnixTimestamp() + bot.getChatDelay());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.cycle(room);
|
||||||
|
}
|
||||||
|
|
||||||
public RoomUnitType getRoomUnitType() {
|
public RoomUnitType getRoomUnitType() {
|
||||||
return RoomUnitType.BOT;
|
return RoomUnitType.BOT;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user