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

46 lines
1.8 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;
2019-05-26 20:14:53 +02:00
public class InteractionBlackHole extends InteractionGate {
public InteractionBlackHole(ResultSet set, Item baseItem) throws SQLException {
2018-07-06 15:30:00 +02:00
super(set, baseItem);
}
2019-05-26 20:14:53 +02:00
public InteractionBlackHole(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
2018-07-06 15:30:00 +02:00
super(id, userId, item, extradata, limitedStack, limitedSells);
}
2018-12-22 11:39:00 +01:00
@Override
2019-05-26 20:14:53 +02:00
public void onPlace(Room room) {
2018-12-22 11:39:00 +01:00
Achievement holeCountAchievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHoleFurniCount");
int holesCountProgress = 0;
Habbo owner = room.getHabbo(this.getUserId());
2019-05-26 20:14:53 +02:00
if (owner == null) {
2019-03-18 02:22:00 +01:00
holesCountProgress = AchievementManager.getAchievementProgressForHabbo(this.getUserId(), holeCountAchievement);
2019-05-26 20:14:53 +02: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;
2019-05-26 20:14:53 +02:00
if (holeDifference > 0) {
if (owner != null) {
2018-12-22 11:39:00 +01:00
AchievementManager.progressAchievement(owner, holeCountAchievement, holeDifference);
2019-05-26 20:14:53 +02:00
} else {
2018-12-22 11:39:00 +01:00
AchievementManager.progressAchievement(this.getUserId(), holeCountAchievement, holeDifference);
}
}
2019-05-26 21:33:51 +02:00
super.onPlace(room);
2018-12-22 11:39:00 +01:00
}
2018-07-06 15:30:00 +02:00
}