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

package engine.net.client.handlers;

import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.ModifyStatMsg;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;

public class ModifyStatMsgHandler extends AbstractClientMsgHandler {

    public ModifyStatMsgHandler() {
        super();
    }

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

        PlayerCharacter playerCharacter = origin.getPlayerCharacter();

        // Member variable declaration

        ModifyStatMsg msg;

        // Member variable assignment

        msg = (ModifyStatMsg) baseMsg;

        int type = msg.getType();

        switch (type) {
            case MBServerStatics.STAT_STR_ID:
                playerCharacter.addStr(msg.getAmount());
                break;
            case MBServerStatics.STAT_DEX_ID:
                playerCharacter.addDex(msg.getAmount());
                break;
            case MBServerStatics.STAT_CON_ID:
                playerCharacter.addCon(msg.getAmount());
                break;
            case MBServerStatics.STAT_INT_ID:
                playerCharacter.addInt(msg.getAmount());
                break;
            case MBServerStatics.STAT_SPI_ID:
                playerCharacter.addSpi(msg.getAmount());
                break;
        }

        return true;
    }

}