Changed CostumeHopper to EffectHopper and made effect configurable with customparams

This commit is contained in:
Remco 2020-11-23 15:10:27 +01:00
parent 771f386b56
commit f952ac15d2
2 changed files with 25 additions and 5 deletions

View File

@ -141,7 +141,7 @@ public class ItemManager {
this.interactionsList.add(new ItemInteraction("puzzle_box", InteractionPuzzleBox.class));
this.interactionsList.add(new ItemInteraction("hopper", InteractionHopper.class));
this.interactionsList.add(new ItemInteraction("costume_hopper", InteractionCostumeHopper.class));
this.interactionsList.add(new ItemInteraction("costume_gate", InteractionCostumeGate.class));
this.interactionsList.add(new ItemInteraction("effect_gate", InteractionEffectGate.class));
this.interactionsList.add(new ItemInteraction("club_hopper", InteractionHabboClubHopper.class));
this.interactionsList.add(new ItemInteraction("club_gate", InteractionHabboClubGate.class));
this.interactionsList.add(new ItemInteraction("club_teleporttile", InteractionHabboClubTeleportTile.class));

View File

@ -10,15 +10,28 @@ import com.eu.habbo.threading.runnables.CloseGate;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class InteractionCostumeGate extends InteractionDefault implements ConditionalGate {
public class InteractionEffectGate extends InteractionDefault implements ConditionalGate {
public InteractionCostumeGate(ResultSet set, Item baseItem) throws SQLException {
// List of Habboween costumes according to http://www.habboxwiki.com/Costumes
private static final List<Integer> defaultAllowedEnables = new ArrayList<>(Arrays.asList(
114, // Strong Arms
115, // Ringmaster Costume
116, // Fly Head
117, // Executioner Hood
118, // Evil Clown Paint
135 // Marionette
));
public InteractionEffectGate(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
this.setExtradata("0");
}
public InteractionCostumeGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
public InteractionEffectGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells);
this.setExtradata("0");
}
@ -33,7 +46,14 @@ public class InteractionCostumeGate extends InteractionDefault implements Condit
if (roomUnit == null || room == null)
return false;
return roomUnit.getEffectId() > 0;
String customparams = this.getBaseItem().getCustomParams().trim();
if (!customparams.isEmpty()) {
return Arrays.asList(customparams.split(";"))
.contains(Integer.valueOf(roomUnit.getEffectId()).toString());
}
return defaultAllowedEnables.contains(roomUnit.getEffectId());
}
@Override