Arcturus-Community/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBlackHole.java

56 lines
1.9 KiB
Java
Raw Normal View History

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());
int furniCollecterProgress = 0;
if (owner == null)
{
furniCollecterProgress = AchievementManager.getAchievementProgressForHabbo(this.getUserId(), holeCountAchievement);
}
else
{
furniCollecterProgress = owner.getHabboStats().getAchievementProgress(holeCountAchievement);
}
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
}