|  |  | 
 |  |  | package com.secondworld.sdk.command; | 
 |  |  |  | 
 |  |  | import com.quicksdk.entity.GameRoleInfo; | 
 |  |  | import com.secondworld.sdk.QuickSdkMgr; | 
 |  |  | import com.secondworld.sdk.utils.CodeU2A; | 
 |  |  |  | 
 |  |  | import org.json.JSONObject; | 
 |  |  |  | 
 |  |  | public class CmdCreateRole implements ICommand { | 
 |  |  |     @Override | 
 |  |  |     public int getCode() { | 
 |  |  |         return CodeU2A.CreateRole; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void process(JSONObject json) throws Exception { | 
 |  |  |         GameRoleInfo roleInfo = new GameRoleInfo(); | 
 |  |  |         roleInfo.setServerID(json.getString("sid")); | 
 |  |  |         roleInfo.setServerName(json.getString("serverName")); | 
 |  |  |         roleInfo.setGameRoleName(json.getString("roleName").trim().replace(" ", "")); | 
 |  |  |         roleInfo.setGameRoleID(json.getString("roleID")); | 
 |  |  |         roleInfo.setGameBalance(json.getString("money")); | 
 |  |  |         roleInfo.setVipLevel( json.getString("vipLevel"));  //设置当前用户vip等级,必须为数字整型字符串,请勿传"vip1"等类似字符串 | 
 |  |  |         roleInfo.setGameUserLevel(json.getString("level"));//设置游戏角色等级 | 
 |  |  |         roleInfo.setPartyName(json.getString("familyName").trim().replace(" ",""));//设置帮派名称 | 
 |  |  |         roleInfo.setRoleCreateTime( json.getString("createTime")); //UC,当乐与1881,TT渠道必传,值为10位数时间戳 | 
 |  |  |  | 
 |  |  |         roleInfo.setPartyId("1100"); //360渠道参数,设置帮派id,必须为整型字符串 | 
 |  |  |         roleInfo.setGameRolePower("38"); //360,TT语音渠道参数,设置角色战力,必须为整型字符串 | 
 |  |  |         roleInfo.setPartyRoleId("11"); //360渠道参数,设置角色在帮派中的id | 
 |  |  |         roleInfo.setPartyRoleName("帮主"); //360渠道参数,设置角色在帮派中的名称 | 
 |  |  |         roleInfo.setProfessionId("38"); //360渠道参数,设置角色职业id,必须为整型字符串 | 
 |  |  |         roleInfo.setProfession("法师"); //360渠道参数,设置角色职业名称 | 
 |  |  |         roleInfo.setFriendlist("无"); //360渠道参数,设置好友关系列表,格式请参考:http://open.quicksdk.net/help/detail/aid/190 | 
 |  |  |         QuickSdkMgr.I.setGameRoleInfo(roleInfo, true); | 
 |  |  |     } | 
 |  |  | } | 
 |  |  | package com.secondworld.sdk.command;
 | 
 |  |  | 
 | 
 |  |  | import com.quicksdk.entity.GameRoleInfo;
 | 
 |  |  | import com.secondworld.sdk.PlatformDiff;
 | 
 |  |  | import com.secondworld.sdk.QuickSdkMgr;
 | 
 |  |  | import com.secondworld.sdk.utils.CodeU2A;
 | 
 |  |  | import org.json.JSONObject;
 | 
 |  |  | 
 | 
 |  |  | public class CmdCreateRole implements ICommand {
 | 
 |  |  |     @Override
 | 
 |  |  |     public int getCode() {
 | 
 |  |  |         return CodeU2A.CreateRole;
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @Override
 | 
 |  |  |     public void process(JSONObject json) throws Exception {
 | 
 |  |  |         GameRoleInfo roleInfo = new GameRoleInfo();
 | 
 |  |  |         roleInfo.setServerID(json.getString("sid"));
 | 
 |  |  |         roleInfo.setServerName(json.getString("serverName"));
 | 
 |  |  |         roleInfo.setGameRoleName(json.getString("roleName").trim().replace(" ", ""));
 | 
 |  |  |         roleInfo.setGameRoleID(json.getString("roleID"));
 | 
 |  |  |         roleInfo.setGameBalance(json.getString("money"));
 | 
 |  |  |         roleInfo.setVipLevel( json.getString("vipLevel"));  //设置当前用户vip等级,必须为数字整型字符串,请勿传"vip1"等类似字符串
 | 
 |  |  |         roleInfo.setGameUserLevel(json.getString("level"));//设置游戏角色等级
 | 
 |  |  |         String familyName = json.getString("familyName").trim().replace(" ","");
 | 
 |  |  |         if (familyName.isEmpty())
 | 
 |  |  |         {
 | 
 |  |  |             familyName = "default";
 | 
 |  |  |         }
 | 
 |  |  |         roleInfo.setPartyName(familyName);//设置帮派名称
 | 
 |  |  |         roleInfo.setRoleCreateTime( json.getString("createTime")); //UC,当乐与1881,TT渠道必传,值为10位数时间戳
 | 
 |  |  | 
 | 
 |  |  |         roleInfo.setPartyId(json.getString("familyID")); //设置帮派id,必须为整型字符串
 | 
 |  |  |         roleInfo.setGameRoleGender("男");
 | 
 |  |  |         roleInfo.setGameRolePower(json.getString("fightPower")); //设置角色战力,必须为整型字符串
 | 
 |  |  |         roleInfo.setPartyRoleId("11"); //设置角色在帮派中的id
 | 
 |  |  |         roleInfo.setPartyRoleName("帮主"); //设置角色在帮派中的名称
 | 
 |  |  |         roleInfo.setProfessionId("-1"); //设置角色职业id,必须为整型字符串
 | 
 |  |  |         roleInfo.setProfession("-1"); //设置角色职业名称
 | 
 |  |  |         roleInfo.setFriendlist("无"); //设置好友关系列表,格式请参考:http://open.quicksdk.net/help/detail/aid/190
 | 
 |  |  |         QuickSdkMgr.I.setGameRoleInfo(roleInfo, true);
 | 
 |  |  |         PlatformDiff.I.CreateRoleEvent(json.getString("roleID"));
 | 
 |  |  |     }
 | 
 |  |  | }
 |