Skip to content

Commit

Permalink
Fixes to DCS and FSU
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenswat committed Feb 7, 2024
1 parent 02a4600 commit a2585dc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@
],
"abyssal_fighter_support_unit": [
(2336, True),
(2337, True),
(2338, True),
(2337, False),
(2338, False),
(50, False),
(30, False),
(2335, True),
Expand Down
6 changes: 4 additions & 2 deletions backend/abyssal_modules/templates/abyssal_modules/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ <h1 class="display-3 mb-0">
'display': function (data, type, row, meta) {
return attr_format({{ at.id }}, data);
},
'_': 'real_value'
'_': function (data, type, row, meta) {
return render_attr({{ at.id }}, data.real_value);
}
}
},
{% endfor %}
Expand Down Expand Up @@ -230,7 +232,7 @@ <h1 class="display-3 mb-0">
data = table
.column(`attr-${at}:name`)
.data()
.map(function (n) { return n.real_value; })
.map(function (n) { return render_attr(at, n.real_value); })
.sort(function (a, b) { return a - b; });

attr_val[at] = [data[0], data.reverse()[0]];
Expand Down
12 changes: 0 additions & 12 deletions backend/abyssal_modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,5 @@ def render_attribute_value(val, attr):
def correct_high_is_good(val, attr):
if attr == 204:
return not val
elif attr == 974:
return not val
elif attr == 975:
return not val
elif attr == 976:
return not val
elif attr == 977:
return not val
elif attr == 2337:
return not val
elif attr == 2338:
return not val
else:
return val
15 changes: 14 additions & 1 deletion backend/static/js/mutaplasmid.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,17 @@ function generate_similar_button(mod, ids, names) {
return output;
}

function render_attr(attr_id, val) {
if (attr_id == 2335 || attr_id == 2336) {
return 100 * (val - 1);
} else if (attr_id == 2337 || attr_id == 2338) {
return -100 * (val - 1);
} else {
return val;
}
return val;
}

function attr_format(attr, data) {
base = `<span class='attr-${attr} attr-cell'>${data.real_value.toFixed(get_precision(attr))}</span>`;

Expand Down Expand Up @@ -212,6 +223,8 @@ function get_precision(attr_id) {
return 0;
} else if (attr_id == 204) {
return 4;
} else if (attr_id == 2335 || attr_id == 2336 || attr_id == 2337 || attr_id == 2338) {
return 3;
} else {
return 1;
}
Expand Down Expand Up @@ -239,7 +252,7 @@ function attribute_format(attrs) {

list += `<div class="col-12 col-md-4">
<img src="/static/img/attributes/${a}.png">
${attrs[a].real_value.toFixed(get_precision(a))} ${attrs[a].unit} ${rating}
${render_attr(a, attrs[a].real_value).toFixed(get_precision(a))} ${attrs[a].unit} ${rating}
</div>`;
}

Expand Down

0 comments on commit a2585dc

Please sign in to comment.