// Path: src/main/java/com/zhaidaosi/game/server/model/player/Player.java
// public class Player extends BasePlayer {
// 
//     private static Map<Integer, Integer> levelExperience = new HashMap<>();
// 
//     private UserInfo userInfo;
//     private BasePosition oldPosition;
//     private Map<String, Integer> actionJson = new HashMap<>();
// 
//     static {
//         levelExperience.put(1, 100);
//         levelExperience.put(2, 300);
//         levelExperience.put(3, 500);
//     }
// 
//     @SuppressWarnings("unchecked")
//     public void init(UserInfo userInfo) {
//         this.userInfo = userInfo;
//         this.name = userInfo.getNickname();
//         this.level = userInfo.getLevel();
//         this.totalHp = this.level * 100;
//         this.hp = this.totalHp;
//         this.experience = userInfo.getExperience();
// 
//         actionJson = BaseJson.JsonToObject(userInfo.getActions(), Map.class);
// 
//         for (Map.Entry<String, Integer> entry : actionJson.entrySet()) {
//             AttackAction attackAction = (AttackAction) ActionManager.getAction(Integer.parseInt(entry.getKey()));
//             attackAction.setLevel(entry.getValue());
//             this.addAction(attackAction);
//         }
// 
//         IBaseArea area = AreaManager.getArea(Area.ID);
//         area.addPlayer(this);
//     }
// 
//     public UserInfo getUserInfo() {
//         return userInfo;
//     }
// 
//     private void upLevel(int level) {
//         if (this.level != level) {
//             this.level = level;
//             userInfo.setLevel(level);
//             for (Entry<Integer, IBaseAction> entry : actions.entrySet()) {
//                 IBaseAction action = entry.getValue();
//                 if (action instanceof AttackAction) {
//                     ((AttackAction) action).setLevel(level);
//                     actionJson.put(Integer.toString(action.getId()), level);
//                 }
//                 userInfo.setActions(BaseJson.ObjectToJson(actionJson));
//             }
//         }
//     }
// 
//     public void addExperience(int experience) {
//         this.experience += experience;
//         int _level = level;
//         Integer _experience = levelExperience.get(_level);
//         while (_experience != null && this.experience > _experience) {
//             _level++;
//             _experience = levelExperience.get(_level);
//         }
//         userInfo.setExperience(this.experience);
//         upLevel(_level);
//         RsyncManager.add(id, UserInfoRsync.class, userInfo);
//     }
// 
//     public BasePosition gOldPosition() {
//         return oldPosition;
//     }
// 
//     public void sOldPosition(BasePosition oldPosition) {
//         this.oldPosition = oldPosition;
//     }
// 
// }


import java.util.HashMap;
import java.util.Map;
import com.zhaidaosi.game.jgframework.connector.IBaseConnector;
import com.zhaidaosi.game.jgframework.handler.BaseHandler;
import com.zhaidaosi.game.jgframework.message.IBaseMessage;
import com.zhaidaosi.game.jgframework.message.InMessage;
import com.zhaidaosi.game.jgframework.message.OutMessage;
import com.zhaidaosi.game.jgframework.model.area.IBaseArea;
import com.zhaidaosi.game.server.model.player.Player;
import io.netty.channel.Channel;

package com.zhaidaosi.game.server.handler;




public class SendMsgHandler extends BaseHandler {

    @Override
    public IBaseMessage run(InMessage im, Channel ch) {
        Object msg = im.getMember("msg");
        if (msg == null || msg.equals("")) {
            return OutMessage.showError("msg 不能为空");
        }


// Path: src/main/java/com/zhaidaosi/game/server/model/player/Player.java
// public class Player extends BasePlayer {
// 
//     private static Map<Integer, Integer> levelExperience = new HashMap<>();
// 
//     private UserInfo userInfo;
//     private BasePosition oldPosition;
//     private Map<String, Integer> actionJson = new HashMap<>();
// 
//     static {
//         levelExperience.put(1, 100);
//         levelExperience.put(2, 300);
//         levelExperience.put(3, 500);
//     }
// 
//     @SuppressWarnings("unchecked")
//     public void init(UserInfo userInfo) {
//         this.userInfo = userInfo;
//         this.name = userInfo.getNickname();
//         this.level = userInfo.getLevel();
//         this.totalHp = this.level * 100;
//         this.hp = this.totalHp;
//         this.experience = userInfo.getExperience();
// 
//         actionJson = BaseJson.JsonToObject(userInfo.getActions(), Map.class);
// 
//         for (Map.Entry<String, Integer> entry : actionJson.entrySet()) {
//             AttackAction attackAction = (AttackAction) ActionManager.getAction(Integer.parseInt(entry.getKey()));
//             attackAction.setLevel(entry.getValue());
//             this.addAction(attackAction);
//         }
// 
//         IBaseArea area = AreaManager.getArea(Area.ID);
//         area.addPlayer(this);
//     }
// 
//     public UserInfo getUserInfo() {
//         return userInfo;
//     }
// 
//     private void upLevel(int level) {
//         if (this.level != level) {
//             this.level = level;
//             userInfo.setLevel(level);
//             for (Entry<Integer, IBaseAction> entry : actions.entrySet()) {
//                 IBaseAction action = entry.getValue();
//                 if (action instanceof AttackAction) {
//                     ((AttackAction) action).setLevel(level);
//                     actionJson.put(Integer.toString(action.getId()), level);
//                 }
//                 userInfo.setActions(BaseJson.ObjectToJson(actionJson));
//             }
//         }
//     }
// 
//     public void addExperience(int experience) {
//         this.experience += experience;
//         int _level = level;
//         Integer _experience = levelExperience.get(_level);
//         while (_experience != null && this.experience > _experience) {
//             _level++;
//             _experience = levelExperience.get(_level);
//         }
//         userInfo.setExperience(this.experience);
//         upLevel(_level);
//         RsyncManager.add(id, UserInfoRsync.class, userInfo);
//     }
// 
//     public BasePosition gOldPosition() {
//         return oldPosition;
//     }
// 
//     public void sOldPosition(BasePosition oldPosition) {
//         this.oldPosition = oldPosition;
//     }
// 
// }


// Path: src/main/java/com/zhaidaosi/game/server/handler/SendMsgHandler.java
import java.util.HashMap;
import java.util.Map;
import com.zhaidaosi.game.jgframework.connector.IBaseConnector;
import com.zhaidaosi.game.jgframework.handler.BaseHandler;
import com.zhaidaosi.game.jgframework.message.IBaseMessage;
import com.zhaidaosi.game.jgframework.message.InMessage;
import com.zhaidaosi.game.jgframework.message.OutMessage;
import com.zhaidaosi.game.jgframework.model.area.IBaseArea;
import com.zhaidaosi.game.server.model.player.Player;
import io.netty.channel.Channel;

package com.zhaidaosi.game.server.handler;




public class SendMsgHandler extends BaseHandler {

    @Override
    public IBaseMessage run(InMessage im, Channel ch) {
        Object msg = im.getMember("msg");
        if (msg == null || msg.equals("")) {
            return OutMessage.showError("msg 不能为空");
        }


        Player player = (Player) ch.attr(IBaseConnector.PLAYER).get();
