From b2ad5b4c692bb23b6da0669425f6ec2c06680d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manw=C3=AB?= Date: Tue, 2 Apr 2024 19:46:10 -0300 Subject: [PATCH] formats update --- public/cards-worker/index.js | 2 +- src/assets/resources/formats.json | 299 +++++++- src/cards-worker/allFormats.ts | 1086 +++++++++++------------------ src/info.json | 2 +- 4 files changed, 697 insertions(+), 692 deletions(-) diff --git a/public/cards-worker/index.js b/public/cards-worker/index.js index 085fd4a..25b0cad 100644 --- a/public/cards-worker/index.js +++ b/public/cards-worker/index.js @@ -1 +1 @@ -!function(f){"object"==typeof exports&&"undefined"!=typeof module?module.exports=f():"function"==typeof define&&define.amd?define([],f):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).cardsworker=f()}(function(){return function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);throw(f=new Error("Cannot find module '"+i+"'")).code="MODULE_NOT_FOUND",f}c=n[i]={exports:{}},e[i][0].call(c.exports,function(r){return o(e[i][1][r]||r)},c,c.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i{allFormats[format.name]=format}),exports.default=allFormats},{}],2:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});const getCollectionData_1=__importDefault(require("./getCollectionData"));self.onmessage=e=>{var{cards:e,cardsList,allCards,setNames,sets}=e.data,e=(0,getCollectionData_1.default)(e,cardsList,allCards,setNames,sets);self.postMessage(e)}},{"./getCollectionData":10}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const colorFlags={NONE:0,W:1,U:2,B:4,R:8,G:16,C:32};exports.default=class{constructor(){return this.w=!1,this.u=!1,this.b=!1,this.r=!1,this.g=!1,this.c=!1,this}get(){const _arr=[];return this.w&&_arr.push(1),this.u&&_arr.push(2),this.b&&_arr.push(3),this.r&&_arr.push(4),this.g&&_arr.push(5),this.c&&_arr.push(6),_arr}getBits(){let bits=0;return this.w&&(bits|=colorFlags.W),this.u&&(bits|=colorFlags.U),this.b&&(bits|=colorFlags.B),this.r&&(bits|=colorFlags.R),this.g&&(bits|=colorFlags.G),this.c&&(bits|=colorFlags.C),bits}getBaseColor(){var bits=this.getBits();if(bits===colorFlags.C||bits===colorFlags.NONE)return 6;bits=326!==c)[0]:7}get length(){let ret=0;return this.w&&(ret+=1),this.u&&(ret+=1),this.b&&(ret+=1),this.r&&(ret+=1),this.g&&(ret+=1),this.c&&(ret+=1),ret}addFromCost(cost){return 0===cost.length&&(this.c=!0),cost.forEach(symbol=>{for(const c of symbol)switch(c){case"w":this.w=!0;break;case"u":this.u=!0;break;case"b":this.b=!0;break;case"r":this.r=!0;break;case"g":this.g=!0;break;case"x":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"10":case"11":case"12":case"13":case"14":case"15":case"16":case"17":this.c=!0}}),this}addFromArray(cost){return cost.forEach(color=>{switch(color){case 1:this.w=!0;break;case 2:this.u=!0;break;case 3:this.b=!0;break;case 4:this.r=!0;break;case 5:this.g=!0;break;case 6:this.c=!0}}),this}addFromColor(color){return this.w=color.w,this.u=color.u,this.b=color.b,this.r=color.r,this.g=color.g,this.c=color.c,this}addFromBits(colorBits){return this.w=!!(colorBits&colorFlags.W),this.u=!!(colorBits&colorFlags.U),this.b=!!(colorBits&colorFlags.B),this.r=!!(colorBits&colorFlags.R),this.g=!!(colorBits&colorFlags.G),this.c=!!(colorBits&colorFlags.C),this}equalTo(color){return this.w==color.w&&this.u==color.u&&this.b==color.b&&this.r==color.r&&this.g==color.g&&this.c==color.c}getColorArchetype(){let currentColorFlags=colorFlags.NONE;switch(this.w&&(currentColorFlags|=colorFlags.W),this.u&&(currentColorFlags|=colorFlags.U),this.b&&(currentColorFlags|=colorFlags.B),this.r&&(currentColorFlags|=colorFlags.R),this.g&&(currentColorFlags|=colorFlags.G),currentColorFlags=32{const format=allFormats_1.default[name];format.bannedTitleIds.includes(card.TitleId)&&banned.push(name)}),banned}},{"./allFormats":1}],6:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});const allFormats_1=__importDefault(require("./allFormats")),findSetByCode_1=__importDefault(require("./findSetByCode"));exports.default=function(card,allCards,setNames,sets){const allowed=[],arenaSetCode=[card.Set.toLowerCase()];return card.DigitalSet&&arenaSetCode.push(card.DigitalSet.toLowerCase()),card.Reprints.forEach(cid=>{var cid=allCards[cid];cid&&(cid=(0,findSetByCode_1.default)(null===cid.DigitalSet||""===cid.DigitalSet?cid.Set:cid.DigitalSet,setNames,sets))&&arenaSetCode.push(cid.arenacode)}),Object.keys(allFormats_1.default).forEach(name=>{const format=allFormats_1.default[name];!format.allowedTitleIds.includes(card.TitleId)&&!format.sets.some(set=>0<=arenaSetCode.indexOf(set.toLowerCase()))||format.bannedTitleIds.includes(card.TitleId)||("Pauper"!=name&&"HistoricPauper"!=name||"common"==card.Rarity)&&allowed.push(name)}),allowed}},{"./allFormats":1,"./findSetByCode":4}],7:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});const findSetByCode_1=__importDefault(require("./findSetByCode"));exports.default=function(card,setNames,sets){return setNames=(0,findSetByCode_1.default)(null===card.DigitalSet||""===card.DigitalSet?card.Set:card.DigitalSet,setNames,sets),!card.IsToken&&(-1!==(null==setNames?void 0:setNames.collation)&&(11!==card.LinkedFaceType&&!!card.IsPrimaryCard))}},{"./findSetByCode":4}],8:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});const getCardFormats_1=__importDefault(require("./getCardFormats"));exports.default=function(card,cards,setNames,sets){if("land"===card.Rarity||!card.IsToken)return!1;if(11===card.LinkedFaceType)return!1;const formats=(0,getCardFormats_1.default)(card,cards,setNames,sets);return!!(formats.includes("Standard")||formats.includes("Historic")||formats.includes("Alchemy")||formats.includes("Explorer")||formats.includes("Timeless")||formats.includes("Singleton"))}},{"./getCardFormats":6}],9:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});const allFormats_1=__importDefault(require("./allFormats"));exports.default=function(card){const suspended=[];return Object.keys(allFormats_1.default).forEach(name=>{const format=allFormats_1.default[name];format.suspendedTitleIds.includes(card.TitleId)&&suspended.push(name)}),suspended}},{"./allFormats":1}],10:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});const colors_1=__importDefault(require("./colors")),getCardBanned_1=__importDefault(require("./getCardBanned")),getCardFormats_1=__importDefault(require("./getCardFormats")),getCardInBoosters_1=__importDefault(require("./getCardInBoosters")),getCardIsCraftable_1=__importDefault(require("./getCardIsCraftable")),getCardSuspended_1=__importDefault(require("./getCardSuspended")),getRarityFilterVal_1=__importDefault(require("./getRarityFilterVal")),DRAFT_RANKS=["F","D-","D","D+","C-","C","C+","B-","B","B+","A-","A","A+"],DRAFT_RANKS_LOLA=["","A+","A","A-","B+","B","B-","C+","C","C-","D+","D","D-","F"],FACE_SPECIALIZE_BACK=11,FACE_ADVENTURE=7,FACE_MODAL_BACK=9,FACE_DFC_BACK=1,FACE_SPLIT=5;exports.default=function(cards,cardsList,allCards,setNames,sets){return cardsList.filter(card=>card.LinkedFaceType!==FACE_DFC_BACK&&3!==card.LinkedFaceType&&card.LinkedFaceType!==FACE_ADVENTURE&&card.LinkedFaceType!==FACE_SPLIT&&card.LinkedFaceType!==FACE_MODAL_BACK&&card.LinkedFaceType!==FACE_SPECIALIZE_BACK).map(card=>{var RANK_SOURCE=0==card.RankData.rankSource?DRAFT_RANKS:DRAFT_RANKS_LOLA;const dfc=allCards[0{allFormats[format.name]=format}),exports.default=allFormats},{}],2:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});const getCollectionData_1=__importDefault(require("./getCollectionData"));self.onmessage=e=>{var{cards:e,cardsList,allCards,setNames,sets}=e.data,e=(0,getCollectionData_1.default)(e,cardsList,allCards,setNames,sets);self.postMessage(e)}},{"./getCollectionData":10}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const colorFlags={NONE:0,W:1,U:2,B:4,R:8,G:16,C:32};exports.default=class{constructor(){return this.w=!1,this.u=!1,this.b=!1,this.r=!1,this.g=!1,this.c=!1,this}get(){const _arr=[];return this.w&&_arr.push(1),this.u&&_arr.push(2),this.b&&_arr.push(3),this.r&&_arr.push(4),this.g&&_arr.push(5),this.c&&_arr.push(6),_arr}getBits(){let bits=0;return this.w&&(bits|=colorFlags.W),this.u&&(bits|=colorFlags.U),this.b&&(bits|=colorFlags.B),this.r&&(bits|=colorFlags.R),this.g&&(bits|=colorFlags.G),this.c&&(bits|=colorFlags.C),bits}getBaseColor(){var bits=this.getBits();if(bits===colorFlags.C||bits===colorFlags.NONE)return 6;bits=326!==c)[0]:7}get length(){let ret=0;return this.w&&(ret+=1),this.u&&(ret+=1),this.b&&(ret+=1),this.r&&(ret+=1),this.g&&(ret+=1),this.c&&(ret+=1),ret}addFromCost(cost){return 0===cost.length&&(this.c=!0),cost.forEach(symbol=>{for(const c of symbol)switch(c){case"w":this.w=!0;break;case"u":this.u=!0;break;case"b":this.b=!0;break;case"r":this.r=!0;break;case"g":this.g=!0;break;case"x":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"10":case"11":case"12":case"13":case"14":case"15":case"16":case"17":this.c=!0}}),this}addFromArray(cost){return cost.forEach(color=>{switch(color){case 1:this.w=!0;break;case 2:this.u=!0;break;case 3:this.b=!0;break;case 4:this.r=!0;break;case 5:this.g=!0;break;case 6:this.c=!0}}),this}addFromColor(color){return this.w=color.w,this.u=color.u,this.b=color.b,this.r=color.r,this.g=color.g,this.c=color.c,this}addFromBits(colorBits){return this.w=!!(colorBits&colorFlags.W),this.u=!!(colorBits&colorFlags.U),this.b=!!(colorBits&colorFlags.B),this.r=!!(colorBits&colorFlags.R),this.g=!!(colorBits&colorFlags.G),this.c=!!(colorBits&colorFlags.C),this}equalTo(color){return this.w==color.w&&this.u==color.u&&this.b==color.b&&this.r==color.r&&this.g==color.g&&this.c==color.c}getColorArchetype(){let currentColorFlags=colorFlags.NONE;switch(this.w&&(currentColorFlags|=colorFlags.W),this.u&&(currentColorFlags|=colorFlags.U),this.b&&(currentColorFlags|=colorFlags.B),this.r&&(currentColorFlags|=colorFlags.R),this.g&&(currentColorFlags|=colorFlags.G),currentColorFlags=32{const format=allFormats_1.default[name];format.bannedTitleIds.includes(card.TitleId)&&banned.push(name)}),banned}},{"./allFormats":1}],6:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});const allFormats_1=__importDefault(require("./allFormats")),findSetByCode_1=__importDefault(require("./findSetByCode"));exports.default=function(card,allCards,setNames,sets){const allowed=[],arenaSetCode=[card.Set.toLowerCase()];return card.DigitalSet&&arenaSetCode.push(card.DigitalSet.toLowerCase()),card.Reprints.forEach(cid=>{var cid=allCards[cid];cid&&(cid=(0,findSetByCode_1.default)(null===cid.DigitalSet||""===cid.DigitalSet?cid.Set:cid.DigitalSet,setNames,sets))&&arenaSetCode.push(cid.arenacode)}),Object.keys(allFormats_1.default).forEach(name=>{const format=allFormats_1.default[name];!format.allowedTitleIds.includes(card.TitleId)&&!format.sets.some(set=>0<=arenaSetCode.indexOf(set.toLowerCase()))||format.bannedTitleIds.includes(card.TitleId)||("Pauper"!=name&&"HistoricPauper"!=name||"common"==card.Rarity)&&allowed.push(name)}),allowed}},{"./allFormats":1,"./findSetByCode":4}],7:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});const findSetByCode_1=__importDefault(require("./findSetByCode"));exports.default=function(card,setNames,sets){return setNames=(0,findSetByCode_1.default)(null===card.DigitalSet||""===card.DigitalSet?card.Set:card.DigitalSet,setNames,sets),!card.IsToken&&(-1!==(null==setNames?void 0:setNames.collation)&&(11!==card.LinkedFaceType&&!!card.IsPrimaryCard))}},{"./findSetByCode":4}],8:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});const getCardFormats_1=__importDefault(require("./getCardFormats"));exports.default=function(card,cards,setNames,sets){if("land"===card.Rarity||!card.IsToken)return!1;if(11===card.LinkedFaceType)return!1;const formats=(0,getCardFormats_1.default)(card,cards,setNames,sets);return!!(formats.includes("Standard")||formats.includes("Historic")||formats.includes("Alchemy")||formats.includes("Explorer")||formats.includes("Timeless")||formats.includes("Singleton"))}},{"./getCardFormats":6}],9:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});const allFormats_1=__importDefault(require("./allFormats"));exports.default=function(card){const suspended=[];return Object.keys(allFormats_1.default).forEach(name=>{const format=allFormats_1.default[name];format.suspendedTitleIds.includes(card.TitleId)&&suspended.push(name)}),suspended}},{"./allFormats":1}],10:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});const colors_1=__importDefault(require("./colors")),getCardBanned_1=__importDefault(require("./getCardBanned")),getCardFormats_1=__importDefault(require("./getCardFormats")),getCardInBoosters_1=__importDefault(require("./getCardInBoosters")),getCardIsCraftable_1=__importDefault(require("./getCardIsCraftable")),getCardSuspended_1=__importDefault(require("./getCardSuspended")),getRarityFilterVal_1=__importDefault(require("./getRarityFilterVal")),DRAFT_RANKS=["F","D-","D","D+","C-","C","C+","B-","B","B+","A-","A","A+"],DRAFT_RANKS_LOLA=["","A+","A","A-","B+","B","B-","C+","C","C-","D+","D","D-","F"],FACE_SPECIALIZE_BACK=11,FACE_ADVENTURE=7,FACE_MODAL_BACK=9,FACE_DFC_BACK=1,FACE_SPLIT=5;exports.default=function(cards,cardsList,allCards,setNames,sets){return cardsList.filter(card=>card.LinkedFaceType!==FACE_DFC_BACK&&3!==card.LinkedFaceType&&card.LinkedFaceType!==FACE_ADVENTURE&&card.LinkedFaceType!==FACE_SPLIT&&card.LinkedFaceType!==FACE_MODAL_BACK&&card.LinkedFaceType!==FACE_SPECIALIZE_BACK).map(card=>{var RANK_SOURCE=0==card.RankData.rankSource?DRAFT_RANKS:DRAFT_RANKS_LOLA;const dfc=allCards[0