forked from MagicBane/Server
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.2 KiB
60 lines
2.2 KiB
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . |
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· |
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ |
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ |
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ |
|
// Magicbane Emulator Project © 2013 - 2022 |
|
// www.magicbane.com |
|
|
|
package engine.net.client.handlers; |
|
|
|
import engine.exception.MsgSendException; |
|
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(ModifyStatMsg.class); |
|
} |
|
|
|
@Override |
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { |
|
|
|
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; |
|
} |
|
|
|
} |