add methods about storage.

This commit is contained in:
Rintim 2023-09-19 22:49:21 +08:00
parent 8682cd0808
commit 6be1fa5dcb
1 changed files with 19 additions and 0 deletions

View File

@ -24730,9 +24730,28 @@
getExpansions:function(tag){
return this.getCards('x',(card)=>card.hasGaintag(tag));
},
countExpansions:function(tag){
return this.getExpansions(tag).length;
},
hasExpansions:function(tag){
return this.countExpansions(tag)>0;
},
setStorage:function(name,value){
return this.storage[name]=value;
},
getStorage:function(name){
return this.storage[name]||[];
},
hasStorage:function(name){
return name in this.storage;
},
initStorage:function(name,value){
return this.hasStorage(name)?this.getStorage(name):this.setStorage(name,value);
},
updateStorage:function(name,operation){
operation(this.getStorage(name));
return this.getStorage(name);
},
markSkill:function(name,info,card){
if(info===true){
this.syncStorage(name);