mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-30 01:50:50 +01:00
Merge branch 'feature/roombadge' into 'dev'
Added roombadge command See merge request morningstar/Arcturus-Community!364
This commit is contained in:
commit
7e78994d69
@ -116,3 +116,9 @@ ADD COLUMN `bubble_id` int(3) NULL DEFAULT 31 AFTER `effect`;
|
|||||||
-- Permissions to see tent chat
|
-- Permissions to see tent chat
|
||||||
ALTER TABLE `permissions` ADD `acc_see_tentchat` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `acc_see_whispers`;
|
ALTER TABLE `permissions` ADD `acc_see_tentchat` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `acc_see_whispers`;
|
||||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('hotel.room.tent.prefix', 'Tent');
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('hotel.room.tent.prefix', 'Tent');
|
||||||
|
|
||||||
|
-- Roombadge command
|
||||||
|
ALTER TABLE `permissions` ADD `cmd_roombadge` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `cmd_massbadge`;
|
||||||
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_roombadge.no_badge', 'No badge specified!');
|
||||||
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_roombadge', 'roombadge');
|
||||||
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.description.cmd_roombadge', ':roombadge <badge>');
|
||||||
|
@ -217,6 +217,7 @@ public class CommandHandler {
|
|||||||
addCommand(new LayCommand());
|
addCommand(new LayCommand());
|
||||||
addCommand(new MachineBanCommand());
|
addCommand(new MachineBanCommand());
|
||||||
addCommand(new MassBadgeCommand());
|
addCommand(new MassBadgeCommand());
|
||||||
|
addCommand(new RoomBadgeCommand());
|
||||||
addCommand(new MassCreditsCommand());
|
addCommand(new MassCreditsCommand());
|
||||||
addCommand(new MassGiftCommand());
|
addCommand(new MassGiftCommand());
|
||||||
addCommand(new MassPixelsCommand());
|
addCommand(new MassPixelsCommand());
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.eu.habbo.habbohotel.commands;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboBadge;
|
||||||
|
import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
|
||||||
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
|
||||||
|
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
||||||
|
import com.eu.habbo.messages.outgoing.users.AddUserBadgeComposer;
|
||||||
|
import gnu.trove.map.hash.THashMap;
|
||||||
|
|
||||||
|
public class RoomBadgeCommand extends Command {
|
||||||
|
public RoomBadgeCommand() {
|
||||||
|
super("cmd_roombadge", Emulator.getTexts().getValue("commands.keys.cmd_roombadge").split(";"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||||
|
if (gameClient == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (params.length == 2) {
|
||||||
|
String badge;
|
||||||
|
|
||||||
|
badge = params[1];
|
||||||
|
|
||||||
|
if (!badge.isEmpty()) {
|
||||||
|
THashMap<String, String> keys = new THashMap<>();
|
||||||
|
keys.put("display", "BUBBLE");
|
||||||
|
keys.put("image", "${image.library.url}album1584/" + badge + ".gif");
|
||||||
|
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
|
||||||
|
ServerMessage message = new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys).compose();
|
||||||
|
|
||||||
|
for (Habbo habbo : gameClient.getHabbo().getRoomUnit().getRoom().getHabbos()) {
|
||||||
|
if (habbo.isOnline()) {
|
||||||
|
if (habbo.getInventory() != null && habbo.getInventory().getBadgesComponent() != null && !habbo.getInventory().getBadgesComponent().hasBadge(badge)) {
|
||||||
|
HabboBadge b = BadgesComponent.createBadge(badge, habbo);
|
||||||
|
|
||||||
|
habbo.getClient().sendResponse(new AddUserBadgeComposer(b));
|
||||||
|
habbo.getClient().sendResponse(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roombadge.no_badge"), RoomChatMessageBubbles.ALERT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user