1d6b302f38
author hppeng <hppeng> 1699417872 -0800 committer hppeng <hppeng> 1720354753 -0700 parent3e725eded8
author hppeng <hppeng> 1699417872 -0800 committer hppeng <hppeng> 1720354749 -0700 parent3e725eded8
author hppeng <hppeng> 1699417872 -0800 committer hppeng <hppeng> 1720354744 -0700 parent3e725eded8
author hppeng <hppeng> 1699417872 -0800 committer hppeng <hppeng> 1720354739 -0700 parent3e725eded8
author hppeng <hppeng> 1699417872 -0800 committer hppeng <hppeng> 1720354735 -0700 parent3e725eded8
author hppeng <hppeng> 1699417872 -0800 committer hppeng <hppeng> 1720354730 -0700 parent3e725eded8
author hppeng <hppeng> 1699417872 -0800 committer hppeng <hppeng> 1720354688 -0700 Update recipes.json (#265) Change ratio of gems to oil as it has been updated in 2.0.4 > Updated the Jeweling Recipe Changes (Bracelet- 2:1 gems:oil, Necklaces- 3:1 gems:oil) https://forums.wynncraft.com/threads/2-0-4-full-changelog-new-bank-lootruns-more.310535/ Finish updating recipes.json why are there 4 versions of this file active at any given time Fix damage calculation for rainbow raw wow this bug has been here for a LONG time also bump version for ing db Bunch of bugfixes - new major ID - divine honor: reduce earth damage - radiance: don't boost tomes, xp/loot bonuses atree: - parry: minor typo - death magnet: marked dep - nightcloak knife: 15s desc Api v3 (#267) * Tweak ordering to be consistent internally * v3 items (#266) * item_wrapper script for updating item data with v3 endpoint * metadata from v3 * v3 item format For the purpose of wynnbuilder, additional mapping might be needed. * v3 item format additional mapping might be needed for wb * v3 compressed item json * clean item json v3 format * Update translate map to api v3 partially... we will need to redo scripts to flatmap all the items * Fix items for 2.0.4.3 finally * New ingredients (and parse script update) just realized I forgot to commit the parse script this whole time * Forgot to commit data files, and bump ing db version * Sketchily reverse translate major ids internalname and separate lookup table lol * Forgot to update data files todo: script should update all files at once * Bump wynn version number already outdated... * Forgot to update 2.0.4.3 major ids --------- Co-authored-by: hppeng <hppeng> Co-authored-by: RawFish69 <108964215+RawFish69@users.noreply.github.com> Add missing fields to ingreds missing ids and consumableIDs tags in some ingreds Fix missing properties in item search setup these should be unified maybe to avoid duplicated code Fix sacshrine dependency on fluid healing also: fix ": " in item searcher I managed to mess up all major ids note: major ids min file is generated along with atree. it uses numeric ids, not just json compress 2.0.4.4 update (#269) * 2.0.4.4 update Fix v3 item api debug script Implement hellfire (discombob disallow not happening yet) * Fix boiling blood implementation slightly more intuitive also, janky first pass implementation for hellfire * Atree default update Allow sliders to specify a default value, for puppet and boiling blood for now * Fix rainbow def display on items and build stats Calculate into raw def correctly * Atree backend improvements Allow major ids to have dependencies Implement cherry bomb new ver. (wooo replace_spell just works out of the box!) Add comments to atree.js * Fix name of normal items don't you love it when wynn api makes breaking changes for no reason * Misc bugfix Reckless abandon req Tempest new damage ID in search * Fix major id search and temblor desc * Fix blockers on mage * Fix flaming uppercut implementation * Force base dps display to display less digits * Tomes finally pulling from the API but still with alias feature enabled! * Lootrun tomes (finally?) cool? maybe? * Fix beachside set set bonus --------- Co-authored-by: hppeng <hppeng> Fix rainbow def display on items and build stats Calculate into raw def correctly Fix major id search and temblor desc Force base dps display to display less digits Fix beachside set set bonus Fix build decode error reading only 7 tome fields no matter what Give NONE tomes correct ids in load_tome i hate this system so much Allow searching for max/min of ranges Fix crafted item damage display in the process, also update powder calculation logic! Should be fully correct now... TL;DR: Weapon damage is floating point; item display is wrong; ingame displays (damage floaters and compass) are floored. Fluid healing now multiplicative with heal efficiency ID NOTE: this breaks backwards compatibility with older atree jsons. Do we care about this? Realizing how much of a nightmare it will be (and already is) to keep atree fully backwards compatible. Maybe that will be something left to `git clone` instead. fix (#274)
224 lines
10 KiB
JavaScript
224 lines
10 KiB
JavaScript
let powderIDs = new Map();
|
|
let powderNames = new Map();
|
|
let _powderID = 0;
|
|
for (const x of skp_elements) {
|
|
for (let i = 1; i <= 6; ++i) {
|
|
// Support both upper and lowercase, I guess.
|
|
powderIDs.set(x.toUpperCase()+i, _powderID);
|
|
powderIDs.set(x+i, _powderID);
|
|
powderNames.set(_powderID, x+i);
|
|
_powderID++;
|
|
}
|
|
}
|
|
|
|
// Ordering: [dmgMin, dmgMax, convert, defPlus, defMinus (+6 mod 5)]
|
|
class Powder {
|
|
constructor(min, max, convert, defPlus, defMinus) {
|
|
this.min = min;
|
|
this.max = max;
|
|
this.convert = convert;
|
|
this.defPlus = defPlus;
|
|
this.defMinus = defMinus;
|
|
}
|
|
}
|
|
function _p(a,b,c,d,e) { return new Powder(a,b,c,d,e); } //bruh moment
|
|
|
|
let powderStats = [
|
|
_p(3,6,17,2,1), _p(5,8,21,4,2), _p(6,10,25,8,3), _p(7,10,31,14,5), _p(9,11,38,22,9), _p(11,13,46,30,13),
|
|
_p(1,8,9,3,1), _p(1,12,11,5,1), _p(2,15,13,9,2), _p(3,15,17,14,4), _p(4,17,22,20,7), _p(5,20,28,28,10),
|
|
_p(3,4,13,3,1), _p(4,6,15,6,1), _p(5,8,17,11,2), _p(6,8,21,18,4), _p(7,10,26,28,7), _p(9,11,32,40,10),
|
|
_p(2,5,14,3,1), _p(4,8,16,5,2), _p(5,9,19,9,3), _p(6,9,24,16,5), _p(8,10,30,25,9), _p(10,12,37,36,13),
|
|
_p(2,6,11,3,1), _p(3,10,14,6,2), _p(4,11,17,10,3), _p(5,11,22,16,5), _p(7,12,28,24,9), _p(8,14,35,34,13)
|
|
];
|
|
|
|
//Ordering: [weapon special name, weapon special effects, armor special name, armor special effects]
|
|
class PowderSpecial{
|
|
constructor(wSpName, wSpEff, aSpName, aSpEff, cap){
|
|
this.weaponSpecialName = wSpName;
|
|
this.weaponSpecialEffects = wSpEff;
|
|
this.armorSpecialName = aSpName;
|
|
this.armorSpecialEffects = aSpEff;
|
|
this.cap = cap;
|
|
}
|
|
}
|
|
function _ps(a,b,c,d,e) { return new PowderSpecial(a,b,c,d,e); } //bruh moment
|
|
|
|
let powderSpecialStats = [
|
|
_ps("Quake",new Map([["Radius",[4.5,5,5.5,6,6.5]], ["Damage",[240,280,320,360,400]] ]),"Rage",new Map([ ["Damage", [0.2,0.4,0.6,0.8,1.0]],["Description", "% " + "\u2764" + " Missing below 75%"] ]),300), //e
|
|
_ps("Chain Lightning",new Map([ ["Chains", [5,6,7,8,9]], ["Damage", [200,225,250,275,300]] ]),"Kill Streak",new Map([ ["Damage", [3,4.5,6,7.5,9]],["Duration", [5,5,5,5,5]],["Description", "Mob Killed"] ]),150), //t
|
|
_ps("Curse",new Map([ ["Duration", [4,4,4,4,4]],["Damage Boost", [10,15,20,25,30]] ]),"Concentration",new Map([ ["Damage", [0.05,0.1,0.15,0.2,0.25]],["Duration",[1,1,1,1,1]],["Description", "Mana Used"] ]),100), //w
|
|
_ps("Courage",new Map([ ["Duration", [4,4,4,4,4]],["Damage", [60, 70, 80, 90, 100]],["Damage Boost", [10,12.5,15,17.5,20]] ]),"Endurance",new Map([ ["Damage", [2,3,4,5,6]],["Duration", [8,8,8,8,8]],["Description", "Hit Taken"] ]),100), //f
|
|
_ps("Wind Prison",new Map([ ["Duration", [3,3.5,4,4.5,5]],["Damage Boost", [100,125,150,175,200]],["Knockback", [8,12,16,20,24]] ]),"Dodge",new Map([ ["Damage",[2,3,4,5,6]],["Duration",[2,3,4,5,6]],["Description","Near Mobs"] ]),150) //a
|
|
];
|
|
|
|
/**
|
|
* Apply armor powders.
|
|
* 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 applyArmorPowders(expandedItem) {
|
|
const powders = expandedItem.get('powders');
|
|
for(const id of powders){
|
|
let powder = powderStats[id];
|
|
let name = powderNames.get(id).charAt(0);
|
|
let prevName = skp_elements[(skp_elements.indexOf(name) + 4 )% 5];
|
|
expandedItem.set(name+"Def", (expandedItem.get(name+"Def") || 0) + powder["defPlus"]);
|
|
expandedItem.set(prevName+"Def", (expandedItem.get(prevName+"Def") || 0) - powder["defMinus"]);
|
|
}
|
|
}
|
|
|
|
const damage_keys = [ "nDam_", "eDam_", "tDam_", "wDam_", "fDam_", "aDam_" ];
|
|
const damage_present_key = 'damagePresent';
|
|
/**
|
|
* Apply weapon powders. MUTATES THE ITEM!
|
|
* Adds entries for `damage_keys` and `damage_present_key`
|
|
* For normal items, `damage_keys` is 6x2 list (elem: [min, max])
|
|
* For crafted items, `damage_keys` is 6x2x2 list (elem: [minroll: [min, max], maxroll: [min, max]])
|
|
*/
|
|
function apply_weapon_powders(item) {
|
|
let present;
|
|
if (item.get("tier") !== "Crafted") {
|
|
let weapon_result = calc_weapon_powder(item);
|
|
let damages = weapon_result[0];
|
|
present = weapon_result[1];
|
|
for (const i in damage_keys) {
|
|
item.set(damage_keys[i], damages[i]);
|
|
}
|
|
} else {
|
|
let base_low = [item.get("nDamBaseLow"),item.get("eDamBaseLow"),item.get("tDamBaseLow"),item.get("wDamBaseLow"),item.get("fDamBaseLow"),item.get("aDamBaseLow")];
|
|
let results_low = calc_weapon_powder(item, base_low);
|
|
let damage_low = results_low[0];
|
|
let base_high = [item.get("nDamBaseHigh"),item.get("eDamBaseHigh"),item.get("tDamBaseHigh"),item.get("wDamBaseHigh"),item.get("fDamBaseHigh"),item.get("aDamBaseHigh")];
|
|
let results_high = calc_weapon_powder(item, base_high);
|
|
let damage_high = results_high[0];
|
|
present = results_high[1];
|
|
|
|
for (const i in damage_keys) {
|
|
item.set(damage_keys[i], [damage_low[i], damage_high[i]]);
|
|
}
|
|
}
|
|
item.set(damage_present_key, present);
|
|
}
|
|
|
|
/**
|
|
* Calculate weapon damage from powder.
|
|
*
|
|
* Params:
|
|
* weapon: Weapon to apply powder to
|
|
* damageBases: used by crafted
|
|
*
|
|
* Return:
|
|
* [damages, damage_present]
|
|
*/
|
|
function calc_weapon_powder(weapon, damageBases) {
|
|
let powders = weapon.get("powders").slice();
|
|
|
|
// Array of neutral + ewtfa damages. Each entry is a pair (min, max).
|
|
let damages = [
|
|
weapon.get('nDam').split('-').map(Number),
|
|
weapon.get('eDam').split('-').map(Number),
|
|
weapon.get('tDam').split('-').map(Number),
|
|
weapon.get('wDam').split('-').map(Number),
|
|
weapon.get('fDam').split('-').map(Number),
|
|
weapon.get('aDam').split('-').map(Number)
|
|
];
|
|
|
|
// Applying spell conversions
|
|
let neutralBase = damages[0].slice();
|
|
let neutralRemainingRaw = damages[0].slice();
|
|
|
|
//powder application for custom crafted weapons is inherently fucked because there is no base. Unsure what to do.
|
|
|
|
//Powder application for Crafted weapons - this implementation is RIGHT YEAAAAAAAAA
|
|
//1st round - apply each as ingred, 2nd round - apply as normal
|
|
if (weapon.get("tier") === "Crafted" && !weapon.get("custom")) {
|
|
for (const p of powders.concat(weapon.get("ingredPowders"))) {
|
|
const powder = powderStats[p]; //use min, max, and convert
|
|
// Bitwise to force conversion to integer (integer division).
|
|
const element = (p/6) | 0;
|
|
let diff = Math.floor(damageBases[0] * powder.convert/100);
|
|
damageBases[0] -= diff;
|
|
damageBases[element+1] += diff + Math.floor( (powder.min + powder.max) / 2 );
|
|
}
|
|
//update all damages
|
|
for (let i = 0; i < damages.length; i++) {
|
|
damages[i] = [Math.floor(damageBases[i] * 0.9), Math.floor(damageBases[i] * 1.1)];
|
|
}
|
|
neutralRemainingRaw = damages[0].slice();
|
|
neutralBase = damages[0].slice();
|
|
}
|
|
|
|
//apply powders to weapon (1.21 fked implementation)
|
|
let powder_apply_order = [];
|
|
let powder_apply_map = new Map();
|
|
for (const powderID of powders) {
|
|
const powder = powderStats[powderID];
|
|
// Bitwise to force conversion to integer (integer division).
|
|
const element = (powderID/6) | 0;
|
|
const conversion_ratio = powder.convert/100;
|
|
|
|
if (powder_apply_map.has(element)) {
|
|
let apply_info = powder_apply_map.get(element);
|
|
apply_info.conv += conversion_ratio;
|
|
apply_info.min += powder.min;
|
|
apply_info.max += powder.max;
|
|
}
|
|
else {
|
|
let apply_info = {
|
|
conv: conversion_ratio,
|
|
min: powder.min,
|
|
max: powder.max
|
|
};
|
|
powder_apply_order.push(element);
|
|
powder_apply_map.set(element, apply_info);
|
|
}
|
|
}
|
|
for (const element of powder_apply_order) {
|
|
const apply_info = powder_apply_map.get(element);
|
|
const conversion_ratio = apply_info.conv;
|
|
const min_diff = Math.min(neutralRemainingRaw[0], conversion_ratio * neutralRemainingRaw[0]);
|
|
const max_diff = Math.min(neutralRemainingRaw[1], conversion_ratio * neutralRemainingRaw[1]);
|
|
neutralRemainingRaw[0] -= min_diff;
|
|
neutralRemainingRaw[1] -= max_diff;
|
|
damages[element+1][0] += min_diff;
|
|
damages[element+1][1] += max_diff;
|
|
damages[element+1][0] += apply_info.min;
|
|
damages[element+1][1] += apply_info.max;
|
|
}
|
|
|
|
/*
|
|
//apply powders to weapon
|
|
for (const powderID of powders) {
|
|
const powder = powderStats[powderID];
|
|
// Bitwise to force conversion to integer (integer division).
|
|
const element = (powderID/6) | 0;
|
|
let conversionRatio = powder.convert/100;
|
|
if (neutralRemainingRaw[1] > 0) {
|
|
let min_diff = Math.min(neutralRemainingRaw[0], conversionRatio * neutralBase[0]);
|
|
let max_diff = Math.min(neutralRemainingRaw[1], conversionRatio * neutralBase[1]);
|
|
|
|
damages[element+1][0] = Math.floor(round_near(damages[element+1][0] + min_diff));
|
|
damages[element+1][1] = Math.floor(round_near(damages[element+1][1] + max_diff));
|
|
neutralRemainingRaw[0] = Math.floor(round_near(neutralRemainingRaw[0] - min_diff));
|
|
neutralRemainingRaw[1] = Math.floor(round_near(neutralRemainingRaw[1] - max_diff));
|
|
//damages[element+1][0] += min_diff;
|
|
//damages[element+1][1] += max_diff;
|
|
//neutralRemainingRaw[0] -= min_diff;
|
|
//neutralRemainingRaw[1] -= max_diff;
|
|
}
|
|
damages[element+1][0] += powder.min;
|
|
damages[element+1][1] += powder.max;
|
|
}
|
|
*/
|
|
|
|
// The ordering of these two blocks decides whether neutral is present when converted away or not.
|
|
damages[0] = neutralRemainingRaw;
|
|
|
|
// The ordering of these two blocks decides whether neutral is present when converted away or not.
|
|
let present_elements = []
|
|
for (const damage of damages) {
|
|
present_elements.push(damage[1] > 0);
|
|
}
|
|
return [damages, present_elements];
|
|
}
|