This commit is contained in:
ferricles 2022-05-12 12:27:25 -07:00
commit 3f1b4408cd
18 changed files with 203 additions and 47 deletions

4
.gitignore vendored
View file

@ -4,6 +4,4 @@ sets/
.idea/
*.iml
node_modules/
package.json
package-lock.json
.editor_log.txt

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html prefix="og: https://ogp.me/ns#">
<html>
<head>
<title>ATLAS???</title>
@ -15,10 +15,6 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.6/dist/css/autoComplete.min.css">
<link rel="stylesheet" href="../css/sq2bs.css">
<meta property="og:title" content="WynnBuilder" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="https://hppeng-wynn.github.io/sq2bs.html" />
<meta property="og:image" content="https://i.kym-cdn.com/entries/icons/original/000/037/349/Screenshot_14.jpg" />
</head>
<body class="text-light d-flex justify-content-center" id = "body">
<div id="main-sidebar" class="sidebar dark-7 dark-shadow col">

View file

@ -1,6 +1,22 @@
<!DOCTYPE html>
<html prefix="og: https://ogp.me/ns#">
<html>
<head>
<meta charset="UTF-8" />
<meta name="HandheldFriendly" content="true" />
<meta name="MobileOptimized" content="320" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width, user-scalable=no" />
<!--OGP suite
<meta property="og:title" content="Wynnbuilder" />
<meta property="og:type" content="website" />
<meta property="og:image" content="https://wynnbuilder.github.io/media/icons/new/builder.png" />
<meta property="og:image:width" content="420" />
<meta property="og:image:height" content="420" />
<meta property="og:image:type" content="image/png" />
<meta property="og:description" id = "ogp-build-list" content = "">
<meta property="og:url" id = "ogp-url" content="" />
-->
<title>WynnBuilder</title>
<link rel="icon" href="../media/icons/new/builder.png" type="image/icon type">
@ -17,11 +33,6 @@
<link rel="stylesheet" href="../css/sq2bs.css">
<link rel="stylesheet" href="../css/sidebar.css">
<link rel="stylesheet" href="../css/wynnstyles.css">
<meta property="og:title" content="WynnBuilder" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="https://hppeng-wynn.github.io/builder/index.html" />
<meta property="og:image" content="https://i.kym-cdn.com/entries/icons/original/000/037/349/Screenshot_14.jpg" />
</head>
<body class="text-light d-flex justify-content-center" id = "body">
<!-- hover tooltip stuff -->

View file

@ -54944,7 +54944,8 @@
"wDamPct": 6,
"type": "ring",
"fixID": true,
"id": 2611
"id": 2611,
"set": "Wynnterfest 2016"
},
{
"name": "North Pole",
@ -55061,7 +55062,8 @@
"eDamPct": 6,
"type": "necklace",
"fixID": true,
"id": 2615
"id": 2615,
"set": "Wynnterfest 2016"
},
{
"name": "Saint's Leggings",
@ -55095,7 +55097,8 @@
"fDamPct": 6,
"type": "bracelet",
"fixID": true,
"id": 2616
"id": 2616,
"set": "Wynnterfest 2016"
},
{
"name": "Saint's Shawl",
@ -55190,7 +55193,8 @@
"tDamPct": 6,
"type": "ring",
"fixID": true,
"id": 2621
"id": 2621,
"set": "Wynnterfest 2016"
},
{
"name": "Sleigh Bell",

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html prefix="og: https://ogp.me/ns#">
<html>
<head>
<title>WynnCrafter</title>
<link rel="icon" href="../media/icons/new/crafter.png" type="image/icon type">
@ -18,11 +18,6 @@
<link rel="stylesheet" href="../css/sq2bs.css">
<link rel="stylesheet" href="../css/sidebar.css">
<link rel="stylesheet" href="../css/wynnstyles.css">
<meta property="og:title" content="WynnCrafter" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="https://hppeng-wynn.github.io/crafter/index.html" />
<meta property="og:image" content="https://i.kym-cdn.com/entries/icons/original/000/037/349/Screenshot_14.jpg" />
</head>
<body id = "body" class = "text-light d-flex justify-content-center">
<div id="main-sidebar" class="sidebar dark-7 dark-shadow">

View file

@ -65,6 +65,7 @@ ul {
ul.search-box {
position: absolute;
padding: 0;
overflow: auto;
}
li.search-item {

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,10 @@
<!DOCTYPE html>
<html>
<meta http-equiv="refresh" content="0; URL=./builder" />
<body>JS not enabled :(</body>
<script type="text/javascript">
let getUrl = window.location;
let baseUrl = getUrl .protocol + "//" + getUrl.host + "/";
let hash = window.location.hash;
window.location.href = baseUrl + "builder/" + hash;
</script>
</html>

View file

@ -588,14 +588,14 @@ function updateStats() {
let delta_total = 0;
for (let i in skp_order) {
let value = document.getElementById(skp_order[i] + "-skp").value;
if (value === ""){value = 0; setValue(skp_order[i] + "-skp", value)}
if (value === ""){value = "0"; setValue(skp_order[i] + "-skp", value)}
let manual_assigned = 0;
if (value.includes("+")) {
let skp = value.split("+");
for (const s of skp) {
manual_assigned += parseInt(s,10);
}
} else {
} else {
manual_assigned = parseInt(value,10);
}
let delta = manual_assigned - skillpoints[i];
@ -861,6 +861,7 @@ function calculateBuildStats() {
location.hash = encodeBuild();
clear_highlights();
updateOGP();
}
function copyBuild() {
@ -1076,3 +1077,4 @@ function init2() {
load_ing_init(init);
}
load_init(init2);
updateOGP();

View file

@ -5,9 +5,10 @@
*/
function applyArmorPowders(expandedItem, powders) {
applyArmorPowdersOnce(expandedItem, powders);
if (expandedItem.get("crafted")) {
applyArmorPowdersOnce(expandedItem, powders);
}
// NOTE: armor powder only applies once!
//if (expandedItem.get("crafted")) {
// applyArmorPowdersOnce(expandedItem, powders);
//}
}
/**

View file

@ -202,7 +202,7 @@ function redraw(data) {
dps_getter_func = tmp;
prepowder = tmp2;
let _bbox = bbox();
let x = d3.scaleLinear([70, 105], [margin.left, bbox().width - margin.right]);
let x = d3.scaleLinear([70, 110], [margin.left, bbox().width - margin.right]);
let y = d3.scaleLinear([0, max_dps_base * 1.1], [bbox().height - margin.bottom, margin.top]);
let type_mod = weapon_type_mods.get(current_type);

View file

@ -71,14 +71,14 @@ const translate_mappings = {
"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",
"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",
@ -95,11 +95,11 @@ const special_mappings = {
"Sum (Mana Sustain)": "s:mr+ms",
"Sum (Life Sustain)": "s:hpr+ls",
"Sum (Health + Health Bonus)": "s:hp+hpBonus",
"No Strength Req": "f:strReq==0",
"No Dexterity Req": "f:dexReq==0",
"No Intelligence Req": "f:intReq==0",
"No Agility Req": "f:agiReq==0",
"No Defense Req": "f:defReq==0",
"No Strength Req": "f:strReq=0",
"No Dexterity Req": "f:dexReq=0",
"No Intelligence Req": "f:intReq=0",
"No Agility Req": "f:agiReq=0",
"No Defense Req": "f:defReq=0",
};
let itemFilters = document.getElementById("filter-items");
@ -168,6 +168,7 @@ function doItemSearch() {
let filter_dat = translate_mappings[raw_dat];
if (filter_dat !== undefined) {
queries.push("s:"+filter_dat);
queries.push("f:"+filter_dat+"!=0");
continue;
}
filter_dat = special_mappings[raw_dat];

View file

@ -1,4 +1,4 @@
const DB_VERSION = 89;
const DB_VERSION = 90;
// @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.jsA
let db;

View file

@ -321,6 +321,7 @@ function init_autocomplete() {
selector: "#"+ eq +"-choice",
wrapper: false,
resultsList: {
maxResults: 1000,
tabSelect: true,
noResults: true,
class: "search-box dark-7 rounded-bottom px-2 fw-bold dark-shadow-sm",
@ -330,6 +331,7 @@ function init_autocomplete() {
list.style.top = position.bottom + window.scrollY +"px";
list.style.left = position.x+"px";
list.style.width = position.width+"px";
list.style.maxHeight = position.height * 2 +"px";
if (!data.results.length) {
message = document.createElement('li');

View file

@ -3,6 +3,31 @@ const url_base = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.sp
const zip = (a, b) => a.map((k, i) => [k, b[i]]);
//updates all the OGP tags for a webpage. Should be called when build changes
function updateOGP() {
//update the embed URL
let url_elem = document.getElementById("ogp-url");
if (url_elem) {
url_elem.content = url_base+location.hash;
}
//update the embed text content
let build_elem = document.getElementById("ogp-build-list");
if (build_elem && player_build) {
let text = "WynnBuilder build:\n"+
"> "+player_build.helmet.get("displayName")+"\n"+
"> "+player_build.chestplate.get("displayName")+"\n"+
"> "+player_build.leggings.get("displayName")+"\n"+
"> "+player_build.boots.get("displayName")+"\n"+
"> "+player_build.ring1.get("displayName")+"\n"+
"> "+player_build.ring2.get("displayName")+"\n"+
"> "+player_build.bracelet.get("displayName")+"\n"+
"> "+player_build.necklace.get("displayName")+"\n"+
"> "+player_build.weapon.get("displayName")+" ["+player_build.weapon.get("powders").map(x => powderNames.get(x)).join("")+"]";
build_elem.content = text;
}
}
function clamp(num, low, high){
return Math.min(Math.max(num, low), high);
}

48
testing/ms_linalg.py Normal file
View file

@ -0,0 +1,48 @@
import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
# Attack speed independent. Fast speed losses not accounted for
mana_consumption = 3
mana_steal = 10 # /3s
mana_regen = 0 # /5s
#mana_steal = 5 # /3s
#mana_regen = 5 # /5s
natural_regen = 1
weight_natural = 8/15 # 4/5 * 2/3
weight_mr = 2/15 # 1/5 * 2/3
weight_ms = 4/15 # 4/5 * 1/3
weight_mr_ms = 1/15 # 1/5 * 1/3
MAX_MANA = 20
transition_matrix = np.zeros((MAX_MANA, MAX_MANA))
for i in range(MAX_MANA):
natural_state = max(0, i - mana_consumption + natural_regen)
mr_state = min(19, natural_state + mana_regen)
ms_state = min(19, natural_state + mana_steal)
mr_ms_state = min(19, natural_state + mana_regen + mana_steal)
transition_matrix[natural_state, i] = weight_natural
transition_matrix[mr_state, i] += weight_mr
transition_matrix[ms_state, i] += weight_ms
transition_matrix[mr_ms_state, i] += weight_mr_ms
eigval, eigvec = la.eig(transition_matrix)
print(eigval)
eps = 0.00001
ind = np.argwhere(abs(eigval - 1) < eps)
steady_state = abs(eigvec[:, ind])
steady_state /= np.sum(steady_state)
cumulative = np.cumsum(steady_state)
print("mana\tprob cumsum")
for i in range(MAX_MANA):
print(f"{i+1}\t{cumulative[i]}")
plt.figure()
plt.scatter(range(len(steady_state)), steady_state)
plt.xlim(0, 19)
plt.ylim(0, 0.2)
plt.xlabel("Mana Value")
plt.ylabel("Probability at t=infty")
plt.title(f"Build={mana_regen}mr,{mana_steal}ms,{mana_consumption}mana/sec")
plt.show()

65
testing/ms_sslow.py Normal file
View file

@ -0,0 +1,65 @@
import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
# Super slow attack speed. (Idealized to 1 hit/2s, 2/3 chance of proc
mana_consumption = 6
mana_steal = 14 # /3s
mana_regen = 6 # /5s
#mana_steal = 5 # /3s
#mana_regen = 5 # /5s
natural_regen = 1
ms_period = 2
ms_chance = ms_period / 3
no_ms_chance = 1 - ms_chance
MAX_MANA = 20
TIME_CYCLE = 10
transition_matrix = np.zeros((MAX_MANA * TIME_CYCLE, MAX_MANA * TIME_CYCLE))
for j in range(TIME_CYCLE):
for i in range(MAX_MANA):
natural_state = max(0, i - mana_consumption + natural_regen)
if j % 5 == 0: # mr activation
natural_state = min(19, natural_state + mana_regen)
next_ind = ((j+1) % TIME_CYCLE) * MAX_MANA
if j % ms_period == 0: # ms activation
ms_state = min(19, natural_state + mana_steal)
transition_matrix[next_ind + natural_state, i+j*MAX_MANA] = no_ms_chance
transition_matrix[next_ind + ms_state, i+j*MAX_MANA] += ms_chance
else:
transition_matrix[next_ind + natural_state, i+j*MAX_MANA] = 1
eigval, eigvec = la.eig(transition_matrix)
print(eigval)
eps = 0.00001
ind = np.argwhere(abs(eigval - 1) < eps)
steady_state = np.sum(abs(eigvec[:, ind]).reshape((TIME_CYCLE, MAX_MANA)), axis=0)
steady_state /= np.sum(steady_state)
cumulative = np.cumsum(steady_state)
print("mana\tcumulative probability")
for i in range(MAX_MANA):
print(f"{i+1}\t{cumulative[i]}")
mana_limit = 6+mana_consumption
x_ticks = list(range(len(steady_state)))
plt.figure()
plt.scatter(x_ticks, steady_state, label="mana values")
plt.xlim(0, 19)
plt.ylim(0, 0.3)
plt.axvline(x=mana_limit, color="red")
plt.xlabel("Mana Value")
plt.xticks(x_ticks)
plt.ylabel("Probability at t=infty")
plt.legend()
ax2 = plt.gca().twinx()
ax2.plot(x_ticks, cumulative, label="cumulative probability", color="pink")
plt.text(mana_limit - 0.2, cumulative[mana_limit] + 0.03, f"time with sprint loss: {cumulative[mana_limit]*100:.2f}%", horizontalalignment='right')
plt.scatter((mana_limit,), (cumulative[mana_limit],), color="red")
ax2.set_ylim(0, 1)
ax2.set_ylabel("Cumulative probability at t=infty")
plt.title(f"Super Slow Speed: Build={mana_regen}mr,{mana_steal}ms,{mana_consumption}mana/sec")
plt.legend()
plt.show()