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

50 lines
1.7 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import gnu.trove.map.hash.THashMap;
import java.awt.*;
import java.sql.ResultSet;
import java.sql.SQLException;
2019-05-26 20:14:53 +02:00
public class InteractionMuteArea extends InteractionCustomValues {
public static THashMap<String, String> defaultValues = new THashMap<String, String>() {
2019-03-18 02:22:00 +01:00
{
2019-05-26 20:14:53 +02:00
this.put("tilesLeft", "0");
}
2019-03-18 02:22:00 +01:00
{
2019-05-26 20:14:53 +02:00
this.put("tilesRight", "0");
}
2019-03-18 02:22:00 +01:00
{
2019-05-26 20:14:53 +02:00
this.put("tilesFront", "0");
}
2019-03-18 02:22:00 +01:00
{
2019-05-26 20:14:53 +02:00
this.put("tilesBack", "0");
}
2018-07-06 15:30:00 +02:00
};
2019-05-26 20:14:53 +02:00
public InteractionMuteArea(ResultSet set, Item baseItem) throws SQLException {
2018-07-06 15:30:00 +02:00
super(set, baseItem, defaultValues);
}
2019-05-26 20:14:53 +02:00
public InteractionMuteArea(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, defaultValues);
}
2019-05-26 20:14:53 +02:00
public boolean inSquare(RoomTile location) {
try {
2018-07-06 15:30:00 +02:00
return new Rectangle(
2019-05-26 20:14:53 +02:00
this.getX() - Integer.valueOf(this.values.get("tilesBack")),
this.getY() + Integer.valueOf(this.values.get("tilesLeft")) - (Integer.valueOf(this.values.get("tilesLeft")) + Integer.valueOf(this.values.get("tilesRight"))),
Integer.valueOf(this.values.get("tilesLeft")) + Integer.valueOf(this.values.get("tilesRight")) + 1,
Integer.valueOf(this.values.get("tilesFront")) + Integer.valueOf(this.values.get("tilesBack")) + 1).contains(location.x, location.y);
} catch (Exception e) {
2018-07-06 15:30:00 +02:00
return false;
}
}
}