修改装饰提交
parent
9c68ef183a
commit
04bc46d6d7
|
@ -10,22 +10,16 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
|
||||
@Component
|
||||
public class ModifyHeadFrameHandler extends BaseHandler<PlayerInfoProto.ModifyHeadRequest> {
|
||||
public class ModifyDecorationHandler extends BaseHandler<PlayerInfoProto.ModifyDecorationRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.MODIFY_HEAD_REQUEST;
|
||||
return MessageTypeProto.MessageType.MODIFY_DECORATION_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.ModifyHeadRequest proto) throws Exception {
|
||||
int headFrameId = proto.getHeadId();
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.ModifyDecorationRequest proto) throws Exception {
|
||||
int headFrameId = proto.getDecorationId();
|
||||
int type = proto.getType();
|
||||
PlayerLogic.getInstance().modifyHeadFrame(iSession,type,headFrameId,MessageTypeProto.MessageType.MODIFY_HEAD_RESPONSE);
|
||||
PlayerLogic.getInstance().modifyHeadFrame(iSession,type,headFrameId,MessageTypeProto.MessageType.MODIFY_DECORATION_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -34,6 +34,14 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private int mapId;
|
||||
|
||||
private int designation;//当前称号
|
||||
|
||||
private int ride;//坐骑
|
||||
|
||||
private int decoration;//皮肤
|
||||
|
||||
private int rideLevel;//坐骑等级
|
||||
|
||||
private long createTime; //创建时间
|
||||
|
||||
private String clientVersion;
|
||||
|
@ -516,5 +524,40 @@ public class PlayerManager extends MongoBase {
|
|||
this.sysMailIds = sysMailIds;
|
||||
}
|
||||
|
||||
public int getDesignation() {
|
||||
return designation;
|
||||
}
|
||||
|
||||
public int getRide() {
|
||||
return ride;
|
||||
}
|
||||
|
||||
public int getRideLevel() {
|
||||
return rideLevel;
|
||||
}
|
||||
|
||||
public int getDecoration() {
|
||||
return decoration;
|
||||
}
|
||||
|
||||
public void setDesignation(int designation) {
|
||||
this.designation = designation;
|
||||
updateString("designation", designation);
|
||||
}
|
||||
|
||||
public void setRide(int ride) {
|
||||
this.ride = ride;
|
||||
updateString("ride", ride);
|
||||
}
|
||||
|
||||
public void setDecoration(int decoration) {
|
||||
this.decoration = decoration;
|
||||
updateString("decoration", decoration);
|
||||
}
|
||||
|
||||
public void setRideLevel(int rideLevel) {
|
||||
this.rideLevel = rideLevel;
|
||||
updateString("rideLevel", rideLevel);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -354,17 +354,40 @@ public class PlayerLogic {
|
|||
|
||||
}
|
||||
|
||||
public void modifyHeadFrame(ISession session, int type,int headId,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
LOGGER.info("头像框或头像id{}",headId);
|
||||
public void modifyHeadFrame(ISession session, int type,int decorationId,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
LOGGER.info("外观物品Id{}",decorationId);
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
ItemManager itemManager = user.getItemManager();
|
||||
if(itemManager.getItem(headId)==null||itemManager.getItem(headId).getItemNum()<1){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("无此头像框"));
|
||||
if(type!=0){
|
||||
if(itemManager.getItem(decorationId)==null||itemManager.getItem(decorationId).getItemNum()<1){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("无此物品"));
|
||||
}
|
||||
}
|
||||
switch (type){
|
||||
case 0:
|
||||
user.getPlayerInfoManager().setHeadFrame(decorationId);
|
||||
break;
|
||||
case 1:
|
||||
user.getPlayerInfoManager().setHead(decorationId);
|
||||
break;
|
||||
case 2:
|
||||
user.getPlayerInfoManager().setDesignation(decorationId);
|
||||
break;
|
||||
case 3:
|
||||
user.getPlayerInfoManager().setRide(decorationId);
|
||||
break;
|
||||
case 4:
|
||||
user.getPlayerInfoManager().setDecoration(decorationId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(type==0){
|
||||
user.getPlayerInfoManager().setHeadFrame(headId);
|
||||
}else{
|
||||
user.getPlayerInfoManager().setHead(headId);
|
||||
user.getPlayerInfoManager().setHeadFrame(decorationId);
|
||||
}else if (type ==1){
|
||||
user.getPlayerInfoManager().setHead(decorationId);
|
||||
}else if(type==2){
|
||||
|
||||
}
|
||||
playerInfoUpdate(user);
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||
|
|
Loading…
Reference in New Issue