## [1.09d] How to make rare items always get 6 affixes

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

rpg302308
Posts: 12
Joined: Wed Jan 20, 2010 12:33 pm

### [1.09d] How to make rare items always get 6 affixes

How to modify d2game to make rare items always get 3 magicprefix and 3 magicsuffix (not include jewels)
Last edited by rpg302308 on Thu Feb 25, 2010 4:33 pm, edited 1 time in total.

saesa
Posts: 47
Joined: Sat Sep 23, 2006 8:18 pm

### Re: [1.09d] How to make rare items always get 6 affixes

You can simulate 6 affixes by having only 6 groups in magicprefixes, suffixes.txt so in most of cases you will get 6 affixes.

Another way is obviously Code Edit.
PK

Amaru
Posts: 19
Joined: Thu Jul 17, 2008 7:43 pm

### Re: [1.09d] How to make rare items always get 6 affixes

as it was somewhere stated, affix number generator is pretty crappy, there's an array of dword[8] in d2game memory data section, a number between 0-7 is picked up randomly, and array[number] will be the number of affixes to be generatred
this is for 1.11b

Code: Select all

``````void PatchNumberRareAffixes()
{
/*
6FD1CA7C  03 00 00 00 04 00 00 00 04 00 00 00 05 00 00 00  ............
6FD1CA8C  05 00 00 00 05 00 00 00 06 00 00 00 06 00 00 00  ............
*/
BYTE a[0x18];
memset(a, 0, 0x18);
a[0x00] = 0x06;	a[0x04] = 0x06;	a[0x08] = 0x06;	a[0x0C] = 0x06;
a[0x10] = 0x06;	a[0x14] = 0x06;
PatchBytes2(GetDllOffset("D2Game.dll", 0xFCA7C), (DWORD)a, 0x18);
}
``````
and this does not include jewels

rpg302308
Posts: 12
Joined: Wed Jan 20, 2010 12:33 pm

### Re: [1.09d] How to make rare items always get 6 affixes

in 1.11b, i try to modify like this:
06 00 00 00 06 00 00 00 06 00 00 00 06 00 00 00
06 00 00 00 06 00 00 00 06 00 00 00 06 00 00 00
result is a rare ring always get 6 affixes, this will cause side effects?

in 1.09d, i can't find following code.
03 00 00 00 04 00 00 00 04 00 00 00 05 00 00 00
05 00 00 00 05 00 00 00 06 00 00 00 06 00 00 00

what should i do？

Amaru
Posts: 19
Joined: Thu Jul 17, 2008 7:43 pm

### Re: [1.09d] How to make rare items always get 6 affixes

rpg302308" wrote:in 1.11b, i try to modify like this:
06 00 00 00 06 00 00 00 06 00 00 00 06 00 00 00
06 00 00 00 06 00 00 00 06 00 00 00 06 00 00 00
result is a rare ring always get 6 affixes, this will cause side effects?
what do you mean? 6 affixes on rings is ok
in 1.09d, i can't find following code.
03 00 00 00 04 00 00 00 04 00 00 00 05 00 00 00
05 00 00 00 05 00 00 00 06 00 00 00 06 00 00 00
what should i do？
sorry, perhaps there's another way they are generated, try debugging setstat for statlist function

Necrolis
Throne
Posts: 9021
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:

### Re: [1.09d] How to make rare items always get 6 affixes

in 1.09 the affix counts are randomized using this:

Code: Select all

``````6FC50AA7                                                 |.  BA 02000000                   MOV EDX,2
6FC50AAC                                                 |.  8BCD                          MOV ECX,EBP
6FC50AAE                                                 |.  E8 0D440A00                   CALL <JMP.&D2Common.#10918>
6FC50AB3                                                 |.  83C0 03                       ADD EAX,3
6FC50AB6                                                 |.  894424 20                     MOV DWORD PTR SS:[ESP+20],EAX                              ;  affix count
6FC50ABA                                                 |.  EB 13                         JMP SHORT D2Game.6FC50ACF
6FC50ABC                                                 |>  BA 04000000                   MOV EDX,4
6FC50AC1                                                 |.  8BCD                          MOV ECX,EBP
6FC50AC3                                                 |.  E8 F8430A00                   CALL <JMP.&D2Common.#10918>
6FC50AC8                                                 |.  83C0 03                       ADD EAX,3
6FC50ACB                                                 |.  894424 20                     MOV DWORD PTR SS:[ESP+20],EAX                              ;  affix count
``````
just after this the loop which adds affixes

Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal

imakeigloos_pat
Posts: 91
Joined: Wed Dec 10, 2008 12:13 am

### Re: [1.09d] How to make rare items always get 6 affixes

I know this is BUMP of the century but I could use an explanation here if anyone could help me.

I just applied this little patch so that every rare item spawn with both three prefixes and suffixes in 1.11b with this great explanation from Amaru wrote.

What I don't get is how he came to 'FCA7C' from the virtual address '6FD1CA7C'? The base address for D2game.dll is so low, only '019D0000'. So I found out that the the virtual address must be from the d2common.dll because d2common.dll's base address is '6FD50000'. However, this is already outside the scope of the virtual address Amaru wrote in his source (6FD50000 > 6FD1CA7C). And if you subtract this offset with the base address you have 0x6FD1CA7C - 0x6FD50000 = 0xFFFCCA7C which doesn't translate to 0xFCA7C as far as I know. And the 'FCA7C' offset is in D2game.dll...

Is there something very obvious I am not understanding?

Necrolis
Throne
Posts: 9021
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:

### Re: [1.09d] How to make rare items always get 6 affixes

imakeigloos_pat" wrote:I know this is BUMP of the century but I could use an explanation here if anyone could help me.
Funnily enough you are still a few years shy of taking that title (I've seen an 8 years old necro on this forum ).
imakeigloos_pat" wrote:I just applied this little patch so that every rare item spawn with both three prefixes and suffixes in 1.11b with this great explanation from Amaru wrote.

What I don't get is how he came to 'FCA7C' from the virtual address '6FD1CA7C'? The base address for D2game.dll is so low, only '019D0000'. So I found out that the the virtual address must be from the d2common.dll because d2common.dll's base address is '6FD50000'. However, this is already outside the scope of the virtual address Amaru wrote in his source (6FD50000 > 6FD1CA7C). And if you subtract this offset with the base address you have 0x6FD1CA7C - 0x6FD50000 = 0xFFFCCA7C which doesn't translate to 0xFCA7C as far as I know. And the 'FCA7C' offset is in D2game.dll...

Is there something very obvious I am not understanding?
Thats because most modern OSes use ASLR for increased security, back in the old days D2 dll's always loaded at the same address (bar overlaps with over dll's). Secondly, the default base load addresses for the D2 dll's have changed over the years, so you need to use the 1.09 bases for 1.09 address and the same for 1.11b. the old 1.09 D2Game has a (default) base address of 6FC20000, which will get you to the correct address if you add that 1.09 RVA. (very little of the item generation and affix generation code lies outside of D2Game.dll btw).