add ability of `Player#hasStorage`

This commit is contained in:
Rintim 2023-09-21 19:56:13 +08:00
parent e5054cc520
commit 47f086fb45
1 changed files with 9 additions and 2 deletions

View File

@ -24816,8 +24816,12 @@
getStorage:function(name){
return this.storage[name]||[];
},
hasStorage:function(name){
return name in this.storage;
hasStorage:function(name,value){
if(!(name in this.storage)) return false;
if(typeof value=="undefined") return true;
const storage=this.storage[name];
if(storage===value) return true;
return !Array.isArray(storage) || storage.contains(value);
},
initStorage:function(name,value){
return this.hasStorage(name)?this.getStorage(name):this.setStorage(name,value);
@ -24830,6 +24834,9 @@
.then(value=>operation(value))
.then(value=>this.setStorage(name,value))
},
removeStorage:function(name){
return player.hasStorage(name)&&delete player.storage[name];
},
markSkill:function(name,info,card){
if(info===true){
this.syncStorage(name);