Fix WiredGame

This commit is contained in:
brenoepic 2022-12-03 15:46:40 -03:00
parent 1a3f1a93fa
commit 27619f484f

View File

@ -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