2018-07-06 15:30:00 +02:00
|
|
|
package com.eu.habbo.habbohotel.items.interactions;
|
|
|
|
|
2018-12-22 11:39:00 +01:00
|
|
|
import com.eu.habbo.Emulator;
|
|
|
|
import com.eu.habbo.habbohotel.achievements.Achievement;
|
|
|
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
2018-07-06 15:30:00 +02:00
|
|
|
import com.eu.habbo.habbohotel.items.Item;
|
2018-12-22 11:39:00 +01:00
|
|
|
import com.eu.habbo.habbohotel.rooms.Room;
|
|
|
|
import com.eu.habbo.habbohotel.users.Habbo;
|
2018-07-06 15:30:00 +02:00
|
|
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
|
|
|
public class InteractionBlackHole extends InteractionGate
|
|
|
|
{
|
|
|
|
public InteractionBlackHole(ResultSet set, Item baseItem) throws SQLException
|
|
|
|
{
|
|
|
|
super(set, baseItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
public InteractionBlackHole(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
|
|
|
|
{
|
|
|
|
super(id, userId, item, extradata, limitedStack, limitedSells);
|
|
|
|
}
|
2018-12-22 11:39:00 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onPlace(Room room)
|
|
|
|
{
|
|
|
|
Achievement holeCountAchievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHoleFurniCount");
|
|
|
|
|
|
|
|
int holesCountProgress = 0;
|
|
|
|
Habbo owner = room.getHabbo(this.getUserId());
|
|
|
|
|
|
|
|
if (owner == null)
|
|
|
|
{
|
2019-03-18 02:22:00 +01:00
|
|
|
holesCountProgress = AchievementManager.getAchievementProgressForHabbo(this.getUserId(), holeCountAchievement);
|
2018-12-22 11:39:00 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-03-18 02:22:00 +01:00
|
|
|
holesCountProgress = owner.getHabboStats().getAchievementProgress(holeCountAchievement);
|
2018-12-22 11:39:00 +01:00
|
|
|
}
|
|
|
|
int holeDifference = room.getRoomSpecialTypes().getItemsOfType(InteractionBlackHole.class).size() - holesCountProgress;
|
|
|
|
|
|
|
|
if (holeDifference > 0)
|
|
|
|
{
|
|
|
|
if (owner != null)
|
|
|
|
{
|
|
|
|
AchievementManager.progressAchievement(owner, holeCountAchievement, holeDifference);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AchievementManager.progressAchievement(this.getUserId(), holeCountAchievement, holeDifference);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|