parent
34d1c820e3
commit
9421219f15
|
@ -309,7 +309,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
'step 1'
|
'step 1'
|
||||||
if(target.countCards('h')&&event.list.length){
|
if(target.countCards('h')&&event.list.length){
|
||||||
event.current=event.list.shift();
|
event.current=event.list.shift();
|
||||||
event.current.gainPlayerCard(target,true);
|
event.current.gainPlayerCard(target,true,'h');
|
||||||
target.line2([event.current,player]);
|
target.line2([event.current,player]);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -15312,7 +15312,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
yidian:'佚典',
|
yidian:'佚典',
|
||||||
yidian_info:'当你使用牌选择目标时,若弃牌堆中没有与此牌名称相同的牌,则你可以为此牌增加一个目标(无距离限制)。',
|
yidian_info:'当你使用牌选择目标时,若弃牌堆中没有与此牌名称相同的牌,则你可以为此牌增加一个目标(无距离限制)。',
|
||||||
xinlianji:'连计',
|
xinlianji:'连计',
|
||||||
xinlianji_info:'出牌阶段限一次,你可以弃置一张手牌,令其使用牌堆中的一张随机武器牌,然后选择一项:对你指定的一名角色使用【杀】,或令你将其装备区里的武器牌交给任意角色。',
|
xinlianji_info:'出牌阶段限一次,你可以弃置一张手牌,令一名角色使用牌堆中的一张随机武器牌。然后其选择一项:对你指定的一名角色使用一张【杀】,或令你将其装备区里的武器牌交给任意角色。',
|
||||||
xinmoucheng:'谋逞',
|
xinmoucheng:'谋逞',
|
||||||
xinmoucheng_info:'觉醒技,准备阶段,若你已经发动了3次以上的〖连计〗,则你失去〖连计〗并获得〖矜功〗。',
|
xinmoucheng_info:'觉醒技,准备阶段,若你已经发动了3次以上的〖连计〗,则你失去〖连计〗并获得〖矜功〗。',
|
||||||
xinjingong:'矜功',
|
xinjingong:'矜功',
|
||||||
|
|
|
@ -387,7 +387,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
moying2:{},
|
moying2:{},
|
||||||
juanhui:{
|
juanhui:{
|
||||||
audio:2,
|
audio:2,
|
||||||
charlotte:true,
|
|
||||||
trigger:{player:'phaseJieshuBegin'},
|
trigger:{player:'phaseJieshuBegin'},
|
||||||
direct:true,
|
direct:true,
|
||||||
content:function(){
|
content:function(){
|
||||||
|
@ -407,6 +406,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
juanhui2:{
|
juanhui2:{
|
||||||
|
charlotte:true,
|
||||||
mark:true,
|
mark:true,
|
||||||
intro:{
|
intro:{
|
||||||
markcount:function(storage,player){
|
markcount:function(storage,player){
|
||||||
|
@ -3143,9 +3143,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
silent:true,
|
silent:true,
|
||||||
firstDo:true,
|
firstDo:true,
|
||||||
filter:function(event,player){
|
filter:function(event,player){
|
||||||
if(!lib.skill[event.skill]) return false;
|
var info=lib.skill[event.skill];
|
||||||
|
if(!info) return false;
|
||||||
if(event.skill==player.storage.pingjian_temp) return true;
|
if(event.skill==player.storage.pingjian_temp) return true;
|
||||||
if(lib.skill[event.skill].sourceSkill==player.storage.pingjian_temp) return true;
|
if(info.sourceSkill==player.storage.pingjian_temp||info.group==player.storage.pingjian_temp) return true;
|
||||||
|
if(Array.isArray(info.group)&&info.group.contains(player.storage.pingjian_temp)) return true;
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
content:function(){
|
content:function(){
|
||||||
|
@ -5365,7 +5367,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
lisu:'李肃',
|
lisu:'李肃',
|
||||||
zhangwen:'张温',
|
zhangwen:'张温',
|
||||||
puyuan:'蒲元',
|
puyuan:'蒲元',
|
||||||
xushao:'许邵',
|
xushao:'许劭',
|
||||||
mangyachang:"忙牙长",
|
mangyachang:"忙牙长",
|
||||||
xugong:"许贡",
|
xugong:"许贡",
|
||||||
zhangchangpu:"张昌蒲",
|
zhangchangpu:"张昌蒲",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
window.noname_asset_list=[
|
window.noname_asset_list=[
|
||||||
'v1.9.105.1',
|
'v1.9.105.2',
|
||||||
'audio/background/aozhan_chaoming.mp3',
|
'audio/background/aozhan_chaoming.mp3',
|
||||||
'audio/background/aozhan_online.mp3',
|
'audio/background/aozhan_online.mp3',
|
||||||
'audio/background/aozhan_rewrite.mp3',
|
'audio/background/aozhan_rewrite.mp3',
|
||||||
|
@ -5217,7 +5217,7 @@ window.noname_skin_list={
|
||||||
key_nao:3,
|
key_nao:3,
|
||||||
key_shiki:4,
|
key_shiki:4,
|
||||||
key_yui:2,
|
key_yui:2,
|
||||||
key_yuri:3,
|
key_yuri:4,
|
||||||
key_yuzuru:2,
|
key_yuzuru:2,
|
||||||
sp_key_kanade:1,
|
sp_key_kanade:1,
|
||||||
key_kamome:1,
|
key_kamome:1,
|
||||||
|
|
1124
game/game.js
1124
game/game.js
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +1,3 @@
|
||||||
window.bannedKeyWords=[
|
window.bannedKeyWords=[
|
||||||
'ghs','直肠','性交','做爱','http','吃奶','骚逼','哈巴狗','美眉','癌','屁眼','艹','傻逼','操你','做鸡','奸','姦','华为','屄','狗子','屎','同性恋','肖战','鸡巴','精液','粪水','挂月亮中','贱骨头',
|
'ghs','直肠','性交','做爱','http','吃奶','骚逼','哈巴狗','美眉','癌','屁眼','艹','傻逼','操你','做鸡','奸','姦','华为','屄','狗子','屎','同性恋','肖战','鸡巴','精液','粪水','挂月亮中','贱骨头','吃屁',
|
||||||
];
|
];
|
735
game/server.js
735
game/server.js
|
@ -1,358 +1,377 @@
|
||||||
(function(){
|
(function(){
|
||||||
var WebSocketServer=require('ws').Server;
|
var WebSocketServer=require('ws').Server;
|
||||||
var wss=new WebSocketServer({port:8080});
|
var wss=new WebSocketServer({port:8080});
|
||||||
var bannedKeys=[];
|
var bannedKeys=[];
|
||||||
var bannedIps=[];
|
var bannedIps=[];
|
||||||
|
|
||||||
var rooms=[{},{},{},{},{},{}];
|
var rooms=[{},{},{},{},{},{},{},{}];
|
||||||
var events=[];
|
var systemEvent={
|
||||||
var clients={};
|
content:'公告内容',
|
||||||
var messages={
|
avatar:'key_yuri',
|
||||||
enter:function(index,nickname,avatar,config,mode){
|
nickname:'系统管理员',
|
||||||
this.nickname=nickname;
|
title:'系统公告',
|
||||||
this.avatar=avatar;
|
};
|
||||||
var room=rooms[index];
|
var events=[systemEvent];
|
||||||
if(!room){
|
var clients={};
|
||||||
index=0;
|
var bannedKeyWords=['ghs','直肠','性交','做爱','http','吃奶','骚逼','哈巴狗','美眉','癌','屁眼','艹','傻逼','操你','做鸡','奸','姦','华为','屄','狗子','屎','同性恋','肖战','鸡巴','精液','粪水','挂月亮中','贱骨头','吃屁'];
|
||||||
room=rooms[0];
|
var messages={
|
||||||
}
|
enter:function(index,nickname,avatar,config,mode){
|
||||||
this.room=room;
|
this.nickname=nickname;
|
||||||
delete this.status;
|
this.avatar=avatar;
|
||||||
if(room.owner){
|
var room=rooms[index];
|
||||||
if(room.servermode&&!room.owner._onconfig&&config&&mode){
|
if(!room){
|
||||||
room.owner.sendl('createroom',index,config,mode);
|
index=0;
|
||||||
room.owner._onconfig=this;
|
room=rooms[0];
|
||||||
room.owner.nickname=nickname;
|
}
|
||||||
room.owner.avatar=avatar;
|
this.room=room;
|
||||||
}
|
delete this.status;
|
||||||
else if(!room.config){
|
if(room.owner){
|
||||||
this.sendl('enterroomfailed');
|
if(room.servermode&&!room.owner._onconfig&&config&&mode){
|
||||||
}
|
room.owner.sendl('createroom',index,config,mode);
|
||||||
else{
|
room.owner._onconfig=this;
|
||||||
this.owner=room.owner;
|
room.owner.nickname=nickname;
|
||||||
this.owner.sendl('onconnection',this.wsid);
|
room.owner.avatar=avatar;
|
||||||
}
|
}
|
||||||
util.updaterooms();
|
else if(!room.config){
|
||||||
}
|
this.sendl('enterroomfailed');
|
||||||
else{
|
}
|
||||||
room.owner=this;
|
else{
|
||||||
this.sendl('createroom',index);
|
this.owner=room.owner;
|
||||||
}
|
this.owner.sendl('onconnection',this.wsid);
|
||||||
},
|
}
|
||||||
changeAvatar:function(nickname,avatar){
|
util.updaterooms();
|
||||||
this.nickname=nickname;
|
}
|
||||||
this.avatar=avatar;
|
else{
|
||||||
util.updateclients();
|
room.owner=this;
|
||||||
},
|
this.sendl('createroom',index);
|
||||||
server:function(cfg){
|
}
|
||||||
if(cfg){
|
},
|
||||||
this.servermode=true;
|
changeAvatar:function(nickname,avatar){
|
||||||
var room=rooms[cfg[0]];
|
this.nickname=nickname;
|
||||||
if(!room||room.owner){
|
this.avatar=avatar;
|
||||||
this.sendl('reloadroom',true);
|
util.updateclients();
|
||||||
}
|
},
|
||||||
else{
|
server:function(cfg){
|
||||||
room.owner=this;
|
if(cfg){
|
||||||
this.room=room;
|
this.servermode=true;
|
||||||
this.nickname=cfg[1];
|
var room=rooms[cfg[0]];
|
||||||
this.avatar=cfg[2];
|
if(!room||room.owner){
|
||||||
this.sendl('createroom',cfg[0],{},'auto')
|
this.sendl('reloadroom',true);
|
||||||
}
|
}
|
||||||
}
|
else{
|
||||||
else{
|
room.owner=this;
|
||||||
for(var i=0;i<rooms.length;i++){
|
this.room=room;
|
||||||
if(!rooms[i].owner){
|
this.nickname=cfg[1];
|
||||||
rooms[i].owner=this;
|
this.avatar=cfg[2];
|
||||||
rooms[i].servermode=true;
|
this.sendl('createroom',cfg[0],{},'auto')
|
||||||
this.room=rooms[i];
|
}
|
||||||
this.servermode=true;
|
}
|
||||||
break;
|
else{
|
||||||
}
|
for(var i=0;i<rooms.length;i++){
|
||||||
}
|
if(!rooms[i].owner){
|
||||||
util.updaterooms();
|
rooms[i].owner=this;
|
||||||
}
|
rooms[i].servermode=true;
|
||||||
},
|
this.room=rooms[i];
|
||||||
key:function(id){
|
this.servermode=true;
|
||||||
clearTimeout(this.keyCheck);
|
break;
|
||||||
delete this.keyCheck;
|
}
|
||||||
if(bannedKeys.indexOf(id)!=-1){
|
}
|
||||||
bannedIps.push(this._socket.remoteAddress);
|
util.updaterooms();
|
||||||
console.log(id, this._socket.remoteAddress);
|
}
|
||||||
this.close();
|
},
|
||||||
return;
|
key:function(id){
|
||||||
}
|
this.onlineKey=id;
|
||||||
},
|
clearTimeout(this.keyCheck);
|
||||||
events:function(cfg,id,type){
|
delete this.keyCheck;
|
||||||
if(bannedKeys.indexOf(id)!=-1){
|
if(typeof id!='string'||bannedKeys.indexOf(id)!=-1){
|
||||||
bannedIps.push(this._socket.remoteAddress);
|
bannedIps.push(this._socket.remoteAddress);
|
||||||
console.log(id, this._socket.remoteAddress);
|
console.log(id, this._socket.remoteAddress);
|
||||||
this.close();
|
this.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var changed=false;
|
},
|
||||||
var time=(new Date()).getTime();
|
events:function(cfg,id,type){
|
||||||
if(cfg&&id){
|
if(bannedKeys.indexOf(id)!=-1||typeof id!='string'){
|
||||||
if(typeof cfg=='string'){
|
bannedIps.push(this._socket.remoteAddress);
|
||||||
for(var i=0;i<events.length;i++){
|
console.log(id, this._socket.remoteAddress);
|
||||||
if(events[i].id==cfg){
|
this.close();
|
||||||
if(type=='join'){
|
return;
|
||||||
if(events[i].members.indexOf(id)==-1){
|
}
|
||||||
events[i].members.push(id);
|
var changed=false;
|
||||||
}
|
var time=(new Date()).getTime();
|
||||||
changed=true;
|
if(cfg&&id){
|
||||||
}
|
if(typeof cfg=='string'){
|
||||||
else if(type=='leave'){
|
for(var i=0;i<events.length;i++){
|
||||||
var index=events[i].members.indexOf(id);
|
if(events[i].id==cfg){
|
||||||
if(index!=-1){
|
if(type=='join'){
|
||||||
events[i].members.splice(index,1);
|
if(events[i].members.indexOf(id)==-1){
|
||||||
if(events[i].members.length==0){
|
events[i].members.push(id);
|
||||||
events.splice(i--,1);
|
}
|
||||||
}
|
changed=true;
|
||||||
}
|
}
|
||||||
changed=true;
|
else if(type=='leave'){
|
||||||
}
|
var index=events[i].members.indexOf(id);
|
||||||
}
|
if(index!=-1){
|
||||||
}
|
events[i].members.splice(index,1);
|
||||||
}
|
if(events[i].members.length==0){
|
||||||
else if(cfg.hasOwnProperty('utc')&&
|
events.splice(i--,1);
|
||||||
cfg.hasOwnProperty('day')&&
|
}
|
||||||
cfg.hasOwnProperty('hour')&&
|
}
|
||||||
cfg.hasOwnProperty('content')){
|
changed=true;
|
||||||
if(events.length>=20){
|
}
|
||||||
this.sendl('eventsdenied','total');
|
}
|
||||||
}
|
}
|
||||||
else if(cfg.utc<=time){
|
}
|
||||||
this.sendl('eventsdenied','time');
|
else if(cfg.hasOwnProperty('utc')&&
|
||||||
}
|
cfg.hasOwnProperty('day')&&
|
||||||
else{
|
cfg.hasOwnProperty('hour')&&
|
||||||
cfg.nickname=cfg.nickname||'无名玩家';
|
cfg.hasOwnProperty('content')){
|
||||||
cfg.avatar=cfg.nickname||'caocao';
|
if(events.length>=20){
|
||||||
cfg.creator=id;
|
this.sendl('eventsdenied','total');
|
||||||
cfg.id=util.getid();
|
}
|
||||||
cfg.members=[id];
|
else if(cfg.utc<=time){
|
||||||
events.unshift(cfg);
|
this.sendl('eventsdenied','time');
|
||||||
changed=true;
|
}
|
||||||
}
|
else if(util.isBanned(cfg.content)){
|
||||||
}
|
this.sendl('eventsdenied','ban');
|
||||||
}
|
}
|
||||||
if(changed){
|
else{
|
||||||
util.updateevents();
|
cfg.nickname=cfg.nickname||'无名玩家';
|
||||||
}
|
cfg.avatar=cfg.nickname||'caocao';
|
||||||
},
|
cfg.creator=id;
|
||||||
config:function(config){
|
cfg.id=util.getid();
|
||||||
var room=this.room;
|
cfg.members=[id];
|
||||||
if(room&&room.owner==this){
|
events.splice(0,1);
|
||||||
if(room.servermode){
|
events.unshift(cfg);
|
||||||
room.servermode=false;
|
events.unshift(systemEvent);
|
||||||
if(this._onconfig){
|
changed=true;
|
||||||
if(clients[this._onconfig.wsid]){
|
}
|
||||||
this._onconfig.owner=this;
|
}
|
||||||
this.sendl('onconnection',this._onconfig.wsid);
|
}
|
||||||
}
|
if(changed){
|
||||||
delete this._onconfig;
|
util.updateevents();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
room.config=config;
|
config:function(config){
|
||||||
}
|
var room=this.room;
|
||||||
util.updaterooms();
|
if(room&&room.owner==this){
|
||||||
},
|
if(room.servermode){
|
||||||
status:function(str){
|
room.servermode=false;
|
||||||
if(typeof str=='string'){
|
if(this._onconfig){
|
||||||
this.status=str;
|
if(clients[this._onconfig.wsid]){
|
||||||
}
|
this._onconfig.owner=this;
|
||||||
else{
|
this.sendl('onconnection',this._onconfig.wsid);
|
||||||
delete this.status;
|
}
|
||||||
}
|
delete this._onconfig;
|
||||||
util.updateclients();
|
}
|
||||||
},
|
}
|
||||||
send:function(id,message){
|
room.config=config;
|
||||||
if(clients[id]&&clients[id].owner==this){
|
}
|
||||||
try{
|
util.updaterooms();
|
||||||
clients[id].send(message);
|
},
|
||||||
}
|
status:function(str){
|
||||||
catch(e){
|
if(typeof str=='string'){
|
||||||
clients[id].close();
|
this.status=str;
|
||||||
}
|
}
|
||||||
}
|
else{
|
||||||
},
|
delete this.status;
|
||||||
close:function(id){
|
}
|
||||||
if(clients[id]&&clients[id].owner==this){
|
util.updateclients();
|
||||||
clients[id].close();
|
},
|
||||||
}
|
send:function(id,message){
|
||||||
},
|
if(clients[id]&&clients[id].owner==this){
|
||||||
};
|
try{
|
||||||
var util={
|
clients[id].send(message);
|
||||||
sendl:function(){
|
}
|
||||||
var args=[];
|
catch(e){
|
||||||
for(var i=0;i<arguments.length;i++){
|
clients[id].close();
|
||||||
args.push(arguments[i]);
|
}
|
||||||
}
|
}
|
||||||
try{
|
},
|
||||||
this.send(JSON.stringify(args));
|
close:function(id){
|
||||||
}
|
if(clients[id]&&clients[id].owner==this){
|
||||||
catch(e){
|
clients[id].close();
|
||||||
this.close();
|
}
|
||||||
}
|
},
|
||||||
},
|
};
|
||||||
getid:function(){
|
var util={
|
||||||
return (Math.floor(1000000000+9000000000*Math.random())).toString();
|
isBanned:function(str){
|
||||||
},
|
for(var i of bannedKeyWords){
|
||||||
getroomlist:function(){
|
if(str.indexOf(i)!=-1) return true;
|
||||||
var roomlist=[];
|
}
|
||||||
for(var i=0;i<rooms.length;i++){
|
return false;
|
||||||
rooms[i]._num=0;
|
},
|
||||||
}
|
sendl:function(){
|
||||||
for(var i in clients){
|
var args=[];
|
||||||
if(clients[i].room&&!clients[i].servermode){
|
for(var i=0;i<arguments.length;i++){
|
||||||
clients[i].room._num++;
|
args.push(arguments[i]);
|
||||||
}
|
}
|
||||||
}
|
try{
|
||||||
for(var i=0;i<rooms.length;i++){
|
this.send(JSON.stringify(args));
|
||||||
if(rooms[i].servermode){
|
}
|
||||||
roomlist[i]='server';
|
catch(e){
|
||||||
}
|
this.close();
|
||||||
else if(rooms[i].owner&&rooms[i].config){
|
}
|
||||||
if(rooms[i]._num==0){
|
},
|
||||||
rooms[i].owner.sendl('reloadroom');
|
getid:function(){
|
||||||
}
|
return (Math.floor(1000000000+9000000000*Math.random())).toString();
|
||||||
roomlist[i]=[rooms[i].owner.nickname,rooms[i].owner.avatar,
|
},
|
||||||
rooms[i].config,rooms[i]._num];
|
getroomlist:function(){
|
||||||
}
|
var roomlist=[];
|
||||||
else{
|
for(var i=0;i<rooms.length;i++){
|
||||||
roomlist[i]=null;
|
rooms[i]._num=0;
|
||||||
}
|
}
|
||||||
delete rooms[i]._num;
|
for(var i in clients){
|
||||||
}
|
if(clients[i].room&&!clients[i].servermode){
|
||||||
return roomlist;
|
clients[i].room._num++;
|
||||||
},
|
}
|
||||||
getclientlist:function(){
|
}
|
||||||
var clientlist=[];
|
for(var i=0;i<rooms.length;i++){
|
||||||
for(var i in clients){
|
if(rooms[i].servermode){
|
||||||
clientlist.push([clients[i].nickname,clients[i].avatar,!clients[i].room,clients[i].status,clients[i].wsid]);
|
roomlist[i]='server';
|
||||||
}
|
}
|
||||||
return clientlist;
|
else if(rooms[i].owner&&rooms[i].config){
|
||||||
},
|
if(rooms[i]._num==0){
|
||||||
updaterooms:function(){
|
rooms[i].owner.sendl('reloadroom');
|
||||||
var roomlist=util.getroomlist();
|
}
|
||||||
var clientlist=util.getclientlist();
|
roomlist[i]=[rooms[i].owner.nickname,rooms[i].owner.avatar,
|
||||||
for(var i in clients){
|
rooms[i].config,rooms[i]._num];
|
||||||
if(!clients[i].room){
|
}
|
||||||
clients[i].sendl('updaterooms',roomlist,clientlist);
|
else{
|
||||||
}
|
roomlist[i]=null;
|
||||||
}
|
}
|
||||||
},
|
delete rooms[i]._num;
|
||||||
updateclients:function(){
|
}
|
||||||
var clientlist=util.getclientlist();
|
return roomlist;
|
||||||
for(var i in clients){
|
},
|
||||||
if(!clients[i].room){
|
getclientlist:function(){
|
||||||
clients[i].sendl('updateclients',clientlist);
|
var clientlist=[];
|
||||||
}
|
for(var i in clients){
|
||||||
}
|
clientlist.push([clients[i].nickname,clients[i].avatar,!clients[i].room,clients[i].status,clients[i].wsid,clients[i].onlineKey]);
|
||||||
},
|
}
|
||||||
checkevents:function(){
|
return clientlist;
|
||||||
if(events.length){
|
},
|
||||||
var time=(new Date()).getTime();
|
updaterooms:function(){
|
||||||
for(var i=0;i<events.length;i++){
|
var roomlist=util.getroomlist();
|
||||||
if(events[i].utc<=time){
|
var clientlist=util.getclientlist();
|
||||||
events.splice(i--,1);
|
for(var i in clients){
|
||||||
}
|
if(!clients[i].room){
|
||||||
}
|
clients[i].sendl('updaterooms',roomlist,clientlist);
|
||||||
}
|
}
|
||||||
return events;
|
}
|
||||||
},
|
},
|
||||||
updateevents:function(){
|
updateclients:function(){
|
||||||
util.checkevents();
|
var clientlist=util.getclientlist();
|
||||||
for(var i in clients){
|
for(var i in clients){
|
||||||
if(!clients[i].room){
|
if(!clients[i].room){
|
||||||
clients[i].sendl('updateevents',events);
|
clients[i].sendl('updateclients',clientlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
checkevents:function(){
|
||||||
wss.on('connection',function(ws){
|
if(events.length){
|
||||||
ws.sendl=util.sendl;
|
var time=(new Date()).getTime();
|
||||||
if(bannedIps.indexOf(ws._socket.remoteAddress)!=-1){
|
for(var i=0;i<events.length;i++){
|
||||||
ws.sendl('denied','banned');
|
if(events[i].utc<=time){
|
||||||
setTimeout(function(){
|
events.splice(i--,1);
|
||||||
ws.close();
|
}
|
||||||
},500);
|
}
|
||||||
return;
|
}
|
||||||
}
|
return events;
|
||||||
ws.keyCheck=setTimeout(function(){
|
},
|
||||||
ws.sendl('denied','key');
|
updateevents:function(){
|
||||||
setTimeout(function(){
|
util.checkevents();
|
||||||
ws.close();
|
for(var i in clients){
|
||||||
},500);
|
if(!clients[i].room){
|
||||||
},2000);
|
clients[i].sendl('updateevents',events);
|
||||||
ws.wsid=util.getid();
|
}
|
||||||
clients[ws.wsid]=ws;
|
}
|
||||||
ws.sendl('roomlist',util.getroomlist(),util.checkevents(),util.getclientlist(ws),ws.wsid);
|
}
|
||||||
ws.heartbeat=setInterval(function(){
|
};
|
||||||
if(ws.beat){
|
wss.on('connection',function(ws){
|
||||||
ws.close();
|
ws.sendl=util.sendl;
|
||||||
clearInterval(ws.heartbeat);
|
if(bannedIps.indexOf(ws._socket.remoteAddress)!=-1){
|
||||||
}
|
ws.sendl('denied','banned');
|
||||||
else{
|
setTimeout(function(){
|
||||||
ws.beat=true;
|
ws.close();
|
||||||
try{
|
},500);
|
||||||
ws.send('heartbeat');
|
return;
|
||||||
}
|
}
|
||||||
catch(e){
|
ws.keyCheck=setTimeout(function(){
|
||||||
ws.close();
|
ws.sendl('denied','key');
|
||||||
}
|
setTimeout(function(){
|
||||||
}
|
ws.close();
|
||||||
},60000);
|
},500);
|
||||||
ws.on('message',function(message){
|
},2000);
|
||||||
if(!clients[this.wsid]) return;
|
ws.wsid=util.getid();
|
||||||
if(message=='heartbeat'){
|
clients[ws.wsid]=ws;
|
||||||
this.beat=false;
|
ws.sendl('roomlist',util.getroomlist(),util.checkevents(),util.getclientlist(ws),ws.wsid);
|
||||||
}
|
ws.heartbeat=setInterval(function(){
|
||||||
else if(this.owner){
|
if(ws.beat){
|
||||||
this.owner.sendl('onmessage',this.wsid,message);
|
ws.close();
|
||||||
}
|
clearInterval(ws.heartbeat);
|
||||||
else{
|
}
|
||||||
var arr;
|
else{
|
||||||
try{
|
ws.beat=true;
|
||||||
arr=JSON.parse(message);
|
try{
|
||||||
if(!Array.isArray(arr)){
|
ws.send('heartbeat');
|
||||||
throw('err');
|
}
|
||||||
}
|
catch(e){
|
||||||
}
|
ws.close();
|
||||||
catch(e){
|
}
|
||||||
this.sendl('denied','banned');
|
}
|
||||||
return;
|
},60000);
|
||||||
}
|
ws.on('message',function(message){
|
||||||
if(arr.shift()=='server'){
|
if(!clients[this.wsid]) return;
|
||||||
var type=arr.shift();
|
if(message=='heartbeat'){
|
||||||
if(messages[type]){
|
this.beat=false;
|
||||||
messages[type].apply(this,arr);
|
}
|
||||||
}
|
else if(this.owner){
|
||||||
}
|
this.owner.sendl('onmessage',this.wsid,message);
|
||||||
}
|
}
|
||||||
});
|
else{
|
||||||
ws.on('close',function(){
|
var arr;
|
||||||
for(var i=0;i<rooms.length;i++){
|
try{
|
||||||
if(rooms[i].owner==this){
|
arr=JSON.parse(message);
|
||||||
rooms[i].owner=null;
|
if(!Array.isArray(arr)){
|
||||||
rooms[i].config=null;
|
throw('err');
|
||||||
rooms[i].servermode=false;
|
}
|
||||||
for(var j in clients){
|
}
|
||||||
if(clients[j].room==rooms[i]&&clients[j]!=this){
|
catch(e){
|
||||||
clients[j].sendl('selfclose');
|
this.sendl('denied','banned');
|
||||||
// clients[j].close();
|
return;
|
||||||
// delete clients[j];
|
}
|
||||||
}
|
if(arr.shift()=='server'){
|
||||||
}
|
var type=arr.shift();
|
||||||
}
|
if(messages[type]){
|
||||||
}
|
messages[type].apply(this,arr);
|
||||||
if(clients[this.wsid]){
|
}
|
||||||
if(this.owner){
|
}
|
||||||
this.owner.sendl('onclose',this.wsid);
|
}
|
||||||
}
|
});
|
||||||
delete clients[this.wsid];
|
ws.on('close',function(){
|
||||||
}
|
for(var i=0;i<rooms.length;i++){
|
||||||
if(this.room) util.updaterooms();
|
if(rooms[i].owner==this){
|
||||||
else util.updateclients();
|
rooms[i].owner=null;
|
||||||
});
|
rooms[i].config=null;
|
||||||
});
|
rooms[i].servermode=false;
|
||||||
}());
|
for(var j in clients){
|
||||||
|
if(clients[j].room==rooms[i]&&clients[j]!=this){
|
||||||
|
clients[j].sendl('selfclose');
|
||||||
|
// clients[j].close();
|
||||||
|
// delete clients[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(clients[this.wsid]){
|
||||||
|
if(this.owner){
|
||||||
|
this.owner.sendl('onclose',this.wsid);
|
||||||
|
}
|
||||||
|
delete clients[this.wsid];
|
||||||
|
}
|
||||||
|
if(this.room) util.updaterooms();
|
||||||
|
else util.updateclients();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
window.noname_update={
|
window.noname_update={
|
||||||
version:'1.9.105.1',
|
version:'1.9.105.2',
|
||||||
update:'1.9.105',
|
update:'1.9.105.1',
|
||||||
changeLog:[
|
changeLog:[
|
||||||
'松下护騨',
|
'庆祝《成神之日》开播!联机服务器全新升级!',
|
||||||
'bug修复',
|
'bug修复',
|
||||||
|
|
||||||
],
|
],
|
||||||
|
@ -10,7 +10,7 @@ window.noname_update={
|
||||||
//'card/extra.js',
|
//'card/extra.js',
|
||||||
//'card/huanlekapai.js',
|
//'card/huanlekapai.js',
|
||||||
//'card/sp.js',
|
//'card/sp.js',
|
||||||
'card/standard.js',
|
//'card/standard.js',
|
||||||
//'card/swd.js',
|
//'card/swd.js',
|
||||||
//'card/mtg.js',
|
//'card/mtg.js',
|
||||||
//'card/gujian.js',
|
//'card/gujian.js',
|
||||||
|
@ -19,17 +19,17 @@ window.noname_update={
|
||||||
//'card/yunchou.js',
|
//'card/yunchou.js',
|
||||||
//'card/zhenfa.js',
|
//'card/zhenfa.js',
|
||||||
//'card/zhulu.js',
|
//'card/zhulu.js',
|
||||||
'character/diy.js',
|
//'character/diy.js',
|
||||||
//'character/extra.js',
|
//'character/extra.js',
|
||||||
//'character/hearth.js',
|
//'character/hearth.js',
|
||||||
//'character/gujian.js',
|
//'character/gujian.js',
|
||||||
//'character/gwent.js',
|
//'character/gwent.js',
|
||||||
//'character/hearth.js',
|
//'character/hearth.js',
|
||||||
'character/mobile.js',
|
//'character/mobile.js',
|
||||||
//'character/mtg.js',
|
//'character/mtg.js',
|
||||||
//'character/old.js',
|
//'character/old.js',
|
||||||
'character/refresh.js',
|
//'character/refresh.js',
|
||||||
'character/shenhua.js',
|
//'character/shenhua.js',
|
||||||
'character/sp.js',
|
'character/sp.js',
|
||||||
'character/sp2.js',
|
'character/sp2.js',
|
||||||
//'character/tw.js',
|
//'character/tw.js',
|
||||||
|
@ -37,25 +37,26 @@ window.noname_update={
|
||||||
//'character/swd.js',
|
//'character/swd.js',
|
||||||
//'character/xianjian.js',
|
//'character/xianjian.js',
|
||||||
//'character/xinghuoliaoyuan.js',
|
//'character/xinghuoliaoyuan.js',
|
||||||
'character/yijiang.js',
|
///'character/yijiang.js',
|
||||||
//'character/yxs.js',
|
//'character/yxs.js',
|
||||||
//'extension/boss/extension.js',
|
//'extension/boss/extension.js',
|
||||||
//'layout/default/layout.css',
|
//'layout/default/layout.css',
|
||||||
//'layout/nova/layout.css',
|
//'layout/nova/layout.css',
|
||||||
//'mode/identity.js',
|
//'mode/identity.js',
|
||||||
//'mode/doudizhu.js',
|
//'mode/doudizhu.js',
|
||||||
'mode/guozhan.js',
|
//'mode/guozhan.js',
|
||||||
//'mode/chess.js',
|
//'mode/chess.js',
|
||||||
//'mode/tafang.js',
|
//'mode/tafang.js',
|
||||||
//'mode/single.js',
|
//'mode/single.js',
|
||||||
//'mode/stone.js',
|
//'mode/stone.js',
|
||||||
//'mode/brawl.js',
|
//'mode/brawl.js',
|
||||||
//'mode/versus.js',
|
//'mode/versus.js',
|
||||||
'mode/boss.js',
|
//'mode/boss.js',
|
||||||
'game/game.js',
|
'game/game.js',
|
||||||
'game/keyWords.js',
|
'game/keyWords.js',
|
||||||
|
'game/server.js',
|
||||||
//'game/NoSleep.js',
|
//'game/NoSleep.js',
|
||||||
'game/config.js',
|
//'game/config.js',
|
||||||
//'game/package.js',
|
//'game/package.js',
|
||||||
//'game/asset.js',
|
//'game/asset.js',
|
||||||
//'game/source.js',
|
//'game/source.js',
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
Loading…
Reference in New Issue