You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-19 15:06:19 +00:00
feat(wired): add leave/click/action/short-period triggers
- add wf_trg_leave_room, wf_trg_stuff_state, wf_trg_period_short, wf_trg_click_furni, wf_trg_click_tile, wf_trg_click_user and wf_trg_user_performs_action\n- add interaction type room_invisible_click_tile\n- persist selector-driven MatchFurni and ToggleRandom state changes\n- use configured duration in WiredEffectMuteHabbo
This commit is contained in:
@@ -203,16 +203,24 @@ public class ItemManager {
|
||||
this.interactionsList.add(new ItemInteraction("vendingmachine_no_sides", InteractionNoSidesVendingMachine.class));
|
||||
this.interactionsList.add(new ItemInteraction("tile_walkmagic", InteractionTileWalkMagic.class));
|
||||
this.interactionsList.add(new ItemInteraction("antenna", InteractionDefault.class));
|
||||
this.interactionsList.add(new ItemInteraction("room_invisible_click_tile", InteractionDefault.class));
|
||||
|
||||
this.interactionsList.add(new ItemInteraction("game_timer", InteractionGameTimer.class));
|
||||
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_walks_on_furni", WiredTriggerHabboWalkOnFurni.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_walks_off_furni", WiredTriggerHabboWalkOffFurni.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_click_furni", WiredTriggerHabboClicksFurni.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_click_tile", WiredTriggerHabboClicksTile.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_click_user", WiredTriggerHabboClicksUser.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_user_performs_action", WiredTriggerHabboPerformsAction.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_enter_room", WiredTriggerHabboEntersRoom.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_leave_room", WiredTriggerHabboLeavesRoom.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_says_something", WiredTriggerHabboSaysKeyword.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_periodically", WiredTriggerRepeater.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_period_short", WiredTriggerRepeaterShort.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_period_long", WiredTriggerRepeaterLong.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_state_changed", WiredTriggerFurniStateToggled.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_stuff_state", WiredTriggerFurniStateToggled.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_at_given_time", WiredTriggerAtSetTime.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_at_time_long", WiredTriggerAtTimeLong.class));
|
||||
this.interactionsList.add(new ItemInteraction("wf_trg_collision", WiredTriggerCollision.class));
|
||||
|
||||
+1
@@ -108,6 +108,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
|
||||
if (this.state && (this.checkForWiredResetPermission && item.allowWiredResetState())) {
|
||||
if (!setting.state.equals(" ") && !item.getExtradata().equals(setting.state)) {
|
||||
item.setExtradata(setting.state);
|
||||
item.needsUpdate(true);
|
||||
room.updateItemState(item);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
|
||||
|
||||
if (room.hasRights(habbo)) continue;
|
||||
|
||||
room.muteHabbo(habbo, 60);
|
||||
room.muteHabbo(habbo, Math.max(1, this.length));
|
||||
|
||||
habbo.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(this.message.replace("%user%", habbo.getHabboInfo().getUsername()).replace("%online_count%", Emulator.getGameEnvironment().getHabboManager().getOnlineCount() + "").replace("%room_count%", Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size() + ""), habbo, habbo, RoomChatMessageBubbles.WIRED)));
|
||||
}
|
||||
|
||||
+1
@@ -197,6 +197,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
|
||||
|
||||
try {
|
||||
item.setExtradata(Emulator.getRandom().nextInt(item.getBaseItem().getStateCount() + 1) + "");
|
||||
item.needsUpdate(true);
|
||||
room.updateItem(item);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Caught exception", e);
|
||||
|
||||
+134
-35
@@ -15,36 +15,48 @@ import gnu.trove.set.hash.THashSet;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger {
|
||||
private static final WiredTriggerType type = WiredTriggerType.STATE_CHANGED;
|
||||
private static final int MODE_ALL_STATES = 0;
|
||||
private static final int MODE_SAVED_STATE = 1;
|
||||
|
||||
private THashSet<HabboItem> items;
|
||||
private THashSet<StateSnapshot> snapshots;
|
||||
private int triggerMode = MODE_ALL_STATES;
|
||||
|
||||
public WiredTriggerFurniStateToggled(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
this.items = new THashSet<>();
|
||||
this.snapshots = new THashSet<>();
|
||||
}
|
||||
|
||||
public WiredTriggerFurniStateToggled(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||
this.items = new THashSet<>();
|
||||
this.snapshots = new THashSet<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(HabboItem triggerItem, WiredEvent event) {
|
||||
// Reject if this was triggered by a wired effect (to prevent loops)
|
||||
if (event.isTriggeredByEffect()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HabboItem sourceItem = event.getSourceItem().orElse(null);
|
||||
if (sourceItem != null) {
|
||||
return this.items.contains(sourceItem);
|
||||
if (sourceItem == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
StateSnapshot snapshot = this.getSnapshot(sourceItem.getId());
|
||||
if (snapshot == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.triggerMode == MODE_SAVED_STATE) {
|
||||
return snapshot.state.equals(this.normalizeState(sourceItem.getExtradata()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -56,21 +68,36 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger {
|
||||
@Override
|
||||
public String getWiredData() {
|
||||
return WiredManager.getGson().toJson(new JsonData(
|
||||
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
|
||||
this.triggerMode,
|
||||
new ArrayList<>(this.snapshots)
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||
this.items = new THashSet<>();
|
||||
this.snapshots = new THashSet<>();
|
||||
this.triggerMode = MODE_ALL_STATES;
|
||||
String wiredData = set.getString("wired_data");
|
||||
|
||||
if (wiredData.startsWith("{")) {
|
||||
if (wiredData != null && wiredData.startsWith("{")) {
|
||||
JsonData data = WiredManager.getGson().fromJson(wiredData, JsonData.class);
|
||||
for (Integer id: data.itemIds) {
|
||||
HabboItem item = room.getHabboItem(id);
|
||||
if (item != null) {
|
||||
this.items.add(item);
|
||||
this.triggerMode = (data != null) ? data.triggerMode : MODE_ALL_STATES;
|
||||
|
||||
if (data != null && data.snapshots != null && !data.snapshots.isEmpty()) {
|
||||
for (StateSnapshot snapshot : data.snapshots) {
|
||||
if (snapshot == null) continue;
|
||||
|
||||
HabboItem item = room.getHabboItem(snapshot.itemId);
|
||||
if (item != null) {
|
||||
this.snapshots.add(new StateSnapshot(item.getId(), snapshot.state));
|
||||
}
|
||||
}
|
||||
} else if (data != null && data.itemIds != null) {
|
||||
for (Integer id : data.itemIds) {
|
||||
HabboItem item = room.getHabboItem(id);
|
||||
if (item != null) {
|
||||
this.snapshots.add(this.captureSnapshot(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -79,10 +106,15 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger {
|
||||
|
||||
if (!wiredData.split(":")[2].equals("\t")) {
|
||||
for (String s : wiredData.split(":")[2].split(";")) {
|
||||
if (s.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
||||
|
||||
if (item != null)
|
||||
this.items.add(item);
|
||||
if (item != null) {
|
||||
this.snapshots.add(this.captureSnapshot(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,7 +123,8 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger {
|
||||
|
||||
@Override
|
||||
public void onPickUp() {
|
||||
this.items.clear();
|
||||
this.snapshots.clear();
|
||||
this.triggerMode = MODE_ALL_STATES;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,33 +134,31 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger {
|
||||
|
||||
@Override
|
||||
public void serializeWiredData(ServerMessage message, Room room) {
|
||||
THashSet<HabboItem> items = new THashSet<>();
|
||||
THashSet<StateSnapshot> snapshotsToRemove = new THashSet<>();
|
||||
|
||||
for (HabboItem item : this.items) {
|
||||
if (item.getRoomId() != this.getRoomId()) {
|
||||
items.add(item);
|
||||
for (StateSnapshot snapshot : this.snapshots) {
|
||||
HabboItem item = room.getHabboItem(snapshot.itemId);
|
||||
if (item == null || item.getRoomId() != this.getRoomId()) {
|
||||
snapshotsToRemove.add(snapshot);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (room.getHabboItem(item.getId()) == null) {
|
||||
items.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
for (HabboItem item : items) {
|
||||
this.items.remove(item);
|
||||
for (StateSnapshot snapshot : snapshotsToRemove) {
|
||||
this.snapshots.remove(snapshot);
|
||||
}
|
||||
|
||||
message.appendBoolean(false);
|
||||
message.appendInt(WiredManager.MAXIMUM_FURNI_SELECTION);
|
||||
message.appendInt(this.items.size());
|
||||
for (HabboItem item : this.items) {
|
||||
message.appendInt(item.getId());
|
||||
message.appendInt(this.snapshots.size());
|
||||
for (StateSnapshot snapshot : this.snapshots) {
|
||||
message.appendInt(snapshot.itemId);
|
||||
}
|
||||
message.appendInt(this.getBaseItem().getSpriteId());
|
||||
message.appendInt(this.getId());
|
||||
message.appendString("");
|
||||
message.appendInt(0);
|
||||
message.appendInt(1);
|
||||
message.appendInt(this.triggerMode);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.getType().code);
|
||||
message.appendInt(0);
|
||||
@@ -135,14 +166,22 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger {
|
||||
|
||||
@Override
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
this.items.clear();
|
||||
this.snapshots.clear();
|
||||
this.triggerMode = (settings.getIntParams().length > 0 && settings.getIntParams()[0] == MODE_SAVED_STATE)
|
||||
? MODE_SAVED_STATE
|
||||
: MODE_ALL_STATES;
|
||||
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
|
||||
if (room == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int count = settings.getFurniIds().length;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
HabboItem item = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]);
|
||||
HabboItem item = room.getHabboItem(settings.getFurniIds()[i]);
|
||||
if (item != null) {
|
||||
this.items.add(item);
|
||||
this.snapshots.add(this.captureSnapshot(item));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,11 +193,71 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger {
|
||||
return true;
|
||||
}
|
||||
|
||||
private StateSnapshot captureSnapshot(HabboItem item) {
|
||||
return new StateSnapshot(item.getId(), this.normalizeState(item.getExtradata()));
|
||||
}
|
||||
|
||||
private StateSnapshot getSnapshot(int itemId) {
|
||||
for (StateSnapshot snapshot : this.snapshots) {
|
||||
if (snapshot.itemId == itemId) {
|
||||
return snapshot;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private String normalizeState(String state) {
|
||||
return (state == null) ? "" : state;
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
int triggerMode;
|
||||
List<StateSnapshot> snapshots;
|
||||
List<Integer> itemIds;
|
||||
|
||||
public JsonData() {
|
||||
}
|
||||
|
||||
public JsonData(List<Integer> itemIds) {
|
||||
this.itemIds = itemIds;
|
||||
}
|
||||
|
||||
public JsonData(int triggerMode, List<StateSnapshot> snapshots) {
|
||||
this.triggerMode = triggerMode;
|
||||
this.snapshots = snapshots;
|
||||
}
|
||||
}
|
||||
|
||||
static class StateSnapshot {
|
||||
int itemId;
|
||||
String state;
|
||||
|
||||
public StateSnapshot() {
|
||||
}
|
||||
|
||||
public StateSnapshot(int itemId, String state) {
|
||||
this.itemId = itemId;
|
||||
this.state = (state == null) ? "" : state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Integer.hashCode(this.itemId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(object instanceof StateSnapshot)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
StateSnapshot that = (StateSnapshot) object;
|
||||
return this.itemId == that.itemId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredEvent;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class WiredTriggerHabboClicksFurni extends InteractionWiredTrigger {
|
||||
public static final WiredTriggerType type = WiredTriggerType.CLICKS_FURNI;
|
||||
|
||||
private THashSet<HabboItem> items;
|
||||
|
||||
public WiredTriggerHabboClicksFurni(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
this.items = new THashSet<>();
|
||||
}
|
||||
|
||||
public WiredTriggerHabboClicksFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||
this.items = new THashSet<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(HabboItem triggerItem, WiredEvent event) {
|
||||
HabboItem sourceItem = event.getSourceItem().orElse(null);
|
||||
return sourceItem != null && this.items.contains(sourceItem);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WiredTriggerType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeWiredData(ServerMessage message, Room room) {
|
||||
THashSet<HabboItem> items = new THashSet<>();
|
||||
|
||||
if (Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()) == null) {
|
||||
items.addAll(this.items);
|
||||
} else {
|
||||
for (HabboItem item : this.items) {
|
||||
if (Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) {
|
||||
items.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (HabboItem item : items) {
|
||||
this.items.remove(item);
|
||||
}
|
||||
|
||||
message.appendBoolean(false);
|
||||
message.appendInt(WiredManager.MAXIMUM_FURNI_SELECTION);
|
||||
message.appendInt(this.items.size());
|
||||
for (HabboItem item : this.items) {
|
||||
message.appendInt(item.getId());
|
||||
}
|
||||
message.appendInt(this.getBaseItem().getSpriteId());
|
||||
message.appendInt(this.getId());
|
||||
message.appendString("");
|
||||
message.appendInt(0);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.getType().code);
|
||||
message.appendInt(0);
|
||||
message.appendInt(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
this.items.clear();
|
||||
|
||||
int count = settings.getFurniIds().length;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
HabboItem item = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i]);
|
||||
if (item != null) {
|
||||
this.items.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWiredData() {
|
||||
return WiredManager.getGson().toJson(new JsonData(
|
||||
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||
this.items.clear();
|
||||
String wiredData = set.getString("wired_data");
|
||||
|
||||
if (wiredData.startsWith("{")) {
|
||||
JsonData data = WiredManager.getGson().fromJson(wiredData, JsonData.class);
|
||||
for (Integer id : data.itemIds) {
|
||||
HabboItem item = room.getHabboItem(id);
|
||||
if (item != null) {
|
||||
this.items.add(item);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (wiredData.split(":").length >= 3) {
|
||||
super.setDelay(Integer.parseInt(wiredData.split(":")[0]));
|
||||
|
||||
if (!wiredData.split(":")[2].equals("\t")) {
|
||||
for (String s : wiredData.split(":")[2].split(";")) {
|
||||
if (s.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
||||
|
||||
if (item != null) {
|
||||
this.items.add(item);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickUp() {
|
||||
this.items.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggeredByRoomUnit() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
List<Integer> itemIds;
|
||||
|
||||
public JsonData(List<Integer> itemIds) {
|
||||
this.itemIds = itemIds;
|
||||
}
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredEvent;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class WiredTriggerHabboClicksTile extends WiredTriggerHabboClicksFurni {
|
||||
public static final WiredTriggerType type = WiredTriggerType.CLICKS_TILE;
|
||||
|
||||
private static final String CLICK_TILE_INTERACTION = "room_invisible_click_tile";
|
||||
|
||||
public WiredTriggerHabboClicksTile(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
}
|
||||
|
||||
public WiredTriggerHabboClicksTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(HabboItem triggerItem, WiredEvent event) {
|
||||
if (!super.matches(triggerItem, event)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HabboItem sourceItem = event.getSourceItem().orElse(null);
|
||||
return isClickTileItem(sourceItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WiredTriggerType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
private boolean isClickTileItem(HabboItem item) {
|
||||
if (item == null || item.getBaseItem() == null || item.getBaseItem().getInteractionType() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String interaction = item.getBaseItem().getInteractionType().getName();
|
||||
return interaction != null && interaction.equalsIgnoreCase(CLICK_TILE_INTERACTION);
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredEvent;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class WiredTriggerHabboClicksUser extends InteractionWiredTrigger {
|
||||
public static final WiredTriggerType type = WiredTriggerType.CLICKS_USER;
|
||||
|
||||
public WiredTriggerHabboClicksUser(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
}
|
||||
|
||||
public WiredTriggerHabboClicksUser(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(HabboItem triggerItem, WiredEvent event) {
|
||||
return event.getActor().isPresent();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWiredData() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickUp() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WiredTriggerType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeWiredData(ServerMessage message, Room room) {
|
||||
message.appendBoolean(false);
|
||||
message.appendInt(5);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.getBaseItem().getSpriteId());
|
||||
message.appendInt(this.getId());
|
||||
message.appendString("");
|
||||
message.appendInt(0);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.getType().code);
|
||||
message.appendInt(0);
|
||||
message.appendInt(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggeredByRoomUnit() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredEvent;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class WiredTriggerHabboLeavesRoom extends InteractionWiredTrigger {
|
||||
public static final WiredTriggerType type = WiredTriggerType.LEAVE_ROOM;
|
||||
|
||||
private String username = "";
|
||||
|
||||
public WiredTriggerHabboLeavesRoom(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
}
|
||||
|
||||
public WiredTriggerHabboLeavesRoom(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(HabboItem triggerItem, WiredEvent event) {
|
||||
RoomUnit roomUnit = event.getActor().orElse(null);
|
||||
Room room = event.getRoom();
|
||||
Habbo habbo = room.getHabbo(roomUnit);
|
||||
|
||||
if (habbo != null) {
|
||||
if (this.username.length() > 0) {
|
||||
return habbo.getHabboInfo().getUsername().equalsIgnoreCase(this.username);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWiredData() {
|
||||
return WiredManager.getGson().toJson(new JsonData(
|
||||
this.username
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||
String wiredData = set.getString("wired_data");
|
||||
|
||||
if (wiredData.startsWith("{")) {
|
||||
JsonData data = WiredManager.getGson().fromJson(wiredData, JsonData.class);
|
||||
this.username = data.username;
|
||||
} else {
|
||||
this.username = wiredData;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickUp() {
|
||||
this.username = "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public WiredTriggerType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeWiredData(ServerMessage message, Room room) {
|
||||
message.appendBoolean(false);
|
||||
message.appendInt(5);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.getBaseItem().getSpriteId());
|
||||
message.appendInt(this.getId());
|
||||
message.appendString(this.username);
|
||||
message.appendInt(0);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.getType().code);
|
||||
message.appendInt(0);
|
||||
message.appendInt(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
this.username = settings.getStringParam();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggeredByRoomUnit() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
String username;
|
||||
|
||||
public JsonData(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
}
|
||||
}
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredUserActionType;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredEvent;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class WiredTriggerHabboPerformsAction extends InteractionWiredTrigger {
|
||||
private static final WiredTriggerType type = WiredTriggerType.USER_PERFORMS_ACTION;
|
||||
private static final int DEFAULT_ACTION = WiredUserActionType.WAVE;
|
||||
|
||||
private int selectedAction = DEFAULT_ACTION;
|
||||
private boolean signFilterEnabled = false;
|
||||
private int signId = 0;
|
||||
private boolean danceFilterEnabled = false;
|
||||
private int danceId = 1;
|
||||
|
||||
public WiredTriggerHabboPerformsAction(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
}
|
||||
|
||||
public WiredTriggerHabboPerformsAction(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(HabboItem triggerItem, WiredEvent event) {
|
||||
if (!event.getActor().isPresent()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (event.getActionId() != this.selectedAction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.selectedAction == WiredUserActionType.SIGN && this.signFilterEnabled) {
|
||||
return event.getActionParameter() == this.signId;
|
||||
}
|
||||
|
||||
if (this.selectedAction == WiredUserActionType.DANCE && this.danceFilterEnabled) {
|
||||
return event.getActionParameter() == this.danceId;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWiredData() {
|
||||
return WiredManager.getGson().toJson(new JsonData(
|
||||
this.selectedAction,
|
||||
this.signFilterEnabled,
|
||||
this.signId,
|
||||
this.danceFilterEnabled,
|
||||
this.danceId
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||
this.resetSettings();
|
||||
|
||||
String wiredData = set.getString("wired_data");
|
||||
|
||||
if (wiredData != null && wiredData.startsWith("{")) {
|
||||
JsonData data = WiredManager.getGson().fromJson(wiredData, JsonData.class);
|
||||
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.selectedAction = normalizeAction(data.selectedAction);
|
||||
this.signFilterEnabled = data.signFilterEnabled;
|
||||
this.signId = normalizeSignId(data.signId);
|
||||
this.danceFilterEnabled = data.danceFilterEnabled;
|
||||
this.danceId = normalizeDanceId(data.danceId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickUp() {
|
||||
this.resetSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WiredTriggerType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeWiredData(ServerMessage message, Room room) {
|
||||
message.appendBoolean(false);
|
||||
message.appendInt(5);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.getBaseItem().getSpriteId());
|
||||
message.appendInt(this.getId());
|
||||
message.appendString("");
|
||||
message.appendInt(5);
|
||||
message.appendInt(this.selectedAction);
|
||||
message.appendInt(this.signFilterEnabled ? 1 : 0);
|
||||
message.appendInt(this.signId);
|
||||
message.appendInt(this.danceFilterEnabled ? 1 : 0);
|
||||
message.appendInt(this.danceId);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.getType().code);
|
||||
message.appendInt(0);
|
||||
message.appendInt(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
int[] intParams = settings.getIntParams();
|
||||
|
||||
this.resetSettings();
|
||||
|
||||
if (intParams.length > 0) {
|
||||
this.selectedAction = normalizeAction(intParams[0]);
|
||||
}
|
||||
|
||||
if (intParams.length > 1) {
|
||||
this.signFilterEnabled = (intParams[1] == 1);
|
||||
}
|
||||
|
||||
if (intParams.length > 2) {
|
||||
this.signId = normalizeSignId(intParams[2]);
|
||||
}
|
||||
|
||||
if (intParams.length > 3) {
|
||||
this.danceFilterEnabled = (intParams[3] == 1);
|
||||
}
|
||||
|
||||
if (intParams.length > 4) {
|
||||
this.danceId = normalizeDanceId(intParams[4]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggeredByRoomUnit() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void resetSettings() {
|
||||
this.selectedAction = DEFAULT_ACTION;
|
||||
this.signFilterEnabled = false;
|
||||
this.signId = 0;
|
||||
this.danceFilterEnabled = false;
|
||||
this.danceId = 1;
|
||||
}
|
||||
|
||||
private int normalizeAction(int action) {
|
||||
switch (action) {
|
||||
case WiredUserActionType.WAVE:
|
||||
case WiredUserActionType.BLOW_KISS:
|
||||
case WiredUserActionType.LAUGH:
|
||||
case WiredUserActionType.AWAKE:
|
||||
case WiredUserActionType.RELAX:
|
||||
case WiredUserActionType.SIT:
|
||||
case WiredUserActionType.STAND:
|
||||
case WiredUserActionType.LAY:
|
||||
case WiredUserActionType.SIGN:
|
||||
case WiredUserActionType.DANCE:
|
||||
case WiredUserActionType.THUMB_UP:
|
||||
return action;
|
||||
default:
|
||||
return DEFAULT_ACTION;
|
||||
}
|
||||
}
|
||||
|
||||
private int normalizeSignId(int signId) {
|
||||
if (signId < 0 || signId > 17) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return signId;
|
||||
}
|
||||
|
||||
private int normalizeDanceId(int danceId) {
|
||||
if (danceId < 1 || danceId > 4) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return danceId;
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
int selectedAction;
|
||||
boolean signFilterEnabled;
|
||||
int signId;
|
||||
boolean danceFilterEnabled;
|
||||
int danceId;
|
||||
|
||||
public JsonData(int selectedAction, boolean signFilterEnabled, int signId, boolean danceFilterEnabled, int danceId) {
|
||||
this.selectedAction = selectedAction;
|
||||
this.signFilterEnabled = signFilterEnabled;
|
||||
this.signId = signId;
|
||||
this.danceFilterEnabled = danceFilterEnabled;
|
||||
this.danceId = danceId;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -139,7 +139,7 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements
|
||||
// Fire when elapsed time is a multiple of repeat time
|
||||
if (elapsedMs % this.repeatTime == 0) {
|
||||
if (this.getRoomId() != 0 && room.isLoaded()) {
|
||||
WiredManager.triggerTimerRepeat(room, this);
|
||||
WiredManager.triggerTimerRepeatLong(room, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import gnu.trove.procedure.TObjectProcedure;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WiredTriggerRepeaterShort extends WiredTriggerRepeater {
|
||||
public static final WiredTriggerType type = WiredTriggerType.PERIODICALLY_SHORT;
|
||||
public static final int STEP_MS = 50;
|
||||
public static final int DEFAULT_DELAY = 10 * STEP_MS;
|
||||
public static final int MIN_DELAY = STEP_MS;
|
||||
public static final int MAX_DELAY = 10 * STEP_MS;
|
||||
|
||||
public WiredTriggerRepeaterShort(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
this.repeatTime = DEFAULT_DELAY;
|
||||
}
|
||||
|
||||
public WiredTriggerRepeaterShort(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||
this.repeatTime = DEFAULT_DELAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||
String wiredData = set.getString("wired_data");
|
||||
|
||||
if (wiredData != null && wiredData.startsWith("{")) {
|
||||
JsonData data = WiredManager.getGson().fromJson(wiredData, JsonData.class);
|
||||
this.repeatTime = (data != null) ? data.repeatTime : DEFAULT_DELAY;
|
||||
} else if (wiredData != null && wiredData.length() >= 1) {
|
||||
this.repeatTime = Integer.parseInt(wiredData);
|
||||
} else {
|
||||
this.repeatTime = DEFAULT_DELAY;
|
||||
}
|
||||
|
||||
this.repeatTime = clampRepeatTime(this.repeatTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickUp() {
|
||||
this.repeatTime = DEFAULT_DELAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WiredTriggerType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeWiredData(ServerMessage message, Room room) {
|
||||
message.appendBoolean(false);
|
||||
message.appendInt(5);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.getBaseItem().getSpriteId());
|
||||
message.appendInt(this.getId());
|
||||
message.appendString("");
|
||||
message.appendInt(1);
|
||||
message.appendInt(this.repeatTime / STEP_MS);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.getType().code);
|
||||
|
||||
if (!this.isTriggeredByRoomUnit()) {
|
||||
List<Integer> invalidTriggers = new ArrayList<>();
|
||||
room.getRoomSpecialTypes().getEffects(this.getX(), this.getY()).forEach(new TObjectProcedure<InteractionWiredEffect>() {
|
||||
@Override
|
||||
public boolean execute(InteractionWiredEffect object) {
|
||||
if (object.requiresTriggeringUser()) {
|
||||
invalidTriggers.add(object.getBaseItem().getSpriteId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
message.appendInt(invalidTriggers.size());
|
||||
for (Integer i : invalidTriggers) {
|
||||
message.appendInt(i);
|
||||
}
|
||||
} else {
|
||||
message.appendInt(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveData(WiredSettings settings) {
|
||||
if (settings.getIntParams().length < 1) return false;
|
||||
|
||||
int newRepeatTime = settings.getIntParams()[0] * STEP_MS;
|
||||
this.repeatTime = clampRepeatTime(newRepeatTime);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWiredTick(Room room, long tickCount, int tickIntervalMs) {
|
||||
long elapsedMs = tickCount * tickIntervalMs;
|
||||
|
||||
if (elapsedMs % this.repeatTime == 0) {
|
||||
if (this.getRoomId() != 0 && room.isLoaded()) {
|
||||
WiredManager.triggerTimerRepeatShort(room, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int clampRepeatTime(int repeatTime) {
|
||||
if (repeatTime < MIN_DELAY) {
|
||||
return DEFAULT_DELAY;
|
||||
}
|
||||
|
||||
if (repeatTime > MAX_DELAY) {
|
||||
return MAX_DELAY;
|
||||
}
|
||||
|
||||
return repeatTime;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,8 @@ import com.eu.habbo.habbohotel.pets.PetManager;
|
||||
import com.eu.habbo.habbohotel.users.DanceType;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.habbohotel.wired.WiredUserActionType;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
||||
import com.eu.habbo.messages.ISerialize;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.outgoing.guilds.GuildInfoComposer;
|
||||
@@ -2151,6 +2153,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
- habbo.getRoomUnit().getBodyRotation().getValue() % 2]);
|
||||
habbo.getRoomUnit().setStatus(RoomUnitStatus.SIT, 0.5 + "");
|
||||
this.sendComposer(new RoomUserStatusComposer(habbo.getRoomUnit()).compose());
|
||||
WiredManager.triggerUserPerformsAction(this, habbo.getRoomUnit(), WiredUserActionType.SIT, -1);
|
||||
}
|
||||
|
||||
public void makeStand(Habbo habbo) {
|
||||
@@ -2160,12 +2163,19 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
|
||||
HabboItem item = this.getTopItemAt(habbo.getRoomUnit().getX(), habbo.getRoomUnit().getY());
|
||||
if (item == null || !item.getBaseItem().allowSit() || !item.getBaseItem().allowLay()) {
|
||||
boolean wasSittingOrLaying = habbo.getRoomUnit().hasStatus(RoomUnitStatus.SIT)
|
||||
|| habbo.getRoomUnit().hasStatus(RoomUnitStatus.LAY);
|
||||
habbo.getRoomUnit().cmdStand = true;
|
||||
habbo.getRoomUnit().setBodyRotation(
|
||||
RoomUserRotation.values()[habbo.getRoomUnit().getBodyRotation().getValue()
|
||||
- habbo.getRoomUnit().getBodyRotation().getValue() % 2]);
|
||||
habbo.getRoomUnit().removeStatus(RoomUnitStatus.SIT);
|
||||
habbo.getRoomUnit().removeStatus(RoomUnitStatus.LAY);
|
||||
this.sendComposer(new RoomUserStatusComposer(habbo.getRoomUnit()).compose());
|
||||
|
||||
if (wasSittingOrLaying) {
|
||||
WiredManager.triggerUserPerformsAction(this, habbo.getRoomUnit(), WiredUserActionType.STAND, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboGender;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
||||
import com.eu.habbo.habbohotel.wired.WiredUserActionType;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.GenericErrorMessagesComposer;
|
||||
import com.eu.habbo.messages.outgoing.inventory.AddPetComposer;
|
||||
import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetComposer;
|
||||
@@ -217,6 +218,10 @@ public class RoomUnitManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (habbo.getRoomUnit() != null) {
|
||||
WiredManager.triggerUserLeavesRoom(this.room, habbo.getRoomUnit());
|
||||
}
|
||||
|
||||
if (habbo.getRoomUnit() != null && habbo.getRoomUnit().getCurrentLocation() != null) {
|
||||
habbo.getRoomUnit().getCurrentLocation().removeUnit(habbo.getRoomUnit());
|
||||
}
|
||||
@@ -352,6 +357,7 @@ public class RoomUnitManager {
|
||||
}
|
||||
|
||||
double z = habbo.getRoomUnit().getCurrentLocation().getStackHeight();
|
||||
boolean hadLayStatus = habbo.getRoomUnit().hasStatus(RoomUnitStatus.LAY);
|
||||
|
||||
if (habbo.getRoomUnit().hasStatus(RoomUnitStatus.SIT)
|
||||
|| (topItem != null && topItem.getBaseItem().allowSit())) {
|
||||
@@ -413,6 +419,10 @@ public class RoomUnitManager {
|
||||
}
|
||||
|
||||
habbo.getRoomUnit().statusUpdate(true);
|
||||
|
||||
if (!hadLayStatus && habbo.getRoomUnit().hasStatus(RoomUnitStatus.LAY)) {
|
||||
WiredManager.triggerUserPerformsAction(this.room, habbo.getRoomUnit(), WiredUserActionType.LAY, -1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!habbos.isEmpty()) {
|
||||
|
||||
@@ -466,7 +466,7 @@ public class WiredHandler {
|
||||
room.getRoomSpecialTypes().getTriggers().forEach(t -> {
|
||||
if (t == null) return;
|
||||
|
||||
if (t.getType() == WiredTriggerType.AT_GIVEN_TIME || t.getType() == WiredTriggerType.PERIODICALLY || t.getType() == WiredTriggerType.PERIODICALLY_LONG) {
|
||||
if (t.getType() == WiredTriggerType.AT_GIVEN_TIME || t.getType() == WiredTriggerType.PERIODICALLY || t.getType() == WiredTriggerType.PERIODICALLY_LONG || t.getType() == WiredTriggerType.PERIODICALLY_SHORT) {
|
||||
((WiredTriggerReset) t).resetTimer();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -15,6 +15,12 @@ public enum WiredTriggerType {
|
||||
PERIODICALLY_LONG(12),
|
||||
BOT_REACHED_STF(13),
|
||||
BOT_REACHED_AVTR(14),
|
||||
LEAVE_ROOM(16),
|
||||
PERIODICALLY_SHORT(17),
|
||||
CLICKS_FURNI(18),
|
||||
CLICKS_TILE(19),
|
||||
CLICKS_USER(20),
|
||||
USER_PERFORMS_ACTION(21),
|
||||
SAY_COMMAND(0),
|
||||
IDLES(11),
|
||||
UNIDLES(11),
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.eu.habbo.habbohotel.wired;
|
||||
|
||||
public final class WiredUserActionType {
|
||||
public static final int WAVE = 1;
|
||||
public static final int BLOW_KISS = 2;
|
||||
public static final int LAUGH = 3;
|
||||
public static final int AWAKE = 4;
|
||||
public static final int RELAX = 5;
|
||||
public static final int SIT = 6;
|
||||
public static final int STAND = 7;
|
||||
public static final int LAY = 8;
|
||||
public static final int SIGN = 9;
|
||||
public static final int DANCE = 10;
|
||||
public static final int THUMB_UP = 11;
|
||||
|
||||
private WiredUserActionType() {
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,18 @@ public final class WiredEvent {
|
||||
|
||||
/** User walks off furniture */
|
||||
USER_WALKS_OFF(WiredTriggerType.WALKS_OFF_FURNI),
|
||||
|
||||
/** User clicks furniture */
|
||||
USER_CLICKS_FURNI(WiredTriggerType.CLICKS_FURNI),
|
||||
|
||||
/** User clicks invisible click tile furniture */
|
||||
USER_CLICKS_TILE(WiredTriggerType.CLICKS_TILE),
|
||||
|
||||
/** User clicks another user */
|
||||
USER_CLICKS_USER(WiredTriggerType.CLICKS_USER),
|
||||
|
||||
/** User performs an avatar action */
|
||||
USER_PERFORMS_ACTION(WiredTriggerType.USER_PERFORMS_ACTION),
|
||||
|
||||
/** Furniture state is toggled/changed */
|
||||
FURNI_STATE_CHANGED(WiredTriggerType.STATE_CHANGED),
|
||||
@@ -54,9 +66,15 @@ public final class WiredEvent {
|
||||
|
||||
/** Long timer repeat */
|
||||
TIMER_REPEAT_LONG(WiredTriggerType.PERIODICALLY_LONG),
|
||||
|
||||
/** Short timer repeat */
|
||||
TIMER_REPEAT_SHORT(WiredTriggerType.PERIODICALLY_SHORT),
|
||||
|
||||
/** User enters the room */
|
||||
USER_ENTERS_ROOM(WiredTriggerType.ENTER_ROOM),
|
||||
|
||||
/** User leaves the room */
|
||||
USER_LEAVES_ROOM(WiredTriggerType.LEAVE_ROOM),
|
||||
|
||||
/** Game starts */
|
||||
GAME_STARTS(WiredTriggerType.GAME_STARTS),
|
||||
@@ -141,6 +159,8 @@ public final class WiredEvent {
|
||||
private final boolean triggeredByEffect; // true if triggered by a wired effect (to prevent loops)
|
||||
private final int callStackDepth; // recursion depth for trigger stacks effect
|
||||
private final int signalChannel; // channel for signal routing (0-based)
|
||||
private final int actionId; // user action id for USER_PERFORMS_ACTION
|
||||
private final int actionParameter; // sign/dance parameter when relevant
|
||||
private final long createdAtMs;
|
||||
|
||||
private WiredEvent(Builder builder) {
|
||||
@@ -156,6 +176,8 @@ public final class WiredEvent {
|
||||
this.triggeredByEffect = builder.triggeredByEffect;
|
||||
this.callStackDepth = builder.callStackDepth;
|
||||
this.signalChannel = builder.signalChannel;
|
||||
this.actionId = builder.actionId;
|
||||
this.actionParameter = builder.actionParameter;
|
||||
this.createdAtMs = builder.createdAtMs;
|
||||
}
|
||||
|
||||
@@ -258,6 +280,14 @@ public final class WiredEvent {
|
||||
return signalChannel;
|
||||
}
|
||||
|
||||
public int getActionId() {
|
||||
return actionId;
|
||||
}
|
||||
|
||||
public int getActionParameter() {
|
||||
return actionParameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the timestamp when this event was created.
|
||||
* @return milliseconds since epoch
|
||||
@@ -313,6 +343,8 @@ public final class WiredEvent {
|
||||
private boolean triggeredByEffect;
|
||||
private int callStackDepth;
|
||||
private int signalChannel;
|
||||
private int actionId;
|
||||
private int actionParameter = -1;
|
||||
private long createdAtMs = System.currentTimeMillis();
|
||||
|
||||
private Builder(Type type, Room room) {
|
||||
@@ -417,6 +449,16 @@ public final class WiredEvent {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder actionId(int actionId) {
|
||||
this.actionId = actionId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder actionParameter(int actionParameter) {
|
||||
this.actionParameter = actionParameter;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a custom creation timestamp.
|
||||
* @param createdAtMs milliseconds since epoch
|
||||
|
||||
@@ -235,6 +235,54 @@ public final class WiredManager {
|
||||
return handleEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger when a user clicks furniture.
|
||||
*/
|
||||
public static boolean triggerUserClicksFurni(Room room, RoomUnit user, HabboItem item) {
|
||||
if (!isEnabled() || room == null || user == null || item == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WiredEvent event = WiredEvents.userClicksFurni(room, user, item);
|
||||
return handleEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger when a user clicks invisible click tile furniture.
|
||||
*/
|
||||
public static boolean triggerUserClicksTile(Room room, RoomUnit user, HabboItem item) {
|
||||
if (!isEnabled() || room == null || user == null || item == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WiredEvent event = WiredEvents.userClicksTile(room, user, item);
|
||||
return handleEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger when a user clicks another user.
|
||||
*/
|
||||
public static boolean triggerUserClicksUser(Room room, RoomUnit clickingUser, RoomUnit clickedUser) {
|
||||
if (!isEnabled() || room == null || clickingUser == null || clickedUser == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WiredEvent event = WiredEvents.userClicksUser(room, clickingUser, clickedUser);
|
||||
return handleEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger when a user performs an avatar action.
|
||||
*/
|
||||
public static boolean triggerUserPerformsAction(Room room, RoomUnit user, int actionId, int actionParameter) {
|
||||
if (!isEnabled() || room == null || user == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WiredEvent event = WiredEvents.userPerformsAction(room, user, actionId, actionParameter);
|
||||
return handleEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger when a user says something.
|
||||
*/
|
||||
@@ -259,6 +307,18 @@ public final class WiredManager {
|
||||
return handleEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger when a user leaves the room.
|
||||
*/
|
||||
public static boolean triggerUserLeavesRoom(Room room, RoomUnit user) {
|
||||
if (!isEnabled() || room == null || user == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WiredEvent event = WiredEvents.userLeavesRoom(room, user);
|
||||
return handleEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger when furniture state changes.
|
||||
*/
|
||||
@@ -295,6 +355,30 @@ public final class WiredManager {
|
||||
return handleEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger a long periodic timer.
|
||||
*/
|
||||
public static boolean triggerTimerRepeatLong(Room room, HabboItem timerItem) {
|
||||
if (!isEnabled() || room == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WiredEvent event = WiredEvents.timerRepeatLong(room, timerItem);
|
||||
return handleEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger a short periodic timer.
|
||||
*/
|
||||
public static boolean triggerTimerRepeatShort(Room room, HabboItem timerItem) {
|
||||
if (!isEnabled() || room == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WiredEvent event = WiredEvents.timerRepeatShort(room, timerItem);
|
||||
return handleEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger game start.
|
||||
*/
|
||||
|
||||
@@ -67,6 +67,70 @@ public final class WiredEvents {
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an event for when a user clicks furniture.
|
||||
* @param room the room
|
||||
* @param user the clicking user
|
||||
* @param item the clicked furniture
|
||||
* @return the event
|
||||
*/
|
||||
public static WiredEvent userClicksFurni(Room room, RoomUnit user, HabboItem item) {
|
||||
RoomTile tile = room.getLayout().getTile(item.getX(), item.getY());
|
||||
return WiredEvent.builder(WiredEvent.Type.USER_CLICKS_FURNI, room)
|
||||
.actor(user)
|
||||
.sourceItem(item)
|
||||
.tile(tile)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an event for when a user clicks invisible click tile furniture.
|
||||
* @param room the room
|
||||
* @param user the clicking user
|
||||
* @param item the clicked furniture
|
||||
* @return the event
|
||||
*/
|
||||
public static WiredEvent userClicksTile(Room room, RoomUnit user, HabboItem item) {
|
||||
RoomTile tile = room.getLayout().getTile(item.getX(), item.getY());
|
||||
return WiredEvent.builder(WiredEvent.Type.USER_CLICKS_TILE, room)
|
||||
.actor(user)
|
||||
.sourceItem(item)
|
||||
.tile(tile)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an event for when a user clicks another user.
|
||||
* @param room the room
|
||||
* @param clickingUser the user performing the click
|
||||
* @param clickedUser the user who was clicked
|
||||
* @return the event
|
||||
*/
|
||||
public static WiredEvent userClicksUser(Room room, RoomUnit clickingUser, RoomUnit clickedUser) {
|
||||
return WiredEvent.builder(WiredEvent.Type.USER_CLICKS_USER, room)
|
||||
.actor(clickedUser)
|
||||
.targetUnit(clickingUser)
|
||||
.tile(clickedUser.getCurrentLocation())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an event for when a user performs an avatar action.
|
||||
* @param room the room
|
||||
* @param user the acting user
|
||||
* @param actionId the wired action id
|
||||
* @param actionParameter sign/dance parameter, or -1 when unused
|
||||
* @return the event
|
||||
*/
|
||||
public static WiredEvent userPerformsAction(Room room, RoomUnit user, int actionId, int actionParameter) {
|
||||
return WiredEvent.builder(WiredEvent.Type.USER_PERFORMS_ACTION, room)
|
||||
.actor(user)
|
||||
.tile(user.getCurrentLocation())
|
||||
.actionId(actionId)
|
||||
.actionParameter(actionParameter)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an event for when a user enters the room.
|
||||
* @param room the room
|
||||
@@ -80,6 +144,19 @@ public final class WiredEvents {
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an event for when a user leaves the room.
|
||||
* @param room the room
|
||||
* @param user the user who left
|
||||
* @return the event
|
||||
*/
|
||||
public static WiredEvent userLeavesRoom(Room room, RoomUnit user) {
|
||||
return WiredEvent.builder(WiredEvent.Type.USER_LEAVES_ROOM, room)
|
||||
.actor(user)
|
||||
.tile(user.getCurrentLocation())
|
||||
.build();
|
||||
}
|
||||
|
||||
// ========== User Interaction Events ==========
|
||||
|
||||
/**
|
||||
@@ -153,6 +230,18 @@ public final class WiredEvents {
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an event for a short periodic timer.
|
||||
* @param room the room
|
||||
* @param timerItem the timer furniture
|
||||
* @return the event
|
||||
*/
|
||||
public static WiredEvent timerRepeatShort(Room room, HabboItem timerItem) {
|
||||
return WiredEvent.builder(WiredEvent.Type.TIMER_REPEAT_SHORT, room)
|
||||
.sourceItem(timerItem)
|
||||
.build();
|
||||
}
|
||||
|
||||
// ========== Game Events ==========
|
||||
|
||||
/**
|
||||
|
||||
@@ -387,6 +387,8 @@ public class PacketManager {
|
||||
this.registerHandler(Incoming.RoomPlacePaintEvent, RoomPlacePaintEvent.class);
|
||||
this.registerHandler(Incoming.RoomUserStartTypingEvent, RoomUserStartTypingEvent.class);
|
||||
this.registerHandler(Incoming.RoomUserStopTypingEvent, RoomUserStopTypingEvent.class);
|
||||
this.registerHandler(Incoming.ClickFurniEvent, ClickFurniEvent.class);
|
||||
this.registerHandler(Incoming.ClickUserEvent, ClickUserEvent.class);
|
||||
this.registerHandler(Incoming.ToggleFloorItemEvent, ToggleFloorItemEvent.class);
|
||||
this.registerHandler(Incoming.ToggleWallItemEvent, ToggleWallItemEvent.class);
|
||||
this.registerHandler(Incoming.RoomBackgroundEvent, RoomBackgroundEvent.class);
|
||||
@@ -647,4 +649,4 @@ public class PacketManager {
|
||||
this.registerHandler(Incoming.GameCenterEvent, GameCenterEvent.class);
|
||||
this.registerHandler(Incoming.GameCenterRequestGameStatusEvent, GameCenterRequestGameStatusEvent.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,6 +205,7 @@ public class Incoming {
|
||||
public static final int RequestRoomDataEvent = 2230;
|
||||
public static final int RequestRoomHeightmapEvent = 2300;
|
||||
public static final int RequestGuildFurniWidgetEvent = 2651;
|
||||
public static final int ClickFurniEvent = 6002;
|
||||
public static final int RequestOwnItemsEvent = 2105;
|
||||
public static final int RequestReportRoomEvent = 3267;
|
||||
public static final int ReportEvent = 1691;
|
||||
@@ -407,6 +408,7 @@ public class Incoming {
|
||||
|
||||
// CUSTOM
|
||||
public static final int UpdateFurniturePositionEvent = 10019;
|
||||
public static final int ClickUserEvent = 10020;
|
||||
public static final int RequestInventoryPetDelete = 10030;
|
||||
public static final int RequestInventoryBadgeDelete = 10031;
|
||||
}
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.eu.habbo.messages.incoming.rooms.items;
|
||||
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
|
||||
public class ClickFurniEvent extends MessageHandler {
|
||||
private static final String CLICK_TILE_INTERACTION = "room_invisible_click_tile";
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
||||
|
||||
if (room == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int itemId = Math.abs(this.packet.readInt());
|
||||
this.packet.readInt();
|
||||
|
||||
HabboItem item = room.getHabboItem(itemId);
|
||||
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
WiredManager.triggerUserClicksFurni(room, this.client.getHabbo().getRoomUnit(), item);
|
||||
|
||||
if (isClickTileItem(item)) {
|
||||
WiredManager.triggerUserClicksTile(room, this.client.getHabbo().getRoomUnit(), item);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isClickTileItem(HabboItem item) {
|
||||
if (item == null || item.getBaseItem() == null || item.getBaseItem().getInteractionType() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String interaction = item.getBaseItem().getInteractionType().getName();
|
||||
return interaction != null && interaction.equalsIgnoreCase(CLICK_TILE_INTERACTION);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.eu.habbo.messages.incoming.rooms.users;
|
||||
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
|
||||
public class ClickUserEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
||||
|
||||
if (room == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
RoomUnit clickingUser = this.client.getHabbo().getRoomUnit();
|
||||
|
||||
if (clickingUser == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int roomUnitId = this.packet.readInt();
|
||||
Habbo clickedHabbo = room.getHabboByRoomUnitId(roomUnitId);
|
||||
|
||||
if (clickedHabbo == null || clickedHabbo.getRoomUnit() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
WiredManager.triggerUserClicksUser(room, clickingUser, clickedHabbo.getRoomUnit());
|
||||
}
|
||||
}
|
||||
+28
@@ -4,6 +4,8 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUserAction;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.wired.WiredUserActionType;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserActionComposer;
|
||||
import com.eu.habbo.plugin.events.users.UserIdleEvent;
|
||||
@@ -26,6 +28,7 @@ public class RoomUserActionEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
int action = this.packet.readInt();
|
||||
int wiredAction = 0;
|
||||
|
||||
if (action == 5) {
|
||||
UserIdleEvent event = new UserIdleEvent(this.client.getHabbo(), UserIdleEvent.IdleReason.ACTION, true);
|
||||
@@ -34,8 +37,10 @@ public class RoomUserActionEvent extends MessageHandler {
|
||||
if (!event.isCancelled()) {
|
||||
if (event.idle) {
|
||||
room.idle(habbo);
|
||||
wiredAction = WiredUserActionType.RELAX;
|
||||
} else {
|
||||
room.unIdle(habbo);
|
||||
wiredAction = WiredUserActionType.AWAKE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -51,6 +56,29 @@ public class RoomUserActionEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
room.sendComposer(new RoomUserActionComposer(habbo.getRoomUnit(), RoomUserAction.fromValue(action)).compose());
|
||||
|
||||
if (wiredAction == 0) {
|
||||
switch (action) {
|
||||
case 1:
|
||||
wiredAction = WiredUserActionType.WAVE;
|
||||
break;
|
||||
case 2:
|
||||
wiredAction = WiredUserActionType.BLOW_KISS;
|
||||
break;
|
||||
case 3:
|
||||
wiredAction = WiredUserActionType.LAUGH;
|
||||
break;
|
||||
case 7:
|
||||
wiredAction = WiredUserActionType.THUMB_UP;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (wiredAction != 0) {
|
||||
WiredManager.triggerUserPerformsAction(room, habbo.getRoomUnit(), wiredAction, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-5
@@ -3,8 +3,9 @@ package com.eu.habbo.messages.incoming.rooms.users;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.users.DanceType;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.wired.WiredUserActionType;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDanceComposer;
|
||||
import com.eu.habbo.plugin.events.users.UserIdleEvent;
|
||||
|
||||
public class RoomUserDanceEvent extends MessageHandler {
|
||||
@@ -14,7 +15,7 @@ public class RoomUserDanceEvent extends MessageHandler {
|
||||
return;
|
||||
|
||||
int danceId = this.packet.readInt();
|
||||
if (danceId >= 0 && danceId <= 5) {
|
||||
if (danceId >= 0 && danceId <= 4) {
|
||||
if (this.client.getHabbo().getRoomUnit().isInRoom()) {
|
||||
|
||||
Habbo habbo = this.client.getHabbo();
|
||||
@@ -29,8 +30,6 @@ public class RoomUserDanceEvent extends MessageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
habbo.getRoomUnit().setDanceType(DanceType.values()[danceId]);
|
||||
|
||||
UserIdleEvent event = new UserIdleEvent(this.client.getHabbo(), UserIdleEvent.IdleReason.DANCE, false);
|
||||
Emulator.getPluginManager().fireEvent(event);
|
||||
|
||||
@@ -40,7 +39,11 @@ public class RoomUserDanceEvent extends MessageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserDanceComposer(habbo.getRoomUnit()).compose());
|
||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().dance(habbo, DanceType.values()[danceId]);
|
||||
|
||||
if (danceId > 0) {
|
||||
WiredManager.triggerUserPerformsAction(this.client.getHabbo().getHabboInfo().getCurrentRoom(), habbo.getRoomUnit(), WiredUserActionType.DANCE, danceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -5,6 +5,8 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionVoteCounter;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.habbohotel.wired.WiredUserActionType;
|
||||
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.plugin.events.users.UserSignEvent;
|
||||
|
||||
@@ -22,6 +24,7 @@ public class RoomUserSignEvent extends MessageHandler {
|
||||
if (!Emulator.getPluginManager().fireEvent(event).isCancelled()) {
|
||||
this.client.getHabbo().getRoomUnit().setStatus(RoomUnitStatus.SIGN, event.sign + "");
|
||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().unIdle(this.client.getHabbo());
|
||||
WiredManager.triggerUserPerformsAction(room, this.client.getHabbo().getRoomUnit(), WiredUserActionType.SIGN, event.sign);
|
||||
|
||||
if(signId <= 10) {
|
||||
|
||||
|
||||
+8
-1
@@ -7,11 +7,18 @@ import com.eu.habbo.plugin.events.users.UserIdleEvent;
|
||||
public class RoomUserSitEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int posture = this.packet.readInt();
|
||||
|
||||
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
||||
if (this.client.getHabbo().getRoomUnit().isWalking()) {
|
||||
this.client.getHabbo().getRoomUnit().stopWalking();
|
||||
}
|
||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().makeSit(this.client.getHabbo());
|
||||
|
||||
if (posture == 0) {
|
||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().makeStand(this.client.getHabbo());
|
||||
} else {
|
||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().makeSit(this.client.getHabbo());
|
||||
}
|
||||
|
||||
UserIdleEvent event = new UserIdleEvent(this.client.getHabbo(), UserIdleEvent.IdleReason.WALKED, false);
|
||||
Emulator.getPluginManager().fireEvent(event);
|
||||
|
||||
Reference in New Issue
Block a user