mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-18 23:46:28 +01:00
Merge branch 'fix-games' into 'ms4/dev'
Fix GymEquipment, Freeze, BattleBanzai and Wired game effects See merge request morningstar/Arcturus-Community!1
This commit is contained in:
commit
9516e25da7
@ -4,8 +4,13 @@ import com.eu.habbo.habbohotel.games.Game;
|
|||||||
import com.eu.habbo.habbohotel.games.GamePlayer;
|
import com.eu.habbo.habbohotel.games.GamePlayer;
|
||||||
import com.eu.habbo.habbohotel.games.GameTeam;
|
import com.eu.habbo.habbohotel.games.GameTeam;
|
||||||
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
||||||
|
import com.eu.habbo.habbohotel.games.freeze.FreezeGame;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate;
|
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.HabboGender;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
|
|
||||||
public class BattleBanzaiGameTeam extends GameTeam {
|
public class BattleBanzaiGameTeam extends GameTeam {
|
||||||
public BattleBanzaiGameTeam(GameTeamColors teamColor) {
|
public BattleBanzaiGameTeam(GameTeamColors teamColor) {
|
||||||
@ -15,21 +20,51 @@ public class BattleBanzaiGameTeam extends GameTeam {
|
|||||||
@Override
|
@Override
|
||||||
public void addMember(GamePlayer gamePlayer) {
|
public void addMember(GamePlayer gamePlayer) {
|
||||||
super.addMember(gamePlayer);
|
super.addMember(gamePlayer);
|
||||||
|
RoomUnit roomUnit = gamePlayer.getHabbo().getRoomUnit();
|
||||||
|
if (roomUnit.getEffectId() > 0)
|
||||||
|
roomUnit.setPreviousEffectId(roomUnit.getEffectId(), roomUnit.getPreviousEffectEndTimestamp());
|
||||||
|
|
||||||
gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gamePlayer.getHabbo(), BattleBanzaiGame.effectId + this.teamColor.type, -1);
|
gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gamePlayer.getHabbo(), BattleBanzaiGame.effectId + this.teamColor.type, -1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeMember(GamePlayer gamePlayer) {
|
public void removeMember(GamePlayer gamePlayer) {
|
||||||
Game game = gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().getGame(gamePlayer.getHabbo().getHabboInfo().getCurrentGame());
|
|
||||||
Room room = gamePlayer.getHabbo().getRoomUnit().getRoom();
|
|
||||||
|
|
||||||
gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gamePlayer.getHabbo(), 0, -1);
|
|
||||||
gamePlayer.getHabbo().getRoomUnit().setCanWalk(true);
|
|
||||||
|
|
||||||
super.removeMember(gamePlayer);
|
super.removeMember(gamePlayer);
|
||||||
|
if (gamePlayer == null || gamePlayer.getHabbo() == null || gamePlayer.getHabbo().getHabboInfo().getCurrentRoom() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (room != null && room.getRoomSpecialTypes() != null) {
|
Habbo habbo = gamePlayer.getHabbo();
|
||||||
|
Game game = habbo.getHabboInfo().getCurrentRoom().getGame(FreezeGame.class);
|
||||||
|
RoomUnit roomUnit = habbo.getRoomUnit();
|
||||||
|
Room room = roomUnit.getRoom();
|
||||||
|
if(room == null) return;
|
||||||
|
HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().x, roomUnit.getCurrentLocation().y);
|
||||||
|
int nextEffectM = 0;
|
||||||
|
int nextEffectF = 0;
|
||||||
|
int nextEffectDuration = -1;
|
||||||
|
|
||||||
|
if (topItem != null) {
|
||||||
|
nextEffectM = topItem.getBaseItem().getEffectM();
|
||||||
|
nextEffectF = topItem.getBaseItem().getEffectF();
|
||||||
|
} else if (roomUnit.getPreviousEffectId() > 0) {
|
||||||
|
nextEffectF = roomUnit.getPreviousEffectId();
|
||||||
|
nextEffectM = roomUnit.getPreviousEffectId();
|
||||||
|
nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) {
|
||||||
|
room.giveEffect(habbo, nextEffectM, nextEffectDuration, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.F)) {
|
||||||
|
room.giveEffect(habbo, nextEffectF, nextEffectDuration, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
roomUnit.setCanWalk(true);
|
||||||
|
|
||||||
|
|
||||||
|
if (room.getRoomSpecialTypes() != null) {
|
||||||
for (InteractionGameGate gate : room.getRoomSpecialTypes().getBattleBanzaiGates().values()) {
|
for (InteractionGameGate gate : room.getRoomSpecialTypes().getBattleBanzaiGates().values()) {
|
||||||
gate.updateState(game, 5);
|
gate.updateState(game, 5);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
|
|
||||||
public class FootballGame extends Game {
|
public class FootballGame extends Game {
|
||||||
private Room room;
|
private final Room room;
|
||||||
|
|
||||||
public FootballGame(Room room) {
|
public FootballGame(Room room) {
|
||||||
super(null, null, room, true);
|
super(null, null, room, true);
|
||||||
|
@ -210,6 +210,6 @@ public class FreezeGamePlayer extends GamePlayer {
|
|||||||
if (this.dead)
|
if (this.dead)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
super.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(super.getHabbo(), this.correctEffectId(), -1);
|
super.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(super.getHabbo(), this.correctEffectId(), -1, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,11 @@ import com.eu.habbo.habbohotel.games.GameTeam;
|
|||||||
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate;
|
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboGender;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
|
|
||||||
public class FreezeGameTeam extends GameTeam {
|
public class FreezeGameTeam extends GameTeam {
|
||||||
public FreezeGameTeam(GameTeamColors teamColor) {
|
public FreezeGameTeam(GameTeamColors teamColor) {
|
||||||
@ -14,17 +19,42 @@ public class FreezeGameTeam extends GameTeam {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeMember(GamePlayer gamePlayer) {
|
public void removeMember(GamePlayer gamePlayer) {
|
||||||
if (gamePlayer == null || gamePlayer.getHabbo() == null || gamePlayer.getHabbo().getHabboInfo().getCurrentRoom() == null) return;
|
|
||||||
|
|
||||||
Game game = gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().getGame(FreezeGame.class);
|
|
||||||
Room room = gamePlayer.getHabbo().getRoomUnit().getRoom();
|
|
||||||
|
|
||||||
gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gamePlayer.getHabbo(), 0, -1);
|
|
||||||
gamePlayer.getHabbo().getRoomUnit().setCanWalk(true);
|
|
||||||
|
|
||||||
super.removeMember(gamePlayer);
|
super.removeMember(gamePlayer);
|
||||||
|
if (gamePlayer == null || gamePlayer.getHabbo() == null || gamePlayer.getHabbo().getHabboInfo().getCurrentRoom() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (room != null && room.getRoomSpecialTypes() != null) {
|
Habbo habbo = gamePlayer.getHabbo();
|
||||||
|
Game game = habbo.getHabboInfo().getCurrentRoom().getGame(FreezeGame.class);
|
||||||
|
RoomUnit roomUnit = habbo.getRoomUnit();
|
||||||
|
Room room = roomUnit.getRoom();
|
||||||
|
if(room == null) return;
|
||||||
|
|
||||||
|
HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().x, roomUnit.getCurrentLocation().y);
|
||||||
|
int nextEffectM = 0;
|
||||||
|
int nextEffectF = 0;
|
||||||
|
int nextEffectDuration = -1;
|
||||||
|
|
||||||
|
if (topItem != null) {
|
||||||
|
nextEffectM = topItem.getBaseItem().getEffectM();
|
||||||
|
nextEffectF = topItem.getBaseItem().getEffectF();
|
||||||
|
} else if (roomUnit.getPreviousEffectId() > 0) {
|
||||||
|
nextEffectF = roomUnit.getPreviousEffectId();
|
||||||
|
nextEffectM = roomUnit.getPreviousEffectId();
|
||||||
|
nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) {
|
||||||
|
room.giveEffect(habbo, nextEffectM, nextEffectDuration, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.F)) {
|
||||||
|
room.giveEffect(habbo, nextEffectF, nextEffectDuration, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
roomUnit.setCanWalk(true);
|
||||||
|
|
||||||
|
if (room.getRoomSpecialTypes() != null) {
|
||||||
for (InteractionGameGate gate : room.getRoomSpecialTypes().getFreezeGates().values()) {
|
for (InteractionGameGate gate : room.getRoomSpecialTypes().getFreezeGates().values()) {
|
||||||
gate.updateState(game, 5);
|
gate.updateState(game, 5);
|
||||||
}
|
}
|
||||||
@ -35,6 +65,9 @@ public class FreezeGameTeam extends GameTeam {
|
|||||||
public void addMember(GamePlayer gamePlayer) {
|
public void addMember(GamePlayer gamePlayer) {
|
||||||
super.addMember(gamePlayer);
|
super.addMember(gamePlayer);
|
||||||
|
|
||||||
gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gamePlayer.getHabbo(), FreezeGame.effectId + this.teamColor.type, -1);
|
RoomUnit roomUnit = gamePlayer.getHabbo().getRoomUnit();
|
||||||
|
if (roomUnit.getEffectId() > 0)
|
||||||
|
roomUnit.setPreviousEffectId(roomUnit.getEffectId(), roomUnit.getPreviousEffectEndTimestamp());
|
||||||
|
gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gamePlayer.getHabbo(), FreezeGame.effectId + this.teamColor.type, -1, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField;
|
|||||||
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
|
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomLayout;
|
import com.eu.habbo.habbohotel.rooms.RoomLayout;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboGender;
|
import com.eu.habbo.habbohotel.users.HabboGender;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
@ -129,6 +130,7 @@ public abstract class TagGame extends Game {
|
|||||||
public synchronized boolean addHabbo(Habbo habbo, GameTeamColors teamColor) {
|
public synchronized boolean addHabbo(Habbo habbo, GameTeamColors teamColor) {
|
||||||
super.addHabbo(habbo, GameTeamColors.RED);
|
super.addHabbo(habbo, GameTeamColors.RED);
|
||||||
|
|
||||||
|
RoomUnit roomUnit = habbo.getRoomUnit();
|
||||||
if (this.getTagPole() != null) {
|
if (this.getTagPole() != null) {
|
||||||
THashSet<HabboItem> poles = habbo.getHabboInfo().getCurrentRoom().getRoomSpecialTypes().getItemsOfType(this.getTagPole());
|
THashSet<HabboItem> poles = habbo.getHabboInfo().getCurrentRoom().getRoomSpecialTypes().getItemsOfType(this.getTagPole());
|
||||||
|
|
||||||
@ -140,22 +142,27 @@ public abstract class TagGame extends Game {
|
|||||||
TObjectHashIterator<HabboItem> iterator = poles.iterator();
|
TObjectHashIterator<HabboItem> iterator = poles.iterator();
|
||||||
if ((iterator.hasNext())) {
|
if ((iterator.hasNext())) {
|
||||||
HabboItem item = iterator.next();
|
HabboItem item = iterator.next();
|
||||||
habbo.getHabboInfo().getCurrentRoom().giveEffect(habbo, this.getEffect(habbo), -1);
|
if (roomUnit.getEffectId() > 0)
|
||||||
this.room.scheduledTasks.add(() -> habbo.getHabboInfo().getCurrentRoom().giveEffect(habbo, this.getTaggedEffect(habbo), -1));
|
roomUnit.setPreviousEffectId(roomUnit.getEffectId(), roomUnit.getPreviousEffectEndTimestamp());
|
||||||
|
habbo.getHabboInfo().getCurrentRoom().giveEffect(habbo, this.getEffect(habbo), -1, true);
|
||||||
|
this.room.scheduledTasks.add(() -> habbo.getHabboInfo().getCurrentRoom().giveEffect(habbo, this.getTaggedEffect(habbo), -1, true));
|
||||||
this.taggers.put(habbo, (InteractionTagPole) item);
|
this.taggers.put(habbo, (InteractionTagPole) item);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.taggers.isEmpty()) {
|
if (this.taggers.isEmpty()) {
|
||||||
habbo.getHabboInfo().getCurrentRoom().giveEffect(habbo, this.getEffect(habbo), -1);
|
if (roomUnit.getEffectId() > 0)
|
||||||
this.room.scheduledTasks.add(() -> habbo.getHabboInfo().getCurrentRoom().giveEffect(habbo, this.getTaggedEffect(habbo), -1));
|
roomUnit.setPreviousEffectId(roomUnit.getEffectId(), roomUnit.getPreviousEffectEndTimestamp());
|
||||||
|
habbo.getHabboInfo().getCurrentRoom().giveEffect(habbo, this.getEffect(habbo), -1, true);
|
||||||
|
this.room.scheduledTasks.add(() -> habbo.getHabboInfo().getCurrentRoom().giveEffect(habbo, this.getTaggedEffect(habbo), -1, true));
|
||||||
this.taggers.put(habbo, null);
|
this.taggers.put(habbo, null);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (roomUnit.getEffectId() > 0)
|
||||||
habbo.getHabboInfo().getCurrentRoom().giveEffect(habbo, this.getEffect(habbo), -1);
|
roomUnit.setPreviousEffectId(roomUnit.getEffectId(), roomUnit.getPreviousEffectEndTimestamp());
|
||||||
|
habbo.getHabboInfo().getCurrentRoom().giveEffect(habbo, this.getEffect(habbo), -1, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -164,7 +171,33 @@ public abstract class TagGame extends Game {
|
|||||||
public synchronized void removeHabbo(Habbo habbo) {
|
public synchronized void removeHabbo(Habbo habbo) {
|
||||||
super.removeHabbo(habbo);
|
super.removeHabbo(habbo);
|
||||||
this.taggers.remove(habbo);
|
this.taggers.remove(habbo);
|
||||||
habbo.getHabboInfo().getCurrentRoom().giveEffect(habbo, 0, -1);
|
|
||||||
|
RoomUnit roomUnit = habbo.getRoomUnit();
|
||||||
|
Room room = roomUnit.getRoom();
|
||||||
|
if (room == null) return;
|
||||||
|
|
||||||
|
HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().x, roomUnit.getCurrentLocation().y);
|
||||||
|
int nextEffectM = 0;
|
||||||
|
int nextEffectF = 0;
|
||||||
|
int nextEffectDuration = -1;
|
||||||
|
|
||||||
|
if (topItem != null) {
|
||||||
|
nextEffectM = topItem.getBaseItem().getEffectM();
|
||||||
|
nextEffectF = topItem.getBaseItem().getEffectF();
|
||||||
|
} else if (roomUnit.getPreviousEffectId() > 0) {
|
||||||
|
nextEffectF = roomUnit.getPreviousEffectId();
|
||||||
|
nextEffectM = roomUnit.getPreviousEffectId();
|
||||||
|
nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) {
|
||||||
|
room.giveEffect(habbo, nextEffectM, nextEffectDuration, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.F)) {
|
||||||
|
room.giveEffect(habbo, nextEffectF, nextEffectDuration, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,7 +3,10 @@ package com.eu.habbo.habbohotel.games.wired;
|
|||||||
import com.eu.habbo.habbohotel.games.*;
|
import com.eu.habbo.habbohotel.games.*;
|
||||||
import com.eu.habbo.habbohotel.games.freeze.FreezeGame;
|
import com.eu.habbo.habbohotel.games.freeze.FreezeGame;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.Habbo;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboGender;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
|
|
||||||
public class WiredGame extends Game {
|
public class WiredGame extends Game {
|
||||||
public GameState state = GameState.RUNNING;
|
public GameState state = GameState.RUNNING;
|
||||||
@ -28,14 +31,42 @@ public class WiredGame extends Game {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addHabbo(Habbo habbo, GameTeamColors teamColor) {
|
public boolean addHabbo(Habbo habbo, GameTeamColors teamColor) {
|
||||||
this.room.giveEffect(habbo, FreezeGame.effectId + teamColor.type, -1);
|
RoomUnit roomUnit = habbo.getRoomUnit();
|
||||||
|
if (roomUnit.getEffectId() > 0)
|
||||||
|
roomUnit.setPreviousEffectId(roomUnit.getEffectId(), roomUnit.getPreviousEffectEndTimestamp());
|
||||||
|
this.room.giveEffect(habbo, FreezeGame.effectId + teamColor.type, -1, true);
|
||||||
return super.addHabbo(habbo, teamColor);
|
return super.addHabbo(habbo, teamColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeHabbo(Habbo habbo) {
|
public void removeHabbo(Habbo habbo) {
|
||||||
super.removeHabbo(habbo);
|
super.removeHabbo(habbo);
|
||||||
this.room.giveEffect(habbo, 0, -1);
|
RoomUnit roomUnit = habbo.getRoomUnit();
|
||||||
|
Room room = this.room;
|
||||||
|
if (room == null) return;
|
||||||
|
|
||||||
|
HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().x, roomUnit.getCurrentLocation().y);
|
||||||
|
int nextEffectM = 0;
|
||||||
|
int nextEffectF = 0;
|
||||||
|
int nextEffectDuration = -1;
|
||||||
|
|
||||||
|
if (topItem != null) {
|
||||||
|
nextEffectM = topItem.getBaseItem().getEffectM();
|
||||||
|
nextEffectF = topItem.getBaseItem().getEffectF();
|
||||||
|
} else if (roomUnit.getPreviousEffectId() > 0) {
|
||||||
|
nextEffectF = roomUnit.getPreviousEffectId();
|
||||||
|
nextEffectM = roomUnit.getPreviousEffectId();
|
||||||
|
nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) {
|
||||||
|
room.giveEffect(habbo, nextEffectM, nextEffectDuration, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.F)) {
|
||||||
|
room.giveEffect(habbo, nextEffectF, nextEffectDuration, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,6 +7,8 @@ import com.eu.habbo.habbohotel.items.ICycleable;
|
|||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.rooms.*;
|
import com.eu.habbo.habbohotel.rooms.*;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboGender;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -55,13 +57,40 @@ public class InteractionGymEquipment extends InteractionEffectTile implements IC
|
|||||||
@Override
|
@Override
|
||||||
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
super.onWalkOff(roomUnit, room, objects);
|
super.onWalkOff(roomUnit, room, objects);
|
||||||
room.giveEffect(roomUnit, 0, -1);
|
|
||||||
|
if (room == null) return;
|
||||||
|
|
||||||
|
this.reset(room);
|
||||||
|
|
||||||
|
if (roomUnit != null) {
|
||||||
|
Habbo habbo = room.getHabbo(roomUnit);
|
||||||
|
HabboItem topItem = room.getTopItemAt(roomUnit.getCurrentLocation().x, roomUnit.getCurrentLocation().y);
|
||||||
|
int nextEffectM = 0;
|
||||||
|
int nextEffectF = 0;
|
||||||
|
int nextEffectDuration = -1;
|
||||||
|
|
||||||
|
if (topItem != null) {
|
||||||
|
nextEffectM = topItem.getBaseItem().getEffectM();
|
||||||
|
nextEffectF = topItem.getBaseItem().getEffectF();
|
||||||
|
} else if (roomUnit.getPreviousEffectId() > 0) {
|
||||||
|
nextEffectF = roomUnit.getPreviousEffectId();
|
||||||
|
nextEffectM = roomUnit.getPreviousEffectId();
|
||||||
|
nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
if (this.forceRotation()) {
|
if (this.forceRotation()) {
|
||||||
roomUnit.canRotate = true;
|
roomUnit.canRotate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.reset(room);
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) {
|
||||||
|
room.giveEffect(habbo, nextEffectM, nextEffectDuration, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (habbo.getHabboInfo().getGender().equals(HabboGender.F)) {
|
||||||
|
room.giveEffect(habbo, nextEffectF, nextEffectDuration, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String achievementName() {
|
public String achievementName() {
|
||||||
|
@ -4161,27 +4161,34 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void giveEffect(Habbo habbo, int effectId, int duration, boolean ignoreChecks) {
|
||||||
|
if (habbo != null && habbo.getRoomUnit() != null && this.currentHabbos.containsKey(habbo.getHabboInfo().getId())) {
|
||||||
|
this.giveEffect(habbo.getRoomUnit(), effectId, duration, ignoreChecks);
|
||||||
|
}
|
||||||
|
}
|
||||||
public void giveEffect(Habbo habbo, int effectId, int duration) {
|
public void giveEffect(Habbo habbo, int effectId, int duration) {
|
||||||
if (this.currentHabbos.containsKey(habbo.getHabboInfo().getId())) {
|
if (habbo != null && habbo.getRoomUnit() != null && this.currentHabbos.containsKey(habbo.getHabboInfo().getId())) {
|
||||||
this.giveEffect(habbo.getRoomUnit(), effectId, duration);
|
this.giveEffect(habbo.getRoomUnit(), effectId, duration, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void giveEffect(RoomUnit roomUnit, int effectId, int duration) {
|
public void giveEffect(RoomUnit roomUnit, int effectId, int duration) {
|
||||||
|
this.giveEffect(roomUnit, effectId, duration, false);
|
||||||
|
}
|
||||||
|
public void giveEffect(RoomUnit roomUnit, int effectId, int duration, boolean ignoreChecks) {
|
||||||
if (roomUnit == null || roomUnit.getRoom() == null) return;
|
if (roomUnit == null || roomUnit.getRoom() == null) return;
|
||||||
|
|
||||||
Habbo habbo = roomUnit.getRoom().getHabbo(roomUnit);
|
Habbo habbo = roomUnit.getRoom().getHabbo(roomUnit);
|
||||||
|
|
||||||
if (habbo == null) return;
|
if (habbo == null) return;
|
||||||
|
|
||||||
if (!habbo.getHabboInfo().isInGame()) {
|
if (!habbo.getHabboInfo().isInGame() || ignoreChecks) {
|
||||||
if (duration == -1 || duration == Integer.MAX_VALUE) {
|
if (duration == -1 || duration == Integer.MAX_VALUE) {
|
||||||
duration = Integer.MAX_VALUE;
|
duration = Integer.MAX_VALUE;
|
||||||
} else {
|
} else {
|
||||||
duration += Emulator.getIntUnixTimestamp();
|
duration += Emulator.getIntUnixTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.allowEffects && !roomUnit.isSwimming) {
|
if ((this.allowEffects || ignoreChecks) && !roomUnit.isSwimming) {
|
||||||
roomUnit.setEffectId(effectId, duration);
|
roomUnit.setEffectId(effectId, duration);
|
||||||
this.sendComposer(new AvatarEffectMessageComposer(roomUnit).compose());
|
this.sendComposer(new AvatarEffectMessageComposer(roomUnit).compose());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user