From 629e4590330341f49bd4b7fec761383316c20c5c Mon Sep 17 00:00:00 2001 From: idinium96 <47635037+idinium96@users.noreply.github.com> Date: Fri, 20 May 2022 16:44:29 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20item=20name=20with=20more?= =?UTF-8?q?=20than=20one=20"the"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/schema.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/schema.js b/lib/schema.js index b511cbb..cc9f5c8 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -277,9 +277,27 @@ class Schema { const items = this.raw.schema.items; const itemsCount = items.length; + name = name.toLowerCase(); + + if (name.includes('the ')) { + const splits = name.split('the '); + splits.forEach(slipt => { + name = name.replace('the ', '').trim(); + }); + } + for (let i = 0; i < itemsCount; i++) { const item = items[i]; - if (name.toLowerCase().replace('the ', '').trim() === item.item_name.toLowerCase().replace('the ', '')) { + let itemName = item.item_name.toLowerCase(); + + if (itemName.includes('the ', '')) { + const splits = itemName.split('the '); + splits.forEach(slipt => { + itemName = itemName.replace('the ', '').trim(); + }); + } + + if (name === itemName) { if (item.item_name === 'Name Tag' && item.defindex === 2093) { // skip and let it find Name Tag with defindex 5020 continue;