mirror of
https://github.com/IvarK/AntimatterDimensionsSourceCode.git
synced 2024-11-21 19:42:17 +00:00
fucking git
This commit is contained in:
parent
375b7031c9
commit
08cfe27d95
@ -1,113 +1,113 @@
|
||||
// deepmerge library modified for Antimatter Dimensions usage (mainly Decimal integration)
|
||||
// Source: https://github.com/TehShrike/deepmerge
|
||||
|
||||
function emptyTarget(val) {
|
||||
return Array.isArray(val) ? [] : {};
|
||||
}
|
||||
|
||||
function cloneUnlessOtherwiseSpecified(value, options) {
|
||||
if (value instanceof Decimal) {
|
||||
return new Decimal(value);
|
||||
}
|
||||
if (value instanceof Set) {
|
||||
return new Set(value);
|
||||
}
|
||||
return (options.clone !== false && options.isMergeableObject(value)) ?
|
||||
deepmerge(emptyTarget(value), value, options) :
|
||||
value;
|
||||
}
|
||||
|
||||
function defaultArrayMerge(target, source, options) {
|
||||
return target.concat(source).map(function(element) {
|
||||
return cloneUnlessOtherwiseSpecified(element, options);
|
||||
});
|
||||
}
|
||||
|
||||
function mergeObject(target, source, options) {
|
||||
const destination = {};
|
||||
if (options.isMergeableObject(target)) {
|
||||
Object.keys(target).forEach(function(key) {
|
||||
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
||||
});
|
||||
}
|
||||
Object.keys(source).forEach(function(key) {
|
||||
if (target[key] && target[key] instanceof Decimal) {
|
||||
destination[key] = new Decimal(source[key]);
|
||||
} else if (target[key] && target[key] instanceof Set) {
|
||||
destination[key] = new Set(source[key]);
|
||||
} else if (!options.isMergeableObject(source[key]) || !target[key]) {
|
||||
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
||||
} else {
|
||||
destination[key] = deepmerge(target[key], source[key], options);
|
||||
}
|
||||
});
|
||||
return destination;
|
||||
}
|
||||
|
||||
function deepmerge(target, source, options) {
|
||||
options = options || {};
|
||||
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
||||
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
||||
|
||||
if (target instanceof Decimal) {
|
||||
return new Decimal(source);
|
||||
}
|
||||
|
||||
if (target instanceof Set) {
|
||||
return new Set(source);
|
||||
}
|
||||
|
||||
const sourceIsArray = Array.isArray(source);
|
||||
const targetIsArray = Array.isArray(target);
|
||||
const sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
||||
|
||||
if (!sourceAndTargetTypesMatch) {
|
||||
return cloneUnlessOtherwiseSpecified(source, options);
|
||||
} else if (sourceIsArray) {
|
||||
return options.arrayMerge(target, source, options);
|
||||
} else {
|
||||
return mergeObject(target, source, options);
|
||||
}
|
||||
}
|
||||
|
||||
deepmerge.all = function deepmergeAll(array, options) {
|
||||
if (!Array.isArray(array)) {
|
||||
throw new Error('first argument should be an array');
|
||||
}
|
||||
|
||||
if (!options) {
|
||||
const deepCloneMerge = (destinationArray, sourceArray, options) => {
|
||||
return sourceArray.map(function(element, index) {
|
||||
if (destinationArray[index] && destinationArray[index] instanceof Decimal) {
|
||||
return new Decimal(element);
|
||||
} else if (destinationArray[index] && destinationArray[index] instanceof Set) {
|
||||
return new Set(element);
|
||||
} else if (!options.isMergeableObject(element) || !destinationArray[index]) {
|
||||
return cloneUnlessOtherwiseSpecified(element, options);
|
||||
} else {
|
||||
return deepmerge(destinationArray[index], element, options);
|
||||
}
|
||||
});
|
||||
};
|
||||
options = {
|
||||
arrayMerge: deepCloneMerge
|
||||
};
|
||||
}
|
||||
|
||||
return array.reduce(function(prev, next) {
|
||||
return deepmerge(prev, next, options);
|
||||
}, {});
|
||||
};
|
||||
|
||||
function isMergeableObject(value) {
|
||||
return isNonNullObject(value) && !isSpecial(value);
|
||||
}
|
||||
|
||||
function isNonNullObject(value) {
|
||||
return !!value && typeof value === 'object';
|
||||
}
|
||||
|
||||
function isSpecial(value) {
|
||||
const stringValue = Object.prototype.toString.call(value);
|
||||
return stringValue === '[object RegExp]' || stringValue === '[object Date]';
|
||||
// deepmerge library modified for Antimatter Dimensions usage (mainly Decimal integration)
|
||||
// Source: https://github.com/TehShrike/deepmerge
|
||||
|
||||
function emptyTarget(val) {
|
||||
return Array.isArray(val) ? [] : {};
|
||||
}
|
||||
|
||||
function cloneUnlessOtherwiseSpecified(value, options) {
|
||||
if (value instanceof Decimal) {
|
||||
return new Decimal(value);
|
||||
}
|
||||
if (value instanceof Set) {
|
||||
return new Set(value);
|
||||
}
|
||||
return (options.clone !== false && options.isMergeableObject(value)) ?
|
||||
deepmerge(emptyTarget(value), value, options) :
|
||||
value;
|
||||
}
|
||||
|
||||
function defaultArrayMerge(target, source, options) {
|
||||
return target.concat(source).map(function(element) {
|
||||
return cloneUnlessOtherwiseSpecified(element, options);
|
||||
});
|
||||
}
|
||||
|
||||
function mergeObject(target, source, options) {
|
||||
const destination = {};
|
||||
if (options.isMergeableObject(target)) {
|
||||
Object.keys(target).forEach(function(key) {
|
||||
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
||||
});
|
||||
}
|
||||
Object.keys(source).forEach(function(key) {
|
||||
if (target[key] && target[key] instanceof Decimal) {
|
||||
destination[key] = new Decimal(source[key]);
|
||||
} else if (target[key] && target[key] instanceof Set) {
|
||||
destination[key] = new Set(source[key]);
|
||||
} else if (!options.isMergeableObject(source[key]) || !target[key]) {
|
||||
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
||||
} else {
|
||||
destination[key] = deepmerge(target[key], source[key], options);
|
||||
}
|
||||
});
|
||||
return destination;
|
||||
}
|
||||
|
||||
function deepmerge(target, source, options) {
|
||||
options = options || {};
|
||||
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
||||
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
||||
|
||||
if (target instanceof Decimal) {
|
||||
return new Decimal(source);
|
||||
}
|
||||
|
||||
if (target instanceof Set) {
|
||||
return new Set(source);
|
||||
}
|
||||
|
||||
const sourceIsArray = Array.isArray(source);
|
||||
const targetIsArray = Array.isArray(target);
|
||||
const sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
||||
|
||||
if (!sourceAndTargetTypesMatch) {
|
||||
return cloneUnlessOtherwiseSpecified(source, options);
|
||||
} else if (sourceIsArray) {
|
||||
return options.arrayMerge(target, source, options);
|
||||
} else {
|
||||
return mergeObject(target, source, options);
|
||||
}
|
||||
}
|
||||
|
||||
deepmerge.all = function deepmergeAll(array, options) {
|
||||
if (!Array.isArray(array)) {
|
||||
throw new Error('first argument should be an array');
|
||||
}
|
||||
|
||||
if (!options) {
|
||||
const deepCloneMerge = (destinationArray, sourceArray, options) => {
|
||||
return sourceArray.map(function(element, index) {
|
||||
if (destinationArray[index] && destinationArray[index] instanceof Decimal) {
|
||||
return new Decimal(element);
|
||||
} else if (destinationArray[index] && destinationArray[index] instanceof Set) {
|
||||
return new Set(element);
|
||||
} else if (!options.isMergeableObject(element) || !destinationArray[index]) {
|
||||
return cloneUnlessOtherwiseSpecified(element, options);
|
||||
} else {
|
||||
return deepmerge(destinationArray[index], element, options);
|
||||
}
|
||||
});
|
||||
};
|
||||
options = {
|
||||
arrayMerge: deepCloneMerge
|
||||
};
|
||||
}
|
||||
|
||||
return array.reduce(function(prev, next) {
|
||||
return deepmerge(prev, next, options);
|
||||
}, {});
|
||||
};
|
||||
|
||||
function isMergeableObject(value) {
|
||||
return isNonNullObject(value) && !isSpecial(value);
|
||||
}
|
||||
|
||||
function isNonNullObject(value) {
|
||||
return !!value && typeof value === 'object';
|
||||
}
|
||||
|
||||
function isSpecial(value) {
|
||||
const stringValue = Object.prototype.toString.call(value);
|
||||
return stringValue === '[object RegExp]' || stringValue === '[object Date]';
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,136 +1,136 @@
|
||||
.general-tooltip {
|
||||
display: block !important;
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
.general-tooltip .tooltip-inner {
|
||||
background: rgba(0, 0, 0, 0.9);
|
||||
color: white;
|
||||
border-radius: 3px;
|
||||
width: 160px;
|
||||
text-align: center;
|
||||
padding: 5px 10px 4px;
|
||||
font-family: Typewriter, serif;
|
||||
font-size: 14px;
|
||||
line-height: 1.2;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.tooltip-inner.automator-tooltip {
|
||||
overflow: auto;
|
||||
width: unset;
|
||||
height: 100%;
|
||||
display: inline-block !important;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.automator-tooltip-header {
|
||||
white-space: nowrap;
|
||||
font-weight: bold;
|
||||
min-width: 16rem;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.automator-tooltip-content {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.automator-tooltip-content div {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.general-tooltip .tooltip-arrow {
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
margin: 5px;
|
||||
border: solid rgba(0, 0, 0, 0.9);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="top"] {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="top"] .tooltip-arrow {
|
||||
border-width: 5px 5px 0 5px !important;
|
||||
border-left-color: transparent !important;
|
||||
border-right-color: transparent !important;
|
||||
border-bottom-color: transparent !important;
|
||||
bottom: -5px;
|
||||
left: calc(50% - 5px);
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="bottom"] {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="bottom"] .tooltip-arrow {
|
||||
border-width: 0 5px 5px 5px;
|
||||
border-left-color: transparent !important;
|
||||
border-right-color: transparent !important;
|
||||
border-top-color: transparent !important;
|
||||
top: -5px;
|
||||
left: calc(50% - 5px);
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="right"] {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="right"] .tooltip-arrow {
|
||||
border-width: 5px 5px 5px 0;
|
||||
border-left-color: transparent !important;
|
||||
border-top-color: transparent !important;
|
||||
border-bottom-color: transparent !important;
|
||||
left: -5px;
|
||||
top: calc(50% - 5px);
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="left"] {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="left"] .tooltip-arrow {
|
||||
border-width: 5px 0 5px 5px;
|
||||
border-top-color: transparent !important;
|
||||
border-right-color: transparent !important;
|
||||
border-bottom-color: transparent !important;
|
||||
right: -5px;
|
||||
top: calc(50% - 5px);
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.general-tooltip.popover .popover-inner {
|
||||
background: #f9f9f9;
|
||||
color: black;
|
||||
padding: 24px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 5px 30px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.general-tooltip.popover .popover-arrow {
|
||||
border-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.general-tooltip[aria-hidden='true'] {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s, visibility 0.3s;
|
||||
}
|
||||
|
||||
.general-tooltip[aria-hidden='false'] {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
transition: opacity 0.3s;
|
||||
.general-tooltip {
|
||||
display: block !important;
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
.general-tooltip .tooltip-inner {
|
||||
background: rgba(0, 0, 0, 0.9);
|
||||
color: white;
|
||||
border-radius: 3px;
|
||||
width: 160px;
|
||||
text-align: center;
|
||||
padding: 5px 10px 4px;
|
||||
font-family: Typewriter, serif;
|
||||
font-size: 14px;
|
||||
line-height: 1.2;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.tooltip-inner.automator-tooltip {
|
||||
overflow: auto;
|
||||
width: unset;
|
||||
height: 100%;
|
||||
display: inline-block !important;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.automator-tooltip-header {
|
||||
white-space: nowrap;
|
||||
font-weight: bold;
|
||||
min-width: 16rem;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.automator-tooltip-content {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.automator-tooltip-content div {
|
||||
width: 0;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.general-tooltip .tooltip-arrow {
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
margin: 5px;
|
||||
border: solid rgba(0, 0, 0, 0.9);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="top"] {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="top"] .tooltip-arrow {
|
||||
border-width: 5px 5px 0 5px !important;
|
||||
border-left-color: transparent !important;
|
||||
border-right-color: transparent !important;
|
||||
border-bottom-color: transparent !important;
|
||||
bottom: -5px;
|
||||
left: calc(50% - 5px);
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="bottom"] {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="bottom"] .tooltip-arrow {
|
||||
border-width: 0 5px 5px 5px;
|
||||
border-left-color: transparent !important;
|
||||
border-right-color: transparent !important;
|
||||
border-top-color: transparent !important;
|
||||
top: -5px;
|
||||
left: calc(50% - 5px);
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="right"] {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="right"] .tooltip-arrow {
|
||||
border-width: 5px 5px 5px 0;
|
||||
border-left-color: transparent !important;
|
||||
border-top-color: transparent !important;
|
||||
border-bottom-color: transparent !important;
|
||||
left: -5px;
|
||||
top: calc(50% - 5px);
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="left"] {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.general-tooltip[x-placement^="left"] .tooltip-arrow {
|
||||
border-width: 5px 0 5px 5px;
|
||||
border-top-color: transparent !important;
|
||||
border-right-color: transparent !important;
|
||||
border-bottom-color: transparent !important;
|
||||
right: -5px;
|
||||
top: calc(50% - 5px);
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.general-tooltip.popover .popover-inner {
|
||||
background: #f9f9f9;
|
||||
color: black;
|
||||
padding: 24px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 5px 30px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.general-tooltip.popover .popover-arrow {
|
||||
border-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.general-tooltip[aria-hidden='true'] {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s, visibility 0.3s;
|
||||
}
|
||||
|
||||
.general-tooltip[aria-hidden='false'] {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
transition: opacity 0.3s;
|
||||
}
|
1638
theme-preview.html
1638
theme-preview.html
File diff suppressed because it is too large
Load Diff
440
typings/break_infinity.d.ts
vendored
440
typings/break_infinity.d.ts
vendored
@ -1,220 +1,220 @@
|
||||
declare type DecimalSource = Decimal | number | string;
|
||||
export default class Decimal {
|
||||
m: number;
|
||||
e: number;
|
||||
s: number;
|
||||
static fromMantissaExponent(mantissa: number, exponent: number): Decimal;
|
||||
static fromMantissaExponent_noNormalize(mantissa: number, exponent: number): Decimal;
|
||||
static fromDecimal(value: Decimal): Decimal;
|
||||
static fromNumber(value: number): Decimal;
|
||||
static fromString(value: string): Decimal;
|
||||
static fromValue(value: DecimalSource): Decimal;
|
||||
static fromValue_noAlloc(value: DecimalSource): Decimal;
|
||||
static abs(value: DecimalSource): Decimal;
|
||||
static neg(value: DecimalSource): Decimal;
|
||||
static negate(value: DecimalSource): Decimal;
|
||||
static negated(value: DecimalSource): Decimal;
|
||||
static sign(value: DecimalSource): number;
|
||||
static sgn(value: DecimalSource): number;
|
||||
static round(value: DecimalSource): Decimal;
|
||||
static floor(value: DecimalSource): Decimal;
|
||||
static ceil(value: DecimalSource): Decimal;
|
||||
static trunc(value: DecimalSource): Decimal;
|
||||
static add(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static plus(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static sub(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static subtract(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static minus(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static mul(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static multiply(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static times(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static div(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static divide(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static recip(value: DecimalSource): Decimal;
|
||||
static reciprocal(value: DecimalSource): Decimal;
|
||||
static reciprocate(value: DecimalSource): Decimal;
|
||||
static cmp(value: DecimalSource, other: DecimalSource): 0 | 1 | -1;
|
||||
static compare(value: DecimalSource, other: DecimalSource): 0 | 1 | -1;
|
||||
static eq(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static equals(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static neq(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static notEquals(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static lt(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static lte(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static gt(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static gte(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static max(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static min(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static cmp_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): 0 | 1 | -1;
|
||||
static compare_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): 0 | 1 | -1;
|
||||
static eq_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static equals_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static neq_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static notEquals_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static lt_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static lte_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static gt_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static gte_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static log10(value: DecimalSource): number;
|
||||
static log(value: DecimalSource, base: number): number;
|
||||
static log2(value: DecimalSource): number;
|
||||
static ln(value: DecimalSource): number;
|
||||
static logarithm(value: DecimalSource, base: number): number;
|
||||
static pow10(value: number): Decimal;
|
||||
static pow(value: DecimalSource, other: number | Decimal): Decimal;
|
||||
static exp(value: DecimalSource): Decimal;
|
||||
static sqr(value: DecimalSource): Decimal;
|
||||
static sqrt(value: DecimalSource): Decimal;
|
||||
static cube(value: DecimalSource): Decimal;
|
||||
static cbrt(value: DecimalSource): Decimal;
|
||||
/**
|
||||
* If you're willing to spend 'resourcesAvailable' and want to buy something
|
||||
* with exponentially increasing cost each purchase (start at priceStart,
|
||||
* multiply by priceRatio, already own currentOwned), how much of it can you buy?
|
||||
* Adapted from Trimps source code.
|
||||
*/
|
||||
static affordGeometricSeries(resourcesAvailable: DecimalSource, priceStart: DecimalSource, priceRatio: DecimalSource, currentOwned: number | Decimal): Decimal;
|
||||
/**
|
||||
* How much resource would it cost to buy (numItems) items if you already have currentOwned,
|
||||
* the initial price is priceStart and it multiplies by priceRatio each purchase?
|
||||
*/
|
||||
static sumGeometricSeries(numItems: number | Decimal, priceStart: DecimalSource, priceRatio: DecimalSource, currentOwned: number | Decimal): Decimal;
|
||||
/**
|
||||
* If you're willing to spend 'resourcesAvailable' and want to buy something with additively
|
||||
* increasing cost each purchase (start at priceStart, add by priceAdd, already own currentOwned),
|
||||
* how much of it can you buy?
|
||||
*/
|
||||
static affordArithmeticSeries(resourcesAvailable: DecimalSource, priceStart: DecimalSource, priceAdd: DecimalSource, currentOwned: DecimalSource): Decimal;
|
||||
/**
|
||||
* How much resource would it cost to buy (numItems) items if you already have currentOwned,
|
||||
* the initial price is priceStart and it adds priceAdd each purchase?
|
||||
* Adapted from http://www.mathwords.com/a/arithmetic_series.htm
|
||||
*/
|
||||
static sumArithmeticSeries(numItems: DecimalSource, priceStart: DecimalSource, priceAdd: DecimalSource, currentOwned: DecimalSource): Decimal;
|
||||
/**
|
||||
* When comparing two purchases that cost (resource) and increase your resource/sec by (deltaRpS),
|
||||
* the lowest efficiency score is the better one to purchase.
|
||||
* From Frozen Cookies:
|
||||
* http://cookieclicker.wikia.com/wiki/Frozen_Cookies_(JavaScript_Add-on)#Efficiency.3F_What.27s_that.3F
|
||||
*/
|
||||
static efficiencyOfPurchase(cost: DecimalSource, currentRpS: DecimalSource, deltaRpS: DecimalSource): Decimal;
|
||||
static randomDecimalForTesting(absMaxExponent: number): Decimal;
|
||||
private static affordGeometricSeries_core;
|
||||
private static sumGeometricSeries_core;
|
||||
private static affordArithmeticSeries_core;
|
||||
private static sumArithmeticSeries_core;
|
||||
private static efficiencyOfPurchase_core;
|
||||
mantissa: number;
|
||||
exponent: number;
|
||||
constructor(value?: DecimalSource);
|
||||
/**
|
||||
* When mantissa is very denormalized, use this to normalize much faster.
|
||||
*/
|
||||
normalize(): this | undefined;
|
||||
fromMantissaExponent(mantissa: number, exponent: number): this;
|
||||
/**
|
||||
* Well, you know what you're doing!
|
||||
*/
|
||||
fromMantissaExponent_noNormalize(mantissa: number, exponent: number): this;
|
||||
fromDecimal(value: Decimal): this;
|
||||
fromNumber(value: number): this;
|
||||
fromString(value: string): this;
|
||||
fromValue(value?: DecimalSource): this;
|
||||
toNumber(): number;
|
||||
mantissaWithDecimalPlaces(places: number): number;
|
||||
toString(): string;
|
||||
toExponential(places: number): string;
|
||||
toFixed(places: number): string;
|
||||
toPrecision(places: number): string;
|
||||
valueOf(): string;
|
||||
toJSON(): string;
|
||||
toStringWithDecimalPlaces(places: number): string;
|
||||
abs(): Decimal;
|
||||
neg(): Decimal;
|
||||
negate(): Decimal;
|
||||
negated(): Decimal;
|
||||
sign(): number;
|
||||
sgn(): number;
|
||||
round(): Decimal;
|
||||
floor(): Decimal;
|
||||
ceil(): Decimal;
|
||||
trunc(): Decimal;
|
||||
add(value: DecimalSource): Decimal;
|
||||
plus(value: DecimalSource): Decimal;
|
||||
sub(value: DecimalSource): Decimal;
|
||||
subtract(value: DecimalSource): Decimal;
|
||||
minus(value: DecimalSource): Decimal;
|
||||
mul(value: DecimalSource): Decimal;
|
||||
multiply(value: DecimalSource): Decimal;
|
||||
times(value: DecimalSource): Decimal;
|
||||
div(value: DecimalSource): Decimal;
|
||||
divide(value: DecimalSource): Decimal;
|
||||
divideBy(value: DecimalSource): Decimal;
|
||||
dividedBy(value: DecimalSource): Decimal;
|
||||
recip(): Decimal;
|
||||
reciprocal(): Decimal;
|
||||
reciprocate(): Decimal;
|
||||
/**
|
||||
* -1 for less than value, 0 for equals value, 1 for greater than value
|
||||
*/
|
||||
cmp(value: DecimalSource): 0 | 1 | -1;
|
||||
compare(value: DecimalSource): 0 | 1 | -1;
|
||||
eq(value: DecimalSource): boolean;
|
||||
equals(value: DecimalSource): boolean;
|
||||
neq(value: DecimalSource): boolean;
|
||||
notEquals(value: DecimalSource): boolean;
|
||||
lt(value: DecimalSource): boolean;
|
||||
lte(value: DecimalSource): boolean;
|
||||
gt(value: DecimalSource): boolean;
|
||||
gte(value: DecimalSource): boolean;
|
||||
max(value: DecimalSource): Decimal;
|
||||
min(value: DecimalSource): Decimal;
|
||||
cmp_tolerance(value: DecimalSource, tolerance: DecimalSource): 0 | 1 | -1;
|
||||
compare_tolerance(value: DecimalSource, tolerance: DecimalSource): 0 | 1 | -1;
|
||||
/**
|
||||
* Tolerance is a relative tolerance, multiplied by the greater of the magnitudes of the two arguments.
|
||||
* For example, if you put in 1e-9, then any number closer to the
|
||||
* larger number than (larger number)*1e-9 will be considered equal.
|
||||
*/
|
||||
eq_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
equals_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
neq_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
notEquals_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
lt_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
lte_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
gt_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
gte_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
abslog10(): number;
|
||||
log10(): number;
|
||||
log(base: number): number;
|
||||
log2(): number;
|
||||
ln(): number;
|
||||
logarithm(base: number): number;
|
||||
pow(value: number | Decimal): Decimal;
|
||||
pow_base(value: DecimalSource): Decimal;
|
||||
factorial(): Decimal;
|
||||
exp(): Decimal;
|
||||
sqr(): Decimal;
|
||||
sqrt(): Decimal;
|
||||
cube(): Decimal;
|
||||
cbrt(): Decimal;
|
||||
sinh(): Decimal;
|
||||
cosh(): Decimal;
|
||||
tanh(): Decimal;
|
||||
asinh(): number;
|
||||
acosh(): number;
|
||||
atanh(): number;
|
||||
/**
|
||||
* Joke function from Realm Grinder
|
||||
*/
|
||||
ascensionPenalty(ascensions: number): Decimal;
|
||||
/**
|
||||
* Joke function from Cookie Clicker. It's 'egg'
|
||||
*/
|
||||
egg(): Decimal;
|
||||
lessThanOrEqualTo(other: DecimalSource): boolean;
|
||||
lessThan(other: DecimalSource): boolean;
|
||||
greaterThanOrEqualTo(other: DecimalSource): boolean;
|
||||
greaterThan(other: DecimalSource): boolean;
|
||||
}
|
||||
export {};
|
||||
declare type DecimalSource = Decimal | number | string;
|
||||
export default class Decimal {
|
||||
m: number;
|
||||
e: number;
|
||||
s: number;
|
||||
static fromMantissaExponent(mantissa: number, exponent: number): Decimal;
|
||||
static fromMantissaExponent_noNormalize(mantissa: number, exponent: number): Decimal;
|
||||
static fromDecimal(value: Decimal): Decimal;
|
||||
static fromNumber(value: number): Decimal;
|
||||
static fromString(value: string): Decimal;
|
||||
static fromValue(value: DecimalSource): Decimal;
|
||||
static fromValue_noAlloc(value: DecimalSource): Decimal;
|
||||
static abs(value: DecimalSource): Decimal;
|
||||
static neg(value: DecimalSource): Decimal;
|
||||
static negate(value: DecimalSource): Decimal;
|
||||
static negated(value: DecimalSource): Decimal;
|
||||
static sign(value: DecimalSource): number;
|
||||
static sgn(value: DecimalSource): number;
|
||||
static round(value: DecimalSource): Decimal;
|
||||
static floor(value: DecimalSource): Decimal;
|
||||
static ceil(value: DecimalSource): Decimal;
|
||||
static trunc(value: DecimalSource): Decimal;
|
||||
static add(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static plus(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static sub(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static subtract(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static minus(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static mul(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static multiply(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static times(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static div(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static divide(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static recip(value: DecimalSource): Decimal;
|
||||
static reciprocal(value: DecimalSource): Decimal;
|
||||
static reciprocate(value: DecimalSource): Decimal;
|
||||
static cmp(value: DecimalSource, other: DecimalSource): 0 | 1 | -1;
|
||||
static compare(value: DecimalSource, other: DecimalSource): 0 | 1 | -1;
|
||||
static eq(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static equals(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static neq(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static notEquals(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static lt(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static lte(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static gt(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static gte(value: DecimalSource, other: DecimalSource): boolean;
|
||||
static max(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static min(value: DecimalSource, other: DecimalSource): Decimal;
|
||||
static cmp_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): 0 | 1 | -1;
|
||||
static compare_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): 0 | 1 | -1;
|
||||
static eq_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static equals_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static neq_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static notEquals_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static lt_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static lte_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static gt_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static gte_tolerance(value: DecimalSource, other: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
static log10(value: DecimalSource): number;
|
||||
static log(value: DecimalSource, base: number): number;
|
||||
static log2(value: DecimalSource): number;
|
||||
static ln(value: DecimalSource): number;
|
||||
static logarithm(value: DecimalSource, base: number): number;
|
||||
static pow10(value: number): Decimal;
|
||||
static pow(value: DecimalSource, other: number | Decimal): Decimal;
|
||||
static exp(value: DecimalSource): Decimal;
|
||||
static sqr(value: DecimalSource): Decimal;
|
||||
static sqrt(value: DecimalSource): Decimal;
|
||||
static cube(value: DecimalSource): Decimal;
|
||||
static cbrt(value: DecimalSource): Decimal;
|
||||
/**
|
||||
* If you're willing to spend 'resourcesAvailable' and want to buy something
|
||||
* with exponentially increasing cost each purchase (start at priceStart,
|
||||
* multiply by priceRatio, already own currentOwned), how much of it can you buy?
|
||||
* Adapted from Trimps source code.
|
||||
*/
|
||||
static affordGeometricSeries(resourcesAvailable: DecimalSource, priceStart: DecimalSource, priceRatio: DecimalSource, currentOwned: number | Decimal): Decimal;
|
||||
/**
|
||||
* How much resource would it cost to buy (numItems) items if you already have currentOwned,
|
||||
* the initial price is priceStart and it multiplies by priceRatio each purchase?
|
||||
*/
|
||||
static sumGeometricSeries(numItems: number | Decimal, priceStart: DecimalSource, priceRatio: DecimalSource, currentOwned: number | Decimal): Decimal;
|
||||
/**
|
||||
* If you're willing to spend 'resourcesAvailable' and want to buy something with additively
|
||||
* increasing cost each purchase (start at priceStart, add by priceAdd, already own currentOwned),
|
||||
* how much of it can you buy?
|
||||
*/
|
||||
static affordArithmeticSeries(resourcesAvailable: DecimalSource, priceStart: DecimalSource, priceAdd: DecimalSource, currentOwned: DecimalSource): Decimal;
|
||||
/**
|
||||
* How much resource would it cost to buy (numItems) items if you already have currentOwned,
|
||||
* the initial price is priceStart and it adds priceAdd each purchase?
|
||||
* Adapted from http://www.mathwords.com/a/arithmetic_series.htm
|
||||
*/
|
||||
static sumArithmeticSeries(numItems: DecimalSource, priceStart: DecimalSource, priceAdd: DecimalSource, currentOwned: DecimalSource): Decimal;
|
||||
/**
|
||||
* When comparing two purchases that cost (resource) and increase your resource/sec by (deltaRpS),
|
||||
* the lowest efficiency score is the better one to purchase.
|
||||
* From Frozen Cookies:
|
||||
* http://cookieclicker.wikia.com/wiki/Frozen_Cookies_(JavaScript_Add-on)#Efficiency.3F_What.27s_that.3F
|
||||
*/
|
||||
static efficiencyOfPurchase(cost: DecimalSource, currentRpS: DecimalSource, deltaRpS: DecimalSource): Decimal;
|
||||
static randomDecimalForTesting(absMaxExponent: number): Decimal;
|
||||
private static affordGeometricSeries_core;
|
||||
private static sumGeometricSeries_core;
|
||||
private static affordArithmeticSeries_core;
|
||||
private static sumArithmeticSeries_core;
|
||||
private static efficiencyOfPurchase_core;
|
||||
mantissa: number;
|
||||
exponent: number;
|
||||
constructor(value?: DecimalSource);
|
||||
/**
|
||||
* When mantissa is very denormalized, use this to normalize much faster.
|
||||
*/
|
||||
normalize(): this | undefined;
|
||||
fromMantissaExponent(mantissa: number, exponent: number): this;
|
||||
/**
|
||||
* Well, you know what you're doing!
|
||||
*/
|
||||
fromMantissaExponent_noNormalize(mantissa: number, exponent: number): this;
|
||||
fromDecimal(value: Decimal): this;
|
||||
fromNumber(value: number): this;
|
||||
fromString(value: string): this;
|
||||
fromValue(value?: DecimalSource): this;
|
||||
toNumber(): number;
|
||||
mantissaWithDecimalPlaces(places: number): number;
|
||||
toString(): string;
|
||||
toExponential(places: number): string;
|
||||
toFixed(places: number): string;
|
||||
toPrecision(places: number): string;
|
||||
valueOf(): string;
|
||||
toJSON(): string;
|
||||
toStringWithDecimalPlaces(places: number): string;
|
||||
abs(): Decimal;
|
||||
neg(): Decimal;
|
||||
negate(): Decimal;
|
||||
negated(): Decimal;
|
||||
sign(): number;
|
||||
sgn(): number;
|
||||
round(): Decimal;
|
||||
floor(): Decimal;
|
||||
ceil(): Decimal;
|
||||
trunc(): Decimal;
|
||||
add(value: DecimalSource): Decimal;
|
||||
plus(value: DecimalSource): Decimal;
|
||||
sub(value: DecimalSource): Decimal;
|
||||
subtract(value: DecimalSource): Decimal;
|
||||
minus(value: DecimalSource): Decimal;
|
||||
mul(value: DecimalSource): Decimal;
|
||||
multiply(value: DecimalSource): Decimal;
|
||||
times(value: DecimalSource): Decimal;
|
||||
div(value: DecimalSource): Decimal;
|
||||
divide(value: DecimalSource): Decimal;
|
||||
divideBy(value: DecimalSource): Decimal;
|
||||
dividedBy(value: DecimalSource): Decimal;
|
||||
recip(): Decimal;
|
||||
reciprocal(): Decimal;
|
||||
reciprocate(): Decimal;
|
||||
/**
|
||||
* -1 for less than value, 0 for equals value, 1 for greater than value
|
||||
*/
|
||||
cmp(value: DecimalSource): 0 | 1 | -1;
|
||||
compare(value: DecimalSource): 0 | 1 | -1;
|
||||
eq(value: DecimalSource): boolean;
|
||||
equals(value: DecimalSource): boolean;
|
||||
neq(value: DecimalSource): boolean;
|
||||
notEquals(value: DecimalSource): boolean;
|
||||
lt(value: DecimalSource): boolean;
|
||||
lte(value: DecimalSource): boolean;
|
||||
gt(value: DecimalSource): boolean;
|
||||
gte(value: DecimalSource): boolean;
|
||||
max(value: DecimalSource): Decimal;
|
||||
min(value: DecimalSource): Decimal;
|
||||
cmp_tolerance(value: DecimalSource, tolerance: DecimalSource): 0 | 1 | -1;
|
||||
compare_tolerance(value: DecimalSource, tolerance: DecimalSource): 0 | 1 | -1;
|
||||
/**
|
||||
* Tolerance is a relative tolerance, multiplied by the greater of the magnitudes of the two arguments.
|
||||
* For example, if you put in 1e-9, then any number closer to the
|
||||
* larger number than (larger number)*1e-9 will be considered equal.
|
||||
*/
|
||||
eq_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
equals_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
neq_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
notEquals_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
lt_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
lte_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
gt_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
gte_tolerance(value: DecimalSource, tolerance: DecimalSource): boolean;
|
||||
abslog10(): number;
|
||||
log10(): number;
|
||||
log(base: number): number;
|
||||
log2(): number;
|
||||
ln(): number;
|
||||
logarithm(base: number): number;
|
||||
pow(value: number | Decimal): Decimal;
|
||||
pow_base(value: DecimalSource): Decimal;
|
||||
factorial(): Decimal;
|
||||
exp(): Decimal;
|
||||
sqr(): Decimal;
|
||||
sqrt(): Decimal;
|
||||
cube(): Decimal;
|
||||
cbrt(): Decimal;
|
||||
sinh(): Decimal;
|
||||
cosh(): Decimal;
|
||||
tanh(): Decimal;
|
||||
asinh(): number;
|
||||
acosh(): number;
|
||||
atanh(): number;
|
||||
/**
|
||||
* Joke function from Realm Grinder
|
||||
*/
|
||||
ascensionPenalty(ascensions: number): Decimal;
|
||||
/**
|
||||
* Joke function from Cookie Clicker. It's 'egg'
|
||||
*/
|
||||
egg(): Decimal;
|
||||
lessThanOrEqualTo(other: DecimalSource): boolean;
|
||||
lessThan(other: DecimalSource): boolean;
|
||||
greaterThanOrEqualTo(other: DecimalSource): boolean;
|
||||
greaterThan(other: DecimalSource): boolean;
|
||||
}
|
||||
export {};
|
||||
|
Loading…
Reference in New Issue
Block a user