You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-20 15:36:17 +00:00
🆕 wf_slc_users_area and some wired updates
This commit is contained in:
@@ -48,6 +48,7 @@ import com.eu.habbo.habbohotel.items.interactions.totems.InteractionTotemPlanet;
|
|||||||
import com.eu.habbo.habbohotel.items.interactions.wired.conditions.*;
|
import com.eu.habbo.habbohotel.items.interactions.wired.conditions.*;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.wired.effects.*;
|
import com.eu.habbo.habbohotel.items.interactions.wired.effects.*;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.wired.selector.WiredEffectFurniArea;
|
import com.eu.habbo.habbohotel.items.interactions.wired.selector.WiredEffectFurniArea;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.wired.selector.WiredEffectUsersArea;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.wired.selector.WiredEffectFurniNeighborhood;
|
import com.eu.habbo.habbohotel.items.interactions.wired.selector.WiredEffectFurniNeighborhood;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.wired.selector.WiredEffectFurniByType;
|
import com.eu.habbo.habbohotel.items.interactions.wired.selector.WiredEffectFurniByType;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob;
|
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob;
|
||||||
@@ -254,6 +255,7 @@ public class ItemManager {
|
|||||||
this.interactionsList.add(new ItemInteraction("wf_slc_furni_area", WiredEffectFurniArea.class));
|
this.interactionsList.add(new ItemInteraction("wf_slc_furni_area", WiredEffectFurniArea.class));
|
||||||
this.interactionsList.add(new ItemInteraction("wf_slc_furni_neighborhood", WiredEffectFurniNeighborhood.class));
|
this.interactionsList.add(new ItemInteraction("wf_slc_furni_neighborhood", WiredEffectFurniNeighborhood.class));
|
||||||
this.interactionsList.add(new ItemInteraction("wf_slc_furni_bytype", WiredEffectFurniByType.class));
|
this.interactionsList.add(new ItemInteraction("wf_slc_furni_bytype", WiredEffectFurniByType.class));
|
||||||
|
this.interactionsList.add(new ItemInteraction("wf_slc_users_area", WiredEffectUsersArea.class));
|
||||||
|
|
||||||
this.interactionsList.add(new ItemInteraction("wf_cnd_has_furni_on", WiredConditionFurniHaveFurni.class));
|
this.interactionsList.add(new ItemInteraction("wf_cnd_has_furni_on", WiredConditionFurniHaveFurni.class));
|
||||||
this.interactionsList.add(new ItemInteraction("wf_cnd_furnis_hv_avtrs", WiredConditionFurniHaveHabbo.class));
|
this.interactionsList.add(new ItemInteraction("wf_cnd_furnis_hv_avtrs", WiredConditionFurniHaveHabbo.class));
|
||||||
|
|||||||
+4
-2
@@ -21,9 +21,11 @@ public class WiredEffectAlert extends WiredEffectWhisper {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(WiredContext ctx) {
|
public void execute(WiredContext ctx) {
|
||||||
Room room = ctx.room();
|
Room room = ctx.room();
|
||||||
Habbo habbo = ctx.actor().map(room::getHabbo).orElse(null);
|
|
||||||
|
|
||||||
if (habbo != null) {
|
for (com.eu.habbo.habbohotel.rooms.RoomUnit unit : ctx.targets().users()) {
|
||||||
|
Habbo habbo = room.getHabbo(unit);
|
||||||
|
if (habbo == null) continue;
|
||||||
|
|
||||||
habbo.alert(this.message
|
habbo.alert(this.message
|
||||||
.replace("%online%", Emulator.getGameEnvironment().getHabboManager().getOnlineCount() + "")
|
.replace("%online%", Emulator.getGameEnvironment().getHabboManager().getOnlineCount() + "")
|
||||||
.replace("%username%", habbo.getHabboInfo().getUsername())
|
.replace("%username%", habbo.getHabboInfo().getUsername())
|
||||||
|
|||||||
+9
-14
@@ -111,12 +111,15 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(WiredContext ctx) {
|
public void execute(WiredContext ctx) {
|
||||||
Room room = ctx.room();
|
Room room = ctx.room();
|
||||||
RoomUnit roomUnit = ctx.actor().orElse(null);
|
|
||||||
if (roomUnit == null) return;
|
|
||||||
|
|
||||||
Habbo habbo = room.getHabbo(roomUnit);
|
List<Bot> bots = room.getBots(this.botName);
|
||||||
|
if (bots.size() != 1) return;
|
||||||
|
Bot bot = bots.get(0);
|
||||||
|
|
||||||
|
for (RoomUnit roomUnit : ctx.targets().users()) {
|
||||||
|
Habbo habbo = room.getHabbo(roomUnit);
|
||||||
|
if (habbo == null) continue;
|
||||||
|
|
||||||
if (habbo != null) {
|
|
||||||
String m = this.message;
|
String m = this.message;
|
||||||
m = m.replace(Emulator.getTexts().getValue("wired.variable.username", "%username%"), habbo.getHabboInfo().getUsername())
|
m = m.replace(Emulator.getTexts().getValue("wired.variable.username", "%username%"), habbo.getHabboInfo().getUsername())
|
||||||
.replace(Emulator.getTexts().getValue("wired.variable.credits", "%credits%"), habbo.getHabboInfo().getCredits() + "")
|
.replace(Emulator.getTexts().getValue("wired.variable.credits", "%credits%"), habbo.getHabboInfo().getCredits() + "")
|
||||||
@@ -128,15 +131,7 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
|
|||||||
.replace(Emulator.getTexts().getValue("wired.variable.roomname", "%roomname%"), room.getName())
|
.replace(Emulator.getTexts().getValue("wired.variable.roomname", "%roomname%"), room.getName())
|
||||||
.replace(Emulator.getTexts().getValue("wired.variable.user_count", "%user_count%"), room.getUserCount() + "");
|
.replace(Emulator.getTexts().getValue("wired.variable.user_count", "%user_count%"), room.getUserCount() + "");
|
||||||
|
|
||||||
List<Bot> bots = room.getBots(this.botName);
|
if (!WiredManager.triggerUserSays(room, bot.getRoomUnit(), m)) {
|
||||||
|
|
||||||
if (bots.size() != 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bot bot = bots.get(0);
|
|
||||||
|
|
||||||
if(!WiredManager.triggerUserSays(room, bot.getRoomUnit(), m)) {
|
|
||||||
if (this.mode == 1) {
|
if (this.mode == 1) {
|
||||||
bot.whisper(m, habbo);
|
bot.whisper(m, habbo);
|
||||||
} else {
|
} else {
|
||||||
@@ -192,7 +187,7 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean requiresTriggeringUser() {
|
public boolean requiresTriggeringUser() {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class JsonData {
|
static class JsonData {
|
||||||
|
|||||||
+4
-3
@@ -28,10 +28,11 @@ public class WiredEffectGiveEffect extends WiredEffectWhisper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Room room = ctx.room();
|
Room room = ctx.room();
|
||||||
RoomUnit roomUnit = ctx.actor().orElse(null);
|
|
||||||
|
|
||||||
if (effectId >= 0 && roomUnit != null) {
|
if (effectId >= 0) {
|
||||||
room.giveEffect(roomUnit, effectId, Integer.MAX_VALUE);
|
for (RoomUnit roomUnit : ctx.targets().users()) {
|
||||||
|
room.giveEffect(roomUnit, effectId, Integer.MAX_VALUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -23,10 +23,12 @@ public class WiredEffectGiveHandItem extends WiredEffectWhisper {
|
|||||||
int itemId = Integer.parseInt(this.message);
|
int itemId = Integer.parseInt(this.message);
|
||||||
|
|
||||||
Room room = ctx.room();
|
Room room = ctx.room();
|
||||||
Habbo habbo = ctx.actor().map(room::getHabbo).orElse(null);
|
|
||||||
|
|
||||||
if (habbo != null) {
|
for (com.eu.habbo.habbohotel.rooms.RoomUnit unit : ctx.targets().users()) {
|
||||||
room.giveHandItem(habbo, itemId);
|
Habbo habbo = room.getHabbo(unit);
|
||||||
|
if (habbo != null) {
|
||||||
|
room.giveHandItem(habbo, itemId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-5
@@ -88,13 +88,14 @@ public class WiredEffectGiveRespect extends InteractionWiredEffect {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(WiredContext ctx) {
|
public void execute(WiredContext ctx) {
|
||||||
Room room = ctx.room();
|
Room room = ctx.room();
|
||||||
Habbo habbo = ctx.actor().map(room::getHabbo).orElse(null);
|
|
||||||
|
|
||||||
if (habbo == null)
|
for (RoomUnit unit : ctx.targets().users()) {
|
||||||
return;
|
Habbo habbo = room.getHabbo(unit);
|
||||||
|
if (habbo == null) continue;
|
||||||
|
|
||||||
habbo.getHabboStats().respectPointsReceived += this.respects;
|
habbo.getHabboStats().respectPointsReceived += this.respects;
|
||||||
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RespectEarned"), this.respects);
|
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RespectEarned"), this.respects);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+5
-6
@@ -52,13 +52,12 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(WiredContext ctx) {
|
public void execute(WiredContext ctx) {
|
||||||
Room room = ctx.room();
|
Room room = ctx.room();
|
||||||
RoomUnit roomUnit = ctx.actor().orElse(null);
|
|
||||||
if (roomUnit == null) return;
|
|
||||||
|
|
||||||
Habbo habbo = room.getHabbo(roomUnit);
|
for (RoomUnit roomUnit : ctx.targets().users()) {
|
||||||
|
Habbo habbo = room.getHabbo(roomUnit);
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
WiredManager.getReward(habbo, this);
|
WiredManager.getReward(habbo, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
-12
@@ -46,13 +46,15 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(WiredContext ctx) {
|
public void execute(WiredContext ctx) {
|
||||||
Room room = ctx.room();
|
Room room = ctx.room();
|
||||||
Habbo habbo = ctx.actor().map(room::getHabbo).orElse(null);
|
|
||||||
|
|
||||||
if (habbo != null && habbo.getHabboInfo().getCurrentGame() != null) {
|
for (RoomUnit unit : ctx.targets().users()) {
|
||||||
|
Habbo habbo = room.getHabbo(unit);
|
||||||
|
if (habbo == null || habbo.getHabboInfo().getCurrentGame() == null) continue;
|
||||||
|
|
||||||
Game game = room.getGame(habbo.getHabboInfo().getCurrentGame());
|
Game game = room.getGame(habbo.getHabboInfo().getCurrentGame());
|
||||||
|
|
||||||
if (game == null)
|
if (game == null)
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
int gameStartTime = game.getStartTime();
|
int gameStartTime = game.getStartTime();
|
||||||
|
|
||||||
@@ -60,6 +62,7 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
|
|||||||
|
|
||||||
TObjectIntIterator<Map.Entry<Integer, Integer>> iterator = dataClone.iterator();
|
TObjectIntIterator<Map.Entry<Integer, Integer>> iterator = dataClone.iterator();
|
||||||
|
|
||||||
|
boolean alreadyCounted = false;
|
||||||
for (int i = dataClone.size(); i-- > 0; ) {
|
for (int i = dataClone.size(); i-- > 0; ) {
|
||||||
iterator.advance();
|
iterator.advance();
|
||||||
|
|
||||||
@@ -72,7 +75,8 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
|
|||||||
|
|
||||||
habbo.getHabboInfo().getGamePlayer().addScore(this.score, true);
|
habbo.getHabboInfo().getGamePlayer().addScore(this.score, true);
|
||||||
|
|
||||||
return;
|
alreadyCounted = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
@@ -80,16 +84,17 @@ public class WiredEffectGiveScore extends InteractionWiredEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (!alreadyCounted) {
|
||||||
this.data.put(new AbstractMap.SimpleEntry<>(gameStartTime, habbo.getHabboInfo().getId()), 1);
|
try {
|
||||||
}
|
this.data.put(new AbstractMap.SimpleEntry<>(gameStartTime, habbo.getHabboInfo().getId()), 1);
|
||||||
catch(IllegalArgumentException e) {
|
}
|
||||||
|
catch(IllegalArgumentException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (habbo.getHabboInfo().getGamePlayer() != null) {
|
||||||
if (habbo.getHabboInfo().getGamePlayer() != null) {
|
habbo.getHabboInfo().getGamePlayer().addScore(this.score, true);
|
||||||
habbo.getHabboInfo().getGamePlayer().addScore(this.score, true);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -40,9 +40,11 @@ public class WiredEffectJoinTeam extends InteractionWiredEffect {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(WiredContext ctx) {
|
public void execute(WiredContext ctx) {
|
||||||
Room room = ctx.room();
|
Room room = ctx.room();
|
||||||
Habbo habbo = ctx.actor().map(room::getHabbo).orElse(null);
|
|
||||||
|
|
||||||
if (habbo != null) {
|
for (RoomUnit unit : ctx.targets().users()) {
|
||||||
|
Habbo habbo = room.getHabbo(unit);
|
||||||
|
if (habbo == null) continue;
|
||||||
|
|
||||||
WiredGame game = (WiredGame) room.getGameOrCreate(WiredGame.class);
|
WiredGame game = (WiredGame) room.getGameOrCreate(WiredGame.class);
|
||||||
|
|
||||||
if (habbo.getHabboInfo().getGamePlayer() != null && habbo.getHabboInfo().getCurrentGame() != null && (habbo.getHabboInfo().getCurrentGame() != WiredGame.class || (habbo.getHabboInfo().getCurrentGame() == WiredGame.class && habbo.getHabboInfo().getGamePlayer().getTeamColor() != this.teamColor))) {
|
if (habbo.getHabboInfo().getGamePlayer() != null && habbo.getHabboInfo().getCurrentGame() != null && (habbo.getHabboInfo().getCurrentGame() != WiredGame.class || (habbo.getHabboInfo().getCurrentGame() == WiredGame.class && habbo.getHabboInfo().getGamePlayer().getTeamColor() != this.teamColor))) {
|
||||||
|
|||||||
+6
-4
@@ -42,17 +42,19 @@ public class WiredEffectKickHabbo extends InteractionWiredEffect {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(WiredContext ctx) {
|
public void execute(WiredContext ctx) {
|
||||||
Room room = ctx.room();
|
Room room = ctx.room();
|
||||||
Habbo habbo = ctx.actor().map(room::getHabbo).orElse(null);
|
|
||||||
|
|
||||||
if (habbo != null) {
|
for (RoomUnit unit : ctx.targets().users()) {
|
||||||
|
Habbo habbo = room.getHabbo(unit);
|
||||||
|
if (habbo == null) continue;
|
||||||
|
|
||||||
if (habbo.hasPermission(Permission.ACC_UNKICKABLE)) {
|
if (habbo.hasPermission(Permission.ACC_UNKICKABLE)) {
|
||||||
habbo.whisper(Emulator.getTexts().getValue("hotel.wired.kickexception.unkickable"));
|
habbo.whisper(Emulator.getTexts().getValue("hotel.wired.kickexception.unkickable"));
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (habbo.getHabboInfo().getId() == room.getOwnerId()) {
|
if (habbo.getHabboInfo().getId() == room.getOwnerId()) {
|
||||||
habbo.whisper(Emulator.getTexts().getValue("hotel.wired.kickexception.owner"));
|
habbo.whisper(Emulator.getTexts().getValue("hotel.wired.kickexception.owner"));
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
room.giveEffect(habbo, 4, 2);
|
room.giveEffect(habbo, 4, 2);
|
||||||
|
|||||||
+4
-2
@@ -37,9 +37,11 @@ public class WiredEffectLeaveTeam extends InteractionWiredEffect {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(WiredContext ctx) {
|
public void execute(WiredContext ctx) {
|
||||||
Room room = ctx.room();
|
Room room = ctx.room();
|
||||||
Habbo habbo = ctx.actor().map(room::getHabbo).orElse(null);
|
|
||||||
|
|
||||||
if (habbo != null) {
|
for (RoomUnit unit : ctx.targets().users()) {
|
||||||
|
Habbo habbo = room.getHabbo(unit);
|
||||||
|
if (habbo == null) continue;
|
||||||
|
|
||||||
if (habbo.getHabboInfo().getCurrentGame() != null) {
|
if (habbo.getHabboInfo().getCurrentGame() != null) {
|
||||||
Game game = room.getGame(habbo.getHabboInfo().getCurrentGame());
|
Game game = room.getGame(habbo.getHabboInfo().getCurrentGame());
|
||||||
|
|
||||||
|
|||||||
+5
-8
@@ -64,16 +64,13 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WiredContext ctx) {
|
public void execute(WiredContext ctx) {
|
||||||
RoomUnit roomUnit = ctx.actor().orElse(null);
|
|
||||||
if (roomUnit == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Room room = ctx.room();
|
Room room = ctx.room();
|
||||||
Habbo habbo = room.getHabbo(roomUnit);
|
|
||||||
|
|
||||||
if (habbo != null) {
|
for (RoomUnit roomUnit : ctx.targets().users()) {
|
||||||
if (room.hasRights(habbo))
|
Habbo habbo = room.getHabbo(roomUnit);
|
||||||
return;
|
if (habbo == null) continue;
|
||||||
|
|
||||||
|
if (room.hasRights(habbo)) continue;
|
||||||
|
|
||||||
room.muteHabbo(habbo, 60);
|
room.muteHabbo(habbo, 60);
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -191,20 +191,21 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(WiredContext ctx) {
|
public void execute(WiredContext ctx) {
|
||||||
Room room = ctx.room();
|
Room room = ctx.room();
|
||||||
RoomUnit roomUnit = ctx.actor().orElse(null);
|
|
||||||
|
|
||||||
if (roomUnit == null || room == null || room.getLayout() == null) {
|
if (room == null || room.getLayout() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.items.removeIf(item -> item == null || item.getRoomId() != this.getRoomId()
|
this.items.removeIf(item -> item == null || item.getRoomId() != this.getRoomId()
|
||||||
|| Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null);
|
|| Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null);
|
||||||
|
|
||||||
if (!this.items.isEmpty()) {
|
if (this.items.isEmpty()) return;
|
||||||
|
|
||||||
|
for (RoomUnit roomUnit : ctx.targets().users()) {
|
||||||
int i = Emulator.getRandom().nextInt(this.items.size());
|
int i = Emulator.getRandom().nextInt(this.items.size());
|
||||||
HabboItem item = this.items.get(i);
|
HabboItem item = this.items.get(i);
|
||||||
|
|
||||||
if (item == null) return;
|
if (item == null) continue;
|
||||||
|
|
||||||
RoomTile tile = room.getLayout().getTile(item.getX(), item.getY());
|
RoomTile tile = room.getLayout().getTile(item.getX(), item.getY());
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
|
|||||||
+6
-12
@@ -91,21 +91,15 @@ public class WiredEffectWhisper extends InteractionWiredEffect {
|
|||||||
public void execute(WiredContext ctx) {
|
public void execute(WiredContext ctx) {
|
||||||
Room room = ctx.room();
|
Room room = ctx.room();
|
||||||
if (this.message.length() > 0) {
|
if (this.message.length() > 0) {
|
||||||
RoomUnit roomUnit = ctx.actor().orElse(null);
|
for (RoomUnit roomUnit : ctx.targets().users()) {
|
||||||
if (roomUnit != null) {
|
|
||||||
Habbo habbo = room.getHabbo(roomUnit);
|
Habbo habbo = room.getHabbo(roomUnit);
|
||||||
|
if (habbo == null) continue;
|
||||||
|
|
||||||
if (habbo != null) {
|
String msg = this.message.replace("%user%", habbo.getHabboInfo().getUsername()).replace("%online_count%", Emulator.getGameEnvironment().getHabboManager().getOnlineCount() + "").replace("%room_count%", Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size() + "");
|
||||||
String msg = this.message.replace("%user%", habbo.getHabboInfo().getUsername()).replace("%online_count%", Emulator.getGameEnvironment().getHabboManager().getOnlineCount() + "").replace("%room_count%", Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size() + "");
|
habbo.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(msg, habbo, habbo, RoomChatMessageBubbles.WIRED)));
|
||||||
habbo.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(msg, habbo, habbo, RoomChatMessageBubbles.WIRED)));
|
|
||||||
|
|
||||||
if (habbo.getRoomUnit().isIdle()) {
|
if (habbo.getRoomUnit().isIdle()) {
|
||||||
habbo.getRoomUnit().getRoom().unIdle(habbo);
|
habbo.getRoomUnit().getRoom().unIdle(habbo);
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (Habbo h : room.getHabbos()) {
|
|
||||||
h.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(this.message.replace("%user%", h.getHabboInfo().getUsername()).replace("%online_count%", Emulator.getGameEnvironment().getHabboManager().getOnlineCount() + "").replace("%room_count%", Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size() + ""), h, h, RoomChatMessageBubbles.WIRED)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+172
@@ -0,0 +1,172 @@
|
|||||||
|
package com.eu.habbo.habbohotel.items.interactions.wired.selector;
|
||||||
|
|
||||||
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
|
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.rooms.RoomUnit;
|
||||||
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
|
import com.eu.habbo.habbohotel.wired.core.WiredContext;
|
||||||
|
import com.eu.habbo.habbohotel.wired.core.WiredManager;
|
||||||
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class WiredEffectUsersArea extends InteractionWiredEffect {
|
||||||
|
|
||||||
|
public static final WiredEffectType type = WiredEffectType.USERS_AREA_SELECTOR;
|
||||||
|
|
||||||
|
private int rootX = 0;
|
||||||
|
private int rootY = 0;
|
||||||
|
private int areaWidth = 0;
|
||||||
|
private int areaHeight = 0;
|
||||||
|
private boolean filterExisting = false;
|
||||||
|
private boolean invert = false;
|
||||||
|
|
||||||
|
public WiredEffectUsersArea(ResultSet set, Item baseItem) throws SQLException {
|
||||||
|
super(set, baseItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WiredEffectUsersArea(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||||
|
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(WiredContext ctx) {
|
||||||
|
Room room = ctx.room();
|
||||||
|
if (room == null || areaWidth <= 0 || areaHeight <= 0) return;
|
||||||
|
|
||||||
|
int maxX = rootX + areaWidth - 1;
|
||||||
|
int maxY = rootY + areaHeight - 1;
|
||||||
|
|
||||||
|
List<RoomUnit> usersInArea = new ArrayList<>();
|
||||||
|
for (RoomUnit unit : room.getRoomUnits()) {
|
||||||
|
int x = unit.getX();
|
||||||
|
int y = unit.getY();
|
||||||
|
boolean inArea = x >= rootX && x <= maxX && y >= rootY && y <= maxY;
|
||||||
|
if (invert ? !inArea : inArea) {
|
||||||
|
usersInArea.add(unit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filterExisting) {
|
||||||
|
usersInArea.retainAll(ctx.targets().users());
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.targets().setUsers(usersInArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException {
|
||||||
|
int[] params = settings.getIntParams();
|
||||||
|
if (params == null || params.length < 4) {
|
||||||
|
throw new WiredSaveException("wf_slc_users_area requires at least 4 int params: rootX, rootY, width, height");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.rootX = params[0];
|
||||||
|
this.rootY = params[1];
|
||||||
|
this.areaWidth = params[2];
|
||||||
|
this.areaHeight = params[3];
|
||||||
|
this.filterExisting = params.length >= 5 && params[4] == 1;
|
||||||
|
this.invert = params.length >= 6 && params[5] == 1;
|
||||||
|
this.setDelay(settings.getDelay());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WiredEffectType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSelector() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getWiredData() {
|
||||||
|
return WiredManager.getGson().toJson(new JsonData(rootX, rootY, areaWidth, areaHeight, filterExisting, invert, getDelay()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@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.rootX = data.rootX;
|
||||||
|
this.rootY = data.rootY;
|
||||||
|
this.areaWidth = data.width;
|
||||||
|
this.areaHeight = data.height;
|
||||||
|
this.filterExisting = data.filterExisting;
|
||||||
|
this.invert = data.invert;
|
||||||
|
this.setDelay(data.delay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPickUp() {
|
||||||
|
this.rootX = 0;
|
||||||
|
this.rootY = 0;
|
||||||
|
this.areaWidth = 0;
|
||||||
|
this.areaHeight = 0;
|
||||||
|
this.filterExisting = false;
|
||||||
|
this.invert = false;
|
||||||
|
this.setDelay(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serializeWiredData(ServerMessage message, Room room) {
|
||||||
|
message.appendBoolean(false);
|
||||||
|
message.appendInt(0);
|
||||||
|
message.appendInt(0);
|
||||||
|
|
||||||
|
message.appendInt(this.getBaseItem().getSpriteId());
|
||||||
|
message.appendInt(this.getId());
|
||||||
|
message.appendString("");
|
||||||
|
|
||||||
|
message.appendInt(6);
|
||||||
|
message.appendInt(this.rootX);
|
||||||
|
message.appendInt(this.rootY);
|
||||||
|
message.appendInt(this.areaWidth);
|
||||||
|
message.appendInt(this.areaHeight);
|
||||||
|
message.appendInt(this.filterExisting ? 1 : 0);
|
||||||
|
message.appendInt(this.invert ? 1 : 0);
|
||||||
|
|
||||||
|
message.appendInt(0);
|
||||||
|
message.appendInt(this.getType().code);
|
||||||
|
message.appendInt(this.getDelay());
|
||||||
|
message.appendInt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static class JsonData {
|
||||||
|
int rootX;
|
||||||
|
int rootY;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
boolean filterExisting;
|
||||||
|
boolean invert;
|
||||||
|
int delay;
|
||||||
|
|
||||||
|
JsonData(int rootX, int rootY, int width, int height, boolean filterExisting, boolean invert, int delay) {
|
||||||
|
this.rootX = rootX;
|
||||||
|
this.rootY = rootY;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
this.filterExisting = filterExisting;
|
||||||
|
this.invert = invert;
|
||||||
|
this.delay = delay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -80,6 +80,7 @@ public class PetCommand implements Comparable<PetCommand> {
|
|||||||
|
|
||||||
if (Emulator.getRandom().nextInt(100) >= obeyChance) {
|
if (Emulator.getRandom().nextInt(100) >= obeyChance) {
|
||||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.DISOBEY));
|
pet.say(pet.getPetData().randomVocal(PetVocalsType.DISOBEY));
|
||||||
|
// Don't record execution on random disobey — player can retry immediately
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ public enum WiredEffectType {
|
|||||||
BOT_TALK_TO_AVATAR(27),
|
BOT_TALK_TO_AVATAR(27),
|
||||||
FURNI_AREA_SELECTOR(28),
|
FURNI_AREA_SELECTOR(28),
|
||||||
FURNI_NEIGHBORHOOD_SELECTOR(29),
|
FURNI_NEIGHBORHOOD_SELECTOR(29),
|
||||||
FURNI_BYTYPE_SELECTOR(30);
|
FURNI_BYTYPE_SELECTOR(30),
|
||||||
|
USERS_AREA_SELECTOR(31);
|
||||||
|
|
||||||
public final int code;
|
public final int code;
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ public interface IWiredEffect {
|
|||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default boolean isSelector() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate this effect's execution and record intended state changes.
|
* Simulate this effect's execution and record intended state changes.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -348,25 +348,49 @@ public final class WiredEngine {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine which effects to execute
|
// Separate selectors from regular effects.
|
||||||
|
// Selectors must always run first so ctx.targets() is populated before
|
||||||
|
// regular effects consume it.
|
||||||
|
List<IWiredEffect> selectors = new ArrayList<>();
|
||||||
|
List<IWiredEffect> regulars = new ArrayList<>();
|
||||||
|
for (IWiredEffect e : effects) {
|
||||||
|
if (e.isSelector()) selectors.add(e);
|
||||||
|
else regulars.add(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine which (regular) effects to execute
|
||||||
List<IWiredEffect> toExecute;
|
List<IWiredEffect> toExecute;
|
||||||
|
|
||||||
if (stack.useRandom()) {
|
if (stack.useRandom()) {
|
||||||
// Random mode: pick one random effect
|
// Random mode: pick one random regular effect
|
||||||
int randomIndex = new Random().nextInt(effects.size());
|
if (regulars.isEmpty()) {
|
||||||
toExecute = Collections.singletonList(effects.get(randomIndex));
|
toExecute = new ArrayList<>();
|
||||||
debug(ctx.room(), "Random mode: selected effect {}/{}", randomIndex + 1, effects.size());
|
} else {
|
||||||
|
int randomIndex = new Random().nextInt(regulars.size());
|
||||||
|
toExecute = Collections.singletonList(regulars.get(randomIndex));
|
||||||
|
debug(ctx.room(), "Random mode: selected effect {}/{}", randomIndex + 1, regulars.size());
|
||||||
|
}
|
||||||
} else if (stack.useUnseen()) {
|
} else if (stack.useUnseen()) {
|
||||||
// Unseen mode: round-robin selection
|
// Unseen mode: round-robin among regular effects
|
||||||
int index = getNextUnseenIndex(stack, effects.size());
|
if (regulars.isEmpty()) {
|
||||||
toExecute = Collections.singletonList(effects.get(index));
|
toExecute = new ArrayList<>();
|
||||||
debug(ctx.room(), "Unseen mode: selected effect {}/{}", index + 1, effects.size());
|
} else {
|
||||||
|
int index = getNextUnseenIndex(stack, regulars.size());
|
||||||
|
toExecute = Collections.singletonList(regulars.get(index));
|
||||||
|
debug(ctx.room(), "Unseen mode: selected effect {}/{}", index + 1, regulars.size());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Normal mode: execute all in random order
|
// Normal mode: regular effects in random order
|
||||||
toExecute = new ArrayList<>(effects);
|
toExecute = new ArrayList<>(regulars);
|
||||||
Collections.shuffle(toExecute);
|
Collections.shuffle(toExecute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Selectors always run first (in their natural tile order), then regular effects
|
||||||
|
List<IWiredEffect> ordered = new ArrayList<>(selectors.size() + toExecute.size());
|
||||||
|
ordered.addAll(selectors);
|
||||||
|
ordered.addAll(toExecute);
|
||||||
|
toExecute = ordered;
|
||||||
|
|
||||||
// Execute selected effects
|
// Execute selected effects
|
||||||
for (IWiredEffect effect : toExecute) {
|
for (IWiredEffect effect : toExecute) {
|
||||||
// Check if effect requires actor
|
// Check if effect requires actor
|
||||||
|
|||||||
Reference in New Issue
Block a user