/// <summary>武将信息验证</summary> private ASObject CheckRole(TGGSession session, tg_role role, BaseRoleTitle btitle, tg_role_title title) { var mainrole = session.Player.Role.Kind.CloneEntity(); var otid = CheckOldTitle(role, btitle.methods, title.id); //被替换称号id if (otid != 0) { role = CheckRoleInfo(role, (int)RoleDatatype.ROLEDATA_LOSE, otid); } //更新武将信息 if (string.IsNullOrEmpty(btitle.attAddition)) { return(Error((int)ResultType.BASE_TABLE_ERROR)); //验证加成信息 } Common.GetInstance().UpdateRole(role, (int)RoleDatatype.ROLEDATA_ADD, btitle.attAddition); //加成武将属性信息 if (!tg_role.UpdateByRole(role)) { return(Error((int)ResultType.DATABASE_ERROR)); } if (mainrole.id == role.id) { session.Player.Role.Kind = role; //装备武将为主角武将 } Common.GetInstance().RoleUpdatePush(mainrole.user_id, role.id); //推送武将信息 if (!tg_role_title.UpdateByTitle(title)) { return(Error((int)ResultType.DATABASE_ERROR)); } return(new ASObject(Common.GetInstance().BuildLoadData((int)ResultType.SUCCESS, title))); }
/// <summary>验证处理称号信息</summary> private void UpdateTitle(Int64 userid, BaseRoleTitle basetitle) { var title = tg_role_title.GetTitleByUseridTid(userid, basetitle.id); if (title == null) { CreateTitle(basetitle, userid); } else if (title.title_state == (int)TitleState.NOT_REACHED) { title.title_state = (int)TitleState.HAS_BEEN_REACHED; title.Update(); } }
/// <summary>创建称号信息</summary> private void CreateTitle(BaseRoleTitle btitle, Int64 userid) { var title = new tg_role_title() { title_id = btitle.id, title_state = (int)TitleState.HAS_BEEN_REACHED, title_load_state = (int)LoadStateType.UNLOAD, title_count = 1, packet_role1 = 0, packet_role2 = 0, packet_role3 = 0, user_id = userid, }; tg_role_title.Insert(title); }