Merge branch 'develop'
This commit is contained in:
@@ -151,11 +151,6 @@ let CreatureSchema = new SimpleSchema({
|
|||||||
blackbox: true,
|
blackbox: true,
|
||||||
defaultValue: {}
|
defaultValue: {}
|
||||||
},
|
},
|
||||||
variables: {
|
|
||||||
type: Object,
|
|
||||||
blackbox: true,
|
|
||||||
defaultValue: {}
|
|
||||||
},
|
|
||||||
computeErrors: {
|
computeErrors: {
|
||||||
type: Array,
|
type: Array,
|
||||||
optional: true,
|
optional: true,
|
||||||
|
|||||||
@@ -2,9 +2,8 @@ import operator from '/imports/parser/parseTree/operator.js';
|
|||||||
import { parse } from '/imports/parser/parser.js';
|
import { parse } from '/imports/parser/parser.js';
|
||||||
import logErrors from './logErrors.js';
|
import logErrors from './logErrors.js';
|
||||||
|
|
||||||
export default function applyEffectsToCalculationParseNode(calcObj, actionContext){
|
export default function applyEffectsToCalculationParseNode(calcObj, actionContext) {
|
||||||
if (!calcObj.effects) return;
|
calcObj.effects?.forEach(effect => {
|
||||||
calcObj.effects.forEach(effect => {
|
|
||||||
if (effect.operation !== 'add') return;
|
if (effect.operation !== 'add') return;
|
||||||
if (!effect.amount) return;
|
if (!effect.amount) return;
|
||||||
if (effect.amount.value === null) return;
|
if (effect.amount.value === null) return;
|
||||||
@@ -17,8 +16,31 @@ export default function applyEffectsToCalculationParseNode(calcObj, actionContex
|
|||||||
operator: '+',
|
operator: '+',
|
||||||
fn: 'add'
|
fn: 'add'
|
||||||
});
|
});
|
||||||
} catch (e){
|
} catch (e) {
|
||||||
logErrors([e], actionContext)
|
logErrors([e], actionContext)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// Add the highest proficiency as well
|
||||||
|
let highestProficiency;
|
||||||
|
calcObj.proficiencies?.forEach(proficiency => {
|
||||||
|
if (
|
||||||
|
proficiency.value > highestProficiency
|
||||||
|
|| (highestProficiency === undefined && Number.isFinite(proficiency.value))
|
||||||
|
) {
|
||||||
|
highestProficiency = proficiency.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (highestProficiency) {
|
||||||
|
try {
|
||||||
|
let profParseNode = parse(highestProficiency.toString());
|
||||||
|
calcObj.parseNode = operator.create({
|
||||||
|
left: calcObj.parseNode,
|
||||||
|
right: profParseNode,
|
||||||
|
operator: '+',
|
||||||
|
fn: 'add'
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
logErrors([e], actionContext)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import evaluateCalculation from '/imports/api/engine/computation/utility/evaluat
|
|||||||
import applyEffectsToCalculationParseNode from '/imports/api/engine/actions/applyPropertyByType/shared/applyEffectsToCalculationParseNode.js';
|
import applyEffectsToCalculationParseNode from '/imports/api/engine/actions/applyPropertyByType/shared/applyEffectsToCalculationParseNode.js';
|
||||||
import logErrors from './logErrors.js';
|
import logErrors from './logErrors.js';
|
||||||
|
|
||||||
export default function recalculateCalculation(calc, actionContext, context){
|
export default function recalculateCalculation(calc, actionContext, context) {
|
||||||
if (!calc?.parseNode) return;
|
if (!calc?.parseNode) return;
|
||||||
calc._parseLevel = 'reduce';
|
calc._parseLevel = 'reduce';
|
||||||
applyEffectsToCalculationParseNode(calc, actionContext);
|
applyEffectsToCalculationParseNode(calc, actionContext);
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import resolve, { toString } from '/imports/parser/resolve.js';
|
import resolve, { toString } from '/imports/parser/resolve.js';
|
||||||
|
|
||||||
export default function evaluateCalculation(calculation, scope, givenContext){
|
export default function evaluateCalculation(calculation, scope, givenContext) {
|
||||||
const parseNode = calculation.parseNode;
|
const parseNode = calculation.parseNode;
|
||||||
const fn = calculation._parseLevel;
|
const fn = calculation._parseLevel;
|
||||||
const calculationScope = {...calculation._localScope, ...scope};
|
const calculationScope = { ...calculation._localScope, ...scope };
|
||||||
const {result: resultNode, context} = resolve(fn, parseNode, calculationScope, givenContext);
|
const { result: resultNode, context } = resolve(fn, parseNode, calculationScope, givenContext);
|
||||||
calculation.errors = context.errors;
|
calculation.errors = context.errors;
|
||||||
if (resultNode?.parseType === 'constant'){
|
if (resultNode?.parseType === 'constant') {
|
||||||
calculation.value = resultNode.value;
|
calculation.value = resultNode.value;
|
||||||
} else if (resultNode?.parseType === 'error'){
|
} else if (resultNode?.parseType === 'error') {
|
||||||
calculation.value = null;
|
calculation.value = null;
|
||||||
} else {
|
} else {
|
||||||
calculation.value = toString(resultNode);
|
calculation.value = toString(resultNode);
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ const duplicateLibraryNode = new ValidatedMethod({
|
|||||||
}).validator(),
|
}).validator(),
|
||||||
mixins: [RateLimiterMixin],
|
mixins: [RateLimiterMixin],
|
||||||
rateLimit: {
|
rateLimit: {
|
||||||
numRequests: 1,
|
numRequests: 4,
|
||||||
timeInterval: 5000,
|
timeInterval: 6000,
|
||||||
},
|
},
|
||||||
run({ _id }) {
|
run({ _id }) {
|
||||||
let libraryNode = LibraryNodes.findOne(_id);
|
let libraryNode = LibraryNodes.findOne(_id);
|
||||||
|
|||||||
@@ -16,42 +16,27 @@ export default {
|
|||||||
wideColumns: Boolean,
|
wideColumns: Boolean,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Removed to improve chrome layout performance, put it back if there are rendering errors
|
|
||||||
.column-layout>span>div {
|
|
||||||
display: table;
|
|
||||||
table-layout: fixed;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="css">
|
<style lang="css">
|
||||||
.column-layout {
|
.column-layout {
|
||||||
column-count: 12;
|
column-count: 12;
|
||||||
column-fill: balance;
|
column-fill: balance;
|
||||||
column-gap: 0;
|
column-gap: 8px;
|
||||||
column-width: 240px;
|
column-width: 240px;
|
||||||
transform: translateZ(0);
|
padding: 8px;
|
||||||
padding: 4px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.column-layout.wide-columns {
|
.column-layout.wide-columns {
|
||||||
column-count: 12;
|
|
||||||
column-fill: balance;
|
|
||||||
column-gap: 0;
|
|
||||||
column-width: 320px;
|
column-width: 320px;
|
||||||
transform: translateZ(0);
|
|
||||||
padding: 4px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.column-layout>div,
|
.column-layout>*,
|
||||||
.column-layout>span>div {
|
.column-layout>span>div {
|
||||||
width: 100%;
|
display: inline-block;
|
||||||
backface-visibility: hidden;
|
|
||||||
transform: translateX(0);
|
|
||||||
page-break-inside: avoid;
|
|
||||||
break-inside: avoid;
|
break-inside: avoid;
|
||||||
padding: 4px;
|
page-break-inside: avoid;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -596,7 +596,6 @@ export default {
|
|||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
margin-left: -30px;
|
margin-left: -30px;
|
||||||
padding-left: 34px;
|
padding-left: 34px;
|
||||||
z-index: -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.number-label .number {
|
.number-label .number {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
v-else-if="model.attributeType === 'resource'"
|
v-else-if="model.attributeType === 'resource'"
|
||||||
:model="model"
|
:model="model"
|
||||||
@click="$emit('click')"
|
@click="$emit('click')"
|
||||||
@change="({ type, value }) => damageProperty({type, value: -value})"
|
@change="({ type, value, ack }) => damageProperty({type, value: -value, ack})"
|
||||||
@mouseover="hover = true"
|
@mouseover="hover = true"
|
||||||
@mouseleave="hover = false"
|
@mouseleave="hover = false"
|
||||||
/>
|
/>
|
||||||
@@ -96,6 +96,9 @@ export default {
|
|||||||
_id: this.model._id,
|
_id: this.model._id,
|
||||||
operation: change.type,
|
operation: change.type,
|
||||||
value: change.value
|
value: change.value
|
||||||
|
}, e => {
|
||||||
|
console.log(change);
|
||||||
|
change.ack?.(e);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
log({_id}) {
|
log({_id}) {
|
||||||
|
|||||||
@@ -41,16 +41,21 @@ Meteor.publish('slotFillers', function (slotId, searchTerm, isDummySlot) {
|
|||||||
sort: { name: 1 }
|
sort: { name: 1 }
|
||||||
});
|
});
|
||||||
|
|
||||||
// Build a filter for nodes in those libraries that match the slot
|
|
||||||
let filter = getSlotFillFilter({ slot, libraryIds });
|
|
||||||
this.autorun(function () {
|
this.autorun(function () {
|
||||||
|
// Build a filter for nodes in those libraries that match the slot
|
||||||
|
let filter = getSlotFillFilter({ slot, libraryIds });
|
||||||
// Get the limit of the documents the user can fetch
|
// Get the limit of the documents the user can fetch
|
||||||
var limit = self.data('limit') || 50;
|
var limit = self.data('limit') || 50;
|
||||||
check(limit, Number);
|
check(limit, Number);
|
||||||
|
|
||||||
let options = undefined;
|
let options = undefined;
|
||||||
if (searchTerm) {
|
if (searchTerm) {
|
||||||
filter.name = { $regex: escapeRegex(searchTerm), '$options': 'i' };
|
filter.$and.push({
|
||||||
|
$or: [
|
||||||
|
{ name: { $regex: escapeRegex(searchTerm), '$options': 'i' } },
|
||||||
|
{ libraryTags: searchTerm }
|
||||||
|
]
|
||||||
|
});
|
||||||
//filter.$text = { $search: searchTerm };
|
//filter.$text = { $search: searchTerm };
|
||||||
options = {
|
options = {
|
||||||
// relevant documents have a higher score.
|
// relevant documents have a higher score.
|
||||||
|
|||||||
Reference in New Issue
Block a user