hasOwnProperty=>in
This commit is contained in:
parent
ccd27c7ce6
commit
22f7b47795
60
game/game.js
60
game/game.js
|
@ -8339,7 +8339,7 @@ new Promise(resolve=>{
|
||||||
run:function(time){
|
run:function(time){
|
||||||
lib.status.time=time;
|
lib.status.time=time;
|
||||||
for(var i=0;i<lib.updates.length;i++){
|
for(var i=0;i<lib.updates.length;i++){
|
||||||
if(!Object.prototype.hasOwnProperty.call(lib.updates[i], '_time')){
|
if(!('_time' in lib.updates[i])){
|
||||||
lib.updates[i]._time=time;
|
lib.updates[i]._time=time;
|
||||||
}
|
}
|
||||||
if(lib.updates[i](time-lib.updates[i]._time-lib.status.delayed)===false){
|
if(lib.updates[i](time-lib.updates[i]._time-lib.status.delayed)===false){
|
||||||
|
@ -20110,14 +20110,14 @@ new Promise(resolve=>{
|
||||||
cards[i].recheck();
|
cards[i].recheck();
|
||||||
|
|
||||||
var info=lib.card[cards[i].name];
|
var info=lib.card[cards[i].name];
|
||||||
if(Object.prototype.hasOwnProperty.call(cards[i], '_destroy')){
|
if('_destroy' in cards[i]){
|
||||||
if(cards[i]._destroy){
|
if(cards[i]._destroy){
|
||||||
cards[i].delete();
|
cards[i].delete();
|
||||||
cards[i].destroyed=cards[i]._destroy;
|
cards[i].destroyed=cards[i]._destroy;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(Object.prototype.hasOwnProperty.call(cards[i], 'destroyed')){
|
else if('destroyed' in cards[i]){
|
||||||
if(event.getlx!==false&&event.position&&cards[i].willBeDestroyed(event.position.id,null,event)){
|
if(event.getlx!==false&&event.position&&cards[i].willBeDestroyed(event.position.id,null,event)){
|
||||||
cards[i].selfDestroy(event);
|
cards[i].selfDestroy(event);
|
||||||
continue;
|
continue;
|
||||||
|
@ -25856,7 +25856,7 @@ new Promise(resolve=>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(next.animate=='gain2'||next.animate=='draw2'){
|
if(next.animate=='gain2'||next.animate=='draw2'){
|
||||||
if(!Object.prototype.hasOwnProperty.call(next, 'log')){
|
if(!('log' in next)){
|
||||||
next.log=true;
|
next.log=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25943,7 +25943,7 @@ new Promise(resolve=>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(next.animate=='gain2'||next.animate=='draw2'||next.animate=='give'){
|
if(next.animate=='gain2'||next.animate=='draw2'||next.animate=='give'){
|
||||||
if(!Object.prototype.hasOwnProperty.call(next, 'log')){
|
if(!('log' in next)){
|
||||||
next.log=true;
|
next.log=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26747,9 +26747,7 @@ new Promise(resolve=>{
|
||||||
}
|
}
|
||||||
clearTimeout(lib.node.torespondtimeout[this.playerid]);
|
clearTimeout(lib.node.torespondtimeout[this.playerid]);
|
||||||
delete lib.node.torespondtimeout[this.playerid];
|
delete lib.node.torespondtimeout[this.playerid];
|
||||||
if(!Object.prototype.hasOwnProperty.call(lib.node.torespond, this.playerid)){
|
if(!(this.playerid in lib.node.torespond)) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
var noresume=false;
|
var noresume=false;
|
||||||
var proceed=null;
|
var proceed=null;
|
||||||
if(typeof lib.node.torespond[this.playerid]=='function'&&lib.node.torespond[this.playerid]._noname_waiting){
|
if(typeof lib.node.torespond[this.playerid]=='function'&&lib.node.torespond[this.playerid]._noname_waiting){
|
||||||
|
@ -26774,9 +26772,7 @@ new Promise(resolve=>{
|
||||||
else if(_status.paused&&!noresume) game.resume();
|
else if(_status.paused&&!noresume) game.resume();
|
||||||
}
|
}
|
||||||
tempUnwait(result){
|
tempUnwait(result){
|
||||||
if(!Object.prototype.hasOwnProperty.call(lib.node.torespond, this.playerid)){
|
if(!(this.playerid in lib.node.torespond)) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
var proceed;
|
var proceed;
|
||||||
if(typeof lib.node.torespond[this.playerid]=='function'&&lib.node.torespond[this.playerid]._noname_waiting){
|
if(typeof lib.node.torespond[this.playerid]=='function'&&lib.node.torespond[this.playerid]._noname_waiting){
|
||||||
proceed=lib.node.torespond[this.playerid](result,this);
|
proceed=lib.node.torespond[this.playerid](result,this);
|
||||||
|
@ -38412,7 +38408,7 @@ new Promise(resolve=>{
|
||||||
const config=game.importedPack.config;
|
const config=game.importedPack.config;
|
||||||
Object.keys(config).forEach(value=>{
|
Object.keys(config).forEach(value=>{
|
||||||
const configObject=config[value];
|
const configObject=config[value];
|
||||||
if(configObject&&Object.prototype.hasOwnProperty.call(configObject, 'init')) game.saveConfig(`extension_${extensionName}_${value}`,configObject.init);
|
if(configObject&&'init' in configObject) game.saveConfig(`extension_${extensionName}_${value}`,configObject.init);
|
||||||
});
|
});
|
||||||
if(game.download){
|
if(game.download){
|
||||||
const files=zip.files,hiddenFileFlags=['.','_'],fileList=Object.keys(files).filter(key=>!files[key].dir&&!hiddenFileFlags.includes(key[0])).reverse();
|
const files=zip.files,hiddenFileFlags=['.','_'],fileList=Object.keys(files).filter(key=>!files[key].dir&&!hiddenFileFlags.includes(key[0])).reverse();
|
||||||
|
@ -42937,7 +42933,7 @@ new Promise(resolve=>{
|
||||||
config.num=config.num||num||3;
|
config.num=config.num||num||3;
|
||||||
config.ratio=config.ratio||ratio||1.2;
|
config.ratio=config.ratio||ratio||1.2;
|
||||||
config.update=config.update||update;
|
config.update=config.update||update;
|
||||||
if(!Object.prototype.hasOwnProperty.call(config, 'first')){
|
if(!('first' in config)){
|
||||||
if(typeof first=='boolean'){
|
if(typeof first=='boolean'){
|
||||||
config.first=first;
|
config.first=first;
|
||||||
}
|
}
|
||||||
|
@ -43548,10 +43544,10 @@ new Promise(resolve=>{
|
||||||
}
|
}
|
||||||
if(info.marktext) lib.translate[`${i}_bg`]=info.marktext;
|
if(info.marktext) lib.translate[`${i}_bg`]=info.marktext;
|
||||||
if(info.silent){
|
if(info.silent){
|
||||||
if(!Object.prototype.hasOwnProperty.call(info, 'forced')) info.forced=true;
|
if(!('forced' in info)) info.forced=true;
|
||||||
if(!Object.prototype.hasOwnProperty.call(info, 'popup')) info.popup=false;
|
if(!('popup' in info)) info.popup=false;
|
||||||
}
|
}
|
||||||
if(!Object.prototype.hasOwnProperty.call(info, '_priority')){
|
if(!('_priority' in info)){
|
||||||
let priority=0;
|
let priority=0;
|
||||||
if(info.priority){
|
if(info.priority){
|
||||||
priority=info.priority*100;
|
priority=info.priority*100;
|
||||||
|
@ -45840,11 +45836,11 @@ new Promise(resolve=>{
|
||||||
var cfg=copyObj(infoconfig[j]);
|
var cfg=copyObj(infoconfig[j]);
|
||||||
cfg._name=j;
|
cfg._name=j;
|
||||||
cfg.mode=mode;
|
cfg.mode=mode;
|
||||||
if(!Object.prototype.hasOwnProperty.call(config, j)){
|
if(j in config){
|
||||||
game.saveConfig(j,cfg.init,mode);
|
cfg.init=config[j];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
cfg.init=config[j];
|
game.saveConfig(j,cfg.init,mode);
|
||||||
}
|
}
|
||||||
if(!cfg.onclick){
|
if(!cfg.onclick){
|
||||||
cfg.onclick=function(result){
|
cfg.onclick=function(result){
|
||||||
|
@ -46308,14 +46304,12 @@ new Promise(resolve=>{
|
||||||
}
|
}
|
||||||
var cfg=copyObj(info.config[j]);
|
var cfg=copyObj(info.config[j]);
|
||||||
cfg._name=j;
|
cfg._name=j;
|
||||||
if(!Object.prototype.hasOwnProperty.call(config, j)){
|
if(j in config){
|
||||||
if(cfg.type!='autoskill'&&cfg.type!='banskill'){
|
|
||||||
game.saveConfig(j,cfg.init);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
cfg.init=config[j];
|
cfg.init=config[j];
|
||||||
}
|
}
|
||||||
|
else if(cfg.type!='autoskill'&&cfg.type!='banskill'){
|
||||||
|
game.saveConfig(j,cfg.init);
|
||||||
|
}
|
||||||
if(!cfg.onclick){
|
if(!cfg.onclick){
|
||||||
cfg.onclick=function(result){
|
cfg.onclick=function(result){
|
||||||
var cfg=this._link.config;
|
var cfg=this._link.config;
|
||||||
|
@ -48182,11 +48176,11 @@ new Promise(resolve=>{
|
||||||
j=mode+'_'+i+'_playpackconfig';
|
j=mode+'_'+i+'_playpackconfig';
|
||||||
}
|
}
|
||||||
cfg._name=j;
|
cfg._name=j;
|
||||||
if(!Object.prototype.hasOwnProperty.call(lib.config, j)){
|
if(j in lib.config){
|
||||||
game.saveConfig(j,cfg.init);
|
cfg.init=lib.config[j];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
cfg.init=lib.config[j];
|
game.saveConfig(j,cfg.init);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i=='enable'){
|
if(i=='enable'){
|
||||||
|
@ -50582,7 +50576,7 @@ new Promise(resolve=>{
|
||||||
game.saveConfig('extension_'+extname+'_enable',true);
|
game.saveConfig('extension_'+extname+'_enable',true);
|
||||||
game.saveConfig('extension_'+extname+'_version',that.info.version);
|
game.saveConfig('extension_'+extname+'_version',that.info.version);
|
||||||
for(var i in game.importedPack.config){
|
for(var i in game.importedPack.config){
|
||||||
if(game.importedPack.config[i]&&Object.prototype.hasOwnProperty.call(game.importedPack.config[i], 'init')){
|
if(game.importedPack.config[i]&&'init' in game.importedPack.config[i]){
|
||||||
game.saveConfig('extension_'+extname+'_'+i,game.importedPack.config[i].init);
|
game.saveConfig('extension_'+extname+'_'+i,game.importedPack.config[i].init);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59432,7 +59426,7 @@ new Promise(resolve=>{
|
||||||
priority:skill=>{
|
priority:skill=>{
|
||||||
const info=get.info(skill);
|
const info=get.info(skill);
|
||||||
if(!info) return 0;
|
if(!info) return 0;
|
||||||
if(Object.prototype.hasOwnProperty.call(info, '_priority')) return info._priority;
|
if('_priority' in info) return info._priority;
|
||||||
let priority=0;
|
let priority=0;
|
||||||
if(info.priority){
|
if(info.priority){
|
||||||
priority=info.priority*100;
|
priority=info.priority*100;
|
||||||
|
@ -60112,7 +60106,7 @@ new Promise(resolve=>{
|
||||||
character:(name,num)=>{
|
character:(name,num)=>{
|
||||||
let info=lib.character[name];
|
let info=lib.character[name];
|
||||||
if(!info){
|
if(!info){
|
||||||
const pack=Object.keys(lib.characterPack).find(pack=>Object.prototype.hasOwnProperty.call(lib.characterPack[pack], name));
|
const pack=Object.keys(lib.characterPack).find(pack=>name in lib.characterPack[pack]);
|
||||||
if(pack) info=lib.characterPack[pack][name];
|
if(pack) info=lib.characterPack[pack][name];
|
||||||
}
|
}
|
||||||
if(info){
|
if(info){
|
||||||
|
@ -61225,7 +61219,7 @@ new Promise(resolve=>{
|
||||||
if(card.length==1) return get.suit(card[0],player);
|
if(card.length==1) return get.suit(card[0],player);
|
||||||
return 'none';
|
return 'none';
|
||||||
}
|
}
|
||||||
else if(!Object.prototype.hasOwnProperty.call(card, 'suit')&&Array.isArray(card.cards)){
|
else if(!('suit' in card)&&Array.isArray(card.cards)){
|
||||||
return get.suit(card.cards,player);
|
return get.suit(card.cards,player);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -61277,7 +61271,7 @@ new Promise(resolve=>{
|
||||||
if(!card) return;
|
if(!card) return;
|
||||||
//狗卡你是真敢出啊
|
//狗卡你是真敢出啊
|
||||||
var number=null;
|
var number=null;
|
||||||
if(Object.prototype.hasOwnProperty.call(card, 'number')){
|
if('number' in card){
|
||||||
number=card.number;
|
number=card.number;
|
||||||
if(typeof number!='number') number=null;
|
if(typeof number!='number') number=null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue