Skip to content

Commit 099ad55

Browse files
committed
ChatSetAttr v1.6.2: Fixed misplaced bracket, safe string values
1 parent fb99deb commit 099ad55

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

ChatSetAttr/1.6.2/ChatSetAttr.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ChatSetAttr version 1.6.2
2-
// Last Updated: 2017-10-02
2+
// Last Updated: 2017-10-03
33
// A script to create, modify, or delete character attributes from the chat area or macros.
44
// If you don't like my choices for --replace, you can edit the replacers variable at your own peril to change them.
55

@@ -259,9 +259,9 @@ var chatSetAttr = chatSetAttr || (function () {
259259
let moddedValue = parseFloat(v) + parseFloat(attr.get(k) || '0');
260260
if (!_.isNaN(moddedValue)) {
261261
if (opts.modb && k === 'current') {
262-
moddedValue = Math.min(Math.max(moddedValue, 0), parseFloat(attr.get('max') || Infinity));
262+
moddedValue = Math.min(Math.max(moddedValue, 0), parseFloat(attr.get('max')) || Infinity);
263263
}
264-
newValue[k] = moddedValue.toString();
264+
newValue[k] = moddedValue;
265265
}
266266
else {
267267
delete newValue[k];
@@ -271,6 +271,7 @@ var chatSetAttr = chatSetAttr || (function () {
271271
}
272272
});
273273
}
274+
newValue = _.mapObject(newValue, v => String(v));
274275
charFeedback[attrName] = newValue;
275276
setAttribute(attr, newValue);
276277
});

ChatSetAttr/ChatSetAttr.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ChatSetAttr version 1.6.2
2-
// Last Updated: 2017-10-02
2+
// Last Updated: 2017-10-03
33
// A script to create, modify, or delete character attributes from the chat area or macros.
44
// If you don't like my choices for --replace, you can edit the replacers variable at your own peril to change them.
55

@@ -259,9 +259,9 @@ var chatSetAttr = chatSetAttr || (function () {
259259
let moddedValue = parseFloat(v) + parseFloat(attr.get(k) || '0');
260260
if (!_.isNaN(moddedValue)) {
261261
if (opts.modb && k === 'current') {
262-
moddedValue = Math.min(Math.max(moddedValue, 0), parseFloat(attr.get('max') || Infinity));
262+
moddedValue = Math.min(Math.max(moddedValue, 0), parseFloat(attr.get('max')) || Infinity);
263263
}
264-
newValue[k] = moddedValue.toString();
264+
newValue[k] = moddedValue;
265265
}
266266
else {
267267
delete newValue[k];
@@ -271,6 +271,7 @@ var chatSetAttr = chatSetAttr || (function () {
271271
}
272272
});
273273
}
274+
newValue = _.mapObject(newValue, v => String(v));
274275
charFeedback[attrName] = newValue;
275276
setAttribute(attr, newValue);
276277
});

0 commit comments

Comments
 (0)