mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-22 23:10:52 +01:00
Fixed ButlerBots, they now give drinks over a furniture if within a command difference.
This commit is contained in:
parent
0e92f9066a
commit
ca2e5ef500
@ -4,5 +4,6 @@ INSERT INTO `catalog_pages`(`id`, `parent_id`, `caption_save`, `caption`, `icon_
|
||||
SET @page_id = LAST_INSERT_ID();
|
||||
UPDATE catalog_items SET page_id = @page_id WHERE catalog_name LIKE '%guild_forum%';
|
||||
UPDATE items_base SET `interaction_type` = 'guild_furni' WHERE item_name LIKE '%guild_forum%';
|
||||
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.bot.butler.commanddistance', '5');
|
||||
|
||||
#END DATABASE UPDATE: 1.16.0 -> 2.0.0
|
@ -592,4 +592,18 @@ public class Bot implements Runnable
|
||||
{
|
||||
this.canWalk = canWalk;
|
||||
}
|
||||
|
||||
public void lookAt(Habbo habbo) {
|
||||
this.lookAt(habbo.getRoomUnit().getCurrentLocation());
|
||||
}
|
||||
|
||||
public void lookAt(RoomUnit roomUnit) {
|
||||
this.lookAt(roomUnit.getCurrentLocation());
|
||||
}
|
||||
|
||||
public void lookAt(RoomTile tile) {
|
||||
this.roomUnit.lookAtPoint(tile);
|
||||
this.roomUnit.statusUpdate(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ public class ButlerBot extends Bot
|
||||
{
|
||||
public static THashMap<THashSet<String>, Integer> serveItems = new THashMap<>();
|
||||
|
||||
|
||||
public ButlerBot(ResultSet set) throws SQLException
|
||||
{
|
||||
super(set);
|
||||
@ -67,7 +66,7 @@ public class ButlerBot extends Bot
|
||||
if(this.getRoomUnit().hasStatus(RoomUnitStatus.MOVE))
|
||||
return;
|
||||
|
||||
if (this.getRoomUnit().getCurrentLocation().distance(message.getHabbo().getRoomUnit().getCurrentLocation()) <= Emulator.getConfig().getInt("hotel.bot.butler.servedistance"))
|
||||
if (this.getRoomUnit().getCurrentLocation().distance(message.getHabbo().getRoomUnit().getCurrentLocation()) <= Emulator.getConfig().getInt("hotel.bot.butler.commanddistance"))
|
||||
if(message.getUnfilteredMessage() != null)
|
||||
{
|
||||
for(Map.Entry<THashSet<String>, Integer> set : serveItems.entrySet())
|
||||
@ -86,8 +85,9 @@ public class ButlerBot extends Bot
|
||||
{
|
||||
final String key = s;
|
||||
final Bot b = this;
|
||||
b.lookAt(serveEvent.habbo);
|
||||
|
||||
List<Runnable> tasks = new ArrayList<>();
|
||||
final List<Runnable> tasks = new ArrayList();
|
||||
tasks.add(new RoomUnitGiveHanditem(serveEvent.habbo.getRoomUnit(), serveEvent.habbo.getHabboInfo().getCurrentRoom(), serveEvent.itemId));
|
||||
tasks.add(new RoomUnitGiveHanditem(this.getRoomUnit(), serveEvent.habbo.getHabboInfo().getCurrentRoom(), 0));
|
||||
|
||||
@ -99,8 +99,20 @@ public class ButlerBot extends Bot
|
||||
b.talk(Emulator.getTexts().getValue("bots.butler.given").replace("%key%", key).replace("%username%", serveEvent.habbo.getHabboInfo().getUsername()));
|
||||
}
|
||||
});
|
||||
List<Runnable> failedReached = new ArrayList();
|
||||
failedReached.add(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (b.getRoomUnit().getCurrentLocation().distance(serveEvent.habbo.getRoomUnit().getCurrentLocation()) <= Emulator.getConfig().getInt("hotel.bot.butler.servedistance")) {
|
||||
for (Runnable t : tasks) {
|
||||
t.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Emulator.getThreading().run(new RoomUnitGiveHanditem(this.getRoomUnit(), serveEvent.habbo.getHabboInfo().getCurrentRoom(), serveEvent.itemId));
|
||||
Emulator.getThreading().run(new RoomUnitWalkToRoomUnit(this.getRoomUnit(), serveEvent.habbo.getRoomUnit(), serveEvent.habbo.getHabboInfo().getCurrentRoom(), tasks, null));
|
||||
Emulator.getThreading().run(new RoomUnitWalkToRoomUnit(this.getRoomUnit(), serveEvent.habbo.getRoomUnit(), serveEvent.habbo.getHabboInfo().getCurrentRoom(), tasks, failedReached));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ public class RoomUnitWalkToRoomUnit implements Runnable
|
||||
|
||||
this.walker.setGoalLocation(this.goalTile);
|
||||
|
||||
if(this.walker.getPath() == null)
|
||||
if (this.walker.getPath().isEmpty())
|
||||
{
|
||||
for(Runnable r : this.failedReached)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user