2018-07-06 15:30:00 +02:00
|
|
|
package com.eu.habbo.habbohotel.games.wired;
|
|
|
|
|
|
|
|
import com.eu.habbo.Emulator;
|
|
|
|
import com.eu.habbo.habbohotel.games.Game;
|
|
|
|
import com.eu.habbo.habbohotel.games.GamePlayer;
|
|
|
|
import com.eu.habbo.habbohotel.games.GameTeam;
|
|
|
|
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
|
|
|
import com.eu.habbo.habbohotel.games.freeze.FreezeGame;
|
|
|
|
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
|
|
|
|
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeTimer;
|
|
|
|
import com.eu.habbo.habbohotel.rooms.Room;
|
|
|
|
import com.eu.habbo.habbohotel.users.Habbo;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
public class WiredGame extends Game
|
|
|
|
{
|
|
|
|
private int timeLeft = 30;
|
|
|
|
public WiredGame(Room room)
|
|
|
|
{
|
|
|
|
super(GameTeam.class, GamePlayer.class, room , false);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void initialise()
|
|
|
|
{
|
|
|
|
for (Map.Entry<Integer, InteractionGameTimer> set : this.room.getRoomSpecialTypes().getGameTimers().entrySet())
|
|
|
|
{
|
|
|
|
if(set.getValue().getExtradata().isEmpty())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if(this.timeLeft < Integer.valueOf(set.getValue().getExtradata()))
|
|
|
|
{
|
|
|
|
this.timeLeft = Integer.valueOf(set.getValue().getExtradata());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.timeLeft <= 30)
|
|
|
|
{
|
|
|
|
this.timeLeft = 30;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
if (this.timeLeft > 0)
|
|
|
|
{
|
|
|
|
Emulator.getThreading().run(this, 1000);
|
|
|
|
this.timeLeft--;
|
|
|
|
for (Map.Entry<Integer, InteractionGameTimer> set : this.room.getRoomSpecialTypes().getGameTimers().entrySet())
|
|
|
|
{
|
|
|
|
set.getValue().setExtradata(timeLeft + "");
|
|
|
|
this.room.updateItemState(set.getValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this.stop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean addHabbo(Habbo habbo, GameTeamColors teamColor)
|
|
|
|
{
|
|
|
|
this.room.giveEffect(habbo, FreezeGame.effectId + teamColor.type);
|
|
|
|
return super.addHabbo(habbo, teamColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-09-12 18:45:00 +02:00
|
|
|
public void removeHabbo(Habbo habbo)
|
2018-07-06 15:30:00 +02:00
|
|
|
{
|
2018-09-12 18:45:00 +02:00
|
|
|
super.removeHabbo(habbo);
|
2018-07-06 15:30:00 +02:00
|
|
|
this.room.giveEffect(habbo, 0);
|
|
|
|
}
|
|
|
|
}
|