mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Add tag achievements
This commit is contained in:
parent
12d03bebc9
commit
8a1dacd831
@ -1,13 +1,22 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions.games.tag.icetag;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.achievements.Achievement;
|
||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||
import com.eu.habbo.habbohotel.games.tag.IceTagGame;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class InteractionIceTagField extends InteractionTagField {
|
||||
private final HashMap<Habbo, Integer> stepTimes = new HashMap<>();
|
||||
|
||||
public InteractionIceTagField(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem, IceTagGame.class);
|
||||
}
|
||||
@ -15,4 +24,24 @@ public class InteractionIceTagField extends InteractionTagField {
|
||||
public InteractionIceTagField(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
super(id, userId, item, extradata, limitedStack, limitedSells, IceTagGame.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||
super.onWalkOn(roomUnit, room, objects);
|
||||
|
||||
Habbo habbo = room.getHabbo(roomUnit);
|
||||
if (habbo != null)
|
||||
this.stepTimes.put(habbo, Emulator.getIntUnixTimestamp());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||
super.onWalkOff(roomUnit, room, objects);
|
||||
|
||||
Habbo habbo = room.getHabbo(roomUnit);
|
||||
if (habbo != null && this.stepTimes.containsKey(habbo)) {
|
||||
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("TagC"), (Emulator.getIntUnixTimestamp() - this.stepTimes.get(habbo)) / 60);
|
||||
this.stepTimes.remove(habbo);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,21 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions.games.tag.rollerskate;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||
import com.eu.habbo.habbohotel.games.tag.RollerskateGame;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class InteractionRollerskateField extends InteractionTagField {
|
||||
private final HashMap<Habbo, Integer> stepTimes = new HashMap<>();
|
||||
|
||||
public InteractionRollerskateField(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem, RollerskateGame.class);
|
||||
}
|
||||
@ -15,4 +23,24 @@ public class InteractionRollerskateField extends InteractionTagField {
|
||||
public InteractionRollerskateField(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
super(id, userId, item, extradata, limitedStack, limitedSells, RollerskateGame.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||
super.onWalkOn(roomUnit, room, objects);
|
||||
|
||||
Habbo habbo = room.getHabbo(roomUnit);
|
||||
if (habbo != null)
|
||||
this.stepTimes.put(habbo, Emulator.getIntUnixTimestamp());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||
super.onWalkOff(roomUnit, room, objects);
|
||||
|
||||
Habbo habbo = room.getHabbo(roomUnit);
|
||||
if (habbo != null && this.stepTimes.containsKey(habbo)) {
|
||||
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RbTagC"), (Emulator.getIntUnixTimestamp() - this.stepTimes.get(habbo)) / 60);
|
||||
this.stepTimes.remove(habbo);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user