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


package engine.devcmd.cmds;

import engine.InterestManagement.InterestManager;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.DbManager;
import engine.mbEnums;
import engine.objects.AbstractGameObject;
import engine.objects.NPC;
import engine.objects.PlayerCharacter;

public class SetRaceCmd extends AbstractDevCmd {

    public SetRaceCmd() {
        super("setRace");
    }

    @Override
    protected void _doCmd(PlayerCharacter player, String[] words,
                          AbstractGameObject target) {

        int newRace = Integer.parseInt(words[0]);

        if (target.getObjectType().equals(mbEnums.GameObjectType.NPC) == false) {
            throwbackError(player, "You Must Target An NPC");
        }

        NPC npc = (NPC) target;
        npc.loadID = newRace;
        DbManager.NPCQueries.UPDATE_RACE(npc, newRace);
        InterestManager.reloadCharacter(npc);
    }

    @Override
    protected String _getHelpString() {
        return "Sets NPC race";
    }

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

}
