d2jsp
Log InRegister
d2jsp Forums > Diablo II > Diablo 2 Discussion > -- Affix Calculator --
Prev11516171819Next
Add Reply New Topic New Poll
Member
Posts: 92,984
Joined: Dec 31 2007
Gold: 2,299.94
Aug 16 2021 09:27am
just curious if this accounts for req lvl 24 for +1 class skills on "class only items", such as +1 pal on pal shields.

if so that must have been fun to code.... most make sense, orbs, wands, scepters, etc. but certain weps +1 barb = rlvl24, bows/javs = 24 for zon, etc.
Member
Posts: 36,368
Joined: Mar 31 2010
Gold: 106,698.50
Aug 16 2021 12:17pm
Quote (thesnipa @ Aug 16 2021 11:27am)
just curious if this accounts for req lvl 24 for +1 class skills on "class only items", such as +1 pal on pal shields.

if so that must have been fun to code.... most make sense, orbs, wands, scepters, etc. but certain weps +1 barb = rlvl24, bows/javs = 24 for zon, etc.


not that bad tbh.

Code
function getItemLevelReq() {
var rlvl = 0;

rlvl = Math.max(
item.classid === -1 ? 0 : baseTypes[item.classid].levelreq,
item.p1 === -1 ? 0 : magicPrefix[item.p1].levelreq,
item.p2 === -1 ? 0 : magicPrefix[item.p2].levelreq,
item.p3 === -1 ? 0 : magicPrefix[item.p3].levelreq,
item.s1 === -1 ? 0 : magicSuffix[item.s1].levelreq,
item.s2 === -1 ? 0 : magicSuffix[item.s2].levelreq,
item.s3 === -1 ? 0 : magicSuffix[item.s3].levelreq,
item.autoaffix === -1 ? 0 : autoMagic[item.autoaffix].levelreq
);

if (item.quality === 8) {
rlvl += 10 + (item.anum * 3);
}

rlvl = Math.max(
rlvl,
item.smod1 === -1 ? 0 : skills[item.smod1].reqlevel,
item.smod2 === -1 ? 0 : skills[item.smod2].reqlevel,
item.smod3 === -1 ? 0 : skills[item.smod3].reqlevel
);

return Math.min(rlvl, 98);
}
Member
Posts: 92,984
Joined: Dec 31 2007
Gold: 2,299.94
Aug 16 2021 12:37pm
Quote (laztheripper @ Aug 16 2021 01:17pm)
not that bad tbh.

Code
function getItemLevelReq() {
var rlvl = 0;

rlvl = Math.max(
item.classid === -1 ? 0 : baseTypes[item.classid].levelreq,
item.p1 === -1 ? 0 : magicPrefix[item.p1].levelreq,
item.p2 === -1 ? 0 : magicPrefix[item.p2].levelreq,
item.p3 === -1 ? 0 : magicPrefix[item.p3].levelreq,
item.s1 === -1 ? 0 : magicSuffix[item.s1].levelreq,
item.s2 === -1 ? 0 : magicSuffix[item.s2].levelreq,
item.s3 === -1 ? 0 : magicSuffix[item.s3].levelreq,
item.autoaffix === -1 ? 0 : autoMagic[item.autoaffix].levelreq
);

if (item.quality === 8) {
rlvl += 10 + (item.anum * 3);
}

rlvl = Math.max(
rlvl,
item.smod1 === -1 ? 0 : skills[item.smod1].reqlevel,
item.smod2 === -1 ? 0 : skills[item.smod2].reqlevel,
item.smod3 === -1 ? 0 : skills[item.smod3].reqlevel
);

return Math.min(rlvl, 98);
}


it appears each case i listed is returning rlvl 22, which afaik should be 24 instead.
Member
Posts: 36,368
Joined: Mar 31 2010
Gold: 106,698.50
Aug 16 2021 01:19pm
Quote (thesnipa @ Aug 16 2021 02:37pm)
it appears each case i listed is returning rlvl 22, which afaik should be 24 instead.


example?

The full formula when parsing item packets and their children is this, but I cut that down for affixcalc cause it doesn't have all the variables an actual item has, like set or unique rarity.

Code
getLevelRequirement() {
var basereq = this.baseItem.levelreq, i, lvlreq, areq = 0,
areqs = [],
reqs = [basereq];

if (this.flags.Identified) {
switch (this.quality) {
case ItemQuality.Magic: // Affixes
if (this.prefix) areqs.push(MagicPrefix[this.prefix.index].levelreq || 0);
if (this.suffix) areqs.push(MagicSuffix[this.suffix.index].levelreq || 0);
if (this.autoMod) areqs.push(AutoAffix[this.autoMod].levelreq || 0);
break;
case ItemQuality.Rare:
if (this.autoMod) areqs.push(AutoAffix[this.autoMod].levelreq || 0);
break;
case ItemQuality.Set:
reqs.push(SetItem[this.setid].lvlreq || 0);
break;
case ItemQuality.Unique:
reqs.push(Unique[this.uniqueid].lvlreq || 0);
break;
}

if (this.magicPrefixes) {
for (i = 0; i < this.magicPrefixes.length; i++) {
areqs.push(MagicPrefix[this.magicPrefixes[i].index].levelreq);
}
}

if (this.magicSuffixes) {
for (i = 0; i < this.magicSuffixes.length; i++) {
areqs.push(MagicSuffix[this.magicSuffixes[i].index].levelreq);
}
}

areq = Math.max(...areqs);

if (this.quality === ItemQuality.Crafted) {
areq += 10;
if (this.magicPrefixes) areq += 3 * this.magicPrefixes.length;
if (this.magicSuffixes) areq += 3 * this.magicSuffixes.length;
}

reqs.push(areq);
}

reqs.push(this.singleskillreq || 0); // Staffmod level reqs
lvlreq = Math.max(...reqs);
if (this.dstats) lvlreq += this.dstats.itemlevelreq || 0; // When upped or double upped (+5 and +7 respectively, for a total of +12) socketed items are never upped, so no need to flatten stats
return Math.min(98, lvlreq);
}


You did mention +paladin skills, that just uses the same required level stuff from it being an affix (like any other) if the result isn't 24, then 24 isn't what it's supposed to be.
Staffmods are another thing

This post was edited by laztheripper on Aug 16 2021 01:33pm
Member
Posts: 92,984
Joined: Dec 31 2007
Gold: 2,299.94
Aug 16 2021 01:26pm
Quote (laztheripper @ Aug 16 2021 02:19pm)
example?


hmmm i searched through my imgur and ALL of the examples i have show lvl 24, but also all have a lvl 24 req skill....

ill check my barb BO wps and pally shield to confirm and lyk.
Member
Posts: 36,368
Joined: Mar 31 2010
Gold: 106,698.50
Aug 16 2021 01:30pm
Quote (thesnipa @ Aug 16 2021 03:26pm)
hmmm i searched through my imgur and ALL of the examples i have show lvl 24, but also all have a lvl 24 req skill....

ill check my barb BO wps and pally shield to confirm and lyk.




I should specify that the item exported from affixcalc cannot set the required level shown by the client, that's calculated by the client from the same rules I mentioned above. And if the required level shown ingame is the same as the one in affixcalc, it's guaranteed to be correct.

This post was edited by laztheripper on Aug 16 2021 01:36pm
Member
Posts: 92,984
Joined: Dec 31 2007
Gold: 2,299.94
Aug 16 2021 01:38pm
Quote (laztheripper @ Aug 16 2021 02:30pm)
https://media.discordapp.net/attachments/778434661327568896/876910722137878580/unknown.png

I should specify that the item exported from affixcalc cannot set the required level shown by the client, that's calculated by the client from the same rules I mentioned above. And if the required level shown ingame is the same as the one in affixcalc, it's guaranteed to be correct.


yes i believe you're working as it should be. in my brain it was messed up because i make lvl 24 duelers and almost all of their gear either has lvl 24 skills or another rlvl 24 mod (mana,etc)
Member
Posts: 36,368
Joined: Mar 31 2010
Gold: 106,698.50
Aug 16 2021 01:43pm
Quote (thesnipa @ Aug 16 2021 03:38pm)
yes i believe you're working as it should be. in my brain it was messed up because i make lvl 24 duelers and almost all of their gear either has lvl 24 skills or another rlvl 24 mod (mana,etc)


:thumbsup: never a bad thing to double check
Cause as far as I know, the formula I pasted for the item packets hasn't been laid out before (publicly at least).
Only other system that does the required level completely accurately is doug's, and even his has some edge cases where it was incorrect.
The latest research we did together probably does produce the final, correct values that include all possible edge cases.

This post was edited by laztheripper on Aug 16 2021 01:46pm
Member
Posts: 92,984
Joined: Dec 31 2007
Gold: 2,299.94
Aug 16 2021 01:51pm
Quote (laztheripper @ Aug 16 2021 02:43pm)
:thumbsup: never a bad thing to double check
Cause as far as I know, the formula I pasted for the item packets hasn't been laid out before (publicly at least).
Only other system that does the required level completely accurately is doug's, and even his has some edge cases where it was incorrect.
The latest research we did together probably does produce the final, correct values that include all possible edge cases.


Indeed and some of them are fairly obvious, class only items like heads/orbs/pelts/palshields, some are fairly obvious like staffs/wands/scepters, and some are less obvious like +1 barb weps, +1 dudu clubs, +1 ama javas,

I've been iso a +1pal-30/20/allres automod / 2 os shield for about 5 years.......
Member
Posts: 36,368
Joined: Mar 31 2010
Gold: 106,698.50
Aug 16 2021 02:20pm
Quote (thesnipa @ Aug 16 2021 03:51pm)
Indeed and some of them are fairly obvious, class only items like heads/orbs/pelts/palshields, some are fairly obvious like staffs/wands/scepters, and some are less obvious like +1 barb weps, +1 dudu clubs, +1 ama javas,

I've been iso a +1pal-30/20/allres automod / 2 os shield for about 5 years.......


the +class ones are some of the easier ones, they're the same as any other affix. so +life or +str are the same, they don't have added components.
But yeah that's a particular iso, guessing only +1 cause lld ?
Go Back To Diablo 2 Discussion Topic List
Prev11516171819Next
Add Reply New Topic New Poll