Making staffmods more common 1.13c

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

Post Reply
Sampson
Posts: 52
Joined: Mon Sep 30, 2013 2:22 am

Making staffmods more common 1.13c

Post by Sampson » Wed Jan 08, 2014 11:10 pm

I want to make staffmods appear more often. It's like they appear 1/4 of the time, and when they do the game chooses 1, 2 or 3 mods. Does anyone know what I need to change to maybe make them appear 50%-100% more often?

This is the 1.13c staffmod code. The notes came from Amaru in another topic from an older version he posted. Unfortunately theres nothing in his notes about how it chooses to have no staffmod.

Code: Select all

039A3320   83EC 18          SUB ESP,18
039A3323   55               PUSH EBP
039A3324   56               PUSH ESI
039A3325   8B7424 2C        MOV ESI,DWORD PTR SS:[ESP+2C]
039A3329   83C8 FF          OR EAX,FFFFFFFF
039A332C   57               PUSH EDI
039A332D   53               PUSH EBX
039A332E   894424 1C        MOV DWORD PTR SS:[ESP+1C],EAX            ;  clear 1st staffmod
039A3332   894424 20        MOV DWORD PTR SS:[ESP+20],EAX            ;  2nd
039A3336   894424 24        MOV DWORD PTR SS:[ESP+24],EAX            ;  3rd
039A333A   E8 AD72FFFF      CALL <JMP.&D2Common.#10411>              ;  get item seed
039A333F   8BC8             MOV ECX,EAX
039A3341   8B01             MOV EAX,DWORD PTR DS:[ECX]
039A3343   8B79 04          MOV EDI,DWORD PTR DS:[ECX+4]
039A3346   BA C590C66A      MOV EDX,6AC690C5
039A334B   F7E2             MUL EDX
039A334D   33ED             XOR EBP,EBP
039A334F   03C7             ADD EAX,EDI
039A3351   13D5             ADC EDX,EBP
039A3353   8951 04          MOV DWORD PTR DS:[ECX+4],EDX
039A3356   8901             MOV DWORD PTR DS:[ECX],EAX
039A3358   33D2             XOR EDX,EDX
039A335A   B9 64000000      MOV ECX,64
039A335F   F7F1             DIV ECX
039A3361   BD 02000000      MOV EBP,2
039A3366   03D6             ADD EDX,ESI
039A3368   83FA 5A          CMP EDX,5A
039A336B   7E 0A            JLE SHORT D2Game.039A3377
039A336D   C74424 10 030000>MOV DWORD PTR SS:[ESP+10],3              ; staffmods = 3
039A3375   EB 20            JMP SHORT D2Game.039A3397
039A3377   83FA 46          CMP EDX,46
039A337A   7E 06            JLE SHORT D2Game.039A3382
039A337C   896C24 10        MOV DWORD PTR SS:[ESP+10],EBP            ;  staffmods = 2
039A3380   EB 15            JMP SHORT D2Game.039A3397
039A3382   83FA 1E          CMP EDX,1E
039A3385   7F 08            JG SHORT D2Game.039A338F
039A3387   85F6             TEST ESI,ESI
039A3389   0F84 44020000    JE D2Game.039A35D3
039A338F   C74424 10 010000>MOV DWORD PTR SS:[ESP+10],1              ;  staffmods = 1
039A3397   8B7C24 28        MOV EDI,DWORD PTR SS:[ESP+28]
039A339B   83FF 24          CMP EDI,24
039A339E   BE 01000000      MOV ESI,1
039A33A3   897424 0C        MOV DWORD PTR SS:[ESP+C],ESI
039A33A7   7E 16            JLE SHORT D2Game.039A33BF
039A33A9   53               PUSH EBX                                 ;  push num of staffmods
039A33AA   E8 CF7FFFFF      CALL <JMP.&D2Common.#10718>              ;  get format from itemdata
039A33AF   66:3D 6400       CMP AX,64
039A33B3   72 0A            JB SHORT D2Game.039A33BF
039A33B5   C74424 0C 050000>MOV DWORD PTR SS:[ESP+C],5
039A33BD   EB 27            JMP SHORT D2Game.039A33E6
039A33BF   83FF 18          CMP EDI,18
039A33C2   7E 0A            JLE SHORT D2Game.039A33CE
039A33C4   C74424 0C 040000>MOV DWORD PTR SS:[ESP+C],4
039A33CC   EB 18            JMP SHORT D2Game.039A33E6
039A33CE   83FF 12          CMP EDI,12
039A33D1   7E 0A            JLE SHORT D2Game.039A33DD
039A33D3   C74424 0C 030000>MOV DWORD PTR SS:[ESP+C],3
039A33DB   EB 09            JMP SHORT D2Game.039A33E6
039A33DD   83FF 0B          CMP EDI,0B
039A33E0   7E 08            JLE SHORT D2Game.039A33EA
039A33E2   896C24 0C        MOV DWORD PTR SS:[ESP+C],EBP
039A33E6   8B7424 0C        MOV ESI,DWORD PTR SS:[ESP+C]
039A33EA   8B4424 10        MOV EAX,DWORD PTR SS:[ESP+10]
039A33EE   85C0             TEST EAX,EAX
039A33F0   C74424 14 000000>MOV DWORD PTR SS:[ESP+14],0
039A33F8   0F8E D5010000    JLE D2Game.039A35D3
039A33FE   EB 04            JMP SHORT D2Game.039A3404
039A3400   8B7424 0C        MOV ESI,DWORD PTR SS:[ESP+C]
039A3404   53               PUSH EBX
039A3405   E8 E271FFFF      CALL <JMP.&D2Common.#10411>
039A340A   8BC8             MOV ECX,EAX
039A340C   8B01             MOV EAX,DWORD PTR DS:[ECX]
039A340E   8B79 04          MOV EDI,DWORD PTR DS:[ECX+4]
039A3411   BA C590C66A      MOV EDX,6AC690C5
039A3416   F7E2             MUL EDX
039A3418   33ED             XOR EBP,EBP
039A341A   03C7             ADD EAX,EDI
039A341C   13D5             ADC EDX,EBP
039A341E   8951 04          MOV DWORD PTR DS:[ECX+4],EDX
039A3421   8901             MOV DWORD PTR DS:[ECX],EAX
039A3423   33D2             XOR EDX,EDX
039A3425   B9 64000000      MOV ECX,64
039A342A   F7F1             DIV ECX
039A342C   83FA 50          CMP EDX,50
039A342F   7E 03            JLE SHORT D2Game.039A3434
039A3431   46               INC ESI
039A3432   EB 10            JMP SHORT D2Game.039A3444
039A3434   83FA 1E          CMP EDX,1E
039A3437   7F 0B            JG SHORT D2Game.039A3444
039A3439   83FA 0A          CMP EDX,0A
039A343C   7E 03            JLE SHORT D2Game.039A3441
039A343E   4E               DEC ESI
039A343F   EB 03            JMP SHORT D2Game.039A3444
039A3441   83C6 FE          ADD ESI,-2
039A3444   83FE 01          CMP ESI,1
039A3447   7D 05            JGE SHORT D2Game.039A344E
039A3449   BE 01000000      MOV ESI,1
039A344E   53               PUSH EBX
039A344F   E8 4474FFFF      CALL <JMP.&D2Common.#10106>
039A3454   83F8 01          CMP EAX,1
039A3457   75 0A            JNZ SHORT D2Game.039A3463
039A3459   83FE 04          CMP ESI,4
039A345C   7C 05            JL SHORT D2Game.039A3463
039A345E   BE 04000000      MOV ESI,4
039A3463   8B5424 2C        MOV EDX,DWORD PTR SS:[ESP+2C]
039A3467   8D04B2           LEA EAX,DWORD PTR DS:[EDX+ESI*4]
039A346A   C74424 28 060000>MOV DWORD PTR SS:[ESP+28],6
039A3472   8D7C06 FB        LEA EDI,DWORD PTR DS:[ESI+EAX-5]
039A3476   53               PUSH EBX
039A3477   E8 7071FFFF      CALL <JMP.&D2Common.#10411>            ;  get item seed
039A347C   8BC8             MOV ECX,EAX
039A347E   8B01             MOV EAX,DWORD PTR DS:[ECX]
039A3480   8B71 04          MOV ESI,DWORD PTR DS:[ECX+4]
039A3483   BA C590C66A      MOV EDX,6AC690C5
039A3488   F7E2             MUL EDX
039A348A   33ED             XOR EBP,EBP
039A348C   03C6             ADD EAX,ESI
039A348E   13D5             ADC EDX,EBP
039A3490   8951 04          MOV DWORD PTR DS:[ECX+4],EDX
039A3493   8901             MOV DWORD PTR DS:[ECX],EAX
039A3495   33D2             XOR EDX,EDX
039A3497   B9 05000000      MOV ECX,5
039A349C   F7F1             DIV ECX
039A349E   8D3417           LEA ESI,DWORD PTR DS:[EDI+EDX]
039A34A1   85F6             TEST ESI,ESI
039A34A3   7C 39            JL SHORT D2Game.039A34DE
039A34A5   8B15 9C82A803    MOV EDX,DWORD PTR DS:[<&D2Common.sgptDat>; D2Common.sgptDataTables
039A34AB   8B0A             MOV ECX,DWORD PTR DS:[EDX]
039A34AD   3BB1 A00B0000    CMP ESI,DWORD PTR DS:[ECX+BA0]
039A34B3   7D 29            JGE SHORT D2Game.039A34DE
039A34B5   8B91 980B0000    MOV EDX,DWORD PTR DS:[ECX+B98]
039A34BB   8BC6             MOV EAX,ESI
039A34BD   69C0 3C020000    IMUL EAX,EAX,23C
039A34C3   03C2             ADD EAX,EDX
039A34C5   74 17            JE SHORT D2Game.039A34DE
039A34C7   66:8B40 18       MOV AX,WORD PTR DS:[EAX+18]
039A34CB   66:85C0          TEST AX,AX
039A34CE   7E 0E            JLE SHORT D2Game.039A34DE
039A34D0   0FBFC0           MOVSX EAX,AX
039A34D3   50               PUSH EAX
039A34D4   53               PUSH EBX
039A34D5   E8 566FFFFF      CALL <JMP.&D2Common.#10744>
039A34DA   85C0             TEST EAX,EAX
039A34DC   74 12            JE SHORT D2Game.039A34F0
039A34DE   3B7424 18        CMP ESI,DWORD PTR SS:[ESP+18]
039A34E2   74 0C            JE SHORT D2Game.039A34F0
039A34E4   3B7424 1C        CMP ESI,DWORD PTR SS:[ESP+1C]
039A34E8   74 06            JE SHORT D2Game.039A34F0
039A34EA   3B7424 20        CMP ESI,DWORD PTR SS:[ESP+20]
039A34EE   75 13            JNZ SHORT D2Game.039A3503
039A34F0   8B4424 28        MOV EAX,DWORD PTR SS:[ESP+28]
039A34F4   48               DEC EAX
039A34F5   85C0             TEST EAX,EAX
039A34F7   894424 28        MOV DWORD PTR SS:[ESP+28],EAX
039A34FB  ^0F8F 75FFFFFF    JG D2Game.039A3476
039A3501   EB 08            JMP SHORT D2Game.039A350B
039A3503   8B4C24 14        MOV ECX,DWORD PTR SS:[ESP+14]
039A3507   89748C 18        MOV DWORD PTR SS:[ESP+ECX*4+18],ESI
039A350B   BD 01000000      MOV EBP,1
039A3510   53               PUSH EBX
039A3511   896C24 2C        MOV DWORD PTR SS:[ESP+2C],EBP
039A3515   E8 647EFFFF      CALL <JMP.&D2Common.#10718>
039A351A   66:3D 6400       CMP AX,64
039A351E   72 0A            JB SHORT D2Game.039A352A
039A3520   53               PUSH EBX
039A3521   E8 7273FFFF      CALL <JMP.&D2Common.#10106>
039A3526   3BC5             CMP EAX,EBP
039A3528   74 4F            JE SHORT D2Game.039A3579
039A352A   53               PUSH EBX
039A352B   E8 BC70FFFF      CALL <JMP.&D2Common.#10411>             ;  get item seed
039A3530   8BC8             MOV ECX,EAX
039A3532   8B01             MOV EAX,DWORD PTR DS:[ECX]
039A3534   8B79 04          MOV EDI,DWORD PTR DS:[ECX+4]
039A3537   BA C590C66A      MOV EDX,6AC690C5
039A353C   F7E2             MUL EDX
039A353E   33ED             XOR EBP,EBP
039A3540   03C7             ADD EAX,EDI
039A3542   13D5             ADC EDX,EBP
039A3544   8901             MOV DWORD PTR DS:[ECX],EAX
039A3546   8951 04          MOV DWORD PTR DS:[ECX+4],EDX
039A3549   33D2             XOR EDX,EDX
039A354B   B9 64000000      MOV ECX,64
039A3550   F7F1             DIV ECX
039A3552   8B4424 30        MOV EAX,DWORD PTR SS:[ESP+30]
039A3556   8BCA             MOV ECX,EDX
039A3558   99               CDQ
039A3559   2BC2             SUB EAX,EDX
039A355B   D1F8             SAR EAX,1
039A355D   03C8             ADD ECX,EAX
039A355F   83F9 5A          CMP ECX,5A
039A3562   7C 07            JL SHORT D2Game.039A356B
039A3564   BD 03000000      MOV EBP,3                               ;  skill level=3
039A3569   EB 0E            JMP SHORT D2Game.039A3579
039A356B   83F9 3C          CMP ECX,3C
039A356E   BD 02000000      MOV EBP,2                                ;  skill level=2
039A3573   7D 04            JGE SHORT D2Game.039A3579
039A3575   8B6C24 28        MOV EBP,DWORD PTR SS:[ESP+28]            ;  skill level=1
039A3579   6A 40            PUSH 40
039A357B   6A 00            PUSH 0
039A357D   53               PUSH EBX
039A357E   E8 3B7AFFFF      CALL <JMP.&D2Common.#10930>             ;  get statlist from unit
039A3583   8BF8             MOV EDI,EAX
039A3585   85FF             TEST EDI,EDI
039A3587   75 2B            JNZ SHORT D2Game.039A35B4
039A3589   85DB             TEST EBX,EBX
039A358B   75 05            JNZ SHORT D2Game.039A3592
039A358D   83C9 FF          OR ECX,FFFFFFFF
039A3590   EB 06            JMP SHORT D2Game.039A3598
039A3592   8B4B 0C          MOV ECX,DWORD PTR DS:[EBX+C]
039A3595   8B43 08          MOV EAX,DWORD PTR DS:[EBX+8]
039A3598   51               PUSH ECX
039A3599   6A 04            PUSH 4
039A359B   6A 00            PUSH 0
039A359D   6A 40            PUSH 40
039A359F   50               PUSH EAX
039A35A0   E8 FB70FFFF      CALL <JMP.&D2Common.#11013>
039A35A5   6A 01            PUSH 1
039A35A7   8BF8             MOV EDI,EAX
039A35A9   57               PUSH EDI
039A35AA   53               PUSH EBX
039A35AB   E8 5A70FFFF      CALL <JMP.&D2Common.#10807>
039A35B0   85FF             TEST EDI,EDI
039A35B2   74 0A            JE SHORT D2Game.039A35BE
039A35B4   56               PUSH ESI
039A35B5   55               PUSH EBP                                ;  skill level
039A35B6   6A 6B            PUSH 6B
039A35B8   57               PUSH EDI
039A35B9   E8 2471FFFF      CALL <JMP.&D2Common.#10188>             ;  setstat for statlist
039A35BE   8B4424 14        MOV EAX,DWORD PTR SS:[ESP+14]
039A35C2   8B4C24 10        MOV ECX,DWORD PTR SS:[ESP+10]
039A35C6   40               INC EAX
039A35C7   3BC1             CMP EAX,ECX
039A35C9   894424 14        MOV DWORD PTR SS:[ESP+14],EAX
039A35CD  ^0F8C 2DFEFFFF    JL D2Game.039A3400
039A35D3   5F               POP EDI
039A35D4   5E               POP ESI
039A35D5   5D               POP EBP
039A35D6   83C4 18          ADD ESP,18
039A35D9   C2 0C00          RETN 0C

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:
South Africa

Hand-picked

Re: Making staffmods more common 1.13c

Post by Necrolis » Thu Jan 09, 2014 4:03 pm

Code: Select all

6FC33368                                              |.  83FA 5A                                                 CMP EDX,5A                                               ;  90
6FC3336B                                              |.  7E 0A                                                   JLE SHORT D2Game.6FC33377                                ;  if(nChance > 90) nStaffMods = 3;
6FC3336D                                              |.  C74424 10 03000000                                      MOV DWORD PTR SS:[ESP+10],3
6FC33375                                              |.  EB 20                                                   JMP SHORT <D2Game.ADD_STAFF_MODS>
6FC33377                                              |>  83FA 46                                                 CMP EDX,46                                               ;  70
6FC3337A                                              |.  7E 06                                                   JLE SHORT D2Game.6FC33382                                ;  if(nChance > 70) nStaffMods = 2;
6FC3337C                                              |.  896C24 10                                               MOV DWORD PTR SS:[ESP+10],EBP
6FC33380                                              |.  EB 15                                                   JMP SHORT <D2Game.ADD_STAFF_MODS>
6FC33382                                              |>  83FA 1E                                                 CMP EDX,1E                                               ;  if(nChance > 30) nStaffMods = 1;
6FC33385                                              |.  7F 08                                                   JG SHORT D2Game.6FC3338F
6FC33387                                              |.  85F6                                                    TEST ESI,ESI                                             ;  if(nItemLevel < 1)
6FC33389                                              |.  0F84 44020000                                           JE D2Game.6FC335D3                                       ;  return
6FC3338F                                              |>  C74424 10 01000000                                      MOV DWORD PTR SS:[ESP+10],1
<D2Game.ADD_STAFF_MODS> 6FC33397                      |>  8B7C24 28                                               MOV EDI,DWORD PTR SS:[ESP+28]
basically you have 10% chance of 3 mods, 30% for 2 mods and 70% for 1 mod (however, should you roll no staffmods and the FORCE_STAFFMOD flag is present, you get 1 staffmod, such as when imbuing). make the numbers (90, 70, 30) lower to increase the chances.

It should be noted, that D2Game.0x6FC335E0 generates staffmods for Classic mode.
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
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

Sampson
Posts: 52
Joined: Mon Sep 30, 2013 2:22 am

Re: Making staffmods more common 1.13c

Post by Sampson » Thu Jan 09, 2014 8:24 pm

thanks a lot!

I changed the chance of 3 to 46(70) so it should be 30%
I changed the chance of 2 to 28(40) so it should be 60% of 70 = 42%
I changed the chance of 1 to 00(00) so it should be the remainder 28%

Then I looked at 167 items to see if they had staffmods.
0 items had no staffmod
66 items had 1 staffmod (39.5%)
56 items had 2 staffmods (33.5%)
45 items had 3 staffmods (27%)

It's a big improvement regardless but maybe my sample size wasn't big enough for it to match the expected values, even so the number with 1 staffmod seems a bit high

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:
South Africa

Hand-picked

Re: Making staffmods more common 1.13c

Post by Necrolis » Fri Jan 10, 2014 10:33 am

Sampson" wrote:thanks a lot!

I changed the chance of 3 to 46(70) so it should be 30%
I changed the chance of 2 to 28(40) so it should be 60% of 70 = 42%
I changed the chance of 1 to 00(00) so it should be the remainder 28%

Then I looked at 167 items to see if they had staffmods.
0 items had no staffmod
66 items had 1 staffmod (39.5%)
56 items had 2 staffmods (33.5%)
45 items had 3 staffmods (27%)

It's a big improvement regardless but maybe my sample size wasn't big enough for it to match the expected values, even so the number with 1 staffmod seems a bit high
D2's RNG doesn't have a proper uniform distribution, so you are going to deviate quite a bit (the price you pay for speedy MWC PRNG's). I can't conform if the statistical part is correct, as no longer remember that from my stats course :P
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
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

Ruffneck
Posts: 5
Joined: Sat Jun 15, 2019 9:07 pm
Canada

Re: Making staffmods more common 1.13c

Post by Ruffneck » Wed Jun 26, 2019 4:12 am

Necrolis wrote:
Thu Jan 09, 2014 4:03 pm
2 mods and 70% for 1 mod (however, should you roll no staffmods and the FORCE_STAFFMOD flag is present, you get 1 staffmod, such as when imbuing). make the numbers (90, 70, 30) lower to increase the chances.
What's the FORCE_STAFFMOD flag?

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:
South Africa

Hand-picked

Re: Making staffmods more common 1.13c

Post by Necrolis » Wed Jun 26, 2019 2:28 pm

Ruffneck wrote:
Wed Jun 26, 2019 4:12 am
Necrolis wrote:
Thu Jan 09, 2014 4:03 pm
2 mods and 70% for 1 mod (however, should you roll no staffmods and the FORCE_STAFFMOD flag is present, you get 1 staffmod, such as when imbuing). make the numbers (90, 70, 30) lower to increase the chances.
What's the FORCE_STAFFMOD flag?
The actual numerical flag is 0x20, but you can easily check the from the code I gave above.
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
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

Post Reply

Return to “Code Editing”