🆙 Gamecenter
This commit is contained in:
parent
2d528aaaac
commit
32383e7cc4
@ -266,7 +266,8 @@ public class Bot implements Runnable {
|
||||
if(PLACEMENT_MESSAGES.length > 0) {
|
||||
String message = PLACEMENT_MESSAGES[Emulator.getRandom().nextInt(PLACEMENT_MESSAGES.length)];
|
||||
if (!WiredHandler.handle(WiredTriggerType.SAY_SOMETHING, this.getRoomUnit(), room, new Object[]{message})) {
|
||||
this.talk(message);
|
||||
if(!habbo.roomBypass) this.talk(message);
|
||||
else this.talk("Deliver the drink here, " + habbo.getHabboInfo().getUsername() + "!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,18 +109,20 @@ public class BotManager {
|
||||
return;
|
||||
|
||||
if (room != null && bot != null && habbo != null) {
|
||||
if (room.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || habbo.hasPermission(Permission.ACC_PLACEFURNI)) {
|
||||
if (room.getCurrentBots().size() >= Room.MAXIMUM_BOTS && !habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS)) {
|
||||
habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_MAX_BOTS));
|
||||
return;
|
||||
}
|
||||
if (room.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || habbo.hasPermission(Permission.ACC_PLACEFURNI) || habbo.roomBypass) {
|
||||
if(!habbo.roomBypass){
|
||||
if (room.getCurrentBots().size() >= Room.MAXIMUM_BOTS && !habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS)) {
|
||||
habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_MAX_BOTS));
|
||||
return;
|
||||
}
|
||||
|
||||
if (room.hasHabbosAt(location.x, location.y) || (!location.isWalkable() && location.state != RoomTileState.SIT && location.state != RoomTileState.LAY))
|
||||
return;
|
||||
if (room.hasHabbosAt(location.x, location.y) || (!location.isWalkable() && location.state != RoomTileState.SIT && location.state != RoomTileState.LAY))
|
||||
return;
|
||||
|
||||
if (room.hasBotsAt(location.x, location.y)) {
|
||||
habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_BOTS_SELECTED_TILE_NOT_FREE));
|
||||
return;
|
||||
if (room.hasBotsAt(location.x, location.y)) {
|
||||
habbo.getClient().sendResponse(new BotErrorComposer(BotErrorComposer.ROOM_ERROR_BOTS_SELECTED_TILE_NOT_FREE));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
RoomUnit roomUnit = new RoomUnit();
|
||||
|
@ -518,6 +518,20 @@ public class ItemManager {
|
||||
}
|
||||
}
|
||||
|
||||
public HabboItem createItemNoSql(int habboId, Item item, int limitedStack, int limitedSells, String extraData) {
|
||||
Class<? extends HabboItem> itemClass = item.getInteractionType().getType();
|
||||
int id = new Random().nextInt(10000000) + 1000000000;
|
||||
if (itemClass != null) {
|
||||
try {
|
||||
return itemClass.getDeclaredConstructor(int.class, int.class, Item.class, String.class, int.class, int.class).newInstance(id, habboId, item, extraData, limitedStack, limitedSells);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Caught exception", e);
|
||||
return new InteractionDefault(id, habboId, item, extraData, limitedStack, limitedSells);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addNewUserGift(NewUserGift gift) {
|
||||
this.newuserGifts.put(gift.getId(), gift);
|
||||
}
|
||||
|
@ -1643,8 +1643,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (unit.hasStatus(RoomUnitStatus.MOVE) && !unit.animateWalk) {
|
||||
if ((unit.hasStatus(RoomUnitStatus.MOVE) || unit.hasStatus(RoomUnitStatus.SNOWWAR_RUN)) && !unit.animateWalk) {
|
||||
unit.removeStatus(RoomUnitStatus.MOVE);
|
||||
unit.removeStatus(RoomUnitStatus.SNOWWAR_RUN);
|
||||
|
||||
update = true;
|
||||
}
|
||||
@ -1670,7 +1671,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
if (!unit.isWalking() && !unit.cmdLay) {
|
||||
if (!unit.isWalking() && !unit.cmdLay && !unit.hasStatus(RoomUnitStatus.SNOWWAR_DIE_BACK)) {
|
||||
HabboItem topItem = this.getTopItemAt(unit.getX(), unit.getY());
|
||||
|
||||
if (topItem == null || !topItem.getBaseItem().allowLay()) {
|
||||
|
@ -531,6 +531,7 @@ public class RoomManager {
|
||||
}
|
||||
|
||||
if (overrideChecks ||
|
||||
habbo.roomBypass ||
|
||||
room.isOwner(habbo) ||
|
||||
room.getState() == RoomState.OPEN ||
|
||||
habbo.hasPermission(Permission.ACC_ANYROOMOWNER) ||
|
||||
|
@ -79,6 +79,7 @@ public class RoomUnit {
|
||||
private Room room;
|
||||
private RoomRightLevels rightsLevel = RoomRightLevels.NONE;
|
||||
private THashSet<Integer> overridableTiles;
|
||||
private boolean isGameSnow;
|
||||
|
||||
public RoomUnit() {
|
||||
this.id = 0;
|
||||
@ -95,6 +96,7 @@ public class RoomUnit {
|
||||
this.isKicked = false;
|
||||
this.overridableTiles = new THashSet<>();
|
||||
this.timeInRoom = 0;
|
||||
this.isGameSnow = false;
|
||||
}
|
||||
|
||||
public void clearWalking() {
|
||||
@ -155,8 +157,13 @@ public class RoomUnit {
|
||||
|
||||
if (this.status.remove(RoomUnitStatus.SIT) != null) this.statusUpdate = true;
|
||||
if (this.status.remove(RoomUnitStatus.MOVE) != null) this.statusUpdate = true;
|
||||
if (this.status.remove(RoomUnitStatus.SNOWWAR_RUN) != null) this.statusUpdate = true;
|
||||
if (this.status.remove(RoomUnitStatus.LAY) != null) this.statusUpdate = true;
|
||||
|
||||
if (this.status.remove(RoomUnitStatus.SNOWWAR_PICK) != null) this.statusUpdate = true;
|
||||
if (this.status.remove(RoomUnitStatus.SNOWWAR_DIE_BACK) != null) this.statusUpdate = true;
|
||||
if (this.status.remove(RoomUnitStatus.SNOWWAR_DIE_FRONT) != null) this.statusUpdate = true;
|
||||
|
||||
for (Map.Entry<RoomUnitStatus, String> set : this.status.entrySet()) {
|
||||
if (set.getKey().removeWhenWalking) {
|
||||
this.status.remove(set.getKey());
|
||||
@ -334,7 +341,18 @@ public class RoomUnit {
|
||||
|
||||
this.setPreviousLocation(this.getCurrentLocation());
|
||||
|
||||
if(this.getIsGameSnow()){
|
||||
this.setStatus(RoomUnitStatus.SNOWWAR_RUN, next.x + "," + next.y + "," + zHeight);
|
||||
}
|
||||
|
||||
this.setStatus(RoomUnitStatus.MOVE, next.x + "," + next.y + "," + zHeight);
|
||||
|
||||
if(this.getStatusMap().containsKey(RoomUnitStatus.SNOWWAR_RUN)){
|
||||
this.removeStatus(RoomUnitStatus.MOVE);
|
||||
this.removeStatus(RoomUnitStatus.SNOWWAR_RUN);
|
||||
this.setStatus(RoomUnitStatus.SNOWWAR_RUN, next.x + "," + next.y + "," + zHeight);
|
||||
}
|
||||
|
||||
if (habbo != null) {
|
||||
if (habbo.getHabboInfo().getRiding() != null) {
|
||||
RoomUnit ridingUnit = habbo.getHabboInfo().getRiding().getRoomUnit();
|
||||
@ -694,6 +712,14 @@ public class RoomUnit {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.status.containsKey(RoomUnitStatus.SNOWWAR_DIE_BACK) || this.status.containsKey(RoomUnitStatus.SNOWWAR_DIE_FRONT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.status.containsKey(RoomUnitStatus.SNOWWAR_PICK)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.status.containsKey(RoomUnitStatus.SIT)) {
|
||||
this.bodyRotation = (RoomUserRotation.values()[Rotation.Calculate(this.getX(), this.getY(), location.x, location.y)]);
|
||||
}
|
||||
@ -820,4 +846,11 @@ public class RoomUnit {
|
||||
public void setMoveBlockingTask(ScheduledFuture moveBlockingTask) {
|
||||
this.moveBlockingTask = moveBlockingTask;
|
||||
}
|
||||
|
||||
public boolean getIsGameSnow() {
|
||||
return isGameSnow;
|
||||
}
|
||||
public void setGameSnow(boolean gameSnow) {
|
||||
isGameSnow = gameSnow;
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,12 @@ public enum RoomUnitStatus {
|
||||
GROW_6("grw6"),
|
||||
GROW_7("grw7"),
|
||||
|
||||
SNOWWAR_DIE_BACK("swdieback", true),
|
||||
SNOWWAR_DIE_FRONT("swdiefront", true),
|
||||
SNOWWAR_PICK("swpick", true),
|
||||
SNOWWAR_RUN("swrun", true),
|
||||
SNOWWAR_THROW("swthrow", true),
|
||||
|
||||
KICK("kck"),
|
||||
WAG_TAIL("wag"),
|
||||
DANCE("dan"),
|
||||
|
@ -45,6 +45,7 @@ public class Habbo implements Runnable {
|
||||
private volatile boolean update;
|
||||
private volatile boolean disconnected = false;
|
||||
private volatile boolean disconnecting = false;
|
||||
public boolean roomBypass = false;
|
||||
|
||||
public Habbo(ResultSet set) {
|
||||
this.client = null;
|
||||
|
@ -32,12 +32,21 @@ public class RoomUserLookAtPoint extends MessageHandler {
|
||||
if (!roomUnit.canWalk())
|
||||
return;
|
||||
|
||||
if (roomUnit.isWalking() || roomUnit.hasStatus(RoomUnitStatus.SNOWWAR_RUN))
|
||||
return;
|
||||
|
||||
if (roomUnit.isWalking() || roomUnit.hasStatus(RoomUnitStatus.MOVE))
|
||||
return;
|
||||
|
||||
if (roomUnit.cmdLay || roomUnit.hasStatus(RoomUnitStatus.LAY))
|
||||
return;
|
||||
|
||||
if (roomUnit.hasStatus(RoomUnitStatus.SNOWWAR_DIE_BACK) || roomUnit.hasStatus(RoomUnitStatus.SNOWWAR_DIE_FRONT))
|
||||
return;
|
||||
|
||||
if (roomUnit.hasStatus(RoomUnitStatus.SNOWWAR_PICK))
|
||||
return;
|
||||
|
||||
if (roomUnit.isIdle())
|
||||
return;
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class RoomUserWalkEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
// Don't care
|
||||
if (habbo.getRoomUnit().hasStatus(RoomUnitStatus.LAY)) {
|
||||
if (habbo.getRoomUnit().hasStatus(RoomUnitStatus.LAY) || habbo.getRoomUnit().hasStatus(RoomUnitStatus.SNOWWAR_PICK) || habbo.getRoomUnit().hasStatus(RoomUnitStatus.SNOWWAR_DIE_FRONT) || habbo.getRoomUnit().hasStatus(RoomUnitStatus.SNOWWAR_DIE_BACK)) {
|
||||
if (room.getLayout().getTilesInFront(habbo.getRoomUnit().getCurrentLocation(), habbo.getRoomUnit().getBodyRotation().getValue(), 2).contains(tile))
|
||||
return;
|
||||
}
|
||||
|
@ -285,6 +285,70 @@ public class PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void updatePluginByName(String name) {
|
||||
File loc = new File("plugins");
|
||||
HabboPlugin pluginReload = null;
|
||||
|
||||
for(HabboPlugin p : this.plugins){
|
||||
if(p.configuration.name.equalsIgnoreCase(name)){
|
||||
pluginReload = p;
|
||||
}
|
||||
}
|
||||
|
||||
if (!loc.exists()) {
|
||||
if (loc.mkdirs()) {
|
||||
LOGGER.info("Created plugins directory!");
|
||||
}
|
||||
}
|
||||
|
||||
for (File file : Objects.requireNonNull(loc.listFiles(file -> file.getPath().toLowerCase().endsWith(".jar")))) {
|
||||
URLClassLoader urlClassLoader;
|
||||
InputStream stream;
|
||||
try {
|
||||
urlClassLoader = URLClassLoader.newInstance(new URL[]{file.toURI().toURL()});
|
||||
stream = urlClassLoader.getResourceAsStream("plugin.json");
|
||||
|
||||
if (stream == null) {
|
||||
throw new RuntimeException("Invalid Jar! Missing plugin.json in: " + file.getName());
|
||||
}
|
||||
|
||||
byte[] content = new byte[stream.available()];
|
||||
|
||||
if (stream.read(content) > 0) {
|
||||
String body = new String(content);
|
||||
|
||||
Gson gson = new GsonBuilder().create();
|
||||
HabboPluginConfiguration pluginConfigurtion = gson.fromJson(body, HabboPluginConfiguration.class);
|
||||
|
||||
try {
|
||||
Class<?> clazz = urlClassLoader.loadClass(pluginConfigurtion.main);
|
||||
Class<? extends HabboPlugin> stackClazz = clazz.asSubclass(HabboPlugin.class);
|
||||
Constructor<? extends HabboPlugin> constructor = stackClazz.getConstructor();
|
||||
HabboPlugin plugin = constructor.newInstance();
|
||||
plugin.configuration = pluginConfigurtion;
|
||||
plugin.classLoader = urlClassLoader;
|
||||
plugin.stream = stream;
|
||||
|
||||
if(plugin.configuration.name.equalsIgnoreCase(name) && pluginReload != null){
|
||||
if(this.plugins.contains(pluginReload) && this.plugins.remove(pluginReload)){
|
||||
this.plugins.add(plugin);
|
||||
plugin.onEnable();
|
||||
LOGGER.info("Plugin: " + plugin.configuration.name + " updated!");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Could not load plugin {}!", pluginConfigurtion.name);
|
||||
LOGGER.error("Caught exception", e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Caught exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void registerEvents(HabboPlugin plugin, EventListener listener) {
|
||||
synchronized (plugin.registeredEvents) {
|
||||
Method[] methods = listener.getClass().getMethods();
|
||||
|
@ -53,6 +53,11 @@ public class RoomUnitWalkToLocation implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.walker.getGoal().equals(this.goalTile) || (this.walker.getPath().size() == 0 && (!this.walker.hasStatus(RoomUnitStatus.MOVE) || !this.walker.hasStatus(RoomUnitStatus.SNOWWAR_RUN)))) {
|
||||
onFail();
|
||||
return;
|
||||
}
|
||||
|
||||
Emulator.getThreading().run(this, 250);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user