shorten _FindItem()

This commit is contained in:
ReznoRMichael 2022-01-20 12:59:55 +01:00
parent a634f44c67
commit a63d0bae9c
3 changed files with 9 additions and 8 deletions

View file

@ -2227,11 +2227,10 @@ var DataChecker = /*#__PURE__*/function () {
_createClass(DataChecker, [{ _createClass(DataChecker, [{
key: "_FindItem", key: "_FindItem",
value: function _FindItem() { value: function _FindItem() {
var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; var entry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var sceneName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
for (var i = 0, length = this.boolData.length; i < length; i++) { for (var i = 0, length = this.boolData.length; i < length; i++) {
if (this.boolData[i].id === id && this.boolData[i].sceneName === sceneName && this.boolData[i].activated === true) { if (this.boolData[i].id === entry.id && this.boolData[i].sceneName === entry.sceneName && this.boolData[i].activated === true) {
return true; return true;
} }
} }
@ -2272,7 +2271,7 @@ var DataChecker = /*#__PURE__*/function () {
for (var i in this.entries) { for (var i in this.entries) {
switch (i) { switch (i) {
default: default:
if (this._FindItem(this.entries[i].id, this.entries[i].sceneName)) { if (this._FindItem(this.entries[i])) {
(0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.SetIconGreen)(this.section, i); (0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.SetIconGreen)(this.section, i);
} else { } else {
(0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.SetIconRed)(this.section, i); (0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.SetIconRed)(this.section, i);

File diff suppressed because one or more lines are too long

View file

@ -2450,10 +2450,12 @@ class DataChecker {
* @param {string} sceneName the Collectible's sceneName in the database. * @param {string} sceneName the Collectible's sceneName in the database.
* @returns {boolean} * @returns {boolean}
*/ */
_FindItem(id = "", sceneName = "") { _FindItem(entry = {}) {
for (let i = 0, length = this.boolData.length; i < length; i++) { for (let i = 0, length = this.boolData.length; i < length; i++) {
if (this.boolData[i].id === id && this.boolData[i].sceneName === sceneName && this.boolData[i].activated === true) { if (this.boolData[i].id === entry.id &&
this.boolData[i].sceneName === entry.sceneName &&
this.boolData[i].activated === true) {
return true; return true;
} }
} }
@ -2493,7 +2495,7 @@ class DataChecker {
switch(i) { switch(i) {
default: default:
if (this._FindItem(this.entries[i].id, this.entries[i].sceneName)) { if (this._FindItem(this.entries[i])) {
SetIconGreen(this.section, i); SetIconGreen(this.section, i);
} else { } else {
SetIconRed(this.section, i); SetIconRed(this.section, i);