feat: use morden method.
This commit is contained in:
parent
39a95d8646
commit
57bda3c309
124
game/game.js
124
game/game.js
|
@ -1,12 +1,12 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
{
|
{
|
||||||
|
const userAgent=navigator.userAgent.toLowerCase();
|
||||||
if(!localStorage.getItem('gplv3_noname_alerted')){
|
if(!localStorage.getItem('gplv3_noname_alerted')){
|
||||||
if(confirm('①无名杀是一款基于GPLv3协议的开源软件!\n你可以在遵守GPLv3协议的基础上任意使用,修改并转发《无名杀》,以及所有基于《无名杀》开发的拓展。\n点击“确定”即代表您认可并接受GPLv3协议↓️\nhttps://www.gnu.org/licenses/gpl-3.0.html\n②无名杀官方发布地址仅有GitHub仓库!\n其他所有的所谓“无名杀”社群(包括但不限于绝大多数“官方”QQ群、QQ频道等)均为玩家自发组织,与无名杀官方无关!')){
|
if(confirm('①无名杀是一款基于GPLv3协议的开源软件!\n你可以在遵守GPLv3协议的基础上任意使用,修改并转发《无名杀》,以及所有基于《无名杀》开发的拓展。\n点击“确定”即代表您认可并接受GPLv3协议↓️\nhttps://www.gnu.org/licenses/gpl-3.0.html\n②无名杀官方发布地址仅有GitHub仓库!\n其他所有的所谓“无名杀”社群(包括但不限于绝大多数“官方”QQ群、QQ频道等)均为玩家自发组织,与无名杀官方无关!')){
|
||||||
localStorage.setItem('gplv3_noname_alerted',true);
|
localStorage.setItem('gplv3_noname_alerted',true);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
const ua=navigator.userAgent.toLowerCase();
|
const ios=userAgent.includes('iphone')||userAgent.includes('ipad')||userAgent.includes('macintosh');
|
||||||
const ios=ua.includes('iphone')||ua.includes('ipad')||ua.includes('macintosh');
|
|
||||||
//electron
|
//electron
|
||||||
if(typeof window.process=='object'&&typeof window.require=='function'){
|
if(typeof window.process=='object'&&typeof window.require=='function'){
|
||||||
const versions=window.process.versions;
|
const versions=window.process.versions;
|
||||||
|
@ -117,6 +117,7 @@
|
||||||
mirrorURL:'https://raw.fgit.cf/libccy/noname',
|
mirrorURL:'https://raw.fgit.cf/libccy/noname',
|
||||||
hallURL:'47.99.105.222',
|
hallURL:'47.99.105.222',
|
||||||
assetURL:typeof nonameInitialized!='string'||nonameInitialized=='nodejs'?'':nonameInitialized,
|
assetURL:typeof nonameInitialized!='string'||nonameInitialized=='nodejs'?'':nonameInitialized,
|
||||||
|
userAgent:userAgent,
|
||||||
compatibleEdition:Boolean(typeof nonameInitialized=='string'&&nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//)),
|
compatibleEdition:Boolean(typeof nonameInitialized=='string'&&nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//)),
|
||||||
changeLog:[],
|
changeLog:[],
|
||||||
updates:[],
|
updates:[],
|
||||||
|
@ -8875,7 +8876,7 @@
|
||||||
}
|
}
|
||||||
var noname_inited=localStorage.getItem('noname_inited');
|
var noname_inited=localStorage.getItem('noname_inited');
|
||||||
if(noname_inited&&noname_inited!=='nodejs'){
|
if(noname_inited&&noname_inited!=='nodejs'){
|
||||||
var ua=navigator.userAgent.toLowerCase();
|
var ua=userAgent;
|
||||||
if(ua.includes('android')){
|
if(ua.includes('android')){
|
||||||
lib.device='android';
|
lib.device='android';
|
||||||
}
|
}
|
||||||
|
@ -9041,7 +9042,7 @@
|
||||||
appearenceConfig.global_font.item.default='默认';
|
appearenceConfig.global_font.item.default='默认';
|
||||||
}
|
}
|
||||||
|
|
||||||
var ua=navigator.userAgent.toLowerCase();
|
var ua=userAgent;
|
||||||
if('ontouchstart' in document){
|
if('ontouchstart' in document){
|
||||||
if(!lib.config.totouched){
|
if(!lib.config.totouched){
|
||||||
game.saveConfig('totouched',true);
|
game.saveConfig('totouched',true);
|
||||||
|
@ -37319,7 +37320,7 @@
|
||||||
delete _status.waitingToReload;
|
delete _status.waitingToReload;
|
||||||
},
|
},
|
||||||
exit:function(){
|
exit:function(){
|
||||||
var ua=navigator.userAgent.toLowerCase();
|
var ua=userAgent;
|
||||||
var ios=ua.includes('iphone')||ua.includes('ipad')||ua.includes('macintosh');
|
var ios=ua.includes('iphone')||ua.includes('ipad')||ua.includes('macintosh');
|
||||||
//electron
|
//electron
|
||||||
if(typeof window.process=='object'&&typeof window.require=='function'){
|
if(typeof window.process=='object'&&typeof window.require=='function'){
|
||||||
|
@ -56857,18 +56858,9 @@
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
banWords:str=>{
|
banWords:str=>get.is.emoji(str)||window.bannedKeyWords.some(item=>str.includes(item)),
|
||||||
if(get.is.emoji(str)) return true;
|
|
||||||
for(var i of window.bannedKeyWords){
|
|
||||||
if(str.includes(i)) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
converted:event=>!(event.card&&event.card.isCard),
|
converted:event=>!(event.card&&event.card.isCard),
|
||||||
safari:()=>{
|
safari:()=>userAgent.indexOf('safari'!=-1)&&userAgent.indexOf('chrome')==-1,
|
||||||
const ua=navigator.userAgent.toLowerCase();
|
|
||||||
return ua.indexOf('safari'!=-1)&&ua.indexOf('chrome')==-1;
|
|
||||||
},
|
|
||||||
freePosition:cards=>!cards.some(card=>!card.hasPosition||card.hasPosition()),
|
freePosition:cards=>!cards.some(card=>!card.hasPosition||card.hasPosition()),
|
||||||
nomenu:(name,item)=>{
|
nomenu:(name,item)=>{
|
||||||
var menus=['system','menu'];
|
var menus=['system','menu'];
|
||||||
|
@ -56904,11 +56896,14 @@
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
altered:skill=>{
|
altered:lib.filter.none,
|
||||||
|
/*
|
||||||
|
skill=>{
|
||||||
return false;
|
return false;
|
||||||
// if(_status.connectMode) return true;
|
// if(_status.connectMode) return true;
|
||||||
// return !lib.config.vintageSkills.contains(skill);
|
// return !lib.config.vintageSkills.contains(skill);
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
node:obj=>{
|
node:obj=>{
|
||||||
var str=Object.prototype.toString.call(obj);
|
var str=Object.prototype.toString.call(obj);
|
||||||
if(str&&str.indexOf('[object HTML')) return true;
|
if(str&&str.indexOf('[object HTML')) return true;
|
||||||
|
@ -56939,10 +56934,7 @@
|
||||||
changban:()=>get.mode()=='single'&&_status.mode=='changban',
|
changban:()=>get.mode()=='single'&&_status.mode=='changban',
|
||||||
single:()=>get.mode()=='single'&&_status.mode=='normal',
|
single:()=>get.mode()=='single'&&_status.mode=='normal',
|
||||||
mobileMe:player=>(game.layout=='mobile'||game.layout=='long')&&!game.chess&&player.dataset.position==0,
|
mobileMe:player=>(game.layout=='mobile'||game.layout=='long')&&!game.chess&&player.dataset.position==0,
|
||||||
newLayout:()=>{
|
newLayout:()=>game.layout!='default',
|
||||||
if(game.layout!='default') return true;
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
phoneLayout:()=>{
|
phoneLayout:()=>{
|
||||||
if(!lib.config.phonelayout) return false;
|
if(!lib.config.phonelayout) return false;
|
||||||
return (game.layout=='mobile'||game.layout=='long'||game.layout=='long2'||game.layout=='nova');
|
return (game.layout=='mobile'||game.layout=='long'||game.layout=='long2'||game.layout=='nova');
|
||||||
|
@ -57243,22 +57235,8 @@
|
||||||
return Math.floor(Math.random()*num);
|
return Math.floor(Math.random()*num);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sort(arr,method){
|
sort:(arr,method,arg)=>method=="seat"?arr.sortBySeat(arg):void 0,
|
||||||
switch(method){
|
sortSeat:(arr,target)=>arr.sortBySeat(target),
|
||||||
case 'seat':{
|
|
||||||
lib.tempSortSeat=arguments[2];
|
|
||||||
arr.sort(lib.sort.seat);
|
|
||||||
delete lib.tempSortSeat;
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sortSeat:(arr,target)=>{
|
|
||||||
lib.tempSortSeat=target;
|
|
||||||
arr.sort(lib.sort.seat);
|
|
||||||
delete lib.tempSortSeat;
|
|
||||||
return arr;
|
|
||||||
},
|
|
||||||
zip:callback=>{
|
zip:callback=>{
|
||||||
if(!window.JSZip){
|
if(!window.JSZip){
|
||||||
lib.init.js(lib.assetURL+'game','jszip',function(){
|
lib.init.js(lib.assetURL+'game','jszip',function(){
|
||||||
|
@ -57312,10 +57290,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
round:(num,f)=>{
|
round:(num,f)=>{
|
||||||
var round=1;
|
var round=10**f;
|
||||||
for(var i=0;i<f;i++){
|
|
||||||
round*=10;
|
|
||||||
}
|
|
||||||
return Math.round(num*round)/round;
|
return Math.round(num*round)/round;
|
||||||
},
|
},
|
||||||
playerNumber:()=>{
|
playerNumber:()=>{
|
||||||
|
@ -57427,7 +57402,7 @@
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
copy:(obj)=>{
|
copy:obj=>{
|
||||||
if(get.objtype(obj)=='object'){
|
if(get.objtype(obj)=='object'){
|
||||||
var copy={};
|
var copy={};
|
||||||
for(var i in obj){
|
for(var i in obj){
|
||||||
|
@ -57874,23 +57849,9 @@
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
},
|
},
|
||||||
infoTargets:info=>{
|
infoTargets:infos=>infos.map(info=>game.playerMap[info]),
|
||||||
var targets=[];
|
cardInfo:card=>[card.suit,card.number,card.name,card.nature],
|
||||||
for(var i=0;i<info.length;i++){
|
cardsInfo:cards=>cards.map(get.cardInfo),
|
||||||
targets.push(game.playerMap[info[i]]);
|
|
||||||
}
|
|
||||||
return targets;
|
|
||||||
},
|
|
||||||
cardInfo:card=>{
|
|
||||||
return [card.suit,card.number,card.name,card.nature];
|
|
||||||
},
|
|
||||||
cardsInfo:cards=>{
|
|
||||||
var info=[];
|
|
||||||
for(var i=0;i<cards.length;i++){
|
|
||||||
info.push(get.cardInfo(cards[i]));
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
},
|
|
||||||
infoCard:info=>{
|
infoCard:info=>{
|
||||||
var card=ui.create.card();
|
var card=ui.create.card();
|
||||||
if(info[0]){
|
if(info[0]){
|
||||||
|
@ -57898,13 +57859,7 @@
|
||||||
}
|
}
|
||||||
return card;
|
return card;
|
||||||
},
|
},
|
||||||
infoCards:info=>{
|
infoCards:infos=>infos.map(get.infoCard),
|
||||||
var cards=[];
|
|
||||||
for(var i=0;i<info.length;i++){
|
|
||||||
cards.push(get.infoCard(info[i]));
|
|
||||||
}
|
|
||||||
return cards;
|
|
||||||
},
|
|
||||||
cardInfoOL:card=>'_noname_card:'+JSON.stringify([card.cardid,card.suit,card.number,card.name,card.nature]),
|
cardInfoOL:card=>'_noname_card:'+JSON.stringify([card.cardid,card.suit,card.number,card.name,card.nature]),
|
||||||
infoCardOL:info=>{
|
infoCardOL:info=>{
|
||||||
if(!lib.cardOL) return info;
|
if(!lib.cardOL) return info;
|
||||||
|
@ -57934,39 +57889,12 @@
|
||||||
}
|
}
|
||||||
return card||info;
|
return card||info;
|
||||||
},
|
},
|
||||||
cardsInfoOL:cards=>{
|
cardsInfoOL:cards=>cards.map(get.cardInfoOL),
|
||||||
var info=[];
|
infoCardsOL:infos=>infos.map(get.infoCardOL),
|
||||||
for(var i=0;i<cards.length;i++){
|
|
||||||
info.push(get.cardInfoOL(cards[i]));
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
},
|
|
||||||
infoCardsOL:info=>{
|
|
||||||
var cards=[];
|
|
||||||
for(var i=0;i<info.length;i++){
|
|
||||||
cards.push(get.infoCardOL(info[i]));
|
|
||||||
}
|
|
||||||
return cards;
|
|
||||||
},
|
|
||||||
playerInfoOL:player=>'_noname_player:'+player.playerid,
|
playerInfoOL:player=>'_noname_player:'+player.playerid,
|
||||||
infoPlayerOL:info=>{
|
infoPlayerOL:info=>lib.playerOL?(lib.playerOL[info.slice(15)]||info):info,
|
||||||
if(!lib.playerOL) return info
|
playersInfoOL:players=>players.map(get.playerInfoOL),
|
||||||
return lib.playerOL[info.slice(15)]||info;
|
infoPlayersOL:infos=>infos.map(get.infoPlayerOL),
|
||||||
},
|
|
||||||
playersInfoOL:players=>{
|
|
||||||
var info=[];
|
|
||||||
for(var i=0;i<players.length;i++){
|
|
||||||
info.push(get.playerInfoOL(players[i]));
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
},
|
|
||||||
infoPlayersOL:info=>{
|
|
||||||
var players=[];
|
|
||||||
for(var i=0;i<info.length;i++){
|
|
||||||
players.push(get.infoPlayerOL(info[i]));
|
|
||||||
}
|
|
||||||
return players;
|
|
||||||
},
|
|
||||||
funcInfoOL:func=>{
|
funcInfoOL:func=>{
|
||||||
if(typeof func=='function'){
|
if(typeof func=='function'){
|
||||||
if(func._filter_args){
|
if(func._filter_args){
|
||||||
|
|
Loading…
Reference in New Issue