feat(防破解): 去除无需的io操作
This commit is contained in:
@@ -539,13 +539,14 @@ export class NormalBattleHandler {
|
|||||||
const { dataId, type, iKey, value, secV } = msg;
|
const { dataId, type, iKey, value, secV } = msg;
|
||||||
let roleId = session.get('roleId');
|
let roleId = session.get('roleId');
|
||||||
let roleName = session.get('roleName');
|
let roleName = session.get('roleName');
|
||||||
|
let sid = session.get('sid');
|
||||||
|
|
||||||
const rec = await BattleCheatRecModel.createRecord(dataId, type, iKey, value, secV, roleId, roleName);
|
const rec = await BattleCheatRecModel.createRecord(dataId, type, iKey, value, secV, roleId, roleName);
|
||||||
if (!rec) {
|
if (!rec) {
|
||||||
return resResult(STATUS.BATTLE_CHECK_REC_SAVE_ERR);
|
return resResult(STATUS.BATTLE_CHECK_REC_SAVE_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.blockByRecordBattleCheat(roleId, type);
|
await this.blockByRecordBattleCheat(roleId, type, sid);
|
||||||
|
|
||||||
return resResult(STATUS.SUCCESS);
|
return resResult(STATUS.SUCCESS);
|
||||||
}
|
}
|
||||||
@@ -557,8 +558,8 @@ export class NormalBattleHandler {
|
|||||||
* @param {number} type 查封类型(封除类型不为200)
|
* @param {number} type 查封类型(封除类型不为200)
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async blockByRecordBattleCheat(roleId: string, type: number) {
|
async blockByRecordBattleCheat(roleId: string, type: number, sid:string) {
|
||||||
if(roleId == undefined || type == undefined){
|
if (roleId == undefined || type == undefined || sid == undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type && type === CHECT_BATTLE_TYPE) {
|
if (type && type === CHECT_BATTLE_TYPE) {
|
||||||
@@ -581,12 +582,10 @@ export class NormalBattleHandler {
|
|||||||
let role = await RoleModel.updateRoleInfo(roleId, { blockType, blockReason });
|
let role = await RoleModel.updateRoleInfo(roleId, { blockType, blockReason });
|
||||||
if (!role) return resResult(STATUS.ROLE_NOT_FOUND);
|
if (!role) return resResult(STATUS.ROLE_NOT_FOUND);
|
||||||
|
|
||||||
let { isOnline, sid } = await getRoleOnlineInfo(roleId);
|
await this.app.rpc.connector.connectorRemote.setOtherUserSession.toServer(sid, [{ roleId, blockType }]);
|
||||||
if (isOnline) {
|
await this.app.rpc.connector.connectorRemote.remoteLogin.toServer(sid, roleId, STATUS.BLOCKED);
|
||||||
await this.app.rpc.connector.connectorRemote.setOtherUserSession.toServer(sid, [{ roleId, blockType }]);
|
await roleLeave(roleId);
|
||||||
await this.app.rpc.connector.connectorRemote.remoteLogin.toServer(sid, roleId, STATUS.BLOCKED);
|
|
||||||
await roleLeave(roleId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user