2018-07-06 15:30:00 +02:00
|
|
|
package com.eu.habbo.habbohotel.bots;
|
|
|
|
|
|
|
|
import com.eu.habbo.Emulator;
|
|
|
|
import com.eu.habbo.habbohotel.rooms.*;
|
|
|
|
import com.eu.habbo.habbohotel.users.Habbo;
|
|
|
|
import com.eu.habbo.habbohotel.users.HabboGender;
|
|
|
|
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
|
|
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
|
|
|
import com.eu.habbo.messages.outgoing.rooms.users.*;
|
|
|
|
import com.eu.habbo.plugin.events.bots.BotChatEvent;
|
|
|
|
import com.eu.habbo.plugin.events.bots.BotShoutEvent;
|
|
|
|
import com.eu.habbo.plugin.events.bots.BotTalkEvent;
|
|
|
|
import com.eu.habbo.plugin.events.bots.BotWhisperEvent;
|
|
|
|
import com.eu.habbo.threading.runnables.BotFollowHabbo;
|
|
|
|
|
|
|
|
import java.sql.Connection;
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
public class Bot implements Runnable
|
|
|
|
{
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private int id;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private String name;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private String motto;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private String figure;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private HabboGender gender;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private int ownerId;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private String ownerName;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private Room room;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private RoomUnit roomUnit;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private boolean chatAuto;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private boolean chatRandom;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private short chatDelay;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private int chatTimeOut;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private final ArrayList<String> chatLines;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private short lastChatIndex;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private String type;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private int effect;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private boolean needsUpdate;
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
private int followingHabboId;
|
|
|
|
|
|
|
|
public Bot(int id, String name, String motto, String figure, HabboGender gender, int ownerId, String ownerName)
|
|
|
|
{
|
|
|
|
this.id = id;
|
|
|
|
this.name = name;
|
|
|
|
this.motto = motto;
|
|
|
|
this.figure = figure;
|
|
|
|
this.gender = gender;
|
|
|
|
this.ownerId = ownerId;
|
|
|
|
this.ownerName = ownerName;
|
|
|
|
this.chatAuto = false;
|
|
|
|
this.chatRandom = false;
|
|
|
|
this.chatDelay = 1000;
|
|
|
|
this.chatLines = new ArrayList<String>();
|
|
|
|
this.type = "generic_bot";
|
|
|
|
this.room = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Bot(ResultSet set) throws SQLException
|
|
|
|
{
|
|
|
|
this.id = set.getInt("id");
|
|
|
|
this.name = set.getString("name");
|
|
|
|
this.motto = set.getString("motto");
|
|
|
|
this.figure = set.getString("figure");
|
|
|
|
this.gender = HabboGender.valueOf(set.getString("gender"));
|
|
|
|
this.ownerId = set.getInt("user_id");
|
|
|
|
this.ownerName = set.getString("owner_name");
|
|
|
|
this.chatAuto = set.getString("chat_auto").equals("1");
|
|
|
|
this.chatRandom = set.getString("chat_random").equals("1");
|
|
|
|
this.chatDelay = set.getShort("chat_delay");
|
|
|
|
this.chatLines = new ArrayList<String>(Arrays.asList(set.getString("chat_lines").split("\r")));
|
|
|
|
this.type = set.getString("type");
|
|
|
|
this.effect = set.getInt("effect");
|
|
|
|
this.room = null;
|
|
|
|
this.roomUnit = null;
|
|
|
|
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
|
|
|
|
this.needsUpdate = false;
|
|
|
|
this.lastChatIndex = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Bot(Bot bot)
|
|
|
|
{
|
|
|
|
this.name = bot.getName();
|
|
|
|
this.motto = bot.getMotto();
|
|
|
|
this.figure = bot.getFigure();
|
|
|
|
this.gender = bot.getGender();
|
|
|
|
this.ownerId = bot.getOwnerId();
|
|
|
|
this.ownerName = bot.getOwnerName();
|
|
|
|
this.chatAuto = true;
|
|
|
|
this.chatRandom = false;
|
|
|
|
this.chatDelay = 10;
|
|
|
|
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
|
|
|
|
this.chatLines = new ArrayList<String>(Arrays.asList(new String[] {"Default Message :D"}));
|
|
|
|
this.type = bot.getType();
|
|
|
|
this.effect = bot.getEffect();
|
|
|
|
this.room = null;
|
|
|
|
this.roomUnit = null;
|
|
|
|
this.lastChatIndex = 0;
|
|
|
|
|
|
|
|
this.needsUpdate = false;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void needsUpdate(boolean needsUpdate)
|
|
|
|
{
|
|
|
|
this.needsUpdate = needsUpdate;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public boolean needsUpdate()
|
|
|
|
{
|
|
|
|
return this.needsUpdate;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
if(this.needsUpdate)
|
|
|
|
{
|
|
|
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE bots SET name = ?, motto = ?, figure = ?, gender = ?, user_id = ?, room_id = ?, x = ?, y = ?, z = ?, rot = ?, dance = ?, freeroam = ?, chat_lines = ?, chat_auto = ?, chat_random = ?, chat_delay = ? WHERE id = ?"))
|
|
|
|
{
|
|
|
|
statement.setString(1, this.name);
|
|
|
|
statement.setString(2, this.motto);
|
|
|
|
statement.setString(3, this.figure);
|
|
|
|
statement.setString(4, this.gender.toString());
|
|
|
|
statement.setInt(5, this.ownerId);
|
|
|
|
statement.setInt(6, this.room == null ? 0 : this.room.getId());
|
|
|
|
statement.setInt(7, this.roomUnit == null ? 0 : this.roomUnit.getX());
|
|
|
|
statement.setInt(8, this.roomUnit == null ? 0 : this.roomUnit.getY());
|
|
|
|
statement.setDouble(9, this.roomUnit == null ? 0 : this.roomUnit.getZ());
|
|
|
|
statement.setInt(10, this.roomUnit == null ? 0 : this.roomUnit.getBodyRotation().getValue());
|
|
|
|
statement.setInt(11, this.roomUnit == null ? 0 : this.roomUnit.getDanceType().getType());
|
|
|
|
statement.setString(12, this.roomUnit == null ? "0" : this.roomUnit.canWalk() ? "1" : "0");
|
|
|
|
String text = "";
|
|
|
|
for(String s : this.chatLines)
|
|
|
|
{
|
|
|
|
text += s + "\r";
|
|
|
|
}
|
|
|
|
statement.setString(13, text);
|
|
|
|
statement.setString(14, this.chatAuto ? "1" : "0");
|
|
|
|
statement.setString(15, this.chatRandom ? "1" : "0");
|
|
|
|
statement.setInt(16, this.chatDelay);
|
|
|
|
statement.setInt(17, this.id);
|
|
|
|
statement.execute();
|
|
|
|
this.needsUpdate = false;
|
|
|
|
}
|
|
|
|
catch(SQLException e)
|
|
|
|
{
|
|
|
|
Emulator.getLogging().logSQLException(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void cycle(boolean canWalk)
|
|
|
|
{
|
|
|
|
if(this.roomUnit != null)
|
|
|
|
{
|
|
|
|
if(canWalk && this.getRoomUnit().canWalk())
|
|
|
|
{
|
|
|
|
if (!this.roomUnit.isWalking())
|
|
|
|
{
|
|
|
|
if (this.roomUnit.getWalkTimeOut() < Emulator.getIntUnixTimestamp() && this.followingHabboId == 0)
|
|
|
|
{
|
|
|
|
this.roomUnit.setGoalLocation(this.room.getRandomWalkableTile());
|
|
|
|
int timeOut = Emulator.getRandom().nextInt(20) * 2;
|
|
|
|
this.roomUnit.setWalkTimeOut((timeOut < 10 ? 5 : timeOut) + Emulator.getIntUnixTimestamp());
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
for (RoomTile t : this.room.getLayout().getTilesAround(this.room.getLayout().getTile(this.getRoomUnit().getX(), this.getRoomUnit().getY())))
|
|
|
|
{
|
|
|
|
WiredHandler.handle(WiredTriggerType.BOT_REACHED_STF, this.roomUnit, this.room, room.getItemsAt(t).toArray());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!this.chatLines.isEmpty() && this.chatTimeOut <= Emulator.getIntUnixTimestamp() && this.chatAuto)
|
|
|
|
{
|
|
|
|
if(this.room != null)
|
|
|
|
{
|
|
|
|
this.lastChatIndex = (this.chatRandom ? (short)Emulator.getRandom().nextInt(this.chatLines.size()) : (this.lastChatIndex == (this.chatLines.size() - 1) ? 0 : this.lastChatIndex++));
|
|
|
|
this.talk(this.chatLines.get(this.lastChatIndex)
|
|
|
|
.replace("%owner%", this.room.getOwnerName())
|
|
|
|
.replace("%item_count%", this.room.itemCount() + "")
|
|
|
|
.replace("%name%", this.name)
|
|
|
|
.replace("%roomname%", this.room.getName())
|
|
|
|
.replace("%user_count%", this.room.getUserCount() + ""));
|
|
|
|
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void talk(String message)
|
|
|
|
{
|
|
|
|
if(this.room != null)
|
|
|
|
{
|
|
|
|
BotChatEvent event = new BotTalkEvent(this, message);
|
|
|
|
if(Emulator.getPluginManager().fireEvent(event).isCancelled())
|
|
|
|
return;
|
|
|
|
|
|
|
|
this.room.botChat(new RoomUserTalkComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT)).compose());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void shout(String message)
|
|
|
|
{
|
|
|
|
if(this.room != null)
|
|
|
|
{
|
|
|
|
BotChatEvent event = new BotShoutEvent(this, message);
|
|
|
|
if(Emulator.getPluginManager().fireEvent(event).isCancelled())
|
|
|
|
return;
|
|
|
|
|
|
|
|
this.room.botChat(new RoomUserShoutComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT)).compose());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void whisper(String message, Habbo habbo)
|
|
|
|
{
|
|
|
|
if(this.room != null && habbo != null)
|
|
|
|
{
|
|
|
|
BotWhisperEvent event = new BotWhisperEvent(this, message, habbo);
|
|
|
|
if(Emulator.getPluginManager().fireEvent(event).isCancelled())
|
|
|
|
return;
|
|
|
|
|
|
|
|
event.target.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void onPlace(Habbo habbo, Room room)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void onPickUp(Habbo habbo, Room room)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void onUserSay(final RoomChatMessage message)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public int getId()
|
|
|
|
{
|
|
|
|
return this.id;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void setId(int id)
|
|
|
|
{
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public String getName()
|
|
|
|
{
|
|
|
|
return this.name;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void setName(String name)
|
|
|
|
{
|
|
|
|
this.name = name;
|
|
|
|
this.needsUpdate = true;
|
|
|
|
|
|
|
|
//if(this.room != null)
|
|
|
|
//this.room.sendComposer(new ChangeNameUpdatedComposer(this.getRoomUnit(), this.getName()).compose());
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public String getMotto()
|
|
|
|
{
|
|
|
|
return this.motto;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void setMotto(String motto)
|
|
|
|
{
|
|
|
|
this.motto = motto;
|
|
|
|
this.needsUpdate = true;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public String getFigure()
|
|
|
|
{
|
|
|
|
return this.figure;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void setFigure(String figure)
|
|
|
|
{
|
|
|
|
this.figure = figure;
|
|
|
|
this.needsUpdate = true;
|
|
|
|
|
|
|
|
if(this.room != null)
|
|
|
|
this.room.sendComposer(new RoomUsersComposer(this).compose());
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public HabboGender getGender()
|
|
|
|
{
|
|
|
|
return this.gender;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void setGender(HabboGender gender)
|
|
|
|
{
|
|
|
|
this.gender = gender;
|
|
|
|
this.needsUpdate = true;
|
|
|
|
|
|
|
|
if(this.room != null)
|
|
|
|
this.room.sendComposer(new RoomUsersComposer(this).compose());
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public int getOwnerId()
|
|
|
|
{
|
|
|
|
return this.ownerId;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void setOwnerId(int ownerId)
|
|
|
|
{
|
|
|
|
this.ownerId = ownerId;
|
|
|
|
this.needsUpdate = true;
|
|
|
|
|
|
|
|
if(this.room != null)
|
|
|
|
this.room.sendComposer(new RoomUsersComposer(this).compose());
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public String getOwnerName()
|
|
|
|
{
|
|
|
|
return this.ownerName;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void setOwnerName(String ownerName)
|
|
|
|
{
|
|
|
|
this.ownerName = ownerName;
|
|
|
|
this.needsUpdate = true;
|
|
|
|
|
|
|
|
if(this.room != null)
|
|
|
|
this.room.sendComposer(new RoomUsersComposer(this).compose());
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public Room getRoom()
|
|
|
|
{
|
|
|
|
return this.room;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void setRoom(Room room)
|
|
|
|
{
|
|
|
|
this.room = room;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public RoomUnit getRoomUnit()
|
|
|
|
{
|
|
|
|
return this.roomUnit;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void setRoomUnit(RoomUnit roomUnit)
|
|
|
|
{
|
|
|
|
this.roomUnit = roomUnit;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public boolean isChatAuto()
|
|
|
|
{
|
|
|
|
return this.chatAuto;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void setChatAuto(boolean chatAuto)
|
|
|
|
{
|
|
|
|
this.chatAuto = chatAuto;
|
|
|
|
this.needsUpdate = true;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public boolean isChatRandom()
|
|
|
|
{
|
|
|
|
return this.chatRandom;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void setChatRandom(boolean chatRandom)
|
|
|
|
{
|
|
|
|
this.chatRandom = chatRandom;
|
|
|
|
this.needsUpdate = true;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public int getChatDelay()
|
|
|
|
{
|
|
|
|
return this.chatDelay;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void setChatDelay(short chatDelay)
|
|
|
|
{
|
|
|
|
this.chatDelay = chatDelay;
|
|
|
|
this.needsUpdate = true;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void clearChat()
|
|
|
|
{
|
|
|
|
synchronized (this.chatLines)
|
|
|
|
{
|
|
|
|
this.chatLines.clear();
|
|
|
|
this.needsUpdate = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public String getType()
|
|
|
|
{
|
|
|
|
return this.type;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public int getEffect()
|
|
|
|
{
|
|
|
|
return this.effect;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void setEffect(int effect)
|
|
|
|
{
|
|
|
|
this.effect = effect;
|
|
|
|
this.needsUpdate = true;
|
|
|
|
|
|
|
|
if (this.roomUnit != null)
|
|
|
|
{
|
|
|
|
this.roomUnit.setEffectId(this.effect);
|
|
|
|
|
|
|
|
if (this.room != null)
|
|
|
|
{
|
|
|
|
this.room.sendComposer(new RoomUserEffectComposer(this.roomUnit).compose());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void addChatLines(ArrayList<String> chatLines)
|
|
|
|
{
|
|
|
|
synchronized (this.chatLines)
|
|
|
|
{
|
|
|
|
this.chatLines.addAll(chatLines);
|
|
|
|
this.needsUpdate = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void addChatLine(String chatLine)
|
|
|
|
{
|
|
|
|
synchronized (this.chatLines)
|
|
|
|
{
|
|
|
|
this.chatLines.add(chatLine);
|
|
|
|
this.needsUpdate = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public ArrayList<String> getChatLines()
|
|
|
|
{
|
|
|
|
return this.chatLines;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public int getFollowingHabboId()
|
|
|
|
{
|
|
|
|
return this.followingHabboId;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public void startFollowingHabbo(Habbo habbo)
|
|
|
|
{
|
|
|
|
this.followingHabboId = habbo.getHabboInfo().getId();
|
|
|
|
|
|
|
|
Emulator.getThreading().run(new BotFollowHabbo(this, habbo, habbo.getHabboInfo().getCurrentRoom()));
|
|
|
|
}
|
|
|
|
|
|
|
|
public void stopFollowingHabbo()
|
|
|
|
{
|
|
|
|
this.followingHabboId = 0;
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public static void initialise()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:32:00 +02:00
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
public static void dispose()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|