2018-07-06 15:30:00 +02:00
|
|
|
package com.eu.habbo.habbohotel.items.interactions;
|
|
|
|
|
|
|
|
import com.eu.habbo.Emulator;
|
|
|
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|
|
|
import com.eu.habbo.habbohotel.items.Item;
|
|
|
|
import com.eu.habbo.habbohotel.rooms.Room;
|
|
|
|
import com.eu.habbo.habbohotel.users.HabboGender;
|
|
|
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
|
|
|
import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
|
|
|
|
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
|
|
|
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public class InteractionFXBox extends InteractionDefault {
|
|
|
|
public InteractionFXBox(ResultSet set, Item baseItem) throws SQLException {
|
2018-07-06 15:30:00 +02:00
|
|
|
super(set, baseItem);
|
2019-05-24 12:51:41 +02:00
|
|
|
this.setExtradata("0");
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public InteractionFXBox(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);
|
2019-05-24 12:51:41 +02:00
|
|
|
this.setExtradata("0");
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-26 20:14:53 +02:00
|
|
|
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
2018-07-06 15:30:00 +02:00
|
|
|
super.onClick(client, room, objects);
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
if (client != null && room.hasRights(client.getHabbo())) {
|
|
|
|
if (client.getHabbo().getHabboInfo().getGender().equals(HabboGender.M)) {
|
|
|
|
if (this.getBaseItem().getEffectM() > 0) {
|
2019-03-18 02:22:00 +01:00
|
|
|
room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectM(), -1);
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
if (client.getHabbo().getHabboInfo().getGender().equals(HabboGender.F)) {
|
|
|
|
if (this.getBaseItem().getEffectF() > 0) {
|
2019-03-18 02:22:00 +01:00
|
|
|
room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectF(), -1);
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setExtradata("1");
|
|
|
|
room.updateItemState(this);
|
|
|
|
room.removeHabboItem(this);
|
|
|
|
HabboItem item = this;
|
2019-05-26 20:14:53 +02:00
|
|
|
Emulator.getThreading().run(new Runnable() {
|
2018-07-06 15:30:00 +02:00
|
|
|
@Override
|
2019-05-26 20:14:53 +02:00
|
|
|
public void run() {
|
2019-05-16 00:39:39 +02:00
|
|
|
new QueryDeleteHabboItem(item.getId()).run();
|
2018-07-06 15:30:00 +02:00
|
|
|
room.sendComposer(new RemoveFloorItemComposer(item).compose());
|
|
|
|
}
|
|
|
|
}, 500);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|