/// <summary> /// 输出角色现有属性 /// </summary> /// <param name="roleId"></param> /// <param name="sb"></param> /// <returns></returns> public static string PrintRoleProps(string otherRoleIdOrName) { string rolePropsStr = null; int roleId; bool find = false; GameClient otherClient; try { roleId = RoleName2IDs.FindRoleIDByName(otherRoleIdOrName); if (-1 == roleId) { if (!int.TryParse(otherRoleIdOrName, out roleId)) { return(rolePropsStr); } } otherClient = GameManager.ClientMgr.FindClient(roleId); if (null == otherClient) { return(rolePropsStr); } StringBuilder sb = new StringBuilder(); Global.PrintSomeProps(otherClient, ref sb); rolePropsStr = sb.ToString(); } catch (System.Exception ex) { } return(rolePropsStr); }
public int GetRoleIDByRoleName(string roleName, int serverID) { int roleid = RoleName2IDs.FindRoleIDByName(roleName, false); if (roleid <= 0) { string[] dbRoleFields = Global.ExecuteDBCmd(10088, roleName, serverID); if (dbRoleFields == null || dbRoleFields.Length != 2 || int.Parse(dbRoleFields[0]) < 0) { return(-15); } roleid = int.Parse(dbRoleFields[0]); } return(roleid); }