Skip to content
This repository was archived by the owner on Mar 29, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 39 additions & 30 deletions src/mods/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,43 +220,52 @@ idrinth.core = {
var min = 10;
/**
*
* @param {Number} durationLeft
* @param {Number} minDuration
* @param {Number} min
* @param {Number} property
* @returns {Number}
*/
var getVal = function ( durationLeft, minDuration ) {
if ( durationLeft < 0.1 ) {
return 0.1;
var check = function(min, property, date) {
/**
*
* @param {Number} durationLeft
* @param {string} minDuration
* @returns {Number}
*/
var getVal = function ( durationLeft, minDuration ) {
if ( durationLeft < 0.1 ) {
return 0.1;
}
return durationLeft < minDuration ? durationLeft : minDuration;
};
/**
*
* @param {string} property
* @returns {undefined}
*/
var handle = function ( property, min ) {
idrinth.core.timeouts.list[property].func ();
idrinth.core.timeouts.list[property].repeats = Math.max ( -1, idrinth.core.timeouts.list[property].repeats - 1 );
if ( idrinth.core.timeouts.list[property].repeats ) {
min = getVal ( idrinth.core.timeouts.list[property].duration, min );
idrinth.core.timeouts.list[property].next = date + idrinth.core.timeouts.list[property].duration / 1000;
} else {
delete idrinth.core.timeouts.list[property];
}
return min;
};
if ( date < idrinth.core.timeouts.list[property].next ) {
return getVal ( idrinth.core.timeouts.list[property].next - date, min );
}
return durationLeft < minDuration ? durationLeft : minDuration;
};
/**
*
* @param {string} property
* @returns {undefined}
*/
var handle = function ( property, min ) {
idrinth.core.timeouts.list[property].func ();
idrinth.core.timeouts.list[property].repeats = Math.max ( -1, idrinth.core.timeouts.list[property].repeats - 1 );
if ( idrinth.core.timeouts.list[property].repeats ) {
min = getVal ( idrinth.core.timeouts.list[property].duration, min );
idrinth.core.timeouts.list[property].next = date + idrinth.core.timeouts.list[property].duration / 1000;
} else {
delete idrinth.core.timeouts.list[property];
try {
return handle ( property, min );
} catch ( e ) {
idrinth.core.log ( e.message ? e.message : e.getMessage () );
return min;
}
return min;
};
for (var property in idrinth.core.timeouts.list) {
if ( idrinth.core.timeouts.list.hasOwnProperty ( property ) ) {
if ( date >= idrinth.core.timeouts.list[property].next ) {
try {
min = handle ( property, min );
} catch ( e ) {
idrinth.core.log ( e.message ? e.message : e.getMessage () );
}
} else {
min = getVal ( idrinth.core.timeouts.list[property].next - date, min );
}
min = check(min, property, date);
}
}
if ( Object.keys ( idrinth.core.timeouts.list ).length ) {
Expand Down
15 changes: 15 additions & 0 deletions src/mods/tier.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,21 @@ idrinth.tier = {
var ln = {
type: 'td'
};
if (
idrinth.tier.list[listKey].hasOwnProperty ( 'loot' ) &&
idrinth.tier.list[listKey].loot.hasOwnProperty ( difficulty ) &&
idrinth.tier.list[listKey].loot[difficulty].hasOwnProperty ( ic ) &&
idrinth.tier.list[listKey].loot[difficulty][ic]
) {
ln.attributes = ln.attributes?ln.attributes:[];
var title = "";
for(var key in idrinth.tier.list[listKey].loot[difficulty][ic]) {
if(idrinth.tier.list[listKey].loot[difficulty][ic].hasOwnProperty (key)) {
title += idrinth.tier.list[listKey].loot[difficulty][ic][key]+" "+idrinth.text.get ('tier.loot.'+key)+"\n";
}
}
ln.attributes.push({name:'title',value:title});
}
if (
idrinth.tier.list[listKey].hasOwnProperty ( difficulty ) &&
idrinth.tier.list[listKey][difficulty].hasOwnProperty ( ic )
Expand Down