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

package engine.net.client.handlers;

import engine.exception.MsgSendException;
import engine.mbEnums;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.RefinerScreenMsg;
import engine.objects.NPC;
import engine.objects.PlayerCharacter;

public class RefinerScreenMsgHandler extends AbstractClientMsgHandler {

    public RefinerScreenMsgHandler() {
        super(RefinerScreenMsg.class);
    }

    @Override
    protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {

        PlayerCharacter playerCharacter = origin.getPlayerCharacter();

        // Member variable declaration

        RefinerScreenMsg msg;

        // Member variable assignment

        msg = (RefinerScreenMsg) baseMsg;

        NPC npc = NPC.getFromCache(msg.getNpcID());

        if (npc != null)
            msg.setUnknown02(0); //cost to refine?

        Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
        DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);

        return true;
    }

}