sq2 initial commit
This commit is contained in:
parent
adf65431d5
commit
e51f1ef92b
10 changed files with 7031 additions and 0 deletions
349
normalize.css
vendored
Normal file
349
normalize.css
vendored
Normal file
|
@ -0,0 +1,349 @@
|
|||
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
|
||||
|
||||
/* Document
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Correct the line height in all browsers.
|
||||
* 2. Prevent adjustments of font size after orientation changes in iOS.
|
||||
*/
|
||||
|
||||
html {
|
||||
line-height: 1.15; /* 1 */
|
||||
-webkit-text-size-adjust: 100%; /* 2 */
|
||||
}
|
||||
|
||||
/* Sections
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the margin in all browsers.
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the `main` element consistently in IE.
|
||||
*/
|
||||
|
||||
main {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the font size and margin on `h1` elements within `section` and
|
||||
* `article` contexts in Chrome, Firefox, and Safari.
|
||||
*/
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
|
||||
/* Grouping content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in Firefox.
|
||||
* 2. Show the overflow in Edge and IE.
|
||||
*/
|
||||
|
||||
hr {
|
||||
box-sizing: content-box; /* 1 */
|
||||
height: 0; /* 1 */
|
||||
overflow: visible; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
pre {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/* Text-level semantics
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the gray background on active links in IE 10.
|
||||
*/
|
||||
|
||||
a {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Remove the bottom border in Chrome 57-
|
||||
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
|
||||
*/
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: none; /* 1 */
|
||||
text-decoration: underline; /* 2 */
|
||||
text-decoration: underline dotted; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font weight in Chrome, Edge, and Safari.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent `sub` and `sup` elements from affecting the line height in
|
||||
* all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
/* Embedded content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the border on images inside links in IE 10.
|
||||
*/
|
||||
|
||||
img {
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
/* Forms
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Change the font styles in all browsers.
|
||||
* 2. Remove the margin in Firefox and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit; /* 1 */
|
||||
font-size: 100%; /* 1 */
|
||||
line-height: 1.15; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the overflow in IE.
|
||||
* 1. Show the overflow in Edge.
|
||||
*/
|
||||
|
||||
button,
|
||||
input { /* 1 */
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inheritance of text transform in Edge, Firefox, and IE.
|
||||
* 1. Remove the inheritance of text transform in Firefox.
|
||||
*/
|
||||
|
||||
button,
|
||||
select { /* 1 */
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the inability to style clickable types in iOS and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
[type="button"],
|
||||
[type="reset"],
|
||||
[type="submit"] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner border and padding in Firefox.
|
||||
*/
|
||||
|
||||
button::-moz-focus-inner,
|
||||
[type="button"]::-moz-focus-inner,
|
||||
[type="reset"]::-moz-focus-inner,
|
||||
[type="submit"]::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the focus styles unset by the previous rule.
|
||||
*/
|
||||
|
||||
button:-moz-focusring,
|
||||
[type="button"]:-moz-focusring,
|
||||
[type="reset"]:-moz-focusring,
|
||||
[type="submit"]:-moz-focusring {
|
||||
outline: 1px dotted ButtonText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the padding in Firefox.
|
||||
*/
|
||||
|
||||
fieldset {
|
||||
padding: 0.35em 0.75em 0.625em;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the text wrapping in Edge and IE.
|
||||
* 2. Correct the color inheritance from `fieldset` elements in IE.
|
||||
* 3. Remove the padding so developers are not caught out when they zero out
|
||||
* `fieldset` elements in all browsers.
|
||||
*/
|
||||
|
||||
legend {
|
||||
box-sizing: border-box; /* 1 */
|
||||
color: inherit; /* 2 */
|
||||
display: table; /* 1 */
|
||||
max-width: 100%; /* 1 */
|
||||
padding: 0; /* 3 */
|
||||
white-space: normal; /* 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
|
||||
*/
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the default vertical scrollbar in IE 10+.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in IE 10.
|
||||
* 2. Remove the padding in IE 10.
|
||||
*/
|
||||
|
||||
[type="checkbox"],
|
||||
[type="radio"] {
|
||||
box-sizing: border-box; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the cursor style of increment and decrement buttons in Chrome.
|
||||
*/
|
||||
|
||||
[type="number"]::-webkit-inner-spin-button,
|
||||
[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the odd appearance in Chrome and Safari.
|
||||
* 2. Correct the outline style in Safari.
|
||||
*/
|
||||
|
||||
[type="search"] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
outline-offset: -2px; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner padding in Chrome and Safari on macOS.
|
||||
*/
|
||||
|
||||
[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inability to style clickable types in iOS and Safari.
|
||||
* 2. Change font properties to `inherit` in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button; /* 1 */
|
||||
font: inherit; /* 2 */
|
||||
}
|
||||
|
||||
/* Interactive
|
||||
========================================================================== */
|
||||
|
||||
/*
|
||||
* Add the correct display in Edge, IE 10+, and Firefox.
|
||||
*/
|
||||
|
||||
details {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the correct display in all browsers.
|
||||
*/
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
/* Misc
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10+.
|
||||
*/
|
||||
|
||||
template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10.
|
||||
*/
|
||||
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
429
sq2.css
Normal file
429
sq2.css
Normal file
|
@ -0,0 +1,429 @@
|
|||
html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: 'Nunito', sans-serif;
|
||||
}
|
||||
|
||||
input::-webkit-calendar-picker-indicator {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
input {
|
||||
-webkit-appearance : none;
|
||||
border-radius : 0;
|
||||
}
|
||||
|
||||
textarea, input { outline: none; }
|
||||
|
||||
body {
|
||||
height: 100%;
|
||||
overflow: hidden; /* makes the body non-scrollable (we will add scrolling to the sidebar and main content containers) */
|
||||
margin: 0; /* removes default style */
|
||||
display: flex; /* enables flex content for its children */
|
||||
box-sizing: border-box;
|
||||
font-family: 'Nunito', sans-serif;
|
||||
}
|
||||
|
||||
/* Works on Firefox */
|
||||
* {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: rgb(30, 30, 30) rgb(45, 45, 45);
|
||||
}
|
||||
|
||||
/* Works on Chrome, Edge, and Safari */
|
||||
*::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar-track {
|
||||
background: rgb(45, 45, 45);
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar-thumb {
|
||||
background-color: rgb(30, 30, 30);
|
||||
}
|
||||
|
||||
.column {
|
||||
height: 100%; /* allows both columns to span the full height of the browser window */
|
||||
display: flex;
|
||||
flex-direction: column; /* places the left and right headers above the bottom content */
|
||||
}
|
||||
|
||||
#left { /* makes sure that content is not cut off in a smaller browser window */
|
||||
flex-shrink: 1;
|
||||
background-color: rgb(30, 30, 30);
|
||||
}
|
||||
|
||||
#right {
|
||||
flex-grow: 1;
|
||||
background-color: rgb(40, 40, 40);
|
||||
color: rgb(240, 240, 240);
|
||||
padding: 2%;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
img.item-icon {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
flex-grow: 1; /* ensures that the container will take up the full height of the parent container */
|
||||
overflow-y: auto;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.full-border, .box {
|
||||
border: 5px solid rgb(45, 45, 45);
|
||||
}
|
||||
|
||||
.top-half-border {
|
||||
border-top: 5px solid rgb(45, 45, 45);
|
||||
border-left: 5px solid rgb(45, 45, 45);
|
||||
border-right: 5px solid rgb(45, 45, 45);
|
||||
}
|
||||
|
||||
.bot-half-border {
|
||||
border-bottom: 5px solid rgb(45, 45, 45);
|
||||
border-left: 5px solid rgb(45, 45, 45);
|
||||
border-right: 5px solid rgb(45, 45, 45);
|
||||
}
|
||||
|
||||
.se-border {
|
||||
border-left: 5px solid rgb(45, 45, 45);
|
||||
border-right: 5px solid rgb(45, 45, 45);
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
p {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
input {
|
||||
background-color: rgb(40, 40, 40);
|
||||
border-color:rgb(45, 45, 45);
|
||||
color: rgb(240, 240, 240);
|
||||
min-width: 0;
|
||||
box-sizing: none;
|
||||
}
|
||||
|
||||
input.item-name {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
width: 13em;
|
||||
}
|
||||
|
||||
input.search-field {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
width: 9em;
|
||||
}
|
||||
|
||||
.equipment-container {
|
||||
background-color: rgb(30, 30, 30);
|
||||
flex-direction: column;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.all-equipment {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.weapon-container {
|
||||
display: inline-flex;
|
||||
background-color: rgb(30, 30, 30);
|
||||
}
|
||||
|
||||
.skp-container {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
background-color: rgb(30, 30, 30);
|
||||
}
|
||||
|
||||
td.mono-font {
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
}
|
||||
|
||||
td.damage-size {
|
||||
width: 7em;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.potency {
|
||||
width: 36em;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.skp-text {
|
||||
width: 7.75em;
|
||||
}
|
||||
|
||||
.skp-input {
|
||||
width: 7em;
|
||||
height: 1.2em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.center-screen {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.powder-input {
|
||||
text-align: center;
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
font-weight: bold;
|
||||
width: 13em;
|
||||
}
|
||||
|
||||
.skp-tooltip {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.draggable {
|
||||
position: absolute !important;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.draggable-header {
|
||||
cursor: move;
|
||||
z-index: 10;
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
text-align: center;
|
||||
}
|
||||
p.Damage {
|
||||
color: rgb(255, 198, 85)
|
||||
}
|
||||
|
||||
.Set {
|
||||
display: inline;
|
||||
color: #5f5;
|
||||
}
|
||||
|
||||
.Mana { color: #5ff;}
|
||||
.Mana:after { content: "\273A"}
|
||||
|
||||
.left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.f-w {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.shaded-table {
|
||||
background-color: rgb(30, 30, 30);
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
|
||||
border: 1px solid rgb(30, 30, 30);
|
||||
border-bottom: 1px solid rgb(45, 45, 45)
|
||||
/*
|
||||
border-top: 1px solid rgb(30, 30, 30);
|
||||
border-bottom: 1px solid rgb(45, 45, 45);*/
|
||||
}
|
||||
|
||||
.spacer-table {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.minimal-stats-container {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
vertical-align: top;
|
||||
background-color: rgb(30, 30, 30);
|
||||
width: 20.5em;
|
||||
}
|
||||
|
||||
.nDam {
|
||||
color: #FFAA00;
|
||||
}
|
||||
|
||||
.eDam, .Earth {
|
||||
color: #00AA00;
|
||||
}
|
||||
|
||||
.Earth:before { content: "\2724" ' '; }
|
||||
|
||||
.tDam, .Thunder {
|
||||
color: #FFFF55;
|
||||
}
|
||||
|
||||
.Thunder:before { content: "\2726" ' '; }
|
||||
|
||||
.wDam, .Water {
|
||||
color: #55FFFF
|
||||
}
|
||||
|
||||
.Water:before { content: "\2749" ' '; }
|
||||
|
||||
.fDam, .Fire {
|
||||
color: #FF5555;
|
||||
}
|
||||
|
||||
.Fire:before { content: "\2739" ' '; }
|
||||
|
||||
.aDam, .Air {
|
||||
color: #FFFFFF
|
||||
}
|
||||
|
||||
.Air:before { content: "\274b" ' '; }
|
||||
|
||||
.Neutral { color: #fa0; }
|
||||
.Neutral:before { content: "\2724" ' '; }
|
||||
.Damage { color: rgb(255, 198, 85)}
|
||||
|
||||
.Health {
|
||||
color: #AA0000
|
||||
}
|
||||
|
||||
.Health:before {
|
||||
content: "\2764" ' ';
|
||||
}
|
||||
|
||||
.Normal {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.Unique {
|
||||
color: #FFFF55;
|
||||
}
|
||||
|
||||
.Rare {
|
||||
color: #FF55FF;
|
||||
}
|
||||
|
||||
.Legendary {
|
||||
color: #55FFFF;
|
||||
}
|
||||
|
||||
.Fabled {
|
||||
color: #FF5555;
|
||||
}
|
||||
|
||||
.Mythic {
|
||||
color: #AA00AA
|
||||
}
|
||||
|
||||
p.no-newline {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.small-text {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.lvl {
|
||||
color: #d4d4d4
|
||||
}
|
||||
|
||||
.lvl:before {
|
||||
content: "Lv. "
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: rgb(30, 30, 30);
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.positive {
|
||||
color: #5f5;
|
||||
/*text-shadow: 2px 2px 0 #153f15;*/
|
||||
}
|
||||
|
||||
.negative {
|
||||
color: #f55;
|
||||
/*text-shadow: 2px 2px 0 #1f1515;*/
|
||||
}
|
||||
|
||||
.item-margin {
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.item-tooltip {
|
||||
max-width: 20em;
|
||||
background-color: rgb(30, 30, 30);
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.window-container {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
background-color: rgb(30, 30, 30);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.window-header {
|
||||
display: flex;
|
||||
cursor: move;
|
||||
background-color: rgb(45, 45, 45);
|
||||
}
|
||||
|
||||
.search-result-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
flex-basis: 40em;
|
||||
max-width: 20em;
|
||||
flex-grow: 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.button-boost {
|
||||
background-color: rgb(45, 45, 45);
|
||||
width: 10rem;
|
||||
border: 5px solid rgb(50, 50, 50)
|
||||
}
|
||||
|
||||
button.toggleOn{
|
||||
background-color:#0a0;
|
||||
border: 3 px solid rgb(0, 70, 0);
|
||||
}
|
||||
|
||||
.damageSubtitle {
|
||||
text-align: center;
|
||||
}
|
302
sq2.js
Normal file
302
sq2.js
Normal file
|
@ -0,0 +1,302 @@
|
|||
let equipment_keys = ['weapon', 'helmet', 'chestplate', 'leggings', 'boots', 'ring1', 'ring2', 'bracelet', 'necklace'];
|
||||
|
||||
$(document).ready(function(){
|
||||
// inits
|
||||
$("#column2").height($("#column1").height());
|
||||
$("#column3").height($("#column1").height());
|
||||
|
||||
$("#overall-window").toggle();
|
||||
$("#search-container").toggle();
|
||||
$("#boost-container").toggle();
|
||||
|
||||
// pot/base damage switch for weap display
|
||||
/*
|
||||
$(".damage-size").click(function(){
|
||||
$(".damage-size").hide();
|
||||
$(".potency").show();
|
||||
});
|
||||
$(".potency").click(function(){
|
||||
$(".potency").hide();
|
||||
$(".damage-size").show();
|
||||
});*/
|
||||
|
||||
// windows
|
||||
$("#overall-window").draggable({
|
||||
handle: '#overall-window-header',
|
||||
}).resizable({
|
||||
alsoResize: "#all-stats",
|
||||
handles: 'n, e, s ,w'
|
||||
});
|
||||
|
||||
$("#search-container").draggable({
|
||||
handle: '#search-container-header',
|
||||
});
|
||||
|
||||
$("#boost-container").draggable({
|
||||
handle: '#boost-container-header',
|
||||
});
|
||||
|
||||
// update builds
|
||||
jQuery(document).on("keypress", '.skp-input', function(event){
|
||||
if (event.keyCode == 13) {
|
||||
updateStats();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(document).on("keypress", '.search-field', function(event){
|
||||
if (event.keyCode == 13) {
|
||||
doItemSearch();
|
||||
}
|
||||
});
|
||||
|
||||
// set search style
|
||||
$("#weapon-choice").on('input', function(){
|
||||
set_input_style('weapon');
|
||||
check_item($("#weapon-choice").val());
|
||||
update_powder_count('weapon');
|
||||
});
|
||||
|
||||
$("#helmet-choice").on('input', function(){
|
||||
set_input_style('helmet');
|
||||
check_item($("#helmet-choice").val());
|
||||
update_powder_count('helmet', '|example: t6t6');
|
||||
});
|
||||
|
||||
$("#chestplate-choice").on('input', function(){
|
||||
set_input_style('chestplate');
|
||||
check_item($("#chestplate-choice").val());
|
||||
update_powder_count('chestplate');
|
||||
});
|
||||
|
||||
$("#leggings-choice").on('input', function(){
|
||||
set_input_style('leggings');
|
||||
check_item($("#leggings-choice").val());
|
||||
update_powder_count('leggings');
|
||||
});
|
||||
|
||||
$("#boots-choice").on('input', function(){
|
||||
set_input_style('boots');
|
||||
check_item($("#boots-choice").val());
|
||||
update_powder_count('boots');
|
||||
});
|
||||
|
||||
$("#ring1-choice").on('input', function(){
|
||||
set_input_style('ring1');
|
||||
check_item($("#ring1-choice").val());
|
||||
});
|
||||
|
||||
$("#ring2-choice").on('input', function(){
|
||||
set_input_style('ring2');
|
||||
check_item($("#ring2-choice").val());
|
||||
});
|
||||
|
||||
$("#bracelet-choice").on('input', function(){
|
||||
set_input_style('bracelet');
|
||||
check_item($("#bracelet-choice").val());
|
||||
});
|
||||
|
||||
$("#necklace-choice").on('input', function(){
|
||||
set_input_style('necklace');
|
||||
check_item($("#necklace-choice").val());
|
||||
});
|
||||
|
||||
// control vars
|
||||
let basic_stats_ctrl = true;
|
||||
let off_stats_ctrl = false;
|
||||
let def_stats_ctrl = false;
|
||||
|
||||
$("#basic-stats-btn").click(function(){
|
||||
basic_stats_ctrl = true;
|
||||
off_stats_ctrl = false;
|
||||
def_stats_ctrl = false;
|
||||
|
||||
$("#minimal-stats").show();
|
||||
$("#minimal-offensive-stats").hide();
|
||||
$("#minimal-defensive-stats").hide();
|
||||
|
||||
$("#off-stats-btn").css("background-color", "rgb(45, 45, 45)");
|
||||
$("#def-stats-btn").css("background-color", "rgb(45, 45, 45)");
|
||||
});
|
||||
$("#basic-stats-btn").hover(
|
||||
function(){
|
||||
$("#basic-stats-btn").css("background-color", "rgb(40, 40, 40)");
|
||||
},function(){
|
||||
if (basic_stats_ctrl) {
|
||||
$("#basic-stats-btn").css("background-color", "rgb(30, 30, 30)");
|
||||
} else {
|
||||
$("#basic-stats-btn").css("background-color", "rgb(45, 45, 45)");
|
||||
}
|
||||
});
|
||||
|
||||
$("#off-stats-btn").click(function(){
|
||||
basic_stats_ctrl = false;
|
||||
off_stats_ctrl = true;
|
||||
def_stats_ctrl = false;
|
||||
|
||||
$("#minimal-stats").hide();
|
||||
$("#minimal-offensive-stats").show();
|
||||
$("#minimal-defensive-stats").hide();
|
||||
|
||||
$("#basic-stats-btn").css("background-color", "rgb(45, 45, 45)");
|
||||
$("#def-stats-btn").css("background-color", "rgb(45, 45, 45)");
|
||||
});
|
||||
$("#off-stats-btn").hover(
|
||||
function(){
|
||||
$("#off-stats-btn").css("background-color", "rgb(40, 40, 40)");
|
||||
},function(){
|
||||
if (off_stats_ctrl) {
|
||||
$("#off-stats-btn").css("background-color", "rgb(30, 30, 30)");
|
||||
} else {
|
||||
$("#off-stats-btn").css("background-color", "rgb(45, 45, 45)");
|
||||
}
|
||||
});
|
||||
|
||||
$("#def-stats-btn").click(function(){
|
||||
basic_stats_ctrl = false;
|
||||
off_stats_ctrl = false;
|
||||
def_stats_ctrl = true;
|
||||
|
||||
$("#minimal-stats").hide();
|
||||
$("#minimal-offensive-stats").hide();
|
||||
$("#minimal-defensive-stats").show();
|
||||
|
||||
$("#off-stats-btn").css("background-color", "rgb(45, 45, 45)");
|
||||
$("#basic-stats-btn").css("background-color", "rgb(45, 45, 45)");
|
||||
});
|
||||
$("#def-stats-btn").hover(
|
||||
function(){
|
||||
$("#def-stats-btn").css("background-color", "rgb(40, 40, 40)");
|
||||
},function(){
|
||||
if (def_stats_ctrl) {
|
||||
$("#def-stats-btn").css("background-color", "rgb(30, 30, 30)");
|
||||
} else {
|
||||
$("#def-stats-btn").css("background-color", "rgb(45, 45, 45)");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// item tooltip
|
||||
init_tooltip_loc()
|
||||
|
||||
$("#weapon-img-loc").hover(function(event){
|
||||
$("#weapon-tooltip").show();
|
||||
}, function(){
|
||||
$("#weapon-tooltip").hide();
|
||||
});
|
||||
|
||||
$("#helmet-img-loc").hover(function(event){
|
||||
$("#helmet-tooltip").show();
|
||||
}, function(){
|
||||
$("#helmet-tooltip").hide();
|
||||
});
|
||||
|
||||
$("#chestplate-img-loc").hover(function(event){
|
||||
$("#chestplate-tooltip").show();
|
||||
}, function(){
|
||||
$("#chestplate-tooltip").hide();
|
||||
});
|
||||
|
||||
$("#leggings-img-loc").hover(function(event){
|
||||
$("#leggings-tooltip").show();
|
||||
}, function(){
|
||||
$("#leggings-tooltip").hide();
|
||||
});
|
||||
|
||||
$("#boots-img-loc").hover(function(event){
|
||||
$("#boots-tooltip").show();
|
||||
}, function(){
|
||||
$("#boots-tooltip").hide();
|
||||
});
|
||||
|
||||
$("#ring1-img-loc").hover(function(event){
|
||||
$("#ring1-tooltip").show();
|
||||
}, function(){
|
||||
$("#ring1-tooltip").hide();
|
||||
});
|
||||
|
||||
$("#ring2-img-loc").hover(function(event){
|
||||
$("#ring2-tooltip").show();
|
||||
}, function(){
|
||||
$("#ring2-tooltip").hide();
|
||||
});
|
||||
|
||||
$("#bracelet-img-loc").hover(function(event){
|
||||
$("#bracelet-tooltip").show();
|
||||
}, function(){
|
||||
$("#bracelet-tooltip").hide();
|
||||
});
|
||||
|
||||
$("#necklace-img-loc").hover(function(event){
|
||||
$("#necklace-tooltip").show();
|
||||
}, function(){
|
||||
$("#necklace-tooltip").hide();
|
||||
});
|
||||
});
|
||||
|
||||
function set_input_style(type) {
|
||||
let item = itemMap.get($("#"+type+"-choice").val());
|
||||
if (item) {
|
||||
$("#"+type+"-choice").addClass(item.tier);
|
||||
if (type == 'weapon') {
|
||||
$("#"+type+"-img").attr('src', 'media/items/new/generic-'+item.type+'.png');
|
||||
}
|
||||
} else {
|
||||
$("#"+type+"-choice").attr('class', 'item-name');
|
||||
}
|
||||
}
|
||||
|
||||
function check_item(name) {
|
||||
if (itemMap.has(name)) {
|
||||
calculateBuild()
|
||||
}
|
||||
}
|
||||
|
||||
function init_tooltip_loc(){
|
||||
for (const i in equipment_keys) {
|
||||
let ImgLoc = document.getElementById(equipment_keys[i]+'-img-loc').getBoundingClientRect();
|
||||
$("#"+equipment_keys[i]+"-tooltip").css('top', ImgLoc.bottom);
|
||||
$("#"+equipment_keys[i]+"-tooltip").css('left', ImgLoc.left);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
document.getElementById(armorType+"-choice").addEventListener("change", (event) => {
|
||||
let item_name = event.target.value;
|
||||
let nSlots = undefined;
|
||||
if (itemMap.has(item_name)) {
|
||||
let item = itemMap.get(item_name);
|
||||
nSlots = item["slots"];
|
||||
//console.log(item);
|
||||
}
|
||||
else {
|
||||
let crafted_custom_item = getCraftFromHash(item_name) !== undefined ? getCraftFromHash(item_name) : (getCustomFromHash(item_name) !== undefined ? getCustomFromHash(item_name) : undefined);
|
||||
if (crafted_custom_item !== undefined) {
|
||||
nSlots = crafted_custom_item.statMap.get("slots");
|
||||
}
|
||||
}
|
||||
if (nSlots !== undefined) {
|
||||
document.getElementById(armorType+"-slots").textContent = nSlots + " slots";
|
||||
}
|
||||
else {
|
||||
document.getElementById(armorType+"-slots").textContent = "X slots";
|
||||
}
|
||||
});*/
|
||||
|
||||
function update_powder_count(type, alt="") {
|
||||
let item = itemMap.get($("#"+type+"-choice").val());
|
||||
if (item) {
|
||||
$("#"+type+"-powder").attr("placeholder", item["slots"]+" slots"+alt);
|
||||
}
|
||||
}
|
||||
|
||||
function init_equipUI() {
|
||||
for (const i in equipment_keys) {
|
||||
set_input_style(equipment_keys[i]);
|
||||
}
|
||||
update_powder_count('weapon');
|
||||
update_powder_count('helmet', '|example: t6t6');
|
||||
update_powder_count('chestplate');
|
||||
update_powder_count('leggings');
|
||||
update_powder_count('boots');
|
||||
}
|
558
sq2build.js
Normal file
558
sq2build.js
Normal file
|
@ -0,0 +1,558 @@
|
|||
|
||||
|
||||
const classDefenseMultipliers = new Map([ ["relik",0.50], ["bow",0.60], ["wand", 0.80], ["dagger", 1.0], ["spear",1.20], ["sword", 1.10]]);
|
||||
|
||||
/**
|
||||
* @description Error to catch items that don't exist.
|
||||
* @module ItemNotFound
|
||||
*/
|
||||
class ItemNotFound {
|
||||
/**
|
||||
* @class
|
||||
* @param {String} item the item name entered
|
||||
* @param {String} type the type of item
|
||||
* @param {Boolean} genElement whether to generate an element from inputs
|
||||
* @param {String} override override for item type
|
||||
*/
|
||||
constructor(item, type, genElement, override) {
|
||||
/**
|
||||
* @public
|
||||
* @type {String}
|
||||
*/
|
||||
this.message = `Cannot find ${override||type} named ${item}`;
|
||||
if (genElement)
|
||||
/**
|
||||
* @public
|
||||
* @type {Element}
|
||||
*/
|
||||
this.element = document.getElementById(`${type}-choice`).parentElement.querySelectorAll("p.error")[0];
|
||||
else
|
||||
this.element = document.createElement("div");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Error to catch incorrect input.
|
||||
* @module IncorrectInput
|
||||
*/
|
||||
class IncorrectInput {
|
||||
/**
|
||||
* @class
|
||||
* @param {String} input the inputted text
|
||||
* @param {String} format the correct format
|
||||
* @param {String} sibling the id of the error node's sibling
|
||||
*/
|
||||
constructor(input, format, sibling) {
|
||||
/**
|
||||
* @public
|
||||
* @type {String}
|
||||
*/
|
||||
this.message = `${input} is incorrect. Example: ${format}`;
|
||||
/**
|
||||
* @public
|
||||
* @type {String}
|
||||
*/
|
||||
this.id = sibling;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Error that inputs an array of items to generate errors of.
|
||||
* @module ListError
|
||||
* @extends Error
|
||||
*/
|
||||
class ListError extends Error {
|
||||
/**
|
||||
* @class
|
||||
* @param {Array} errors array of errors
|
||||
*/
|
||||
constructor(errors) {
|
||||
let ret = [];
|
||||
if (typeof errors[0] == "string") {
|
||||
super(errors[0]);
|
||||
} else {
|
||||
super(errors[0].message);
|
||||
}
|
||||
for (let i of errors) {
|
||||
if (typeof i == "string") {
|
||||
ret.push(new Error(i));
|
||||
} else {
|
||||
ret.push(i);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
* @type {Object[]}
|
||||
*/
|
||||
this.errors = ret;
|
||||
}
|
||||
}
|
||||
|
||||
/*Class that represents a wynn player's build.
|
||||
*/
|
||||
class Build{
|
||||
|
||||
/**
|
||||
* @description Construct a build.
|
||||
* @param {Number} level : Level of the player.
|
||||
* @param {String[]} equipment : List of equipment names that make up the build.
|
||||
* In order: boots, Chestplate, Leggings, Boots, Ring1, Ring2, Brace, Neck, Weapon.
|
||||
* @param {Number[]} powders : Powder application. List of lists of integers (powder IDs).
|
||||
* In order: boots, Chestplate, Leggings, Boots, Weapon.
|
||||
* @param {Object[]} inputerrors : List of instances of error-like classes.
|
||||
*/
|
||||
constructor(level,equipment, powders, externalStats, inputerrors=[]){
|
||||
|
||||
let errors = inputerrors;
|
||||
//this contains the Craft objects, if there are any crafted items. this.boots, etc. will contain the statMap of the Craft (which is built to be an expandedItem).
|
||||
this.craftedItems = [];
|
||||
this.customItems = [];
|
||||
// NOTE: powders is just an array of arrays of powder IDs. Not powder objects.
|
||||
this.powders = powders;
|
||||
if(itemMap.get(equipment[0]) && itemMap.get(equipment[0]).type === "helmet") {
|
||||
const helmet = itemMap.get(equipment[0]);
|
||||
this.powders[0] = this.powders[0].slice(0,helmet.slots);
|
||||
this.helmet = expandItem(helmet, this.powders[0]);
|
||||
} else {
|
||||
try {
|
||||
let helmet = getCustomFromHash(equipment[0]) ? getCustomFromHash(equipment[0]) : (getCraftFromHash(equipment[0]) ? getCraftFromHash(equipment[0]) : undefined);
|
||||
if (helmet.statMap.get("type") !== "helmet") {
|
||||
throw new Error("Not a helmet");
|
||||
}
|
||||
this.powders[0] = this.powders[0].slice(0,helmet.statMap.get("slots"));
|
||||
helmet.statMap.set("powders",this.powders[0].slice());
|
||||
this.helmet = helmet.statMap;
|
||||
applyArmorPowders(this.helmet, this.powders[0]);
|
||||
if (this.helmet.get("custom")) {
|
||||
this.customItems.push(helmet);
|
||||
} else if (this.helmet.get("crafted")) { //customs can also be crafted, but custom takes priority.
|
||||
this.craftedItems.push(helmet);
|
||||
}
|
||||
|
||||
} catch (Error) {
|
||||
const helmet = itemMap.get("No Helmet");
|
||||
this.powders[0] = this.powders[0].slice(0,helmet.slots);
|
||||
this.helmet = expandItem(helmet, this.powders[0]);
|
||||
errors.push(new ItemNotFound(equipment[0], "helmet", true));
|
||||
}
|
||||
}
|
||||
if(itemMap.get(equipment[1]) && itemMap.get(equipment[1]).type === "chestplate") {
|
||||
const chestplate = itemMap.get(equipment[1]);
|
||||
this.powders[1] = this.powders[1].slice(0,chestplate.slots);
|
||||
this.chestplate = expandItem(chestplate, this.powders[1]);
|
||||
} else {
|
||||
try {
|
||||
let chestplate = getCustomFromHash(equipment[1]) ? getCustomFromHash(equipment[1]) : (getCraftFromHash(equipment[1]) ? getCraftFromHash(equipment[1]) : undefined);
|
||||
if (chestplate.statMap.get("type") !== "chestplate") {
|
||||
throw new Error("Not a chestplate");
|
||||
}
|
||||
this.powders[1] = this.powders[1].slice(0,chestplate.statMap.get("slots"));
|
||||
chestplate.statMap.set("powders",this.powders[1].slice());
|
||||
this.chestplate = chestplate.statMap;
|
||||
applyArmorPowders(this.chesplate, this.powders[1]);
|
||||
if (this.chestplate.get("custom")) {
|
||||
this.customItems.push(chestplate);
|
||||
} else if (this.chestplate.get("crafted")) { //customs can also be crafted, but custom takes priority.
|
||||
this.craftedItems.push(chestplate);
|
||||
}
|
||||
} catch (Error) {
|
||||
console.log(Error);
|
||||
const chestplate = itemMap.get("No Chestplate");
|
||||
this.powders[1] = this.powders[1].slice(0,chestplate.slots);
|
||||
this.chestplate = expandItem(chestplate, this.powders[1]);
|
||||
errors.push(new ItemNotFound(equipment[1], "chestplate", true));
|
||||
}
|
||||
}
|
||||
if (itemMap.get(equipment[2]) && itemMap.get(equipment[2]).type === "leggings") {
|
||||
const leggings = itemMap.get(equipment[2]);
|
||||
this.powders[2] = this.powders[2].slice(0,leggings.slots);
|
||||
this.leggings = expandItem(leggings, this.powders[2]);
|
||||
} else {
|
||||
try {
|
||||
let leggings = getCustomFromHash(equipment[2]) ? getCustomFromHash(equipment[2]) : (getCraftFromHash(equipment[2]) ? getCraftFromHash(equipment[2]) : undefined);
|
||||
if (leggings.statMap.get("type") !== "leggings") {
|
||||
throw new Error("Not a leggings");
|
||||
}
|
||||
this.powders[2] = this.powders[2].slice(0,leggings.statMap.get("slots"));
|
||||
leggings.statMap.set("powders",this.powders[2].slice());
|
||||
this.leggings = leggings.statMap;
|
||||
applyArmorPowders(this.leggings, this.powders[2]);
|
||||
if (this.leggings.get("custom")) {
|
||||
this.customItems.push(leggings);
|
||||
} else if (this.leggings.get("crafted")) { //customs can also be crafted, but custom takes priority.
|
||||
this.craftedItems.push(leggings);
|
||||
}
|
||||
} catch (Error) {
|
||||
const leggings = itemMap.get("No Leggings");
|
||||
this.powders[2] = this.powders[2].slice(0,leggings.slots);
|
||||
this.leggings = expandItem(leggings, this.powders[2]);
|
||||
errors.push(new ItemNotFound(equipment[2], "leggings", true));
|
||||
}
|
||||
}
|
||||
if (itemMap.get(equipment[3]) && itemMap.get(equipment[3]).type === "boots") {
|
||||
const boots = itemMap.get(equipment[3]);
|
||||
this.powders[3] = this.powders[3].slice(0,boots.slots);
|
||||
this.boots = expandItem(boots, this.powders[3]);
|
||||
} else {
|
||||
try {
|
||||
let boots = getCustomFromHash(equipment[3]) ? getCustomFromHash(equipment[3]) : (getCraftFromHash(equipment[3]) ? getCraftFromHash(equipment[3]) : undefined);
|
||||
if (boots.statMap.get("type") !== "boots") {
|
||||
throw new Error("Not a boots");
|
||||
}
|
||||
this.powders[3] = this.powders[3].slice(0,boots.statMap.get("slots"));
|
||||
boots.statMap.set("powders",this.powders[3].slice());
|
||||
this.boots = boots.statMap;
|
||||
applyArmorPowders(this.boots, this.powders[3]);
|
||||
if (this.boots.get("custom")) {
|
||||
this.customItems.push(boots);
|
||||
} else if (this.boots.get("crafted")) { //customs can also be crafted, but custom takes priority.
|
||||
this.craftedItems.push(boots);
|
||||
}
|
||||
} catch (Error) {
|
||||
const boots = itemMap.get("No Boots");
|
||||
this.powders[3] = this.powders[3].slice(0,boots.slots);
|
||||
this.boots = expandItem(boots, this.powders[3]);
|
||||
errors.push(new ItemNotFound(equipment[3], "boots", true));
|
||||
}
|
||||
}
|
||||
if(itemMap.get(equipment[4]) && itemMap.get(equipment[4]).type === "ring") {
|
||||
const ring = itemMap.get(equipment[4]);
|
||||
this.ring1 = expandItem(ring, []);
|
||||
}else{
|
||||
try {
|
||||
let ring = getCustomFromHash(equipment[4]) ? getCustomFromHash(equipment[4]) : (getCraftFromHash(equipment[4]) ? getCraftFromHash(equipment[4]) : undefined);
|
||||
if (ring.statMap.get("type") !== "ring") {
|
||||
throw new Error("Not a ring");
|
||||
}
|
||||
this.ring1 = ring.statMap;
|
||||
if (this.ring1.get("custom")) {
|
||||
this.customItems.push(ring);
|
||||
} else if (this.ring1.get("crafted")) { //customs can also be crafted, but custom takes priority.
|
||||
this.craftedItems.push(ring);
|
||||
}
|
||||
} catch (Error) {
|
||||
const ring = itemMap.get("No Ring 1");
|
||||
this.ring1 = expandItem(ring, []);
|
||||
errors.push(new ItemNotFound(equipment[4], "ring1", true, "ring"));
|
||||
}
|
||||
}
|
||||
if(itemMap.get(equipment[5]) && itemMap.get(equipment[5]).type === "ring") {
|
||||
const ring = itemMap.get(equipment[5]);
|
||||
this.ring2 = expandItem(ring, []);
|
||||
}else{
|
||||
try {
|
||||
let ring = getCustomFromHash(equipment[5]) ? getCustomFromHash(equipment[5]) : (getCraftFromHash(equipment[5]) ? getCraftFromHash(equipment[5]) : undefined);
|
||||
if (ring.statMap.get("type") !== "ring") {
|
||||
throw new Error("Not a ring");
|
||||
}
|
||||
this.ring2 = ring.statMap;
|
||||
if (this.ring2.get("custom")) {
|
||||
this.customItems.push(ring);
|
||||
} else if (this.ring2.get("crafted")) { //customs can also be crafted, but custom takes priority.
|
||||
this.craftedItems.push(ring);
|
||||
}
|
||||
} catch (Error) {
|
||||
const ring = itemMap.get("No Ring 2");
|
||||
this.ring2 = expandItem(ring, []);
|
||||
errors.push(new ItemNotFound(equipment[5], "ring2", true, "ring"));
|
||||
}
|
||||
}
|
||||
if(itemMap.get(equipment[6]) && itemMap.get(equipment[6]).type === "bracelet") {
|
||||
const bracelet = itemMap.get(equipment[6]);
|
||||
this.bracelet = expandItem(bracelet, []);
|
||||
}else{
|
||||
try {
|
||||
let bracelet = getCustomFromHash(equipment[6]) ? getCustomFromHash(equipment[6]) : (getCraftFromHash(equipment[6]) ? getCraftFromHash(equipment[6]) : undefined);
|
||||
if (bracelet.statMap.get("type") !== "bracelet") {
|
||||
throw new Error("Not a bracelet");
|
||||
}
|
||||
this.bracelet = bracelet.statMap;
|
||||
if (this.bracelet.get("custom")) {
|
||||
this.customItems.push(bracelet);
|
||||
} else if (this.bracelet.get("crafted")) { //customs can also be crafted, but custom takes priority.
|
||||
this.craftedItems.push(bracelet);
|
||||
}
|
||||
} catch (Error) {
|
||||
const bracelet = itemMap.get("No Bracelet");
|
||||
this.bracelet = expandItem(bracelet, []);
|
||||
errors.push(new ItemNotFound(equipment[6], "bracelet", true));
|
||||
}
|
||||
}
|
||||
if(itemMap.get(equipment[7]) && itemMap.get(equipment[7]).type === "necklace") {
|
||||
const necklace = itemMap.get(equipment[7]);
|
||||
this.necklace = expandItem(necklace, []);
|
||||
}else{
|
||||
try {
|
||||
let necklace = getCustomFromHash(equipment[7]) ? getCustomFromHash(equipment[7]) : (getCraftFromHash(equipment[7]) ? getCraftFromHash(equipment[7]) : undefined);
|
||||
if (necklace.statMap.get("type") !== "necklace") {
|
||||
throw new Error("Not a necklace");
|
||||
}
|
||||
this.necklace = necklace.statMap;
|
||||
if (this.necklace.get("custom")) {
|
||||
this.customItems.push(necklace);
|
||||
} else if (this.necklace.get("crafted")) { //customs can also be crafted, but custom takes priority.
|
||||
this.craftedItems.push(necklace);
|
||||
}
|
||||
} catch (Error) {
|
||||
const necklace = itemMap.get("No Necklace");
|
||||
this.necklace = expandItem(necklace, []);
|
||||
errors.push(new ItemNotFound(equipment[7], "necklace", true));
|
||||
}
|
||||
}
|
||||
|
||||
if(itemMap.get(equipment[8]) && itemMap.get(equipment[8]).category === "weapon") {
|
||||
const weapon = itemMap.get(equipment[8]);
|
||||
this.powders[4] = this.powders[4].slice(0,weapon.slots);
|
||||
this.weapon = expandItem(weapon, this.powders[4]);
|
||||
/*
|
||||
if (equipment[8] !== "No Weapon") {
|
||||
document.getElementsByClassName("powder-specials")[0].style.display = "grid";
|
||||
} else {
|
||||
document.getElementsByClassName("powder-specials")[0].style.display = "none";
|
||||
}*/
|
||||
}else{
|
||||
try {
|
||||
let weapon = getCustomFromHash(equipment[8]) ? getCustomFromHash(equipment[8]) : (getCraftFromHash(equipment[8]) ? getCraftFromHash(equipment[8]) : undefined);
|
||||
if (weapon.statMap.get("category") !== "weapon") {
|
||||
throw new Error("Not a weapon");
|
||||
}
|
||||
this.weapon = weapon.statMap;
|
||||
if (this.weapon.get("custom")) {
|
||||
this.customItems.push(weapon);
|
||||
} else if (this.weapon.get("crafted")) { //customs can also be crafted, but custom takes priority.
|
||||
this.craftedItems.push(weapon);
|
||||
}
|
||||
this.powders[4] = this.powders[4].slice(0,this.weapon.get("slots"));
|
||||
this.weapon.set("powders",this.powders[4].slice());
|
||||
document.getElementsByClassName("powder-specials")[0].style.display = "grid";
|
||||
} catch (Error) {
|
||||
const weapon = itemMap.get("No Weapon");
|
||||
this.powders[4] = this.powders[4].slice(0,weapon.slots);
|
||||
this.weapon = expandItem(weapon, this.powders[4]);
|
||||
document.getElementsByClassName("powder-specials")[0].style.display = "none";
|
||||
errors.push(new ItemNotFound(equipment[8], "weapon", true));
|
||||
}
|
||||
}
|
||||
|
||||
//console.log(this.craftedItems)
|
||||
|
||||
if (level < 1) { //Should these be constants?
|
||||
this.level = 1;
|
||||
} else if (level > 106) {
|
||||
this.level = 106;
|
||||
} else if (level <= 106 && level >= 1) {
|
||||
this.level = level;
|
||||
} else if (typeof level === "string") {
|
||||
this.level = level;
|
||||
errors.push(new IncorrectInput(level, "a number", "level-choice"));
|
||||
} else {
|
||||
errors.push("Level is not a string or number.");
|
||||
}
|
||||
document.getElementById("level-choice").value = this.level;
|
||||
|
||||
this.availableSkillpoints = levelToSkillPoints(this.level);
|
||||
this.equipment = [ this.helmet, this.chestplate, this.leggings, this.boots, this.ring1, this.ring2, this.bracelet, this.necklace ];
|
||||
this.items = this.equipment.concat([this.weapon]);
|
||||
// return [equip_order, best_skillpoints, final_skillpoints, best_total];
|
||||
let result = calculate_skillpoints(this.equipment, this.weapon);
|
||||
console.log(result);
|
||||
this.equip_order = result[0];
|
||||
// How many skillpoints the player had to assign (5 number)
|
||||
this.base_skillpoints = result[1];
|
||||
// How many skillpoints the build ended up with (5 number)
|
||||
this.total_skillpoints = result[2];
|
||||
// How many skillpoints assigned (1 number, sum of base_skillpoints)
|
||||
this.assigned_skillpoints = result[3];
|
||||
this.activeSetCounts = result[4];
|
||||
|
||||
// For strength boosts like warscream, vanish, etc.
|
||||
this.damageMultiplier = 1.0;
|
||||
this.defenseMultiplier = 1.0;
|
||||
|
||||
// For other external boosts ;-;
|
||||
this.externalStats = externalStats;
|
||||
|
||||
this.initBuildStats();
|
||||
|
||||
// Remove every error before adding specific ones
|
||||
for (let i of document.getElementsByClassName("error")) {
|
||||
i.textContent = "";
|
||||
}
|
||||
this.errors = errors;
|
||||
if (errors.length > 0) this.errored = true;
|
||||
}
|
||||
|
||||
/*Returns build in string format
|
||||
*/
|
||||
toString(){
|
||||
return [this.equipment,this.weapon].flat();
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
|
||||
getSpellCost(spellIdx, cost) {
|
||||
return Math.max(1, this.getBaseSpellCost(spellIdx, cost));
|
||||
}
|
||||
|
||||
getBaseSpellCost(spellIdx, cost) {
|
||||
cost = Math.ceil(cost * (1 - skillPointsToPercentage(this.total_skillpoints[2])));
|
||||
cost += this.statMap.get("spRaw"+spellIdx);
|
||||
return Math.floor(cost * (1 + this.statMap.get("spPct"+spellIdx) / 100));
|
||||
}
|
||||
|
||||
|
||||
/* Get melee stats for build.
|
||||
Returns an array in the order:
|
||||
*/
|
||||
getMeleeStats(){
|
||||
const stats = this.statMap;
|
||||
if (this.weapon.get("tier") === "Crafted") {
|
||||
stats.set("damageBases", [this.weapon.get("nDamBaseHigh"),this.weapon.get("eDamBaseHigh"),this.weapon.get("tDamBaseHigh"),this.weapon.get("wDamBaseHigh"),this.weapon.get("fDamBaseHigh"),this.weapon.get("aDamBaseHigh")]);
|
||||
}
|
||||
let adjAtkSpd = attackSpeeds.indexOf(stats.get("atkSpd")) + stats.get("atkTier");
|
||||
if(adjAtkSpd > 6){
|
||||
adjAtkSpd = 6;
|
||||
}else if(adjAtkSpd < 0){
|
||||
adjAtkSpd = 0;
|
||||
}
|
||||
|
||||
let damage_mult = 1;
|
||||
if (this.weapon.get("type") === "relik") {
|
||||
damage_mult = 0.99; // CURSE YOU WYNNCRAFT
|
||||
//One day we will create WynnWynn and no longer have shaman 99% melee injustice.
|
||||
//In all seriousness 99% is because wynn uses 0.33 to estimate dividing the damage by 3 to split damage between 3 beams.
|
||||
}
|
||||
// 0spellmult for melee damage.
|
||||
let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], stats.get("mdRaw"), stats.get("mdPct") + this.externalStats.get("mdPct"), 0, this.weapon, this.total_skillpoints, damage_mult * this.damageMultiplier, this.externalStats);
|
||||
|
||||
let dex = this.total_skillpoints[1];
|
||||
|
||||
let totalDamNorm = results[0];
|
||||
let totalDamCrit = results[1];
|
||||
totalDamNorm.push(1-skillPointsToPercentage(dex));
|
||||
totalDamCrit.push(skillPointsToPercentage(dex));
|
||||
let damages_results = results[2];
|
||||
|
||||
let singleHitTotal = ((totalDamNorm[0]+totalDamNorm[1])*(totalDamNorm[2])
|
||||
+(totalDamCrit[0]+totalDamCrit[1])*(totalDamCrit[2]))/2;
|
||||
|
||||
//Now do math
|
||||
let normDPS = (totalDamNorm[0]+totalDamNorm[1])/2 * baseDamageMultiplier[adjAtkSpd];
|
||||
let critDPS = (totalDamCrit[0]+totalDamCrit[1])/2 * baseDamageMultiplier[adjAtkSpd];
|
||||
let avgDPS = (normDPS * (1 - skillPointsToPercentage(dex))) + (critDPS * (skillPointsToPercentage(dex)));
|
||||
//[[n n n n] [e e e e] [t t t t] [w w w w] [f f f f] [a a a a] [lowtotal hightotal normalChance] [critlowtotal crithightotal critChance] normalDPS critCPS averageDPS adjAttackSpeed, singleHit]
|
||||
return damages_results.concat([totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS,adjAtkSpd, singleHitTotal]).concat(results[3]);
|
||||
}
|
||||
|
||||
/*
|
||||
Get all defensive stats for this build.
|
||||
*/
|
||||
getDefenseStats(){
|
||||
const stats = this.statMap;
|
||||
let defenseStats = [];
|
||||
let def_pct = skillPointsToPercentage(this.total_skillpoints[3]);
|
||||
let agi_pct = skillPointsToPercentage(this.total_skillpoints[4]);
|
||||
//total hp
|
||||
let totalHp = stats.get("hp") + stats.get("hpBonus");
|
||||
if (totalHp < 5) totalHp = 5;
|
||||
defenseStats.push(totalHp);
|
||||
//EHP
|
||||
let ehp = [totalHp, totalHp];
|
||||
let defMult = classDefenseMultipliers.get(this.weapon.get("type"));
|
||||
ehp[0] /= ((1-def_pct)*(1-agi_pct)*(2-defMult)*(2-this.defenseMultiplier));
|
||||
ehp[1] /= ((1-def_pct)*(2-defMult)*(2-this.defenseMultiplier));
|
||||
defenseStats.push(ehp);
|
||||
//HPR
|
||||
let totalHpr = rawToPct(stats.get("hprRaw"), stats.get("hprPct")/100.);
|
||||
defenseStats.push(totalHpr);
|
||||
//EHPR
|
||||
let ehpr = [totalHpr, totalHpr];
|
||||
ehpr[0] /= ((1-def_pct)*(1-agi_pct)*(2-defMult)*(2-this.defenseMultiplier));
|
||||
ehpr[1] /= ((1-def_pct)*(2-defMult)*(2-this.defenseMultiplier));
|
||||
defenseStats.push(ehpr);
|
||||
//skp stats
|
||||
defenseStats.push([ (1 - ((1-def_pct) * (2 - this.defenseMultiplier)))*100, agi_pct*100]);
|
||||
//eledefs - TODO POWDERS
|
||||
let eledefs = [0, 0, 0, 0, 0];
|
||||
for(const i in skp_elements){ //kinda jank but ok
|
||||
eledefs[i] = rawToPct(stats.get(skp_elements[i] + "Def"), stats.get(skp_elements[i] + "DefPct")/100.);
|
||||
}
|
||||
defenseStats.push(eledefs);
|
||||
|
||||
//[total hp, [ehp w/ agi, ehp w/o agi], total hpr, [ehpr w/ agi, ehpr w/o agi], [def%, agi%], [edef,tdef,wdef,fdef,adef]]
|
||||
return defenseStats;
|
||||
}
|
||||
|
||||
/* Get all stats for this build. Stores in this.statMap.
|
||||
@pre The build itself should be valid. No checking of validity of pieces is done here.
|
||||
*/
|
||||
initBuildStats(){
|
||||
|
||||
let staticIDs = ["hp", "eDef", "tDef", "wDef", "fDef", "aDef", "str", "dex", "int", "def", "agi"];
|
||||
|
||||
//Create a map of this build's stats
|
||||
let statMap = new Map();
|
||||
|
||||
for (const staticID of staticIDs) {
|
||||
statMap.set(staticID, 0);
|
||||
}
|
||||
statMap.set("hp", levelToHPBase(this.level));
|
||||
|
||||
let major_ids = new Set();
|
||||
for (const item of this.items){
|
||||
for (let [id, value] of item.get("maxRolls")) {
|
||||
if (staticIDs.includes(id)) {
|
||||
continue;
|
||||
}
|
||||
statMap.set(id,(statMap.get(id) || 0)+value);
|
||||
}
|
||||
for (const staticID of staticIDs) {
|
||||
if (item.get(staticID)) {
|
||||
statMap.set(staticID, statMap.get(staticID) + item.get(staticID));
|
||||
}
|
||||
}
|
||||
if (item.get("majorIds")) {
|
||||
for (const major_id of item.get("majorIds")) {
|
||||
major_ids.add(major_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
statMap.set("activeMajorIDs", major_ids);
|
||||
for (const [setName, count] of this.activeSetCounts) {
|
||||
const bonus = sets[setName].bonuses[count-1];
|
||||
for (const id in bonus) {
|
||||
if (skp_order.includes(id)) {
|
||||
// pass. Don't include skillpoints in ids
|
||||
}
|
||||
else {
|
||||
statMap.set(id,(statMap.get(id) || 0)+bonus[id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
statMap.set("poisonPct", 100);
|
||||
|
||||
// The stuff relevant for damage calculation!!! @ferricles
|
||||
statMap.set("atkSpd", this.weapon.get("atkSpd"));
|
||||
|
||||
for (const x of skp_elements) {
|
||||
this.externalStats.set(x + "DamPct", 0);
|
||||
}
|
||||
this.externalStats.set("mdPct", 0);
|
||||
this.externalStats.set("sdPct", 0);
|
||||
this.externalStats.set("damageBonus", [0, 0, 0, 0, 0]);
|
||||
this.externalStats.set("defBonus",[0, 0, 0, 0, 0]);
|
||||
this.externalStats.set("poisonPct", 0);
|
||||
this.statMap = statMap;
|
||||
|
||||
this.aggregateStats();
|
||||
}
|
||||
|
||||
aggregateStats() {
|
||||
let statMap = this.statMap;
|
||||
statMap.set("damageRaw", [this.weapon.get("nDam"), this.weapon.get("eDam"), this.weapon.get("tDam"), this.weapon.get("wDam"), this.weapon.get("fDam"), this.weapon.get("aDam")]);
|
||||
statMap.set("damageBonus", [statMap.get("eDamPct"), statMap.get("tDamPct"), statMap.get("wDamPct"), statMap.get("fDamPct"), statMap.get("aDamPct")]);
|
||||
statMap.set("defRaw", [statMap.get("eDef"), statMap.get("tDef"), statMap.get("wDef"), statMap.get("fDef"), statMap.get("aDef")]);
|
||||
statMap.set("defBonus", [statMap.get("eDefPct"), statMap.get("tDefPct"), statMap.get("wDefPct"), statMap.get("fDefPct"), statMap.get("aDefPct")]);
|
||||
statMap.set("defMult", classDefenseMultipliers.get(this.weapon.get("type")));
|
||||
}
|
||||
}
|
1056
sq2builder.js
Normal file
1056
sq2builder.js
Normal file
File diff suppressed because it is too large
Load diff
2521
sq2display.js
Normal file
2521
sq2display.js
Normal file
File diff suppressed because it is too large
Load diff
419
sq2display_constants.js
Normal file
419
sq2display_constants.js
Normal file
|
@ -0,0 +1,419 @@
|
|||
let nonRolledIDs = [
|
||||
"name",
|
||||
"lore",
|
||||
"displayName",
|
||||
"tier",
|
||||
"set",
|
||||
"slots",
|
||||
"type",
|
||||
"material",
|
||||
"drop",
|
||||
"quest",
|
||||
"restrict",
|
||||
"nDam",
|
||||
"fDam",
|
||||
"wDam",
|
||||
"aDam",
|
||||
"tDam",
|
||||
"eDam",
|
||||
"atkSpd",
|
||||
"hp",
|
||||
"fDef",
|
||||
"wDef",
|
||||
"aDef",
|
||||
"tDef",
|
||||
"eDef",
|
||||
"lvl",
|
||||
"classReq",
|
||||
"strReq",
|
||||
"dexReq",
|
||||
"intReq",
|
||||
"defReq",
|
||||
"agiReq","str",
|
||||
"dex",
|
||||
"int",
|
||||
"agi",
|
||||
"def",
|
||||
"fixID",
|
||||
"category",
|
||||
"id",
|
||||
"skillpoints",
|
||||
"reqs",
|
||||
"nDam_",
|
||||
"fDam_",
|
||||
"wDam_",
|
||||
"aDam_",
|
||||
"tDam_",
|
||||
"eDam_",
|
||||
"majorIds"];
|
||||
let rolledIDs = [
|
||||
"hprPct",
|
||||
"mr",
|
||||
"sdPct",
|
||||
"mdPct",
|
||||
"ls",
|
||||
"ms",
|
||||
"xpb",
|
||||
"lb",
|
||||
"ref",
|
||||
"thorns",
|
||||
"expd",
|
||||
"spd",
|
||||
"atkTier",
|
||||
"poison",
|
||||
"hpBonus",
|
||||
"spRegen",
|
||||
"eSteal",
|
||||
"hprRaw",
|
||||
"sdRaw",
|
||||
"mdRaw",
|
||||
"fDamPct",
|
||||
"wDamPct",
|
||||
"aDamPct",
|
||||
"tDamPct",
|
||||
"eDamPct",
|
||||
"fDefPct",
|
||||
"wDefPct",
|
||||
"aDefPct",
|
||||
"tDefPct",
|
||||
"eDefPct",
|
||||
"spPct1",
|
||||
"spRaw1",
|
||||
"spPct2",
|
||||
"spRaw2",
|
||||
"spPct3",
|
||||
"spRaw3",
|
||||
"spPct4",
|
||||
"spRaw4",
|
||||
"rainbowRaw",
|
||||
"sprint",
|
||||
"sprintReg",
|
||||
"jh",
|
||||
"lq",
|
||||
"gXp",
|
||||
"gSpd"
|
||||
];
|
||||
let reversedIDs = [ "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4" ];
|
||||
let colorMap = new Map(
|
||||
[
|
||||
["Normal", "#fff"],
|
||||
["Unique", "#ff5"],
|
||||
["Rare","#f5f"],
|
||||
["Legendary","#5ff"],
|
||||
["Fabled","#f55"],
|
||||
["Mythic","#a0a"],
|
||||
["Crafted","#0aa"],
|
||||
["Custom","#0aa"],
|
||||
["Set","#5f5"]
|
||||
]
|
||||
);
|
||||
let idPrefixes = {"displayName": "",
|
||||
"lvl":"Combat Level Min: ",
|
||||
"classReq":"Class Req: ",
|
||||
"strReq":"Strength Min: ",
|
||||
"dexReq":"Dexterity Min: ",
|
||||
"intReq":"Intelligence Min: ",
|
||||
"defReq":"Defense Min: ",
|
||||
"agiReq":"Agility Min: ",
|
||||
"nDam_":"Neutral Damage: ",
|
||||
"eDam_":"Earth Damage: ",
|
||||
"tDam_":"Thunder Damage: ",
|
||||
"wDam_":"Water Damage: ",
|
||||
"fDam_":"Fire Damage: ",
|
||||
"aDam_":"Air Damage: ",
|
||||
"atkSpd":"Attack Speed: ",
|
||||
"hp":"Health : ",
|
||||
"eDef":"Earth Defense: ",
|
||||
"tDef":"Thunder Defense: ",
|
||||
"wDef":"Water Defense: ",
|
||||
"fDef":"Fire Defense: ",
|
||||
"aDef":"Air Defense: ",
|
||||
"str":"Strength: ",
|
||||
"dex":"Dexterity: ",
|
||||
"int":"Intelligence: ",
|
||||
"def":"Defense: ","agi":"Agility: ",
|
||||
"hpBonus":"Health Bonus: ",
|
||||
"hprRaw":"Health Regen Raw: ",
|
||||
"hprPct":"Health Regen %: ",
|
||||
"sdRaw":"Raw Spell Damage: ",
|
||||
"sdPct":"Spell Damage %: ",
|
||||
"mdRaw":"Raw Melee Damage: ",
|
||||
"mdPct":"Melee Damage %: ",
|
||||
"mr":"Mana Regen: ",
|
||||
"ms":"Mana Steal: ",
|
||||
"ref":"Reflection: ",
|
||||
"ls":"Life Steal: ",
|
||||
"poison":"Poison: ",
|
||||
"thorns":"Thorns: ",
|
||||
"expd":"Exploding: ",
|
||||
"spd":"Walk Speed Bonus: ",
|
||||
"atkTier":"Attack Speed Bonus: ",
|
||||
"eDamPct":"Earth Damage %: ",
|
||||
"tDamPct":"Thunder Damage %: ",
|
||||
"wDamPct":"Water Damage %: ",
|
||||
"fDamPct":"Fire Damage %: ",
|
||||
"aDamPct":"Air Damage %: ",
|
||||
"eDefPct":"Earth Defense %: ",
|
||||
"tDefPct":"Thunder Defense %: ",
|
||||
"wDefPct":"Water Defense %: ",
|
||||
"fDefPct":"Fire Defense %: ",
|
||||
"aDefPct":"Air Defense %: ",
|
||||
"spPct1":"1st Spell Cost %: ",
|
||||
"spRaw1":"1st Spell Cost Raw: ",
|
||||
"spPct2":"2nd Spell Cost %: ",
|
||||
"spRaw2":"2nd Spell Cost Raw: ",
|
||||
"spPct3":"3rd Spell Cost %: ",
|
||||
"spRaw3":"3rd Spell Cost Raw: ",
|
||||
"spPct4":"4th Spell Cost %: ",
|
||||
"spRaw4":"4th Spell Cost Raw: ",
|
||||
"rainbowRaw":"Rainbow Spell Damage Raw: ",
|
||||
"sprint":"Sprint Bonus: ",
|
||||
"sprintReg":"Sprint Regen Bonus: ",
|
||||
"jh":"Jump Height: ",
|
||||
"xpb":"Combat XP Bonus: ",
|
||||
"lb":"Loot Bonus: ",
|
||||
"lq":"Loot Quality: ",
|
||||
"spRegen":"Soul Point Regen: ",
|
||||
"eSteal":"Stealing: ",
|
||||
"gXp":"Gathering XP Bonus: ",
|
||||
"gSpd":"Gathering Speed Bonus: ",
|
||||
"slots":"Powder Slots: ",
|
||||
"set":"Set: ",
|
||||
"quest":"Quest Req: ",
|
||||
"restrict":"",
|
||||
"lore": ""
|
||||
};
|
||||
let idSuffixes = {"displayName": "",
|
||||
"lvl":"",
|
||||
"classReq":"",
|
||||
"strReq":"",
|
||||
"dexReq":"",
|
||||
"intReq":"",
|
||||
"defReq":"",
|
||||
"agiReq":"",
|
||||
"nDam_":"",
|
||||
"eDam_":"",
|
||||
"tDam_":"",
|
||||
"wDam_":"",
|
||||
"fDam_":"",
|
||||
"aDam_":"",
|
||||
"atkSpd":"",
|
||||
"hp":"",
|
||||
"eDef":"",
|
||||
"tDef":"",
|
||||
"wDef":"",
|
||||
"fDef":"",
|
||||
"aDef":"",
|
||||
"str":"",
|
||||
"dex":"",
|
||||
"int":"",
|
||||
"def":"",
|
||||
"agi":"",
|
||||
"hpBonus":"",
|
||||
"hprRaw":"",
|
||||
"hprPct":"%",
|
||||
"sdRaw":"",
|
||||
"sdPct":"%",
|
||||
"mdRaw":"",
|
||||
"mdPct":"%",
|
||||
"mr":"/5s",
|
||||
"ms":"/3s",
|
||||
"ref":"%",
|
||||
"ls":"/3s",
|
||||
"poison":"/3s",
|
||||
"thorns":"%",
|
||||
"expd":"%",
|
||||
"spd":"%",
|
||||
"atkTier":" tier",
|
||||
"eDamPct":"%",
|
||||
"tDamPct":"%",
|
||||
"wDamPct":"%",
|
||||
"fDamPct":"%",
|
||||
"aDamPct":"%",
|
||||
"eDefPct":"%",
|
||||
"tDefPct":"%",
|
||||
"wDefPct":"%",
|
||||
"fDefPct":"%",
|
||||
"aDefPct":"%",
|
||||
"spPct1":"%",
|
||||
"spRaw1":"",
|
||||
"spPct2":"%",
|
||||
"spRaw2":"",
|
||||
"spPct3":"%",
|
||||
"spRaw3":"",
|
||||
"spPct4":"%",
|
||||
"spRaw4":"",
|
||||
"rainbowRaw":"",
|
||||
"sprint":"%",
|
||||
"sprintReg":"%",
|
||||
"jh":"",
|
||||
"xpb":"%",
|
||||
"lb":"%",
|
||||
"lq":"%",
|
||||
"spRegen":"%",
|
||||
"eSteal":"%",
|
||||
"gXp":"%",
|
||||
"gSpd":"%",
|
||||
"slots":"",
|
||||
"set":" set.",
|
||||
"quest":"",
|
||||
"restrict":"",
|
||||
"lore": ""
|
||||
};
|
||||
|
||||
//Used for item IDs and ingredient id field IDs
|
||||
//Used for ingredient IDs - name, lvl, tier. As of now, not used.
|
||||
/*let ingPrefixes = {"name": "", "lvl": "", "tier": ""};
|
||||
let ingSuffixes = {"name": "", "lvl": "", "tier": ""}*/
|
||||
//Used for ingredient consumableIDs
|
||||
let consumableIDPrefixes = {
|
||||
"charges": "Charges: ",
|
||||
"dura": "Duration: "
|
||||
}
|
||||
let consumableIDSuffixes = {
|
||||
"charges": "",
|
||||
"dura": " sec."
|
||||
}
|
||||
//Used for ingredient itemIDs
|
||||
let itemIDPrefixes = {
|
||||
"dura": "Durability: ",
|
||||
"strReq": "Strength Min: ",
|
||||
"dexReq": "Dexterity Min: ",
|
||||
"intReq": "Intelligence Min: ",
|
||||
"defReq": "Defense Min: ",
|
||||
"agiReq": "Agility Min: "
|
||||
}
|
||||
|
||||
//Used for ingredient posMods IDs
|
||||
let posModPrefixes = {
|
||||
"left":"Effectiveness Left: ",
|
||||
"right":"EFfectiveness Right: ",
|
||||
"above":"Effectiveness Above: ",
|
||||
"under":"Effectiveness Under: ",
|
||||
"touching":"EFfectiveness Touching: ",
|
||||
"notTouching":"Effectiveness Not Touching: "
|
||||
}
|
||||
let posModSuffixes = {
|
||||
"left":"%",
|
||||
"right":"%",
|
||||
"above":"%",
|
||||
"under":"%",
|
||||
"touching":"%",
|
||||
"notTouching":"%"
|
||||
}
|
||||
|
||||
/*
|
||||
* Display commands
|
||||
*/
|
||||
let build_overall_display_commands = [
|
||||
"#table",
|
||||
"#defense-stats",
|
||||
"str", "dex", "int", "def", "agi",
|
||||
"mr", "ms",
|
||||
"hprRaw", "hprPct",
|
||||
"sdRaw", "sdPct",
|
||||
"mdRaw", "mdPct",
|
||||
"ref", "thorns",
|
||||
"ls",
|
||||
"poison",
|
||||
"expd",
|
||||
"spd",
|
||||
"atkTier",
|
||||
"!elemental",
|
||||
"fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct",
|
||||
"!elemental",
|
||||
"spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4",
|
||||
"rainbowRaw",
|
||||
"sprint", "sprintReg",
|
||||
"jh",
|
||||
"xpb", "lb", "lq",
|
||||
"spRegen",
|
||||
"eSteal",
|
||||
"gXp", "gSpd",
|
||||
];
|
||||
|
||||
let build_offensive_display_commands = [
|
||||
'#table',
|
||||
"str", "dex", "int", "def", "agi",
|
||||
"mr", "ms",
|
||||
"sdRaw", "sdPct",
|
||||
"mdRaw", "mdPct",
|
||||
"ref", "thorns",
|
||||
"ls",
|
||||
"poison",
|
||||
"expd",
|
||||
"spd",
|
||||
"atkTier",
|
||||
"rainbowRaw",
|
||||
"!elemental",
|
||||
"fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct",
|
||||
"!elemental",
|
||||
"spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4",
|
||||
];
|
||||
|
||||
let build_basic_display_commands = [
|
||||
'#table',
|
||||
'#defense-stats',
|
||||
'#spacer',
|
||||
// defense stats [hp, ehp, hpr, ]
|
||||
// "sPot", // base * atkspd + spell raws
|
||||
// melee potential
|
||||
// "mPot", // melee% * (base * atkspd) + melee raws
|
||||
"mr", "ms",
|
||||
"ls",
|
||||
"poison",
|
||||
"spd",
|
||||
"atkTier",
|
||||
]
|
||||
|
||||
let item_display_commands = [
|
||||
"#cdiv",
|
||||
"displayName",
|
||||
//"type", //REPLACE THIS WITH SKIN
|
||||
"#ldiv",
|
||||
"atkSpd",
|
||||
"#ldiv",
|
||||
"!elemental",
|
||||
"hp",
|
||||
"nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_",
|
||||
"fDef", "wDef", "aDef", "tDef", "eDef",
|
||||
"!elemental",
|
||||
"#ldiv",
|
||||
"classReq",
|
||||
"lvl",
|
||||
"strReq", "dexReq", "intReq", "defReq","agiReq",
|
||||
"#ldiv",
|
||||
"str", "dex", "int", "def", "agi",
|
||||
"#table",
|
||||
"str", "dex", "int", "def", "agi", //jank lmao
|
||||
"hpBonus",
|
||||
"hprRaw", "hprPct",
|
||||
"sdRaw", "sdPct",
|
||||
"mdRaw", "mdPct",
|
||||
"mr", "ms",
|
||||
"ref", "thorns",
|
||||
"ls",
|
||||
"poison",
|
||||
"expd",
|
||||
"spd",
|
||||
"atkTier",
|
||||
"!elemental",
|
||||
"fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct",
|
||||
"fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct",
|
||||
"!elemental",
|
||||
"spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4",
|
||||
"rainbowRaw",
|
||||
"sprint", "sprintReg",
|
||||
"jh",
|
||||
"xpb", "lb", "lq",
|
||||
"spRegen",
|
||||
"eSteal",
|
||||
"gXp", "gSpd",
|
||||
"#ldiv",
|
||||
"majorIds",
|
||||
"slots",
|
||||
"set",
|
||||
"lore",
|
||||
"quest",
|
||||
"restrict"
|
||||
];
|
38
sq2icons.js
Normal file
38
sq2icons.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
//which icons to use
|
||||
let window_storage = window.localStorage;
|
||||
console.log(window_storage);
|
||||
icon_state_stored = window_storage.getItem("newicons");
|
||||
newIcons = true;
|
||||
if (icon_state_stored === "false") {toggleIcons()}
|
||||
|
||||
//REMOVE THIS IN THE REAL VERSION 7 OR SOMETHING
|
||||
window_storage.removeItem("rick");
|
||||
|
||||
/** Toggle icons on the ENTIRE page.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
function toggleIcons() {
|
||||
newIcons = !newIcons;
|
||||
let imgs = document.getElementsByTagName("IMG");
|
||||
let favicon = document.querySelector("link[rel~='icon']");
|
||||
let toggleiconbutton = document.getElementById("toggle-icon-button");
|
||||
|
||||
if (newIcons) { //switch to new
|
||||
favicon.href = favicon.href.replace("media/icons/old","media/icons/new");
|
||||
for (const img of imgs) {
|
||||
if (img.src.includes("media/icons/old")) {img.src = img.src.replace("media/icons/old","media/icons/new");}
|
||||
if (img.src.includes("media/items/old")) {img.src = img.src.replace("media/items/old","media/items/new");}
|
||||
}
|
||||
toggleiconbutton.textContent = "Use Old Icons";
|
||||
window_storage.setItem("newicons","true");
|
||||
} else { //switch to old
|
||||
favicon.href = favicon.href.replace("media/icons/new","media/icons/old");
|
||||
for (const img of imgs) {
|
||||
if (img.src.includes("media/icons/new")) {img.src = img.src.replace("media/icons/new","media/icons/old");}
|
||||
if (img.src.includes("media/items/new")) {img.src = img.src.replace("media/items/new","media/items/old");}
|
||||
}
|
||||
toggleiconbutton.textContent = "Use New Icons";
|
||||
window_storage.setItem("newicons","false");
|
||||
}
|
||||
}*/
|
200
sq2items.js
Normal file
200
sq2items.js
Normal file
|
@ -0,0 +1,200 @@
|
|||
|
||||
|
||||
const translate_mappings = {
|
||||
//"Name": "name",
|
||||
//"Display Name": "displayName",
|
||||
//"tier"Tier": ",
|
||||
//"Set": "set",
|
||||
"Powder Slots": "slots",
|
||||
//"Type": "type",
|
||||
//"armorType", (deleted)
|
||||
//"color", (deleted)
|
||||
//"lore", (deleted)
|
||||
//"material", (deleted)
|
||||
"Drop type": "drop",
|
||||
"Quest requirement": "quest",
|
||||
"Restriction": "restrict",
|
||||
//"Base Neutral Damage": "nDam",
|
||||
//"Base Fire Damage": "fDam",
|
||||
//"Base Water Damage": "wDam",
|
||||
//"Base Air Damage": "aDam",
|
||||
//"Base Thunder Damage": "tDam",
|
||||
//"Base Earth Damage": "eDam",
|
||||
//"Base Attack Speed": "atkSpd",
|
||||
"Health": "hp",
|
||||
"Raw Fire Defense": "fDef",
|
||||
"Raw Water Defense": "wDef",
|
||||
"Raw Air Defense": "aDef",
|
||||
"Raw Thunder Defense": "tDef",
|
||||
"Raw Earth Defense": "eDef",
|
||||
"Combat Level": "lvl",
|
||||
//"Class Requirement": "classReq",
|
||||
"Req Strength": "strReq",
|
||||
"Req Dexterity": "dexReq",
|
||||
"Req Intelligence": "intReq",
|
||||
"Req Agility": "agiReq",
|
||||
"Req Defense": "defReq",
|
||||
"% Health Regen": "hprPct",
|
||||
"Mana Regen": "mr",
|
||||
"% Spell Damage": "sdPct",
|
||||
"% Melee Damage": "mdPct",
|
||||
"Life Steal": "ls",
|
||||
"Mana Steal": "ms",
|
||||
"XP Bonus": "xpb",
|
||||
"Loot Bonus": "lb",
|
||||
"Reflection": "ref",
|
||||
"Strength": "str",
|
||||
"Dexterity": "dex",
|
||||
"Intelligence": "int",
|
||||
"Agility": "agi",
|
||||
"Defense": "def",
|
||||
"Thorns": "thorns",
|
||||
"Exploding": "expd",
|
||||
"Walk Speed": "spd",
|
||||
"Attack Speed Bonus": "atkTier",
|
||||
"Poison": "poison",
|
||||
"Health Bonus": "hpBonus",
|
||||
"Soul Point Regen": "spRegen",
|
||||
"Stealing": "eSteal",
|
||||
"Raw Health Regen": "hprRaw",
|
||||
"Raw Spell": "sdRaw",
|
||||
"Raw Melee": "mdRaw",
|
||||
"% Fire Damage": "fDamPct",
|
||||
"% Water Damage": "wDamPct",
|
||||
"% Air Damage": "aDamPct",
|
||||
"% Thunder Damage": "tDamPct",
|
||||
"% Earth Damage": "eDamPct",
|
||||
"% Fire Defense": "fDefPct",
|
||||
"% Water Defense": "wDefPct",
|
||||
"% Air Defense": "aDefPct",
|
||||
"% Thunder Defense": "tDefPct",
|
||||
"% Earth Defense": "eDefPct",
|
||||
"Fixed IDs": "fixID",
|
||||
"Custom Skin": "skin",
|
||||
//"Item Category": "category",
|
||||
|
||||
"1st Spell Cost %": "spPct1",
|
||||
"1st Spell Cost Raw": "spRaw1",
|
||||
"2nd Spell Cost %": "spPct2",
|
||||
"2nd Spell Cost Raw": "spRaw2",
|
||||
"3rd Spell Cost %": "spPct3",
|
||||
"3rd Spell Cost Raw": "spRaw3",
|
||||
"4th Spell Cost %": "spPct4",
|
||||
"4th Spell Cost Raw": "spRaw4",
|
||||
|
||||
"Rainbow Spell Damage": "rainbowRaw",
|
||||
"Sprint": "sprint",
|
||||
"Sprint Regen": "sprintReg",
|
||||
"Jump Height": "jh",
|
||||
"Loot Quality": "lq",
|
||||
|
||||
"Gather XP Bonus": "gXp",
|
||||
"Gather Speed Bonus": "gSpd",
|
||||
};
|
||||
|
||||
const special_mappings = {
|
||||
"Sum (skill points)": new SumQuery(["str", "dex", "int", "def", "agi"]),
|
||||
"Sum (Mana Sustain)": new SumQuery(["mr", "ms"]),
|
||||
"Sum (Life Sustain)": new SumQuery(["hpr", "ls"]),
|
||||
"Sum (Health + Health Bonus)": new SumQuery(["hp", "hpBonus"]),
|
||||
"No Strength Req": new NegateQuery("strReq"),
|
||||
"No Dexterity Req": new NegateQuery("dexReq"),
|
||||
"No Intelligence Req": new NegateQuery("intReq"),
|
||||
"No Agility Req": new NegateQuery("agiReq"),
|
||||
"No Defense Req": new NegateQuery("defReq"),
|
||||
};
|
||||
|
||||
let itemFilters = document.getElementById("filter-items");
|
||||
for (let x in translate_mappings) {
|
||||
let el = document.createElement("option");
|
||||
el.value = x;
|
||||
itemFilters.appendChild(el);
|
||||
}
|
||||
for (let x in special_mappings) {
|
||||
let el = document.createElement("option");
|
||||
el.value = x;
|
||||
itemFilters.appendChild(el);
|
||||
}
|
||||
|
||||
let itemCategories = [ "armor", "accessory", "weapon" ];
|
||||
|
||||
function applyQuery(items, query) {
|
||||
return items.filter(query.filter, query).sort(query.compare);
|
||||
}
|
||||
|
||||
function displayItems(items_copy) {
|
||||
let items_parent = document.getElementById("main");
|
||||
for (let i in items_copy) {
|
||||
let item = items_copy[i];
|
||||
let box = document.createElement("div");
|
||||
box.style.flex = "1";
|
||||
box.classList.add("box");
|
||||
box.id = "item"+i;
|
||||
items_parent.appendChild(box);
|
||||
displayExpandedItem(item, box.id);
|
||||
}
|
||||
}
|
||||
|
||||
let items_expanded;
|
||||
|
||||
function doItemSearch() {
|
||||
// window.scrollTo(0, 0);
|
||||
let queries = [];
|
||||
queries.push(new NameQuery(document.getElementById("name-choice").value.trim()));
|
||||
|
||||
let categoryOrType = document.getElementById("category-choice").value;
|
||||
console.log("category: "+categoryOrType)
|
||||
if (itemTypes.includes(categoryOrType)) {
|
||||
queries.push(new IdMatchQuery("type", categoryOrType));
|
||||
}
|
||||
else if (itemCategories.includes(categoryOrType)) {
|
||||
queries.push(new IdMatchQuery("category", categoryOrType));
|
||||
}
|
||||
|
||||
let rarity = document.getElementById("rarity-choice").value;
|
||||
if (rarity) {
|
||||
if (rarity === "ANY") {
|
||||
|
||||
}
|
||||
else {
|
||||
queries.push(new IdMatchQuery("tier", rarity));
|
||||
}
|
||||
}
|
||||
|
||||
let level_dat = document.getElementById("search-level-choice").value.split("-");
|
||||
queries.push(new LevelRangeQuery(parseInt(level_dat[0]), parseInt(level_dat[1])));
|
||||
|
||||
for (let i = 1; i <= 4; ++i) {
|
||||
let raw_dat = document.getElementById("filter"+i+"-choice").value;
|
||||
let filter_dat = translate_mappings[raw_dat];
|
||||
if (filter_dat !== undefined) {
|
||||
queries.push(new IdQuery(filter_dat));
|
||||
continue;
|
||||
}
|
||||
filter_dat = special_mappings[raw_dat];
|
||||
if (filter_dat !== undefined) {
|
||||
queries.push(filter_dat);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
let items_copy = items_expanded.slice();
|
||||
document.getElementById("main").textContent = "";
|
||||
for (const query of queries) {
|
||||
console.log(items_copy.length);
|
||||
console.log(query);
|
||||
console.log(query.filter);
|
||||
items_copy = applyQuery(items_copy, query);
|
||||
console.log(items_copy.length);
|
||||
}
|
||||
// document.getElementById("summary").textContent = items_copy.length + " results."
|
||||
console.log('a')
|
||||
console.log(items_copy);
|
||||
displayItems(items_copy);
|
||||
}
|
||||
|
||||
function init_items() {
|
||||
items_expanded = items.filter( (i) => !("remapID" in i) ).map( (i) => expandItem(i, []) );
|
||||
}
|
||||
|
||||
load_init(init_items);
|
Loading…
Reference in a new issue