Merge branch 'dev' of https://github.com/hppeng-wynn/hppeng-wynn.github.io into dev
This commit is contained in:
commit
48554a5e36
3 changed files with 37 additions and 26 deletions
|
@ -30,7 +30,11 @@ function encodeCustom(custom, verbose) {
|
||||||
if (rolledIDs.includes(id)) {
|
if (rolledIDs.includes(id)) {
|
||||||
let val_min = custom.get("minRolls").has(id) ? custom.get("minRolls").get(id) : 0;
|
let val_min = custom.get("minRolls").has(id) ? custom.get("minRolls").get(id) : 0;
|
||||||
let val_max = custom.get("maxRolls").has(id) ? custom.get("maxRolls").get(id) : 0;
|
let val_max = custom.get("maxRolls").has(id) ? custom.get("maxRolls").get(id) : 0;
|
||||||
let sign = (Boolean(val_min / Math.abs(val_min) < 0) | 0) + 2*(Boolean(val_max / Math.abs(val_max) < 0) | 0) // 0 - both pos 1 - min neg max pos 2 - min pos max neg (how?) 3 - min neg max neg
|
// 0 - both pos
|
||||||
|
// 1 - min neg max pos
|
||||||
|
// 2 - min pos max neg (how?)
|
||||||
|
// 3 - min neg max neg
|
||||||
|
let sign = (Boolean(val_min / Math.abs(val_min) < 0) | 0) + 2*(Boolean(val_max / Math.abs(val_max) < 0) | 0);
|
||||||
//console.log(id + ": " + sign);
|
//console.log(id + ": " + sign);
|
||||||
let min_len = Math.max(1,Math.ceil(log(64,Math.abs(val_min)+1)));
|
let min_len = Math.max(1,Math.ceil(log(64,Math.abs(val_min)+1)));
|
||||||
let max_len = Math.max(1,Math.ceil(log(64,Math.abs(val_max)+1)));
|
let max_len = Math.max(1,Math.ceil(log(64,Math.abs(val_max)+1)));
|
||||||
|
@ -38,9 +42,7 @@ function encodeCustom(custom, verbose) {
|
||||||
val_min = Math.abs(val_min);
|
val_min = Math.abs(val_min);
|
||||||
val_max = Math.abs(val_max);
|
val_max = Math.abs(val_max);
|
||||||
|
|
||||||
|
|
||||||
if ( val_min != 0 || val_max != 0 ) {
|
if ( val_min != 0 || val_max != 0 ) {
|
||||||
//hash += Base64.fromIntN(i,2) + Base64.fromIntN(val_min,Math.max(1,Math.ceil(log(64,Math.abs(val_min))))) + ":" + Base64.fromIntN(val_max,Math.max(1,Math.ceil(log(64,Math.abs(val_min))))) + "_";
|
|
||||||
if (custom.get("fixID")) {
|
if (custom.get("fixID")) {
|
||||||
hash += Base64.fromIntN(i,2) + Base64.fromIntN(len,2) + sign + Base64.fromIntN(val_min, len);
|
hash += Base64.fromIntN(i,2) + Base64.fromIntN(len,2) + sign + Base64.fromIntN(val_min, len);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* Apply armor powdering.
|
* Apply armor powdering.
|
||||||
|
* Applies twice for crafted items because wynn.
|
||||||
* Also for jeweling for crafted items.
|
* Also for jeweling for crafted items.
|
||||||
*/
|
*/
|
||||||
function applyArmorPowders(expandedItem, powders) {
|
function applyArmorPowders(expandedItem, powders) {
|
||||||
|
@ -8,15 +9,27 @@ function applyArmorPowders(expandedItem, powders) {
|
||||||
applyArmorPowdersOnce(expandedItem, powders);
|
applyArmorPowdersOnce(expandedItem, powders);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply armor powders once only.
|
||||||
|
* Encoding shortcut assumes that all powders give +def to one element
|
||||||
|
* and -def to the element "behind" it in cycle ETWFA, which is true
|
||||||
|
* as of now and unlikely to change in the near future.
|
||||||
|
*/
|
||||||
function applyArmorPowdersOnce(expandedItem, powders) {
|
function applyArmorPowdersOnce(expandedItem, powders) {
|
||||||
for(const id of powders){
|
for(const id of powders){
|
||||||
let powder = powderStats[id];
|
let powder = powderStats[id];
|
||||||
let name = powderNames.get(id);
|
let name = powderNames.get(id).charAt(0);
|
||||||
expandedItem.set(name.charAt(0) + "Def", (expandedItem.get(name.charAt(0)+"Def") || 0) + powder["defPlus"]);
|
let prevName = skp_elements[(skp_elements.indexOf(name) + 4 )% 5];
|
||||||
expandedItem.set(skp_elements[(skp_elements.indexOf(name.charAt(0)) + 4 )% 5] + "Def", (expandedItem.get(skp_elements[(skp_elements.indexOf(name.charAt(0)) + 4 )% 5]+"Def") || 0) - powder["defMinus"]);
|
expandedItem.set(name+"Def", (expandedItem.get(name+"Def") || 0) + powder["defPlus"]);
|
||||||
|
expandedItem.set(prevName+"Def", (expandedItem.get(prevName+"Def") || 0) - powder["defMinus"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Take an item with id list and turn it into a set of minrolls and maxrolls.
|
||||||
|
* Also applies powders to armor.
|
||||||
|
*/
|
||||||
function expandItem(item, powders) {
|
function expandItem(item, powders) {
|
||||||
let minRolls = new Map();
|
let minRolls = new Map();
|
||||||
let maxRolls = new Map();
|
let maxRolls = new Map();
|
||||||
|
@ -25,10 +38,8 @@ function expandItem(item, powders) {
|
||||||
expandedItem.set("fixID",true);
|
expandedItem.set("fixID",true);
|
||||||
for (const id of rolledIDs) { //all rolled IDs are numerical
|
for (const id of rolledIDs) { //all rolled IDs are numerical
|
||||||
let val = (item[id] || 0);
|
let val = (item[id] || 0);
|
||||||
//if(item[id]) {
|
|
||||||
minRolls.set(id,val);
|
minRolls.set(id,val);
|
||||||
maxRolls.set(id,val);
|
maxRolls.set(id,val);
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
} else { //The item does not have fixed IDs.
|
} else { //The item does not have fixed IDs.
|
||||||
for (const id of rolledIDs) {
|
for (const id of rolledIDs) {
|
||||||
|
@ -41,18 +52,15 @@ function expandItem(item, powders) {
|
||||||
maxRolls.set(id,idRound(val*1.3));
|
maxRolls.set(id,idRound(val*1.3));
|
||||||
minRolls.set(id,idRound(val*0.3));
|
minRolls.set(id,idRound(val*0.3));
|
||||||
}
|
}
|
||||||
}else if(val < 0){ //negative rolled IDs
|
} else if (val <= 0) { //negative rolled IDs
|
||||||
if (reversedIDs.includes(id)) {
|
if (reversedIDs.includes(id)) {
|
||||||
maxRolls.set(id,idRound(val*1.3));
|
maxRolls.set(id,idRound(val*1.3));
|
||||||
minRolls.set(id,idRound(val*0.7));
|
minRolls.set(id,idRound(val*0.7));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
minRolls.set(id,idRound(val*1.3));
|
|
||||||
maxRolls.set(id,idRound(val*0.7));
|
maxRolls.set(id,idRound(val*0.7));
|
||||||
|
minRolls.set(id,idRound(val*1.3));
|
||||||
}
|
}
|
||||||
}else{//Id = 0
|
|
||||||
minRolls.set(id,0);
|
|
||||||
maxRolls.set(id,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,11 @@ async function load_local(init_func) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clean bad item data. For now just assigns display name if it isn't already assigned.
|
* Clean bad item data.
|
||||||
|
* Assigns `displayName` to equal `name` if it is undefined.
|
||||||
|
* String values default to empty string.
|
||||||
|
* Numeric values default to 0.
|
||||||
|
* Major ID defaults to empty list.
|
||||||
*/
|
*/
|
||||||
function clean_item(item) {
|
function clean_item(item) {
|
||||||
if (item.remapID === undefined) {
|
if (item.remapID === undefined) {
|
||||||
|
@ -68,9 +72,6 @@ function clean_item(item) {
|
||||||
if (item.skillpoints[i] === undefined) { item.skillpoints[i] = 0; }
|
if (item.skillpoints[i] === undefined) { item.skillpoints[i] = 0; }
|
||||||
if (item.skillpoints[i] < 0) { item.has_negstat = true; }
|
if (item.skillpoints[i] < 0) { item.has_negstat = true; }
|
||||||
}
|
}
|
||||||
if (item.slots === undefined) {
|
|
||||||
item.slots = 0
|
|
||||||
}
|
|
||||||
for (let key of item_fields) {
|
for (let key of item_fields) {
|
||||||
if (item[key] === undefined) {
|
if (item[key] === undefined) {
|
||||||
if (key in str_item_fields) {
|
if (key in str_item_fields) {
|
||||||
|
|
Loading…
Reference in a new issue