online
This commit is contained in:
parent
6feeb753df
commit
116f63b5ce
|
@ -1420,19 +1420,27 @@ card.standard={
|
||||||
state:state,
|
state:state,
|
||||||
ai1:function(){
|
ai1:function(){
|
||||||
if(isJudge){
|
if(isJudge){
|
||||||
var info=lib.card[card.viewAs||card.name];
|
var name=card.viewAs||card.name;
|
||||||
|
var info=lib.card[name];
|
||||||
if(info&&info.ai&&info.ai.wuxie){
|
if(info&&info.ai&&info.ai.wuxie){
|
||||||
var aiii=info.ai.wuxie(source,card,source,_status.event.player,state);
|
var aiii=info.ai.wuxie(source,card,source,_status.event.player,state);
|
||||||
if(typeof aiii=='number') return aiii;
|
if(typeof aiii=='number') return aiii;
|
||||||
}
|
}
|
||||||
if(Math.abs(ai.get.attitude(_status.event.player,source))<3) return 0;
|
if(Math.abs(ai.get.attitude(_status.event.player,source))<3) return 0;
|
||||||
if(source.skills.contains('guanxing')) return 0;
|
if(source.skills.contains('guanxing')) return 0;
|
||||||
if(card.name!='lebu'&&card.name!='bingliang'){
|
if(name!='lebu'&&name!='bingliang'){
|
||||||
if(source!=_status.event.player){
|
if(source!=_status.event.player){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var eff=ai.get.effect(source,card,source,source);
|
var card2;
|
||||||
|
if(name!=card.name){
|
||||||
|
card2={name:name};
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
card2=card;
|
||||||
|
}
|
||||||
|
var eff=ai.get.effect(source,card2,source,source);
|
||||||
if(eff>=0) return 0;
|
if(eff>=0) return 0;
|
||||||
return state*ai.get.attitude(_status.event.player,source);
|
return state*ai.get.attitude(_status.event.player,source);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1727,7 +1727,7 @@ character.sp={
|
||||||
trigger:{global:'phaseEnd'},
|
trigger:{global:'phaseEnd'},
|
||||||
direct:true,
|
direct:true,
|
||||||
filter:function(event,player){
|
filter:function(event,player){
|
||||||
return player.storage.tunchu&&player.storage.tunchu.length>0&&event.player.num('h')==0;
|
return player.storage.tunchu&&player.storage.tunchu.length>0&&event.player.num('h')==0&&event.player.isAlive();
|
||||||
},
|
},
|
||||||
content:function(){
|
content:function(){
|
||||||
'step 0'
|
'step 0'
|
||||||
|
|
225
game/game.js
225
game/game.js
|
@ -3875,7 +3875,7 @@
|
||||||
connection:function(ws){
|
connection:function(ws){
|
||||||
var client={
|
var client={
|
||||||
ws:ws,
|
ws:ws,
|
||||||
id:get.id(),
|
id:ws.wsid||get.id(),
|
||||||
closed:false
|
closed:false
|
||||||
};
|
};
|
||||||
lib.node.clients.push(client);
|
lib.node.clients.push(client);
|
||||||
|
@ -6967,6 +6967,46 @@
|
||||||
this.node.name.innerHTML='';
|
this.node.name.innerHTML='';
|
||||||
delete this.nickname;
|
delete this.nickname;
|
||||||
delete this.avatar;
|
delete this.avatar;
|
||||||
|
},
|
||||||
|
initRoom:function(info,info2){
|
||||||
|
if(!info){
|
||||||
|
this.initOL('空房间',info2);
|
||||||
|
this.node.hp.innerHTML='';
|
||||||
|
if(this.node.gaming){
|
||||||
|
this.node.gaming.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var config=info[2];
|
||||||
|
this.initOL(get.cnNumber(parseInt(config.number))+'人'+get.translation(config.mode),info[1]);
|
||||||
|
if(!this.node.gaming){
|
||||||
|
this.node.gaming=ui.create.div('.gaming','游戏中',this);
|
||||||
|
this.node.gaming.dataset.nature='fire';
|
||||||
|
}
|
||||||
|
if(config.gameStarted){
|
||||||
|
this.node.gaming.show();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.node.gaming.hide();
|
||||||
|
}
|
||||||
|
this.setNickname(info[0]);
|
||||||
|
this.maxHp=parseInt(config.number);
|
||||||
|
this.hp=info[3];
|
||||||
|
this.update();
|
||||||
|
if(this.hp==this.maxHp){
|
||||||
|
this.roomfull=true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.roomfull=false;
|
||||||
|
}
|
||||||
|
if(config.gameStarted&&!config.observe){
|
||||||
|
this.roomgaming=true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.roomgaming=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
uninit:function(){
|
uninit:function(){
|
||||||
this.node.avatar.hide();
|
this.node.avatar.hide();
|
||||||
|
@ -7163,7 +7203,10 @@
|
||||||
hp.classList.remove('long');
|
hp.classList.remove('long');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.hp==0){
|
if(hp.classList.contains('room')){
|
||||||
|
hp.dataset.condition='high';
|
||||||
|
}
|
||||||
|
else if(this.hp==0){
|
||||||
hp.dataset.condition='';
|
hp.dataset.condition='';
|
||||||
}
|
}
|
||||||
else if(this.hp>Math.round(this.maxHp/2)||this.hp===this.maxHp){
|
else if(this.hp>Math.round(this.maxHp/2)||this.hp===this.maxHp){
|
||||||
|
@ -11087,6 +11130,17 @@
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
nodews:{
|
||||||
|
send:function(message){
|
||||||
|
game.send('server','send',this.wsid,message);
|
||||||
|
},
|
||||||
|
on:function(type,func){
|
||||||
|
this['on'+type]=func;
|
||||||
|
},
|
||||||
|
close:function(){
|
||||||
|
game.send('server','close',this.wsid);
|
||||||
|
}
|
||||||
|
},
|
||||||
ws:{
|
ws:{
|
||||||
onopen:function(){
|
onopen:function(){
|
||||||
if(_status.connectCallback){
|
if(_status.connectCallback){
|
||||||
|
@ -11129,7 +11183,7 @@
|
||||||
_status.connectCallback(false);
|
_status.connectCallback(false);
|
||||||
delete _status.connectCallback;
|
delete _status.connectCallback;
|
||||||
}
|
}
|
||||||
if(game.online){
|
if(game.online||game.onlineroom){
|
||||||
localStorage.setItem(lib.configprefix+'directstart',true);
|
localStorage.setItem(lib.configprefix+'directstart',true);
|
||||||
game.reload();
|
game.reload();
|
||||||
}
|
}
|
||||||
|
@ -11479,11 +11533,12 @@
|
||||||
else if(player.isOnline()||(_status.connectMode&&player==game.me)||player.hasSkillTag('save',true)||player.num('h','tao')||player.num('h','spell_zhiliaoshui')||
|
else if(player.isOnline()||(_status.connectMode&&player==game.me)||player.hasSkillTag('save',true)||player.num('h','tao')||player.num('h','spell_zhiliaoshui')||
|
||||||
(player==event.dying&&(player.num('h','jiu')||player.num('h','hufu')||player.num('h','tianxianjiu')))){
|
(player==event.dying&&(player.num('h','jiu')||player.num('h','hufu')||player.num('h','tianxianjiu')))){
|
||||||
player.chooseToUse({
|
player.chooseToUse({
|
||||||
filterCard:function(card,player){
|
filterCard:function(card,player,event){
|
||||||
|
event=event||_status.event;
|
||||||
var mod=game.checkMod(card,player,'unchanged','cardSavable',player.get('s'));
|
var mod=game.checkMod(card,player,'unchanged','cardSavable',player.get('s'));
|
||||||
if(mod!='unchanged') return mod;
|
if(mod!='unchanged') return mod;
|
||||||
var savable=get.info(card).savable;
|
var savable=get.info(card).savable;
|
||||||
if(typeof savable=='function') savable=savable(card,player,_status.event.dying);
|
if(typeof savable=='function') savable=savable(card,player,event.dying);
|
||||||
return savable;
|
return savable;
|
||||||
},
|
},
|
||||||
filterTarget:trigger.player,
|
filterTarget:trigger.player,
|
||||||
|
@ -11684,6 +11739,9 @@
|
||||||
if(!ui.removeObserve){
|
if(!ui.removeObserve){
|
||||||
ui.removeObserve=ui.create.system('移除旁观',function(){
|
ui.removeObserve=ui.create.system('移除旁观',function(){
|
||||||
lib.configOL.observe=false;
|
lib.configOL.observe=false;
|
||||||
|
if(game.onlineroom){
|
||||||
|
game.send('server','config',lib.configOL);
|
||||||
|
}
|
||||||
while(lib.node.observing.length){
|
while(lib.node.observing.length){
|
||||||
lib.node.observing.shift().ws.close();
|
lib.node.observing.shift().ws.close();
|
||||||
}
|
}
|
||||||
|
@ -11792,12 +11850,30 @@
|
||||||
nickname:lib.config.connect_nickname
|
nickname:lib.config.connect_nickname
|
||||||
},lib.config.banned_info);
|
},lib.config.banned_info);
|
||||||
},
|
},
|
||||||
|
onconnection:function(id){
|
||||||
|
var ws={wsid:id};
|
||||||
|
for(var i in lib.element.nodews){
|
||||||
|
ws[i]=lib.element.nodews[i];
|
||||||
|
}
|
||||||
|
lib.wsOL[id]=ws;
|
||||||
|
lib.init.connection(ws);
|
||||||
|
},
|
||||||
|
onmessage:function(id,message){
|
||||||
|
if(lib.wsOL[id]){
|
||||||
|
lib.wsOL[id].onmessage(message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onclose:function(id){
|
||||||
|
if(lib.wsOL[id]){
|
||||||
|
lib.wsOL[id].onclose();
|
||||||
|
}
|
||||||
|
},
|
||||||
createroom:function(){
|
createroom:function(){
|
||||||
game.online=false;
|
game.online=false;
|
||||||
game.onlineroom=true;
|
game.onlineroom=true;
|
||||||
lib.node={};
|
lib.node={};
|
||||||
for(var i=0;i<ui.rooms.length;i++){
|
for(var i=0;i<ui.rooms.length;i++){
|
||||||
ui.rooms[i].delete();
|
ui.rooms[i].remove();
|
||||||
}
|
}
|
||||||
delete ui.rooms;
|
delete ui.rooms;
|
||||||
game.switchMode('identity');
|
game.switchMode('identity');
|
||||||
|
@ -11811,29 +11887,15 @@
|
||||||
lib.config.recentIP.remove(_status.ip);
|
lib.config.recentIP.remove(_status.ip);
|
||||||
lib.config.recentIP.unshift(_status.ip);
|
lib.config.recentIP.unshift(_status.ip);
|
||||||
lib.config.recentIP.splice(5);
|
lib.config.recentIP.splice(5);
|
||||||
|
game.saveConfig('reconnect_info',[_status.ip]);
|
||||||
game.saveConfig('recentIP',lib.config.recentIP);
|
game.saveConfig('recentIP',lib.config.recentIP);
|
||||||
_status.connectMode=true;
|
_status.connectMode=true;
|
||||||
|
|
||||||
game.clearArena();
|
game.clearArena();
|
||||||
|
game.clearConnect();
|
||||||
ui.pause.hide();
|
ui.pause.hide();
|
||||||
ui.auto.hide();
|
ui.auto.hide();
|
||||||
|
|
||||||
if(ui.ipnode){
|
|
||||||
ui.ipnode.remove();
|
|
||||||
delete ui.ipnode;
|
|
||||||
}
|
|
||||||
if(ui.iptext){
|
|
||||||
ui.iptext.remove();
|
|
||||||
delete ui.iptext;
|
|
||||||
}
|
|
||||||
if(ui.ipbutton){
|
|
||||||
ui.ipbutton.remove();
|
|
||||||
delete ui.ipbutton;
|
|
||||||
}
|
|
||||||
if(ui.recentIP){
|
|
||||||
ui.recentIP.remove();
|
|
||||||
delete ui.recentIP;
|
|
||||||
}
|
|
||||||
clearTimeout(_status.createNodeTimeout);
|
clearTimeout(_status.createNodeTimeout);
|
||||||
|
|
||||||
var proceed=function(){
|
var proceed=function(){
|
||||||
|
@ -11845,16 +11907,14 @@
|
||||||
player.dataset.position='c'+i;
|
player.dataset.position='c'+i;
|
||||||
player.classList.add('connect');
|
player.classList.add('connect');
|
||||||
player.roomindex=i;
|
player.roomindex=i;
|
||||||
if(!list[i]){
|
player.node.hp.classList.add('room');
|
||||||
player.initOL('空房间',list2[i])
|
player.initRoom(list[i],list2[i]);
|
||||||
}
|
|
||||||
else{
|
|
||||||
var config=list[i][2];
|
|
||||||
player.initOL(get.cnNumber(parseInt(config.number))+'人'+get.translation(config.mode),list[i][1]);
|
|
||||||
player.setNickname(list[i][0]);
|
|
||||||
}
|
|
||||||
ui.rooms.push(player);
|
ui.rooms.push(player);
|
||||||
}
|
}
|
||||||
|
ui.exitroom=ui.create.system('退出房间',function(){
|
||||||
|
if(ui.rooms) game.saveConfig('reconnect_info');
|
||||||
|
game.reload();
|
||||||
|
},true);
|
||||||
}
|
}
|
||||||
if(_status.event.getParent()){
|
if(_status.event.getParent()){
|
||||||
game.forceOver('noover',proceed);
|
game.forceOver('noover',proceed);
|
||||||
|
@ -11867,16 +11927,7 @@
|
||||||
if(ui.rooms){
|
if(ui.rooms){
|
||||||
var list2=['re_caocao','liubei','sunquan'];
|
var list2=['re_caocao','liubei','sunquan'];
|
||||||
for(var i=0;i<ui.rooms.length;i++){
|
for(var i=0;i<ui.rooms.length;i++){
|
||||||
var player=ui.rooms[i];
|
ui.rooms[i].initRoom(list[i],list2[i]);
|
||||||
if(!list[i]){
|
|
||||||
player.initOL('空房间',list2[i])
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
var config=list[i][2];
|
|
||||||
player.initOL(get.cnNumber(parseInt(config.number))+'人'+get.translation(config.mode),list[i][1]);
|
|
||||||
player.setNickname(list[i][0]);
|
|
||||||
}
|
|
||||||
ui.rooms.push(player);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -11901,22 +11952,7 @@
|
||||||
ui.create.connectPlayers(ip);
|
ui.create.connectPlayers(ip);
|
||||||
ui.pause.hide();
|
ui.pause.hide();
|
||||||
ui.auto.hide();
|
ui.auto.hide();
|
||||||
if(ui.ipnode){
|
game.clearConnect();
|
||||||
ui.ipnode.remove();
|
|
||||||
delete ui.ipnode;
|
|
||||||
}
|
|
||||||
if(ui.iptext){
|
|
||||||
ui.iptext.remove();
|
|
||||||
delete ui.iptext;
|
|
||||||
}
|
|
||||||
if(ui.ipbutton){
|
|
||||||
ui.ipbutton.remove();
|
|
||||||
delete ui.ipbutton;
|
|
||||||
}
|
|
||||||
if(ui.recentIP){
|
|
||||||
ui.recentIP.remove();
|
|
||||||
delete ui.recentIP;
|
|
||||||
}
|
|
||||||
clearTimeout(_status.createNodeTimeout);
|
clearTimeout(_status.createNodeTimeout);
|
||||||
|
|
||||||
var proceed=function(){
|
var proceed=function(){
|
||||||
|
@ -11966,22 +12002,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reinit:function(config,state,state2,ip,observe){
|
reinit:function(config,state,state2,ip,observe){
|
||||||
if(ui.ipnode){
|
game.clearConnect();
|
||||||
ui.ipnode.remove();
|
|
||||||
delete ui.ipnode;
|
|
||||||
}
|
|
||||||
if(ui.iptext){
|
|
||||||
ui.iptext.remove();
|
|
||||||
delete ui.iptext;
|
|
||||||
}
|
|
||||||
if(ui.ipbutton){
|
|
||||||
ui.ipbutton.remove();
|
|
||||||
delete ui.ipbutton;
|
|
||||||
}
|
|
||||||
if(ui.recentIP){
|
|
||||||
ui.recentIP.remove();
|
|
||||||
delete ui.recentIP;
|
|
||||||
}
|
|
||||||
clearTimeout(_status.createNodeTimeout);
|
clearTimeout(_status.createNodeTimeout);
|
||||||
game.online=true;
|
game.online=true;
|
||||||
game.ip=ip;
|
game.ip=ip;
|
||||||
|
@ -12028,10 +12049,12 @@
|
||||||
game.finishCards();
|
game.finishCards();
|
||||||
if(!observe) ui.create.chat();
|
if(!observe) ui.create.chat();
|
||||||
else{
|
else{
|
||||||
ui.create.system('退出旁观',function(){
|
if(!ui.exitroom){
|
||||||
game.saveConfig('reconnect_info');
|
ui.create.system('退出旁观',function(){
|
||||||
game.reload();
|
game.saveConfig('reconnect_info');
|
||||||
},true);
|
game.reload();
|
||||||
|
},true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ui.arena.dataset.number=state.number;
|
ui.arena.dataset.number=state.number;
|
||||||
var pos=state.players[observe||game.onlineID].position;
|
var pos=state.players[observe||game.onlineID].position;
|
||||||
|
@ -12183,6 +12206,10 @@
|
||||||
ui.roomInfo.remove();
|
ui.roomInfo.remove();
|
||||||
delete ui.roomInfo;
|
delete ui.roomInfo;
|
||||||
}
|
}
|
||||||
|
if(ui.exitroom){
|
||||||
|
ui.exitroom.remove();
|
||||||
|
delete ui.exitroom;
|
||||||
|
}
|
||||||
ui.auto.show();
|
ui.auto.show();
|
||||||
ui.pause.show();
|
ui.pause.show();
|
||||||
if(lib.config.show_cardpile){
|
if(lib.config.show_cardpile){
|
||||||
|
@ -12284,7 +12311,7 @@
|
||||||
if(event.func){
|
if(event.func){
|
||||||
event.func();
|
event.func();
|
||||||
}
|
}
|
||||||
if(game.ws){
|
if(game.onlineroom){
|
||||||
game.send('server','config',lib.configOL);
|
game.send('server','config',lib.configOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12298,10 +12325,18 @@
|
||||||
game.pause();
|
game.pause();
|
||||||
'step 1'
|
'step 1'
|
||||||
_status.waitingForPlayer=false;
|
_status.waitingForPlayer=false;
|
||||||
|
lib.configOL.gameStarted=true;
|
||||||
|
if(game.onlineroom){
|
||||||
|
game.send('server','config',lib.configOL);
|
||||||
|
}
|
||||||
for(var i=0;i<game.connectPlayers.length;i++){
|
for(var i=0;i<game.connectPlayers.length;i++){
|
||||||
game.connectPlayers[i].delete();
|
game.connectPlayers[i].delete();
|
||||||
}
|
}
|
||||||
delete game.connectPlayers;
|
delete game.connectPlayers;
|
||||||
|
if(ui.exitroom){
|
||||||
|
ui.exitroom.remove();
|
||||||
|
delete ui.exitroom;
|
||||||
|
}
|
||||||
game.broadcast('gameStart');
|
game.broadcast('gameStart');
|
||||||
game.delay(2);
|
game.delay(2);
|
||||||
ui.auto.show();
|
ui.auto.show();
|
||||||
|
@ -12414,9 +12449,10 @@
|
||||||
lib.configOL={};
|
lib.configOL={};
|
||||||
lib.playerOL={};
|
lib.playerOL={};
|
||||||
lib.cardOL={};
|
lib.cardOL={};
|
||||||
|
lib.wsOL={};
|
||||||
ui.create.chat();
|
ui.create.chat();
|
||||||
|
|
||||||
if(game.ws){
|
if(game.onlineroom){
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -16244,6 +16280,30 @@
|
||||||
game.players.length=0;
|
game.players.length=0;
|
||||||
game.dead.length=0;
|
game.dead.length=0;
|
||||||
game.me=null;
|
game.me=null;
|
||||||
|
},
|
||||||
|
clearConnect:function(){
|
||||||
|
if(ui.ipnode){
|
||||||
|
ui.ipnode.remove();
|
||||||
|
delete ui.ipnode;
|
||||||
|
}
|
||||||
|
if(ui.iptext){
|
||||||
|
ui.iptext.remove();
|
||||||
|
delete ui.iptext;
|
||||||
|
}
|
||||||
|
if(ui.ipbutton){
|
||||||
|
ui.ipbutton.remove();
|
||||||
|
delete ui.ipbutton;
|
||||||
|
}
|
||||||
|
if(ui.recentIP){
|
||||||
|
ui.recentIP.remove();
|
||||||
|
delete ui.recentIP;
|
||||||
|
}
|
||||||
|
if(ui.rooms){
|
||||||
|
for(var i=0;i<ui.rooms.length;i++){
|
||||||
|
ui.rooms[i].remove();
|
||||||
|
}
|
||||||
|
delete ui.rooms;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
log:function(str){
|
log:function(str){
|
||||||
var str='';
|
var str='';
|
||||||
|
@ -22880,7 +22940,13 @@
|
||||||
if(ui.intro) return;
|
if(ui.intro) return;
|
||||||
if(this.classList.contains('connect')){
|
if(this.classList.contains('connect')){
|
||||||
if(game.online){
|
if(game.online){
|
||||||
if(this.hasOwnProperty('roomindex')){
|
if(this.roomfull){
|
||||||
|
alert('房间已满');
|
||||||
|
}
|
||||||
|
else if(this.roomgaming){
|
||||||
|
alert('游戏已开始')
|
||||||
|
}
|
||||||
|
else if(this.hasOwnProperty('roomindex')){
|
||||||
if(!_status.enteringroom){
|
if(!_status.enteringroom){
|
||||||
_status.enteringroom=true;
|
_status.enteringroom=true;
|
||||||
game.send('server','enter',this.roomindex,lib.config.connect_nickname,lib.config.connect_avatar);
|
game.send('server','enter',this.roomindex,lib.config.connect_nickname,lib.config.connect_avatar);
|
||||||
|
@ -22911,6 +22977,7 @@
|
||||||
else{
|
else{
|
||||||
lib.configOL.number++;
|
lib.configOL.number++;
|
||||||
}
|
}
|
||||||
|
game.send('server','config',lib.configOL);
|
||||||
game.updateWaiting();
|
game.updateWaiting();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -20,10 +20,9 @@
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this.owner=room.owner;
|
this.owner=room.owner;
|
||||||
this.owner.send('connection');
|
this.owner.sendl('onconnection',this.wsid);
|
||||||
this.sendl('enterroom');
|
|
||||||
}
|
}
|
||||||
messages.updaterooms();
|
util.updaterooms();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
room.owner=this;
|
room.owner=this;
|
||||||
|
@ -35,14 +34,16 @@
|
||||||
if(room&&room.owner==this){
|
if(room&&room.owner==this){
|
||||||
room.config=config;
|
room.config=config;
|
||||||
}
|
}
|
||||||
messages.updaterooms();
|
util.updaterooms();
|
||||||
},
|
},
|
||||||
updaterooms:function(){
|
send:function(id,message){
|
||||||
var roomlist=util.getroomlist();
|
if(clients[id]&&clients[id].owner==this){
|
||||||
for(var i in clients){
|
clients[id].send(message);
|
||||||
if(!clients[i].room){
|
}
|
||||||
clients[i].sendl('updaterooms',roomlist);
|
},
|
||||||
}
|
close:function(id){
|
||||||
|
if(clients[id]&&clients[id].owner==this){
|
||||||
|
clients[id].close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -55,16 +56,34 @@
|
||||||
},
|
},
|
||||||
getroomlist:function(){
|
getroomlist:function(){
|
||||||
var roomlist=[];
|
var roomlist=[];
|
||||||
|
for(var i=0;i<3;i++){
|
||||||
|
rooms[i]._num=0;
|
||||||
|
}
|
||||||
|
for(var i in clients){
|
||||||
|
if(clients[i].room){
|
||||||
|
clients[i].room._num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
for(var i=0;i<3;i++){
|
for(var i=0;i<3;i++){
|
||||||
if(rooms[i].owner&&rooms[i].config){
|
if(rooms[i].owner&&rooms[i].config){
|
||||||
roomlist[i]=[rooms[i].owner.nickname,rooms[i].owner.avatar,rooms[i].config];
|
roomlist[i]=[rooms[i].owner.nickname,rooms[i].owner.avatar,
|
||||||
|
rooms[i].config,rooms[i]._num];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
roomlist[i]=null;
|
roomlist[i]=null;
|
||||||
}
|
}
|
||||||
|
delete rooms[i]._num;
|
||||||
}
|
}
|
||||||
return roomlist;
|
return roomlist;
|
||||||
}
|
},
|
||||||
|
updaterooms:function(){
|
||||||
|
var roomlist=util.getroomlist();
|
||||||
|
for(var i in clients){
|
||||||
|
if(!clients[i].room){
|
||||||
|
clients[i].sendl('updaterooms',roomlist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
wss.on('connection',function(ws){
|
wss.on('connection',function(ws){
|
||||||
ws.sendl=util.sendl;
|
ws.sendl=util.sendl;
|
||||||
|
@ -72,27 +91,33 @@
|
||||||
clients[ws.wsid]=ws;
|
clients[ws.wsid]=ws;
|
||||||
ws.sendl('roomlist',util.getroomlist());
|
ws.sendl('roomlist',util.getroomlist());
|
||||||
ws.on('message',function(message){
|
ws.on('message',function(message){
|
||||||
var arr;
|
if(this.owner){
|
||||||
try{
|
this.owner.sendl('onmessage',this.wsid,message);
|
||||||
arr=JSON.parse(message);
|
}
|
||||||
if(!Array.isArray(arr)){
|
else{
|
||||||
throw('err');
|
var arr;
|
||||||
|
try{
|
||||||
|
arr=JSON.parse(message);
|
||||||
|
if(!Array.isArray(arr)){
|
||||||
|
throw('err');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
catch(e){
|
||||||
catch(e){
|
this.sendl('denied','banned');
|
||||||
this.sendl('denied','banned');
|
return;
|
||||||
return;
|
}
|
||||||
}
|
if(arr.shift()=='server'){
|
||||||
if(arr.shift()=='server'){
|
var type=arr.shift();
|
||||||
var type=arr.shift();
|
if(messages[type]){
|
||||||
if(messages[type]){
|
messages[type].apply(this,arr);
|
||||||
messages[type].apply(this,arr);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ws.on('close',function(){
|
ws.on('close',function(){
|
||||||
|
if(!clients[this.wsid]) return;
|
||||||
if(this.owner){
|
if(this.owner){
|
||||||
|
this.owner.sendl('onclose',this.wsid);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
var room=this.room;
|
var room=this.room;
|
||||||
|
@ -102,12 +127,13 @@
|
||||||
for(var i in clients){
|
for(var i in clients){
|
||||||
if(clients[i].room==room&&clients[i]!=this){
|
if(clients[i].room==room&&clients[i]!=this){
|
||||||
clients[i].close();
|
clients[i].close();
|
||||||
|
delete clients[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete clients[this.wsid];
|
delete clients[this.wsid];
|
||||||
}
|
}
|
||||||
messages.updaterooms();
|
util.updaterooms();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -271,9 +271,15 @@ table{table-layout: fixed;}
|
||||||
.player.linked:not(.treasure).playerfocus{
|
.player.linked:not(.treasure).playerfocus{
|
||||||
transform: scale(1.1) rotate(-90deg);
|
transform: scale(1.1) rotate(-90deg);
|
||||||
}
|
}
|
||||||
.player.connect>div:not(.avatar):not(.name):not(.nameol){
|
.player.connect>div:not(.avatar):not(.name):not(.nameol):not(.hp.room):not(.gaming){
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
.player.connect>.gaming{
|
||||||
|
left:16px;
|
||||||
|
top:auto;
|
||||||
|
bottom: 16px;
|
||||||
|
font-family: 'xinwei'
|
||||||
|
}
|
||||||
|
|
||||||
#arena #me>div>div>.card{
|
#arena #me>div>div>.card{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -153,7 +153,8 @@
|
||||||
z-index:3;
|
z-index:3;
|
||||||
transform:rotate(180deg);
|
transform:rotate(180deg);
|
||||||
}
|
}
|
||||||
#arena.slim_player .player .hp{
|
#arena.slim_player .player .hp,
|
||||||
|
#window>.player .hp{
|
||||||
bottom: 15px;
|
bottom: 15px;
|
||||||
left:121px;
|
left:121px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -979,14 +979,7 @@ mode.identity={
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i in libCharacter){
|
for(i in libCharacter){
|
||||||
if(libCharacter[i][4]&&libCharacter[i][4].contains('forbidai')) continue;
|
if(lib.filter.characterDisabled(i)) continue;
|
||||||
if(lib.config.forbidai.contains(i)) continue;
|
|
||||||
// if(lib.config.forbidall.contains(i)) continue;
|
|
||||||
if(lib.config.banned.contains(i)) continue;
|
|
||||||
if(!get.config('double_character')&&get.config('ban_weak')&&
|
|
||||||
(lib.config.forbidsingle.contains(i)||lib.rank.c.contains(i)||lib.rank.d.contains(i))) continue;
|
|
||||||
if(get.config('ban_strong')&&(lib.rank.s.contains(i)||lib.rank.ap.contains(i))) continue;
|
|
||||||
if(get.config('double_character')&&lib.config.forbiddouble.contains(i)) continue;
|
|
||||||
event.list.push(i);
|
event.list.push(i);
|
||||||
if(libCharacter[i][4]&&libCharacter[i][4].contains('zhu')){
|
if(libCharacter[i][4]&&libCharacter[i][4].contains('zhu')){
|
||||||
list2.push(i);
|
list2.push(i);
|
||||||
|
|
|
@ -657,24 +657,22 @@ mode.stone={
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
drawDeck:function(num,log){
|
drawDeck:function(num,log){
|
||||||
if(this.isMin()){
|
|
||||||
this.draw(num,log);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!num){
|
if(!num){
|
||||||
num=1;
|
num=1;
|
||||||
}
|
}
|
||||||
|
var cards=this.getDeckCards(num);
|
||||||
if(log==false){
|
if(log==false){
|
||||||
this.directgain(this.getDeckCards(num));
|
this.directgain(cards);
|
||||||
}
|
}
|
||||||
else if(log==true){
|
else if(log==true){
|
||||||
this.directgain(this.getDeckCards(num));
|
this.directgain(cards);
|
||||||
game.log(this,'从牌库中获得了'+get.cnNumber(num)+'张牌');
|
game.log(this,'从牌库中获得了'+get.cnNumber(num)+'张牌');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this.gain(this.getDeckCards(num),'draw');
|
this.gain(cards,'draw');
|
||||||
game.log(this,'从牌库中获得了'+get.cnNumber(num)+'张牌');
|
game.log(this,'从牌库中获得了'+get.cnNumber(num)+'张牌');
|
||||||
}
|
}
|
||||||
|
return cards;
|
||||||
},
|
},
|
||||||
updateActCount:function(used,countx,current){
|
updateActCount:function(used,countx,current){
|
||||||
if(_status.video){
|
if(_status.video){
|
||||||
|
@ -774,10 +772,13 @@ mode.stone={
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
getDeckCards:function(num){
|
getDeckCards:function(num){
|
||||||
var player=this;
|
|
||||||
if(typeof num!='number'){
|
if(typeof num!='number'){
|
||||||
num=1;
|
num=1;
|
||||||
}
|
}
|
||||||
|
if(!this.deckCards){
|
||||||
|
return get.cards(num);
|
||||||
|
}
|
||||||
|
var player=this;
|
||||||
for(var i=0;i<5;i++){
|
for(var i=0;i<5;i++){
|
||||||
if(player.deckCards.length<num){
|
if(player.deckCards.length<num){
|
||||||
get.deck(player,player.deck);
|
get.deck(player,player.deck);
|
||||||
|
|
Loading…
Reference in New Issue