mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-18 23:46:28 +01:00
Merge branch 'wired-bot-fix' into 'dev'
wired bot fix See merge request morningstar/Arcturus-Community!258
This commit is contained in:
commit
045bd05c35
@ -68,12 +68,13 @@ public class WiredEffectBotClothes extends InteractionWiredEffect {
|
||||
@Override
|
||||
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||
List<Bot> bots = room.getBots(this.botName);
|
||||
if (bots.size() > 1) {
|
||||
|
||||
if (bots.size() != 1) {
|
||||
return false;
|
||||
}
|
||||
for (Bot bot : bots) {
|
||||
bot.setFigure(this.botLook);
|
||||
}
|
||||
|
||||
Bot bot = bots.get(0);
|
||||
bot.setFigure(this.botLook);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -86,16 +86,15 @@ public class WiredEffectBotFollowHabbo extends InteractionWiredEffect {
|
||||
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||
Habbo habbo = room.getHabbo(roomUnit);
|
||||
|
||||
if (habbo != null) {
|
||||
List<Bot> bots = room.getBots(this.botName);
|
||||
if (bots.size() > 1) {
|
||||
return false;
|
||||
}
|
||||
for (Bot bot : bots) {
|
||||
if (this.mode == 1)
|
||||
bot.startFollowingHabbo(habbo);
|
||||
else
|
||||
bot.stopFollowingHabbo();
|
||||
List<Bot> bots = room.getBots(this.botName);
|
||||
|
||||
if (habbo != null && bots.size() == 1) {
|
||||
Bot bot = bots.get(0);
|
||||
|
||||
if (this.mode == 1) {
|
||||
bot.startFollowingHabbo(habbo);
|
||||
} else {
|
||||
bot.stopFollowingHabbo();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -88,24 +88,21 @@ public class WiredEffectBotGiveHandItem extends InteractionWiredEffect {
|
||||
@Override
|
||||
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||
Habbo habbo = room.getHabbo(roomUnit);
|
||||
List<Bot> bots = room.getBots(this.botName);
|
||||
|
||||
if (habbo != null) {
|
||||
List<Bot> bots = room.getBots(this.botName);
|
||||
if (bots.size() > 1) {
|
||||
return false;
|
||||
}
|
||||
for (Bot bot : bots) {
|
||||
List<Runnable> tasks = new ArrayList<>();
|
||||
tasks.add(new RoomUnitGiveHanditem(habbo.getRoomUnit(), room, this.itemId));
|
||||
tasks.add(new RoomUnitGiveHanditem(bot.getRoomUnit(), room, 0));
|
||||
if (habbo != null && bots.size() == 1) {
|
||||
Bot bot = bots.get(0);
|
||||
|
||||
Emulator.getThreading().run(new RoomUnitGiveHanditem(bot.getRoomUnit(), room, this.itemId));
|
||||
List<Runnable> tasks = new ArrayList<>();
|
||||
tasks.add(new RoomUnitGiveHanditem(habbo.getRoomUnit(), room, this.itemId));
|
||||
tasks.add(new RoomUnitGiveHanditem(bot.getRoomUnit(), room, 0));
|
||||
|
||||
List<Runnable> failedReach = new ArrayList<>();
|
||||
failedReach.add(() -> tasks.forEach(Runnable::run));
|
||||
Emulator.getThreading().run(new RoomUnitGiveHanditem(bot.getRoomUnit(), room, this.itemId));
|
||||
|
||||
Emulator.getThreading().run(new RoomUnitWalkToRoomUnit(bot.getRoomUnit(), habbo.getRoomUnit(), room, tasks, failedReach));
|
||||
}
|
||||
List<Runnable> failedReach = new ArrayList<>();
|
||||
failedReach.add(() -> tasks.forEach(Runnable::run));
|
||||
|
||||
Emulator.getThreading().run(new RoomUnitWalkToRoomUnit(bot.getRoomUnit(), habbo.getRoomUnit(), room, tasks, failedReach));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -83,16 +83,21 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.pixels"), habbo.getHabboInfo().getPixels() + "")
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.points"), habbo.getHabboInfo().getCurrencyAmount(Emulator.getConfig().getInt("seasonal.primary.type")) + "");
|
||||
}
|
||||
|
||||
List<Bot> bots = room.getBots(this.botName);
|
||||
if (bots.size() > 1) {
|
||||
|
||||
if (bots.size() != 1) {
|
||||
return false;
|
||||
}
|
||||
for (Bot bot : bots) {
|
||||
if (this.mode == 1)
|
||||
bot.shout(message);
|
||||
else
|
||||
bot.talk(message);
|
||||
|
||||
Bot bot = bots.get(0);
|
||||
|
||||
if (this.mode == 1) {
|
||||
bot.shout(message);
|
||||
} else {
|
||||
bot.talk(message);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -103,19 +103,22 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
|
||||
.replace(Emulator.getTexts().getValue("wired.variable.points"), habbo.getHabboInfo().getCurrencyAmount(Emulator.getConfig().getInt("seasonal.primary.type")) + "");
|
||||
|
||||
List<Bot> bots = room.getBots(this.botName);
|
||||
if (bots.size() > 1) {
|
||||
|
||||
if (bots.size() != 1) {
|
||||
return false;
|
||||
}
|
||||
for (Bot bot : bots) {
|
||||
if (this.mode == 1) {
|
||||
bot.whisper(m, habbo);
|
||||
} else {
|
||||
bot.talk(habbo.getHabboInfo().getUsername() + ": " + m);
|
||||
}
|
||||
|
||||
Bot bot = bots.get(0);
|
||||
|
||||
if (this.mode == 1) {
|
||||
bot.whisper(m, habbo);
|
||||
} else {
|
||||
bot.talk(habbo.getHabboInfo().getUsername() + ": " + m);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -139,23 +139,22 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
|
||||
|
||||
List<Bot> bots = room.getBots(this.botName);
|
||||
|
||||
if (bots.isEmpty())
|
||||
return false;
|
||||
|
||||
if (bots.size() > 1) {
|
||||
if (bots.size() != 1) {
|
||||
return false;
|
||||
}
|
||||
for (Bot bot : bots) {
|
||||
int i = Emulator.getRandom().nextInt(this.items.size()) + 1;
|
||||
int j = 1;
|
||||
for (HabboItem item : this.items) {
|
||||
if (item.getRoomId() != 0 && item.getRoomId() == bot.getRoom().getId()) {
|
||||
if (i == j) {
|
||||
teleportUnitToTile(bot.getRoomUnit(), room.getLayout().getTile(item.getX(), item.getY()));
|
||||
return true;
|
||||
} else {
|
||||
j++;
|
||||
}
|
||||
|
||||
Bot bot = bots.get(0);
|
||||
|
||||
int i = Emulator.getRandom().nextInt(this.items.size()) + 1;
|
||||
int j = 1;
|
||||
|
||||
for (HabboItem item : this.items) {
|
||||
if (item.getRoomId() != 0 && item.getRoomId() == bot.getRoom().getId()) {
|
||||
if (i == j) {
|
||||
teleportUnitToTile(bot.getRoomUnit(), room.getLayout().getTile(item.getX(), item.getY()));
|
||||
return true;
|
||||
} else {
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,14 +88,13 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
|
||||
|
||||
@Override
|
||||
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||
if (this.items.isEmpty())
|
||||
return false;
|
||||
|
||||
List<Bot> bots = room.getBots(this.botName);
|
||||
|
||||
if (bots.isEmpty())
|
||||
if (this.items.isEmpty() || bots.size() != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Bot bot = bots.get(0);
|
||||
THashSet<HabboItem> items = new THashSet<>();
|
||||
|
||||
for (HabboItem item : this.items) {
|
||||
@ -108,20 +107,15 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
if (this.items.size() > 0) {
|
||||
if (bots.size() > 1) {
|
||||
return false;
|
||||
}
|
||||
for (Bot bot : bots) {
|
||||
int i = Emulator.getRandom().nextInt(this.items.size()) + 1;
|
||||
int j = 1;
|
||||
for (HabboItem item : this.items) {
|
||||
if (item.getRoomId() != 0 && item.getRoomId() == bot.getRoom().getId()) {
|
||||
if (i == j) {
|
||||
bot.getRoomUnit().setGoalLocation(room.getLayout().getTile(item.getX(), item.getY()));
|
||||
break;
|
||||
} else {
|
||||
j++;
|
||||
}
|
||||
int i = Emulator.getRandom().nextInt(this.items.size()) + 1;
|
||||
int j = 1;
|
||||
for (HabboItem item : this.items) {
|
||||
if (item.getRoomId() != 0 && item.getRoomId() == bot.getRoom().getId()) {
|
||||
if (i == j) {
|
||||
bot.getRoomUnit().setGoalLocation(room.getLayout().getTile(item.getX(), item.getY()));
|
||||
break;
|
||||
} else {
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user