View unanswered posts | View active topics It is currently Wed May 22, 2013 8:14 am



Reply to topic  [ 31 posts ]  Go to page Previous  1, 2, 3, 4  Next
 D3 Api item link encoding 
Author Message

Joined: Fri Aug 10, 2012 1:45 pm
Posts: 26
Post Re: D3 Api item link encoding
admin wrote:
I was originally creating profiles per class, but then ended up switching to an approach where I rate the item based on the highest primary (Str, Dex, Int) stat. It's not perfect, but it simplified things for me.

yep seams a good idea to simplify and would still give good results
maybe give some weight too vitality (specialy for HC)
and of course some weight to class specific skill bonuses

admin wrote:
I don't know the exact number, but could probably figure it out with a couple queries. Based on some observations, I think the min Affix for a given item is roughly ilvl - 17. That would mean the lowest alvl for an ilvl 63 item is 46.

i would be curious about that i dont think it's a simple range, there must be special rules
it would mean that all chest armor ilvl 63 should have 3 socket or none (i never saw any of thoses http://www.d3lexicon.com/affix#socket-enhancement and the other one after aLvl 46 have 3 sockets)
also i dont see pants socket after lvl 46

admin wrote:
Not sure what you mean by "missing the affix part of the price". Affixes don't have prices so confused about what you are talking about here.

if you look at sell price of items, same items with same afixes have the same sell price (so not stat roll dependant) so it have to be a link between sell prices and affixes (and maybe the chance of an affix to roll)

admin wrote:
You're not going to figure it all out without looking at the decompiled ASM code from the game client. While the basic idea is simple, the implementation has a lot of tricky parts including extra rnd values being popped, the rnd function being re-seeded, special rules for when random armor offsets are applied, and you also need to know the implementation of the RandomFloat() function (which is a custom function).

maybe i'll do that when i have some time, dont really feel like decompiling/playing processor right now, i can figure out like 30-40% of my item db with the function i have right now, i just wonder why this function should be so complicated, why reseed ? why special rules ? why a custom function ? why some wasted call to Next() ?

the classic one (val/MAX_UINT) i use seems to be working quite well for most armor values

it's late now and a godd night sleeping often helps ;)


Thu Aug 16, 2012 6:19 pm
Profile
Site Admin

Joined: Tue Aug 16, 2011 12:49 am
Posts: 229
Post Re: D3 Api item link encoding
jonv11 wrote:
maybe give some weight too vitality (specialy for HC)
and of course some weight to class specific skill bonuses

My original goal (about a year) ago was to support multiple kinds of profiles so you could create separate HC or PvP profiles if you wanted. I haven't done that yet, but that seems like the logical progression.

I also need to add class-specific skill support since I haven't done that either, although most of them (so far are lackluster). But with the new 1.0.4 procs, this will become much more interesting.

jonv11 wrote:
i would be curious about that i dont think it's a simple range, there must be special rules
it would mean that all chest armor ilvl 63 should have 3 socket or none (i never saw any of thoses http://www.d3lexicon.com/affix#socket-enhancement and the other one after aLvl 46 have 3 sockets) also i dont see pants socket after lvl 46

Yeah, that's an excellent point. Some Affixes may have different rules. Not really sure/

jonv11 wrote:
if you look at sell price of items, same items with same afixes have the same sell price (so not stat roll dependant) so it have to be a link between sell prices and affixes (and maybe the chance of an affix to roll)

AH ok, I just ignore Vendor sell price since no one cares about that at all. Not really worth spending any time on.


Fri Aug 17, 2012 11:33 pm
Profile

Joined: Fri Aug 10, 2012 1:45 pm
Posts: 26
Post Re: D3 Api item link encoding
here is we i am so far ...

start by seeding prg with item seed and reseed
then
Quote:
if (!Description.ItemType.Is("FollowerSpecial"))
{
unknowValues.Add(randomizer.InternalNext());
if (ItemQuality > 5)
if (
Description.ItemType.Is("ChestArmor") || Description.ItemType.Is("Shoulders") || Description.ItemType.Is("Gloves") ||
Description.ItemType.Is("Legs") || Description.ItemType.Is("Boots") || Description.ItemType.Is("GenericHelm") ||
Description.ItemType.Is("VoodooMask")
)
unknowValues.Add(randomizer.InternalNext());
if (ItemCraftType <= 9)
{
if (Description.ItemArmorDelta > 0)
{
unknowValues.Add(randomizer.InternalNext());
float trueArmor = randomizer.RangeFloat(Description.ItemArmorBase, Description.ItemArmorBase + Description.ItemArmorDelta, unknowValues[unknowValues.Count - 1]);
double armor = Math.Round(trueArmor);
}
}
}

randomizer.Reseed();

if (Description.ItemType.Is("Weapon"))
{
unknowValues.Add(randomizer.InternalNext());
unknowValues.Add(randomizer.InternalNext());
float trueMinDmg = randomizer.RangeFloat(Description.ItemMinimumDamageBase, Description.ItemMinimumDamageBase + Description.ItemMinimumDamageDelta, unknowValues[unknowValues.Count - 2]);
float trueModDmg = randomizer.RangeFloat(Description.ItemDeltaDamageBase, Description.ItemDeltaDamageBase + Description.ItemDeltaDamageDelta, unknowValues[unknowValues.Count - 1]);
double minDmg = Math.Round(trueMinDmg);
double maxDmg = Math.Round(trueMinDmg + trueModDmg);
}


then run all the modifier in order (it's always a RangeUint32 from byte of modcode (even if the data is encoded as a float))

it's not perfect yet but it works for +95% of my db, also i didnt check the validity of the float values (armor, dmg) as i'm not sure of the float implementation, just those of the magic props values
got this from buteforcing the next/reseed pattern and then segmentationnal analysis
tried to see the asm code but even with IDAPro i canot find anything i'm happy with :s

still didnt find the 'why' to all thoses wasted calls ...

i'm starting to wonder if it's not some prg mechanism when high or low bit reach some value ...


Sun Aug 19, 2012 11:37 am
Profile

Joined: Fri Aug 10, 2012 1:45 pm
Posts: 26
Post Re: D3 Api item link encoding
i made a quick shema of wath i think (by looking in the asm code) are the different possible ways (and test to perform a call to next() or not)

the circles represent the possible calls (i also post some part of the code that i dont understand quite fully :s)


Attachments:
File comment: a random float ?
randomFloat.png
randomFloat.png [ 26.67 KiB | Viewed 361 times ]
File comment: first test on the left
doublePopInternal.png
doublePopInternal.png [ 24.41 KiB | Viewed 361 times ]
File comment: the schema
shema.png
shema.png [ 13.21 KiB | Viewed 361 times ]
Sun Aug 19, 2012 2:01 pm
Profile

Joined: Mon Jul 09, 2012 1:31 pm
Posts: 1
Post Re: D3 Api item link encoding
Quote:
I don't know the exact number, but could probably figure it out with a couple queries. Based on some observations, I think the min Affix for a given item is roughly ilvl - 17. That would mean the lowest alvl for an ilvl 63 item is 46.


No.
-Lvlreq counts from the normal alvl.
So an item -17 lvlreq = 43 alvl.


Mon Aug 20, 2012 4:22 am
Profile

Joined: Fri Aug 10, 2012 1:45 pm
Posts: 26
Post Re: D3 Api item link encoding
Ghent wrote:
No.
-Lvlreq counts from the normal alvl.
So an item -17 lvlreq = 43 alvl.


which lvlreq are you talking about ?
from this http://d3inferno.com/AffixList.gam.html i dont see any lvlreq defined (maybe one of the unknow values?)
the only one i see is on items and is the character level ...

here http://www.d3lexicon.com/affix/socketed-8 i can see some req information but no explanation on how it's found/computed

can you give a bit more explanation/examples ?
thanks


Mon Aug 20, 2012 5:55 am
Profile

Joined: Fri Aug 10, 2012 1:45 pm
Posts: 26
Post Re: D3 Api item link encoding
from what i understand of the RandomFloat it should be somethng like this

Code:
int x = (int)NextInternal();
float y = (float)x;
if(x < 0) y += (float)(uint.MaxValue); // 0xffffffff
y *= (1.0 / (float)(uint.MaxValue)); // 1 / 0xffffffff


y is then a float between 0 and 1


Mon Aug 20, 2012 11:56 am
Profile
Site Admin

Joined: Tue Aug 16, 2011 12:49 am
Posts: 229
Post Re: D3 Api item link encoding
jonv11 wrote:
still didnt find the 'why' to all thoses wasted calls ...

i'm starting to wonder if it's not some prg mechanism when high or low bit reach some value ...

Not sure as to why there are wasted calls (or rnd pops as I call them). Originally I thought that they might be used for things I didn't care about, so I just ignored them.

Having looked at that code a lot, I am pretty sure that it has nothing to do with high or low bits reaching any values. There would be no reason for that.

Ghent wrote:
-Lvlreq counts from the normal alvl.
So an item -17 lvlreq = 43 alvl.

I wasn't talking about the REQ (minus lvl req Affix). When I did a rough (albeit manual) search of lowest Affix on an ilvl 63 item, I came up with 46. But I didn't look too hard, since I was just wanting a ballpark number. But you mentioned that Sockets might work different since you can still get 1 or 2 Sockets on Pants/Chests which would not be possible the way I described it.

jonv11 wrote:
from what i understand of the RandomFloat it should be somethng like this

PM or email me and I will send you the RandomFloat() code. Or you can just look in IDA for the ptr to the RandomFloat function (there's actually a string with that name that's part of ptr array). I don't know the current offset since I haven't looked at it since beta, but I know it hasn't changed since my gen works fine.

Note that the RandomFloat is only used for the Armor and Weapon offsets, not the Attribute values.

jonv11 wrote:
Code:
if (Description.ItemArmorDelta > 0)
{
unknowValues.Add(randomizer.InternalNext());
float trueArmor = randomizer.RangeFloat(Description.ItemArmorBase, Description.ItemArmorBase + Description.ItemArmorDelta, unknowValues[unknowValues.Count - 1]);
double armor = Math.Round(trueArmor);
}

That code is not entirely correct. For some reason (and I have no idea why) not all armors have a random delta. There's a flag that determines whether a random delta needs to be applied or not.


Mon Aug 20, 2012 12:59 pm
Profile

Joined: Fri Aug 10, 2012 1:45 pm
Posts: 26
Post Re: D3 Api item link encoding
Code:
Not sure as to why there are wasted calls (or rnd pops as I call them). Originally I thought that they might be used for things I didn't care about, so I just ignored them.

my best guess is those value were used while generating the item (first time) and were used to compute other random value that are now fixed (ie durability, rare names and affixes)
but again it's just a wild guess ;)

Quote:
There's a flag that determines whether a random delta needs to be applied or not.

and that flag is not a flag for crafted items ? (i think only those dont run on armor and dmg but i may be wrong)


Mon Aug 20, 2012 2:43 pm
Profile
Site Admin

Joined: Tue Aug 16, 2011 12:49 am
Posts: 229
Post Re: D3 Api item link encoding
jonv11 wrote:
and that flag is not a flag for crafted items ? (i think only those dont run on armor and dmg but i may be wrong)

You might be correct on that. I wasn't looking at that. After all, once you've crafted an item, there is no (easy) way to tell by looking at it that it was crafted. Unlike in D2 where crafted items were Orange or in WoW where it says who crafted it.

But in any case, there is a flag that indicates whether there is a "delta" float offset to the base armor and damage.

--Muaziz


Mon Aug 20, 2012 3:30 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 31 posts ]  Go to page Previous  1, 2, 3, 4  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.