Files
winapp/HookJS.cpp
T
2026-06-23 21:59:23 +08:00

1321 lines
41 KiB
C++

//---------------------------------------------------------------------------
#pragma hdrstop
#include "HookJS.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
String linkJS_PA =
"if('undefined'==typeof MyGameLink){"
"Object.defineProperty(VideoGameCore.GameLinkStore.prototype, 'availableGameType', {"
"get: function() {"
"return [VideoGameCore.GAME_BAC];"
"},"
"enumerable: !0,"
"configurable: !0"
"});"
"VideoGameCore.LinkStoreFactory.prototype.release = function() {"
"Core.SingletonDispatcher.prototype.release.call(this);"
"this.betTableStoreMap.forEach(function(e) {"
"e.release();"
"}, this);"
"this.pokerStoreMap.forEach(function(e) {"
"e.release();"
"}, this);"
"this.roadMapStoreMap.forEach(function(e) {"
"e.release();"
"}, this);"
"this.roomTimerStoreMap.forEach(function(e) {"
"e.release();"
"}, this);"
"this.singleSocketGameStoreMap.forEach(function(e) {"
"e.release();"
"}, this);"
"};"
"function MyGameLink(){"
"if(!Cube.ModuleSys.ModuleNavigator.prototype.getCurrentModuleOld)"
"Cube.ModuleSys.ModuleNavigator.prototype.getCurrentModuleOld = Cube.ModuleSys.ModuleNavigator.prototype.getCurrentModule;"
"if(!VideoGameCore.GameLinkStore.prototype.onSocketDataOld){"
"VideoGameCore.GameLinkStore.prototype.onSocketDataOld = VideoGameCore.GameLinkStore.prototype.onSocketData;"
"VideoGameCore.GameLinkStore.prototype.onSocketData = function(e,t) {"
"if(e.respId==Cube.Game.Protocol.NO_BET_NOTIFY_PROTO_R){"
"console.log('长时间未下注');"
"reGameLink(1);"
"return;"
"}"
"VideoGameCore.GameLinkStore.prototype.onSocketDataOld.call(this,e,t);"
"if(typeof myGameLink=='undefined') return;"
"if(e.respId==Cube.Game.Protocol.ENTER_TABLE_PROTO_R && 'LINK'==e.payload.vid){"
"if(e.retCode==78){" //余额不足
"const store = VideoGameCore.GameLinkStore.instance;"
"for(let i=0; i<store.vids.length; i++){"
"const ind = store.visibleVids.indexOf(store.vids[i]);"
"if(ind>=0 && ind!=0){"
"store.changeTable(store.vids[i],0);"
"console.log('changeTable('+store.vids[i]+',0)');"
"break;"
"}"
"}"
"}"
"myGameLink.GameLinkStore.instance.closeVideo();"
"const vids = VideoGameCore.GameLinkStore.instance.visibleVids;"
"console.log('visibleVids', vids.length);"//, JSON.stringify(vids));"
"const rooms = VideoGameCore.RoomConfig.instance.getAllRoomInfoByFilter({gameType:'BAC'});"
"if(rooms.length > vids.length){"
"for(const r of rooms){"
"if(VideoGameCore.isGameMaintain(r.vid) && vids.indexOf(r.vid)<0) "
"cefApp.OnJSMessage('3|'+r.vid+'|||12|');"
"}"
"}"
"}"
"else if(e.respId==VideoGameCore.BET_PROTO_R){" //180227
"console.log('BET_PROTO_R', JSON.stringify(e));"
"const p=e.payload, jts=p.jettonlist;"
"let msg='6|'+e.vid+'|'+e.retCode+'|'+p.gmcode+'|';"
"let bets=[0,0,0];"
"for(const jt of jts) "
"bets[jt.playtype-1] += jt.totaljetton;"
"msg += bets[0]+'|'+bets[1]+'|'+bets[2];"
"cefApp.OnJSMessage(msg);"
"}"
"}"
"};"
"if(!PCPlaza.SingleSocketStore.prototype.onSocketDataOld){"
"PCPlaza.SingleSocketStore.prototype.onSocketDataOld = PCPlaza.SingleSocketStore.prototype.onSocketData;"
"PCPlaza.SingleSocketStore.prototype.onSocketData = function(e,t){"
"PCPlaza.SingleSocketStore.prototype.onSocketDataOld.call(this, e, t);"
"if(typeof myGameLink=='undefined') return;"
"ssTimeout = 0;"
"if(e.respId==Cube.Game.Protocol.CLIENT_LOGIN_GAME_PROTO_R){"
"console.log('CLIENT_LOGIN_GAME_PROTO_R', JSON.stringify(e));"
"if(0==e.retCode) "// && 'LOBB'==e.payload.vid){"
// "if(myGameLink.isStarted) reGameLink();"
"cefApp.OnJSMessage('4|'+e.payload.vid);"
"}"
"else if(e.respId==Cube.Game.Protocol.ENTER_TABLE_PROTO_R){"
"console.log('ENTER_TABLE_PROTO_R', JSON.stringify(e));"
"if(0==e.retCode) "
"cefApp.OnJSMessage('4|'+e.payload.vid);"
"}"
"else if(e.respId==VideoGameCore.GAME_SNAPSHOT_PROTO && checkVid(e.vid)"
"&& !VideoGameCore.isGameMaintain(e.vid)){" //135190 //台桌维护不处理
"const p=e.payload;"
"if(p.gmstatus==2 && (p.bcard && p.bcard.length || p.pcard && p.pcard.length)){"
"const msg = '9|' + e.vid + '|' + p.gmcode + '|';" //翻牌
"const bc = p.bcard && p.bcard.length ? parseCards(p.bcard) : '';"
"const pc = p.pcard && p.pcard.length ? parseCards(p.pcard) : '';"
"cefApp.OnJSMessage(msg + bc + '|' + pc);"
"}"
"else{"
"let msg='3|'+e.vid+'||'+p.gmcode+'|'+p.gmstatus+'|';"
"if(p.gmstatus==0) "
"msg += p.wintypes[0];"
"else if(p.gmstatus==1) "
"msg += e.timeout;"
"cefApp.OnJSMessage(msg);"
"}"
"}"
"else if(e.respId==VideoGameCore.UPDATE_BALANCE_R){" //131106
"console.log('UPDATE_BALANCE_R_2', JSON.stringify(e));"
"const msg='5|'+e.val.toFixed(2);"
"cefApp.OnJSMessage(msg);"
"}"
// "else{"
// "console.log(JSON.stringify(e));"
// "}"
"}"
"};"
"this.isStarted = false;"
"this.LinkStoreFactory = VideoGameCore.LinkStoreFactory;"
"this.GameLinkStore = VideoGameCore.GameLinkStore;"
"this.BetHistoryStore = VideoGameCore.MultiBetHistoryStore;"
"this.start = function(){"
"if(this.isStarted) return;"
"this.isStarted = true;"
"if(VideoGameCore.singleSocket){"
"if(VideoGameCore.singleSocket.readyState>1) VideoGameCore.singleSocket.connect();"
"}"
"if(VideoGameCore.PlazaSocket.instance){"
"VideoGameCore.PlazaSocket.instance.removeEventListener('EVENT_PACKET',onVidData);"
"VideoGameCore.PlazaSocket.instance.addEventListener('EVENT_PACKET',onVidData);"
"}"
"if(VideoGameCore.UserStore.instance){"
"VideoGameCore.UserStore.instance.removeEventListener('EVENT_PACKET',onVidData);"
"VideoGameCore.UserStore.instance.addEventListener('EVENT_PACKET',onVidData);"
"}"
"Cube.ModuleSys.ModuleNavigator.prototype.getCurrentModule = function(){return 'GameLink';};"
"this.LinkStoreFactory.init();"
"this.GameLinkStore.init();"
"this.BetHistoryStore.init();"
"setupStores();"
"this.GameLinkStore.instance.connectSocket();"
"console.log('start at', new Date());"
"};"
"this.close = function(){"
"if(!this.isStarted) return;"
"this.isStarted = false;"
"this.GameLinkStore.releaseInstance();"
"this.LinkStoreFactory.releaseInstance();"
"this.BetHistoryStore.releaseInstance();"
"Cube.ModuleSys.ModuleNavigator.prototype.getCurrentModule = Cube.ModuleSys.ModuleNavigator.prototype.getCurrentModuleOld;"
"PCPlaza.SingleSocketStore.instance.quitTable();"
"PCPlaza.RootPageStore.instance.backLobby();"
"console.log('close at', new Date());"
"}"
"};"
"}";
String goLinkJS_PA = "goLink();";
String goLobbyJS_PA = "goLobby();";
String baseJS_PA =
"if(typeof onVidData=='undefined' || !onVidData){"
"(function () {"
"const iframe = document.createElement('iframe');"
"iframe.style.display = 'none';"
"document.body.appendChild(iframe);"
"window.console.log = iframe.contentWindow.console.log"
"})();"
"var goLobby = ()=>{"
"if(typeof myGameLink=='undefined' || !myGameLink){"
"PCPlaza.SingleSocketStore.instance.quitTable();"
"PCPlaza.RootPageStore.instance.backLobby();"
"}"
"else myGameLink.close();"
"};"
"var goLink = ()=>{"
"const module = PCPlaza.RootPageStore.instance.getCurrentModule();"
"console.log(module,PCPlaza.RootPageStore.instance.isInPlaza,PCPlaza.SingleSocketStore.instance.isInLobby);"
"if(module!='PCPlaza' && module!='GameLink' && module!='Core'){"
"PCPlaza.SingleSocketStore.instance.quitTable();"
"PCPlaza.RootPageStore.instance.backLobby();"
"}"
"else{"
"if(typeof myGameLink=='undefined'){ myGameLink = new MyGameLink(); }"
"if(myGameLink.isStarted) reGameLink(1);"
"else myGameLink.start();"
"}"
"};"
"var reGameLink = (e)=>{"
"const store = myGameLink.GameLinkStore;"
"store.releaseInstance();"
"if(!e){"
"const factory = myGameLink.LinkStoreFactory;"
"factory.releaseInstance();"
"factory.init();"
"}"
"store.init();"
"setupStores();"
"store.instance.connectSocket();"
"};"
"var setupStores = ()=>{"
"const store = myGameLink.GameLinkStore.instance;"
"const factory = myGameLink.LinkStoreFactory.instance;"
"const addVids = store.vids.filter(e=>store.visibleVids.indexOf(e)<0);"
"store.visibleVids.push(...addVids);"
"store.visibleVids.forEach(function(e) {"
"factory.setupStoresByVid(e);"
"});"
"};"
"var parseCards = (cards)=>{"
"const c=[];"
"cards.forEach((e,i)=>{let n=e&15; c[i] = n>=10 ? 0 : n;});"
"return c;"
"};"
"var checkVid = (vid)=>{"
"const room = VideoGameCore.RoomConfig.instance.getRoomInfoByVid(vid);"
"return room && room.gmtype===VideoGameCore.GAME_BAC"
"&& (room.platformtype===VideoGameCore.PLATFORM_CGY"
"||room.platformtype===VideoGameCore.PLATFORM_EMA"
"||room.platformtype===VideoGameCore.PLATFORM_CHO);" //新台桌类型
"};"
"var ssTimeout=0, psTimeout=0, tmRetry=90;"//待机状态尝试恢复5分钟,否则90秒
"var chkSockets = ()=>{"
"if(typeof myGameLink=='undefined') return;"
// "if(ssTimeout>1 || psTimeout>1) "
// "console.log(ssTimeout, psTimeout);"
"ssTimeout++, psTimeout++;"
"if(ssTimeout>=tmRetry || psTimeout>=tmRetry){" //确认网络异常,退出登录
"cefApp.OnJSMessage('0|3');"
"}"
"if(ssTimeout>=10 && (ssTimeout % 5)==0){" //10秒没有ss网络数据,尝试每5秒reconnect
"console.log(ssTimeout + 's try reconnect ss!!!!');"
"const sSkt = VideoGameCore.singleSocket;"
"if(sSkt && !sSkt.connected && sSkt.readyState>1){"
"console.log('singleSocket connect: ', sSkt.connected, sSkt.readyState);"
"sSkt.connect();"
"}"
"else if(sSkt && (sSkt.connected || (ssTimeout % 20)==0)){" //20秒一次断开重连
"console.log('singleSocket close');"
"sSkt.close();"
"}"
"else{"
"console.log('singleSocket wait: ', sSkt.connected, sSkt.readyState);"
"}"
"}"
"if(psTimeout>=10 && (psTimeout % 10)==0){" //10秒没有ps网络数据,尝试每10秒reconnect
"console.log(psTimeout + 's try reconnect ps!!!!');"
"const pSkt = VideoGameCore.PlazaSocket.instance;"
"if(pSkt && !pSkt.connected && pSkt.readyState>1){"
"console.log('PlazaSocket connect', pSkt.connected, pSkt.readyState);"
"pSkt.connect();"
"}"
"else if(pSkt && (pSkt.connected || (psTimeout % 20)==0)){"
"console.log('PlazaSocket close');"
"pSkt.close();"
"pSkt.connect();"
"}"
"else{"
"console.log('PlazaSocket wait: ', pSkt.connected, pSkt.readyState);"
"}"
"}"
"};"
"var onVidData = (e)=>{"
"const vgc = VideoGameCore;"
"let t = e.data;"
"if(t && t.respId){"
"if(t.respId==vgc.EXCEPTION_EXIT_R ){" // 131142
"cefApp.OnJSMessage('0|0');" //重复登入
"}"
"else if(t.respId==vgc.UPDATE_BALANCE_R){" //131106
"console.log('UPDATE_BALANCE_R_1', JSON.stringify(t));"
"psTimeout = 0;"
"let msg='5|'+t.val.toFixed(2);"
"cefApp.OnJSMessage(msg);"
"}"
"else if(t.respId==vgc.PERSONAL_LIMIT_R){" //131119
"console.log('PERSONAL_LIMIT_R', JSON.stringify(t));"
"psTimeout = 0;"
"const limit = t.limitList.dataObj[1];"
"if(limit){"
"const msg = '7|'+limit.min + '|' + limit.max;"
"cefApp.OnJSMessage(msg);"
"}"
"}"
"else if(t.respId==vgc.GAME_SNAPSHOT_PROTO && checkVid(t.vid)){" // 135190
// "console.log('GAME_SNAPSHOT_PROTO', JSON.stringify(t));"
// "const p=t.payload;"
// "if(p.gmstatus==2 && (p.bcard && p.bcard.length || p.pcard && p.pcard.length)) "
// "return;"
"psTimeout = 0;"
"if(vgc.isGameMaintain(t.vid)){"
"cefApp.OnJSMessage('3|'+t.vid+'|||12|');" //维护中
"const store = vgc.GameLinkStore.instance;"
"if(store && store.roomInfosMap.get(t.vid)){"
"console.log('DelTable', t.vid);"
// "reGameLink();"
"myGameLink.close();"
"};"
"}"
"else{"
"if(!vgc.singleSocket.connected || ssTimeout>2){" //singleSocket断开时接管 //可能产生数据冲突ps数据滞后于ss
"const p=t.payload;"
"if(p.gmstatus==2 && (p.bcard && p.bcard.length || p.pcard && p.pcard.length)){"
"const msg = '9|' + t.vid + '|' + p.gmcode + '|';" //翻牌
"const bc = p.bcard && p.bcard.length ? parseCards(p.bcard) : '';"
"const pc = p.pcard && p.pcard.length ? parseCards(p.pcard) : '';"
"cefApp.OnJSMessage(msg + bc + '|' + pc);"
"}"
"else{"
"let msg='3|'+t.vid+'||'+p.gmcode+'|'+p.gmstatus+'|';"
"if(p.gmstatus==0) "
"msg += p.wintypes[0];"
"else if(p.gmstatus==1) "
"msg += t.timeout;"
"cefApp.OnJSMessage(msg);"
"}"
"}"
"const store = vgc.GameLinkStore.instance;"
"if(store && !store.roomInfosMap.get(t.vid)){"
"console.log('AddTable', t.vid);"
// "reGameLink();"
"myGameLink.close();"
"};"
"}"
// "let msg='3|'+t.vid+'||'+p.gmcode+'|'+p.gmstatus+'|';"
// "if(p.gmstatus==0) "
// "msg += p.wintypes[0];"
// "else if(p.gmstatus==1) "
// "msg += t.timeout;"
//
// "cefApp.OnJSMessage(msg);"
"}"
"else if(t.respId==vgc.BAC_FULL_RESULT_LIST && checkVid(t.vid)){" // 135176
// "console.log('BAC_FULL_RESULT_LIST', JSON.stringify(e));"
"psTimeout = 0;"
"let s='';"
"t.beadList.forEach(e=>s+=e.winType);"
"const msg='2|'+t.vid+'||'+s;"
"cefApp.OnJSMessage(msg);"
"}"
"else if(t.respId==vgc.CLIENT_LOGIN_PLAZA_R){"
"const module = PCPlaza.RootPageStore.instance.getCurrentModule();"
"console.log('CLIENT_LOGIN_PLAZA_R', JSON.stringify(t));"
"psTimeout = 0;"
"if(module!='GameLink' || PCPlaza.RootPageStore.instance.isInPlaza"
" || PCPlaza.SingleSocketStore.instance.isInLobby){"
"console.log('CLIENT_LOGIN_PLAZA_R', t.retCode, module,"
"PCPlaza.RootPageStore.instance.isInPlaza,"
"PCPlaza.SingleSocketStore.instance.isInLobby);"
"reGameLink();"
"}"
"}"
"}"
"else if(t && t.type){"
// "console.log(t.type, JSON.stringify(t));"
"if(t.type==egret.Event.CLOSE){"
"const sSkt = vgc.singleSocket;"
"if(sSkt && !sSkt.connected && sSkt.readyState>1){" //singleSocket中断
"console.log('reconnect singleSocket on CLOSE');"
"sSkt.connect();"
"}"
"}"
"}"
"};"
"egret.lifecycle.LifecycleContext.prototype.pause = ()=>{};"
"VideoGameCore.SettingStore.instance.setBGMEnable(0);"
"VideoGameCore.SettingStore.instance.setSoundEnable(0);"
"VideoGameCore.SettingStore.instance.setLiveEnable(0);"
"VideoGameCore.SettingStore.instance.setVideoAutoChange(0);"
"}"
;
String enterJS_PA =
"{"
"const iv_games = setInterval("
"function getGames(){"
"let iRet=0;"
"const roadMap = VideoGameCore.PlazaRoadStore.instance.roadDataMap;"
"const itemMap = VideoGameCore.RoomItemStore.storeVidMap;"
"if(roadMap && itemMap){"
"const rooms = VideoGameCore.RoomConfig.instance.getAllRoomInfoByFilter({gameType:'BAC'});"
"if(rooms.length>=15){"
"iRet = 1;"
"let info='1|';"
"for(const r of rooms){"
"const t = roadMap.get(r.vid);"
"const i = itemMap.get(r.vid);"
"if(t && i){"
"const gs = VideoGameCore.isGameMaintain(r.vid) ? 12 : i.gmstatus ? i.gmstatus : 0;"
"let p='';"
"if(t.beadList) "
"t.beadList.forEach(e=>p+=e.winType);"
"info += r.vid+',,'+i.lastgmcode+','+gs+','+p+';'"
"}"
"else{"
"iRet=0;"
"break;"
"}"
"}"
"if(iRet){"
"console.log(info);"
"clearInterval(iv_games);"
"VideoGameCore.PlazaSocket.instance.addEventListener('EVENT_PACKET',onVidData);"
"VideoGameCore.UserStore.instance.addEventListener('EVENT_PACKET',onVidData);"
"cefApp.OnJSMessage(info);"
"}"
"}"
"}"
"}, 1000);"
"}";
String stopJS_PA = "VideoGameCore.PlazaSocket.instance.removeEventListener('EVENT_PACKET',onVidData);";
String loginJS_PA =
"{"
"const st = window.localStorage;"
"st.setItem('pid_s', '%s');"
"st.setItem('lang_s', '%s');"
"st.setItem('gtp_s', '%s');"
"st.setItem('un_s', '%s');"
"st.setItem('dm_s', '%s');"
"st.setItem('dfd_s', '%s');"
"st.setItem('pd_s', '');"
"st.setItem('cdn_s', '');"
"st.setItem('od_s', '');"
"st.setItem('gtk_s', 'null');"
"st.setItem('cur_s', 'CNY');"
"window.location = '/pc/?';"
"}";
String userJS_PA =
"{"
"const user = VideoGameCore.UserStore.instance;"
"const limit = user.getBetLimitByPlayType(VideoGameCore.PLAYTYPE_BANKER);"
"console.log(user.userName,user.balance,user.currency,limit.min,limit.max);"
"cefApp.GetUserInfo(user.userName,user.balance,user.currency,limit.min,limit.max);"
"}";
String expireJS_PA =
"{"
"if(typeof itv_exp!='undefined' && itv_exp) clearInterval(itv_exp);"
"let uid=%d, extm=%d*1000;"
"if(!uid) extm=Core.LoginStore.instance.getCurServerTime()+60000;"
"var itv_exp=setInterval((function exp(){"
"console.log('itv_exp of '+uid, extm);"
"if(Core.LoginStore.instance.getCurServerTime()>extm){"
"Core.quit();"
"cefApp.OnJSMessage('0|-2');"
"};"
"return exp;"
"})(),120000);"
"}";
String goLinkJS_AB =
"{"
"const instGD = Netbet.component.entity.GameDO.getInstance();"
"const instCEM = Netbet.component.entity.manager.ComponentEventManager.getInstance();"
"if(instGD && instCEM){"
"setTimeout(()=>{"
"instGD.setGameHallGameFilterList(" //设置台桌类型
"'MULTITABLE',"
"[{"
"'parentItem': {'name': 'Baccarat', 'status': 'selected'},"
"'subItem': ["
"{'name': 'BACCARAT', 'status': 'selected'},"
"{'name': 'SEXY_BACCARAT', 'status': 'selected'},"
"{'name': 'CLASSIC_BACCARAT', 'status': 'selected'},"
"{'name': 'QUICK_BACCARAT', 'status': 'selected'},"
"{'name': 'INSURANCE_BACCARAT', 'status': 'selected'},"
"{'name': 'SEECARD_BACCARAT', 'status': 'selected'},"
"]"
"}]"
");"
"instCEM.alNavBtnClick({'navBtnName': 'MULTITABLE'});" //进入多台
"}, 200);"
"}"
"}";
String stopJS_AB =
"{"
"msgHandler = (e)=>{};"
"updHandler = (e,t)=>{};"
"iv_login = undefined;"
"}";
String msgJS_AB =
"if(typeof iv_login=='undefined'){"
"console.warn = function (e) {};" //禁止打印warn
"const iframe = document.createElement('iframe');" //重定位log
"iframe.style.display = 'none';"
"document.body.appendChild(iframe);"
"window.console.log = iframe.contentWindow.console.log;"
"var ssTimeout=0, psTimeout=0, tmRetry=90;" //计时器
"function msgHandler(e){"
"console.log(JSON.stringify(e));"
"if(e.errorCode>=6075 && e.errorCode<=6079) "
"cefApp.OnJSMessage('0');"
"else if(e.errorCode==6008) "
"cefApp.OnJSMessage('0|0');"
"};"
"const chkGameType = function(t){" //是否百家乐
"return t<=110 || t==1011 || t==1012;"
"};"
"const chgTableStatus = function(t){" //转换台桌状态
"return t==999 ? 12 : t==102 ? 11 : t==100 ? 1 "
": (t==110 || t==113 || t>=103 && t<=108) ? 2 "
": 0;"
"};"
"function updHandler(e,t){"
"if(e=='login'){" //登录
"if(t.A==0){" //成功,获取用户信息
"const un = t.C.BB;"
"const amo = (t.C.DD/100).toFixed(2);"
"const cur = t.C.LL;"
"const low = t.D[0].BB;"
"const high = t.D[0].CC;"
"cefApp.GetUserInfo(un, amo, cur, low, high);"
"}"
"else " //失败
"cefApp.OnJSMessage('0|-3');"
"}"
"else if(e=='setPlayerHandicap'){" //限额
"for(let i=0; i<t.C.length; i++){"
"if(t.C[i].AA.includes(101)){"
"const low = t.C[i].BB;"
"const high = t.C[i].CC;"
"cefApp.OnJSMessage('7|'+low+'|'+high);"
"break;"
"}"
"}"
"}"
"else if(e=='pushUserInfo'){" //账户余额
"cefApp.OnJSMessage('5|'+(t.A/100).toFixed(2));"
"console.log(e, JSON.stringify(t));"
"}"
"else if(e=='getGameHall'){" //所有台桌
// "console.log(e, JSON.stringify(t));"
"const hallId = t.C;"
"cefApp.OnJSMessage('4|'+hallId);"
// "if(hallId==100){" //多桌
"let msg = '1|';"
"t.D.forEach(a=>{"
"if(chkGameType(a.DD)){" //百家乐
"let p='';"
"if(a.WW3 && a.WW3.length)"
"a.WW3[0].forEach(v=>p+=v[0]);"
"let s = chgTableStatus(a.Z3);" //台桌状态
"msg += a.AA+','+a.BB+','+a.HH.CC+','+s+','+p+';'"
"}"
"});"
"cefApp.OnJSMessage(msg);"
// "}"
"}"
"else if(e=='getRoadData'){" //历史结果
"const inst = Netbet.component.entity.gameHallDO.getInstance();"
"const td = inst.getTableDO(t.C);"
"if(td && chkGameType(td.getGameType()) && t.G && t.G.length==1){"
"let msg = '2|'+t.C+'|'+td.getTableName()+'|';"
"t.G[0].forEach(v=>msg+=v[0]);"
"cefApp.OnJSMessage(msg);"
// "console.log(e, JSON.stringify(t));"
"}"
"}"
"else if(e=='getCountDown'){" //倒计时
"let msg = '8|';"
"const inst = Netbet.component.entity.gameHallDO.getInstance();"
"t.C.forEach(v=>{ "
"const td = inst.getTableDO(v.AA);"
"if(td && chkGameType(td.getGameType())) "
"msg += v.AA+','+v.DD+','+v.CC+';';"
"});"
"cefApp.OnJSMessage(msg);"
"}"
"else if(e=='pushGameStatus'){" //台桌状态
"const inst = Netbet.component.entity.gameHallDO.getInstance();"
"t.A.forEach(v=>{"
"const td = inst.getTableDO(v.AA);"
"if(td && chkGameType(td.getGameType())){"
"let msg = '3|';"
"const s = chgTableStatus(v.DD);"
"const r = v.DD==101 ? v.NN[0][0][0] : '';"
"msg += v.AA+'|'+td.getTableName()+'|'+v.CC+'|'+s+'|'+r;"
"cefApp.OnJSMessage(msg);"
"}"
"});"
// "if(log) console.log(e, JSON.stringify(t));"
"}"
"else if(e=='pushRawCards'){" //发牌
"const inst = Netbet.component.entity.gameHallDO.getInstance();"
"const td = inst.getTableDO(t.A);"
"if(td && chkGameType(td.getGameType()) && t.B && t.B.length==2){"
"let msg = '9|' + t.A + '|' + t.E + '|';"
"const card = ['',''];"
"t.B.forEach((e,i)=>{"
"e.forEach(v=>{"
"if(card[i].length>0)"
"card[i]+=',';"
"if(v==-2)"
"card[i]+='_';"
"else{"
"let w=v%100;"
"if(w>=10) w=0;"
"card[i]+=w;"
"}"
"})"
"});"
"msg += card[0] + '|' + card[1];"
"cefApp.OnJSMessage(msg);"
"}"
"}"
"else if(e=='gameBet'){" //下注反馈
"console.log(e, JSON.stringify(t));"
"let msg='6|'+t.D+'|'+t.A+'|'+t.H+'|';"
"let bets=[0,0,0];"
"t.E.forEach((bt,i)=>{bets[bt-1001]+=t.F[i]/100;});"
"msg += bets[0]+'|'+bets[1]+'|'+bets[2];"
"cefApp.OnJSMessage(msg);"
"}"
"else if(e=='pushGameTableResults'){" //保活?
"const inst = Netbet.component.entity.gameHallDO.getInstance();"
"const td = inst.getTableDO(t.A);"
"if(td && chkGameType(td.getGameType())){"
"const r = {a:t.A, b:1};"
"Netbet.component.entity.RequestManager.getInstance().instantRequest('getRoadData', r);"
// "console.log(e, JSON.stringify(t));"
"}"
"}"
"else if(e=='getBriefGameTableList'){"
"const inst = Netbet.component.entity.gameHallDO.getInstance();"
"const ghn = inst.getCurGameHallName();"
"let msg = '4|';"
"msg += ghn=='MULTITABLE' ? '102' : '100';"
"cefApp.OnJSMessage(msg);"
// "console.log(e, JSON.stringify(t), ghn);"
"}"
"else if(e!='pushGHStatistics' && e!='pushGHStatus' "//&& e!='getBriefGameTableList' "
"&& e!='pushGHDealer' && e!='pulseRequest' && e!='pushAdditionalTableInfo' "
"&& e!='showOpenedBrand'){"
"console.log(e, JSON.stringify(t));"
"}"
"};"
"function multiTableBet(e,t,a){"
"const td = Netbet.component.entity.gameHallDO.getInstance().getTableDO(e);"
"const bo = td.getBettingObj();" //获取bettingObj 重点!
"const t2s = ['banker','player','tie'];"
"t.forEach((bt,i)=>{bt && (bo.pendingBet[t2s[bt-1001]] += a[i]);});" //修改pendingBet
"const bp = {betTypes: t, betAmounts: a};"
"const sa = Netbet.component.entity.GameDO.getInstance().getSendApi();"
"sa.push({cmd:'gameBet', data: JSON.stringify({ tableId: e, data: bp })});"
"Netbet.component.entity.GameDO.getInstance().setSendApi(sa);"
"const rid = td.getGameRoundId();"
"bo.gameRoundId = rid;" //gameRoundId为当前局号
"td.setBettingObj(bo);" //保存BettingObj
"const E = {a:e, c:td.getGameStatue().inningsID, d:rid, e:102, f:bp.betTypes, "
"h:bp.betAmounts, i:1, j:Netbet.component.tools.Tools.bv(rid, bp, 1)"
"};"
"Netbet.component.entity.RequestManager.getInstance().instantRequest('gameBet', E);" //发送下注消息
// "console.log(JSON.stringify(E));"
"};"
"iv_login = setInterval("
"function(){"
"console.log('try capture message');"
"if(Netbet && Netbet.component && Netbet.component.entity && Netbet.component.entity.ApiManager "
"&& Netbet.component.Messenger){"
"const instAM = Netbet.component.entity.ApiManager.getInstance();"
"const instM = Netbet.component.Messenger.getInstance();"
"if(instAM && instM){"
"clearInterval(iv_login);"
"console.log('addListener');"
//拦截api消息
// "instAM._event.on('apiEvent', apiHandler);"
"const amUpd = instAM.update;"
"instAM.update = function(e,t){"
"amUpd(e,t);"
"updHandler(e,t);"
"};"
//拦截消息框,确认网站异常
"const mfunc = instM.func;"
"instM.func = function(){"
"const t = arguments[0];"
"if(t=='showConfirmMessage'){ "
"const a = [].slice.call(arguments, 1);"
"msgHandler.apply(0, a);"
"return;"
"};"
"mfunc.apply(0, arguments);"
"}"
"}"
"}"
"}, 1000);"
"}";
String expireJS_AB =
"{"
"if(typeof itv_exp!='undefined' && itv_exp) clearInterval(itv_exp);"
"let uid=%d, extm=%d*1000;"
"if(!uid) extm=Date.now()+60000;"
"var itv_exp=setInterval((function exp(){"
"console.log('itv_exp of '+uid, extm);"
"if(Date.now()>extm){"
"Netbet.component.entity.RequestManager.getInstance().queueRequest('logout', {});"
"cefApp.OnJSMessage('0|-2');"
"};"
"return exp;"
"})(),120000);"
"}";
String loginJS_DB =
"{"
"const id = '%s';"
"const st = window.localStorage;"
"if(st.getItem('fixedDeviceId')!=id){"
"console.log('change deviceId to', id);"
"st.setItem('fixedDeviceId', id);"
"window.location.reload();"
"}"
"else console.log('deviceId no changed');"
"}";
String userJS_DB =
"{"
"console.log('import module');"
"const oldNode = document.getElementById('usrScript');"
"if(oldNode) oldNode.remove();"
"const script = document.createElement('script');"
"script.setAttribute('type', 'module');"
"script.setAttribute('crossorigin', 'anonymous');"
"script.setAttribute('id', 'usrScript');"
"script.text = `import(\"/egret/js/assets-`+SENTRY_RELEASE.id+`.js\")"
".then((plugin) => {"
"for (let key in plugin) {"
"const o = plugin[key];"
"if(o!=null && typeof o===\"function\"){"
"if(o.hasOwnProperty(\"playerInfo\")) "
"App.user = o;"
"else if(o.hasOwnProperty(\"setDuotaiTypeState\")) "
"App.setting = o;"
"else if(o.prototype && Object.getOwnPropertyNames(o.prototype).length==1){"
"const str = o.toString();"
"if(str.startsWith(\"function(){return\")) "
"App.gameManager = o();"
"}"
"}"
"if(App.user && App.setting && App.gameManager) "
"break;"
"}"
"})"
".catch((error) => {"
"console.log('load module error', error);"
"cefApp.OnJSMessage('0|-3');"
"clearInterval(iv_usr);"
"});`;"
"console.log(script.text);"
"document.body.appendChild(script);"
"const iv_usr = setInterval("
"function(){"
"if(App.user && App.user.playerInfo && App.setting && App.BetManager && App.BetManager.tableBetDic){"
"const limit = [];"
"const limits = App.BetManager.tableBetDic.getAllValue();"
"for(const l of limits){"
"if(l.gameTypeId==2002 || l.gameTypeId==2001){"
"limit[0] = l.limit[0].min,"
"limit[1] = l.limit[0].max;"
"break;"
"}"
"}"
"if(limit.length>0){"
"App.setting.setDuotaiTypeState([2001,2002]);"
"App.setting.setModeType(3);" //路单模式
"App.setting.setCustomIconState(0);" //关闭视频
"App.setting.setGAME_AUDIO(0);" //关闭音频
"const pi = App.user.playerInfo;"
"console.log(pi.loginName, pi.balance, pi.currency, limit[0], limit[1]);"
"cefApp.GetUserInfo(pi.loginName, pi.balance, pi.currency, limit[0], limit[1]);"
"clearInterval(iv_usr);"
"}"
"}"
"}, 500);"
"}";
String msgJS_DB =
"if('undefined'==typeof handleNotify){"
"const pu = ['0', '00', '000', '0000', '00000', '000000', '0000000', '00000000'],"
"Iu = new Map();"
"class vu {"
"constructor(e) {"
"this._pointer = 0,"
"this._bitString = this.getBits(e);"
"};"
"getBits(e) {"
"const dc = atob(e);"
"const bits = [];"
"for (let i = 0; i < dc.length; i++) {"
"const e = dc.charCodeAt(i);"
"let a;"
"(Iu.has(e) ? (a = Iu.get(e)) : ((a = e.toString(2)), Iu.set(e, a)),"
"8 - a.length > 0 && bits.push(pu[8 - a.length - 1]),"
"bits.push(a));"
"}"
"return bits.join('');"
"};"
"getNextInteger(e) {"
"const end = this._pointer + e;"
"const t = parseInt(this._bitString.slice(this._pointer, end), 2);"
"return ((this._pointer = end), t);"
"}"
"};"
"function parseRoad(a) {"
"if (!a) return '';"
"const i = new vu(a);"
"i.getNextInteger(8);"
"let n = i.getNextInteger(8) * i.getNextInteger(8)," //row * col
"l = 0;"
"let o = '';"
"for (; n > 0; ) {"
"l = i.getNextInteger(1);"
"if (1 == l){"
"const d = i.getNextInteger(2);"
"o += d==0 ? 2 : d==2 ? 3 : 1;"
"i.getNextInteger(2);"
"}"
"else "
"i.getNextInteger(4);"
"n--;"
"}"
"return o;"
"};"
"const chgTableStatus = function(t){" //转换台桌状态
"return t==1 ? 11 "
": t==2 ? 1 "
": t==3 ? 2 "
": t==6 ? 12 "
": 0;"
"};"
"const chkGameType = function(e,t){" //是否百家乐
"const g = e.getGameTalbeInfo(t);"
"return g && (g.gameTypeId==2001 || g.gameTypeId==2002);"
"};"
//设置注码
"var pushChip = async function(tableId, bet, chip){"//bet 1=庄2=闲3=和
"const g = App.PresenterManager.presenterDic.dict.MultiplayPresenter.model.getGameTalbeInfo(tableId);"
"let res = -1;"
"await Promise.race(["
"App.BetManager.pushChip2({"
"'tableId': tableId," //台号
"'betAreaId': (bet+3000)," //betId: 3001庄 3002闲 3003和
"'value': chip," //注码
//////////////////////
//test
// "'betAreaId': 3012," 5818超级幸运七 3012幸运六
// "'value': 1,"
//
//////////////////////
"'isMultiplayBet': true," //多台
"'noFastBet': true," //非快速下注
"'roundId': g.roundId" //局号
"}),"
"new Promise((resolve, reject) => {" //超时处理(1秒)
"setTimeout(() => {"
"reject('超时');"
"}, 1000);"
"})"
"])"
".then(()=>{res = 0;})"
".catch((e)=>{"
"console.log(g.physicsTableNo, tableId, e.message);"
// "if(e.message.indexOf('超时')>=0) res = -1;"
// "else "
"if(e.message.indexOf('已下注')>=0) res = 4;"
"else if(e.message.indexOf('不足')>=0) res = 26;"
"else if(e.message.indexOf('最低限红')>=0) res = 10;"
"else if(e.message.indexOf('限额不满足')>=0) res = 11;"
"else res = 5;"
"});"
// "console.log('pushChip inside result:', res);"
"return res;"
"};"
//取消注码
"var cancelBet = function(tableId){"
"MultiplayConst.betStatus[tableId] = 0;"
"App.BetManager.cancelUnsureBet(tableId, {isMulti: 1});"
"App.BetManager.cancelUnsureBet(tableId);"
"};"
//确认下注
"var sureBet = function(tableId){"
"const g = App.PresenterManager.presenterDic.dict.MultiplayPresenter.model.getGameTalbeInfo(tableId);"
"const bi = App.BetManager.getUnsureBetInfo(tableId);"
"if (!bi || !bi.length) return;"
"const o = App.BetManager.getTimeAndZone(),"
"playerId = GameConst.URL_PARAMS.playerId;"
"const s = App.BetManager.getUserActions(tableId);"
"const d = {"
"tableId: tableId,"
"roundId: g.roundId,"
"playerId: playerId,"
"deviceId: GameConst.getDeviceID(),"
"deviceType: 15,"
"clientDeviceType: (GameConst.URL_PARAMS && GameConst.URL_PARAMS.params.deviceType) || 5,"
"betSource: 3,"
"betInfos: bi,"
"bettingMode: 2,"
"userActions: JSON.stringify(s),"
"timeZone: o.operateTime_zone,"
"dataTime: o.operateTime,"
"version: '4.0'"
"};"
"MultiplayConst.betStatus[tableId] = 1;"
"const u = App.SocketCommonUtils.getRequestDataVO(105, d, g.gameTypeId, tableId, playerId, 2);"
"App.Socket.send(u);"
"GameConst.isSendingBet = 1;"
"App.BetManager.saveUnsureBetInfo(tableId);"
"};"
"function handleNotify(e, t) {"
"const model = App.PresenterManager.presenterDic.dict.MultiplayPresenter.model;"
"if(t && t.res && t.res.tableId && !chkGameType(model,t.res.tableId)) "
"return;"
"sTimeout = 0;"
"switch (e) {"
"case 103: {"//NEW_BOOT
"const o = t.res;"
"const g = model.getGameTalbeInfo(o.tableId);"
"if(g){"
"App.BetManager.clearTimeoutByTableId(o.tableId);"
"const msg = '3|'+o.tableId+'|'+g.physicsTableNo+'||11|';"
"cefApp.OnJSMessage(msg);"
"}"
"break;"
"}"
"case 104: {"//NEW_ROUND
"const o = t.res;"
"const g = model.getGameTalbeInfo(o.tableId);"
"if(g){"
"App.BetManager.clearTimeoutByTableId(o.tableId);"
"const msg = '3|'+o.tableId+'|'+g.physicsTableNo+'|'+o.roundId+'|1|'+o.totalBetCountDown;"
"cefApp.OnJSMessage(msg);"
"}"
"break;"
"}"
"case 105: {"//BET 下注返回
"console.log(e, JSON.stringify(t));"
"const o = t.res;"
"let errCode = 0,"
"tableId = 0,"
"roundId = 0;"
"const bets=[0,0,0];"
"if(t.errorId){" //失败
"const r = JSON.parse(o);"
"errCode = parseInt(r.errorId);"
"const d = JSON.parse(r.data);"
"tableId = d.tableId;"
"const g = model.getGameTalbeInfo(tableId);"
"if(g) roundId = g.roundId;"
"if(r.errorData){"
"const ed = JSON.parse(r.errorData);"
"if(ed && ed[0] && ed[0]>=3001 && ed[0]<=3003) "
"bets[ed[0]-3001] = 1;"
"}"
"else cancelBet(tableId);"
"}"
"else{"
"tableId = o.tableId;"
"roundId = o.roundId;"
"o.betInfos.forEach((bi)=>{"
"if(bi.betResult) "
"bets[bi.betPointId-3001] += bi.betAmount;"
"});"
"cefApp.OnJSMessage('5|'+o.balance);"
"}"
"if(!roundId) roundId = g.roundId;"
"let msg='6|'+tableId+'|'+errCode+'|'+roundId+'|';"
"msg += bets[0]+'|'+bets[1]+'|'+bets[2];"
"cefApp.OnJSMessage(msg);"
"break;"
"}"
"case 106: {"//OPEN_CARD 开牌
// "console.log(e, JSON.stringify(t));"
"const o = t.res;"
"const cards = o.currentRoundExtInfos.sort((a,b)=>{"
"return a.cardIndex - b.cardIndex;"
"});"
"const card = ['',''];"
"for(const c of cards){"
"const i = c.cardOwner;"
"let n = Math.floor(c.cardNumber / 4) + 1;"
"n = n>=10 ? 0 : n;"
"if(card[i].length>0) "
"card[i]+=',';"
"card[i] += n;"
"};"
"cefApp.OnJSMessage('9|'+o.tableId+'|'+o.roundId+'|'+card[0]+'|'+card[1]);"
"break;"
"}"
"case 107: {"//SETTLEMENT 结算
"const o = t.res;"
"const g = model.getGameTalbeInfo(o.tableId);"
"if(g){"
"const card = ['',''];"
"if(!g.opendCardData){"
"const cards = o.currentRoundExtInfos.sort((a,b)=>{"
"return a.cardIndex - b.cardIndex;"
"});"
"for(const c of cards){"
"const i = c.cardOwner;"
"let n = Math.floor(c.cardNumber / 4) + 1;"
"n = n>=10 ? 0 : n;"
"if(card[i].length>0) "
"card[i]+=',';"
"card[i] += n;"
"};"
// "cefApp.OnJSMessage('9|'+o.tableId+'|'+o.roundId+'|'+card[0]+'|'+card[1]);"
"}"
"let wt=3;"
"if(o.activePoints.indexOf(3001)>-1) wt=1;"
"else if(o.activePoints.indexOf(3002)>-1) wt=2;"
"const msg = '3|'+o.tableId+'|'+g.physicsTableNo+'|'+o.roundId+'|0|'+wt"
"+'|'+card[0]+'|'+card[1];" //DB特殊处理
"cefApp.OnJSMessage(msg);"
"}"
"break"
"}"
// "case 112: {"//CHANGE_CARD 换牌
// "break;"
// "}"
"case 113: {"//JUMP_ROUND 本局取消
"console.log(e, JSON.stringify(t));"
"const o = t.res;"
"const g = model.getGameTalbeInfo(o.tableId);"
"if(g){"
"const msg = '3|'+o.tableId+'|'+g.physicsTableNo+'|'+o.roundId+'|12';"
// "const msg = '10|'+o.tableId+'|'+o.roundId;"
"cefApp.OnJSMessage(msg);"
"}"
"break;"
"}"
// "case 116: {" //ROAD_PAPER
// "break;"
// "}"
"case 148: {" //TABLE_STATUS_CHANGE //状态改变
"console.log(e, JSON.stringify(t));"
"const h = t.res;"
"if(h && h.gameTable && h.gameTable.tableId){"
"const g = model.getGameTalbeInfo(h.gameTable.tableId);"
"if(g && (h.gameTable.gameStatus==0"
"|| h.gameTable.gameStatus==1"
"|| h.gameTable.gameStatus==6)){"
"let s = chgTableStatus(h.gameTable.gameStatus);"
"cefApp.OnJSMessage('3|'+g.tableId+'|'+g.physicsTableNo+'||'+s);"
"}"
"}"
"break;"
"}"
"case 160: {"//STOP_BET 停止下注
"const o = t.res;"
"const g = model.getGameTalbeInfo(o.tableId);"
"if(g){"
"const msg = '3|'+o.tableId+'|'+g.physicsTableNo+'|'+o.roundId+'|2|';"
"cefApp.OnJSMessage(msg);"
"}"
"break;"
"}"
"case 161: {" //SINGLE_ROAD
"break;"
"}"
"case 200: {" //CLEAR_CARD
"break;"
"}"
"case 10071: {" //TABLE_ROAD
// "console.log(10071, JSON.stringify(t));"
"const m = t.res.roadPaperCacheMap;"
"for (let k in m) {"
"const o = m[k];"
"if(chkGameType(model, o.tableId)){"
"const g = model.getGameTalbeInfo(o.tableId);"
"if(g){ "
"const p = o.data.beatPlateRoad ? parseRoad(o.data.beatPlateRoad) : '';"
// "console.log('TABLE_ROAD',o.tableId,g.physicsTableNo, p);"
"if(p){"
"const msg = '2|'+o.tableId+'|'+g.physicsTableNo+'|'+p;"
"cefApp.OnJSMessage(msg);"
"}"
"}"
"}"
"}"
"break;"
"}"
"case 10002: {" //BALANCE_CHANGE
"console.log(e, JSON.stringify(t));"
"const o = t.res;"
"cefApp.OnJSMessage('5|'+o.balance);"
"break;"
"}"
"case 10016: {" //RUSH_LOGIN 账号在其他设备上登录
"cefApp.OnJSMessage('0|0');"
"break;"
"}"
// "case 10108: {" //ADD_DEL_TABLE
// "break;"
// "}"
"default: {"
"console.log(e, JSON.stringify(t));"
"break;"
"}"
"}"
"};"
"const iv_msg = setInterval("
"function(){"
"console.log('iv_msg');"
"const multi = App.PresenterManager.presenterDic.dict.MultiplayPresenter;"
"if(multi && multi.model && multi.model.gameListData && multi.model.gameListData.length>40){"
"clearInterval(iv_msg);"
"console.log('enter multi', multi.model.isEnter, GameConst.isEnterMulti);"
"cefApp.OnJSMessage('4|' + GameConst.hallMode);"
"let msg = '1|';"
"const games = multi.model.gameListData;"
"const ids = [];"
"const a = App.BetManager.tableBetDic.getValue(Object.keys(App.BetManager.tableBetDic.dict)[0]).chipAreas;"
"for(const g of games){"
"const p = g.roadPaper ? parseRoad(g.roadPaper.beatPlateRoad) : '';"
"let s = chgTableStatus(g.gameStatus);" //台桌状态
"msg += g.tableId+','+g.physicsTableNo+','+g.roundId+','+s+','+p+';';"
"ids.push(g.tableId);"
"const f = App.BetManager.tableBetDic.getValue(g.tableId);"
"if(!f){"
"App.BetManager.initTableBetByParam({"
"gameTypeId: g.gameTypeId,"
"tableId: g.tableId,"
"seat: 0,"
"limit: g.betPointLimit,"
"chipAreas: a,"
"playerPosition: null,"
"dealerPosition: null,"
"needRecoverByView: !0,"
"isCenter: !0,"
"})"
"};"
"}"
"console.log('Table num:', ids.length, JSON.stringify(ids));"
"console.log('tableBetDic len', Object.keys(App.BetManager.tableBetDic.dict).length);"
"cefApp.OnJSMessage(msg);"
"multi.oldHandleNotify = multi.handleNotify;"
"multi.handleNotify = function(e,t,a){"
// "console.log('multiHandleNotify', e);"
"if(e==102 || e=='SOCKET_CLOSE'){" //OUT_GAME=102
"console.log('reconnect socket');"
"multi.onSocketReconnect();"
"return;"
"}"
"else if(e==123){" //KICK_OUT_GAME
"setTimeout(function(){"
"console.log('reentry multi');"
"App.gameManager.sendEnterMultiPlay(32);"
"}, 90000);"
"return;"
"}"
"multi.oldHandleNotify.call(multi, e, t, a);"
"handleNotify(e,t);"
"};"
"App.gameManager.sendGetTableListRoad(ids);"
"}"
"}, 500);"
"var sTimeout=0, tmRetry=90;" //计时器
"var chkSockets = ()=>{"
"sTimeout++;"
"if(sTimeout>=tmRetry){" //确认网络异常,退出登录
"cefApp.OnJSMessage('0|3');"
"}"
"if(sTimeout>=10 && (sTimeout % 5)==0){" //10秒没有ss网络数据,尝试每5秒reconnect
"console.log(sTimeout + 's try reconnect!!!!');"
// "const multi = App.PresenterManager.presenterDic.dict.MultiplayPresenter;"
"if(App.Socket.status==0||App.Socket.status==3){" //Socket若断开则连接
"console.log('App.Socket connect: ', App.Socket.status);"
"App.Socket.connect();"
"}"
"else if(App.Socket.status==2 && (sTimeout % 20)==0){" //20秒一次手动重连
"console.log('App.Socket reconnect');"
"App.Socket.reconnect();"
"}"
"else{" //尝试重入多台
"console.log('multi reentry: ', App.Socket.status);"
"App.gameManager.sendEnterMultiPlay(32);"
"}"
"}"
"};"
"}";
String expireJS_DB =
"{"
"if(typeof itv_exp!='undefined' && itv_exp) clearInterval(itv_exp);"
"let uid=%d, extm=%d*1000;"
"if(!uid) extm=Date.now()+60000;"
"var itv_exp=setInterval((function exp(){"
"console.log('itv_exp of '+uid, extm);"
"if(Date.now()>extm){"
"App.Socket.close();"
"cefApp.OnJSMessage('0|-2');"
"};"
"return exp;"
"})(),120000);"
"}";