54 lines
3.2 KiB
Java
Raw Normal View History

2018-07-06 13:30:00 +00:00
package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
2018-09-12 16:45:00 +00:00
import com.eu.habbo.habbohotel.pets.Pet;
2018-07-06 13:30:00 +00:00
import com.eu.habbo.habbohotel.pets.PetManager;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import gnu.trove.procedure.TIntObjectProcedure;
2019-05-26 21:14:53 +03:00
public class PetInfoCommand extends Command {
public PetInfoCommand() {
2018-07-06 13:30:00 +00:00
super("cmd_pet_info", Emulator.getTexts().getValue("commands.keys.cmd_pet_info").split(";"));
}
@Override
2019-05-26 21:14:53 +03:00
public boolean handle(GameClient gameClient, String[] params) throws Exception {
if (params.length > 1) {
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == null)
2018-07-06 13:30:00 +00:00
return false;
String name = params[1];
2019-05-26 21:14:53 +03:00
gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().forEachEntry(new TIntObjectProcedure<Pet>() {
2018-07-06 13:30:00 +00:00
@Override
2019-05-26 21:14:53 +03:00
public boolean execute(int a, Pet pet) {
if (pet.getName().equalsIgnoreCase(name)) {
2019-03-18 01:22:00 +00:00
gameClient.getHabbo().alert("" +
2018-07-06 13:30:00 +00:00
Emulator.getTexts().getValue("commands.generic.cmd_pet_info.title") + ": " + pet.getName() + "\r\n" +
Emulator.getTexts().getValue("generic.pet.id") + ": " + pet.getId() + "\r" +
Emulator.getTexts().getValue("generic.pet.name") + ": " + pet.getName() + "\r" +
Emulator.getTexts().getValue("generic.pet.age") + ": " + pet.daysAlive() + " " + Emulator.getTexts().getValue("generic.pet.days.alive") + "\r" +
Emulator.getTexts().getValue("generic.pet.level") + ": " + pet.getLevel() + "\r" +
"\r" +
Emulator.getTexts().getValue("commands.generic.cmd_pet_info.stats") + "\r\n" +
Emulator.getTexts().getValue("generic.pet.scratches") + ": " + pet.getRespect() + "\r" +
Emulator.getTexts().getValue("generic.pet.energy") + ": " + pet.getEnergy() + "/" + PetManager.maxEnergy(pet.getLevel()) + "\r" +
Emulator.getTexts().getValue("generic.pet.happyness") + ": " + pet.getHappyness() + "\r" +
2018-09-28 19:25:00 +00:00
Emulator.getTexts().getValue("generic.pet.level.thirst") + ": " + pet.levelThirst + "\r" +
Emulator.getTexts().getValue("generic.pet.level.hunger") + ": " + pet.levelHunger + "\r" +
2019-05-26 21:14:53 +03:00
Emulator.getTexts().getValue("generic.pet.current_action") + ": " + (pet.getTask() == null ? Emulator.getTexts().getValue("generic.nothing") : pet.getTask().name()) + "\r" +
2018-07-06 13:30:00 +00:00
Emulator.getTexts().getValue("generic.can.walk") + ": " + (pet.getRoomUnit().canWalk() ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + ""
2019-03-18 01:22:00 +00:00
);
2018-07-06 13:30:00 +00:00
}
return true;
}
});
2019-05-26 21:14:53 +03:00
} else {
2018-07-06 13:30:00 +00:00
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_pet_info.pet_not_found"), RoomChatMessageBubbles.ALERT);
}
return true;
}
}