// • ▌ ▄ ·.  ▄▄▄·  ▄▄ • ▪   ▄▄· ▄▄▄▄·  ▄▄▄·  ▐▄▄▄  ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀  █▪▀▀▀ ▀  ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀  ▀  ▀ ▀▀  █▪ ▀▀▀
//      Magicbane Emulator Project © 2013 - 2022
//                www.magicbane.com


package engine.devcmd.cmds;

import engine.Enum;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd;
import engine.objects.AbstractGameObject;
import engine.objects.Item;
import engine.objects.PlayerCharacter;


/**
 * @author
 */
public class ItemInfoCmd extends AbstractDevCmd {

    public ItemInfoCmd() {
        super("iteminfo");
    }

    @Override
    protected void _doCmd(PlayerCharacter pc, String[] words,AbstractGameObject target) {
        if (pc == null) {
            return;
        }
        if(target.getObjectType().equals(GameObjectType.Item) == false){
            throwbackInfo(pc, "Must Select An Item");
            return;
        }
        Item item = (Item)target;
        String newline = "\r\n ";
        String output = "";
        output += "Required Races:" + newline;
        for (Enum.MonsterType required : item.template.item_race_req)
            output += "     " + required.name() + newline;
        output += "Restricted Races:" + newline;
        for (Enum.MonsterType required : item.template.item_race_res)
            output += "     " + required.name() + newline;
        output += "Required Classes:" + newline;
        for (Enum.ClassType required : item.template.item_class_req)
            output += "     " + required.name() + newline;
        output += "Restricted Classes:" + newline;
        for (Enum.ClassType required : item.template.item_class_res)
            output += "     " + required.name() + newline;
        output += "Required Disciplines:" + newline;
        for (Enum.DisciplineType required : item.template.item_disc_req)
            output += "     " + required.name() + newline;
        output += "Restricted Disciplines:" + newline;
        for (Enum.DisciplineType required : item.template.item_disc_res)
            output += "     " + required.name() + newline;
        throwbackInfo(pc, output);
    }

    @Override
    protected String _getHelpString() {
        return "Gets information on an Object.";
    }

    @Override
    protected String _getUsageString() {
        return "' /iteminfo'";
    }

}
