Exp cutoff / level

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

User avatar
om
Junior Member
Champion of the Light
Posts: 464
Joined: Fri Aug 16, 2002 12:48 am
Location: Canada

Exp cutoff / level

Post by om » Sun Sep 14, 2003 9:56 am

ya know how the original game cutts exp in half at lvl 70 and so on every every so levels, where is this in the dlls?
My new msn: om_silverbolt@hotmail.com
Add me :)

User avatar
Myhrginoc
Retired Admin
Cherub
Posts: 12062
Joined: Sat May 25, 2002 7:28 am
Location: Percussion U

Hand-picked

Re: Exp cutoff / level

Post by Myhrginoc » Sun Sep 14, 2003 10:39 am

In 1.10/1.10x the ExpRatio field of Experience.txt controls the penalty. In that field 1024 = 100%. No need to edit a DLL.

A simple search yields these threads for 1.09x:

Thread #1
Thread #2
Last edited by Myhrginoc on Sun Sep 14, 2003 10:41 am, edited 1 time in total.
Do the right thing. It will gratify some people and astonish the rest.
~ Mark Twain
Run Diablo II in any version for mods: tutorial
The Terms of Service!! Know them, abide by them, and enjoy the forums at peace.
The Beginner's Guide v1.4: (MS Word | PDF) || Mod Running Scripts || TFW: Awakening

User avatar
om
Junior Member
Champion of the Light
Posts: 464
Joined: Fri Aug 16, 2002 12:48 am
Location: Canada

Re: Exp cutoff / level

Post by om » Sun Sep 14, 2003 6:09 pm

thanks Myhrginoc :)
My new msn: om_silverbolt@hotmail.com
Add me :)

User avatar
Myhrginoc
Retired Admin
Cherub
Posts: 12062
Joined: Sat May 25, 2002 7:28 am
Location: Percussion U

Hand-picked

Re: Exp cutoff / level

Post by Myhrginoc » Fri Sep 19, 2003 5:34 am

Here are some more Experience tidbits for 1.10s. I found the function that takes monster experience, applies penalties as called for, and adds it to the player. The function is at d2game.6FCC4130.

The penalty for player level too different from monster level is revised substantially. Instead of a large switch statement, there is a table in the data section. The code using it is in two sections, one for player > monster and one for monster > player. The first case is shown below:

Code: Select all

6FCC4193   SUB ECX,EAX                           ; character level - monster level
6FCC4195   CMP ECX,0B                            ; difference more than 10?
6FCC4198   JL SHORT D2Game.6FCC419F
6FCC419A   MOV ECX,0A                            ; yes, evaluate at delta = 10
6FCC419F   MOV ECX,DWORD PTR DS:[ECX*4+6FD29394] ; look up penalty in a table
6FCC41A6   CMP ECX,100
6FCC41AC   JE D2Game.6FCC4267                    ; jump if no penalty
and the second case is here:

Code: Select all

6FCC4230   CMP EBP,19                            ; character achieved L25 yet?
6FCC4233   JL SHORT D2Game.6FCC423E
6FCC4235   TEST EAX,EAX
6FCC4237   JLE SHORT D2Game.6FCC423E
6FCC4239   PUSH EAX
6FCC423A   MOV EDX,EBP
6FCC423C   JMP SHORT D2Game.6FCC425E
6FCC423E   SUB EAX,EBP                           ; monster level - character level
6FCC4240   CMP EAX,0B                            ; difference more than 10?
6FCC4243   JL SHORT D2Game.6FCC424A
6FCC4245   MOV EAX,0A                            ; yes, evaluate at delta = 10
6FCC424A   MOV EDX,DWORD PTR DS:[EAX*4+6FD293C0] ; look up penalty in a table
6FCC4251   CMP EDX,100
6FCC4257   JE SHORT D2Game.6FCC4267              ; jump if no penalty
The two tables (grey dwords not included) are

Code: Select all

6FD29390  [color=#cfcfcf]04 00 00 00[/color] 00 01 00 00 00 01 00 00 00 01 00 00  ............
6FD293A0  00 01 00 00 00 01 00 00 00 01 00 00 CF 00 00 00  .........Ï...
6FD293B0  9F 00 00 00 6E 00 00 00 3D 00 00 00 0D 00 00 00  Ÿ...n...=.......
[color=#007fff]6FD293C0  00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00  ............
6FD293D0  00 01 00 00 00 01 00 00 E1 00 00 00 AE 00 00 00  ......á...®...
6FD293E0  5C 00 00 00 26 00 00 00 05 00 00 00 [/color][color=#cfcfcf]00 00 00 00[/color]  [color=#007fff]\...&..........[/color]
So the delta multipliers are (in decimal numbers):

Code: Select all

clvl - mlvl = 0-5  256  1.00       mlvl - clvl = 0-5  256  1.00
                6  207  0.81                       6  225  0.88
                7  159  0.62                       7  174  0.68
                8  110  0.43                       8   92  0.36
                9   61  0.24                       9   38  0.15
               10   13  0.05                      10    5  0.02
Notice this table is no longer symmetrical! And the penalty for clvl >= 25 and mlvl >= (clvl+10) is now 2% instead of 5%, that is a really steep penalty for getting experience from a monster much higher than you. Obviously an anti-leeching measure.

This system is actually more flexible, although it is still hardcoded. To remove the penalties, all you need to do is change the conditional jumps to unconditional jumps at the end of each code block shown above. You can rescale the penalties in the existing ranges by changing the dwords of the table. You can change the spread of the penalties by multiplying the deltas and checking across a wider range of levels (still keeping the same number of penalty steps)---but this takes extra steps so you have to jump out and back into each block. Finally, you can increase the number of penalty steps by making a new table (probably in slack space of the .rdata section) and adjusting the references accordingly. Combining the latter two options, you could have a twenty-step penalty table that changes with every four levels difference, and the direction of the delta can still matter because it can be asymmetrical.

As if this isn't bad enough, after these penalties are factored in, you still have ExpRatio to reckon with. Here is the target of those jumps skipping the delta penalties:

Code: Select all

6FCC4267   TEST ESI,ESI                          ; skip if no experience
6FCC4269   JLE SHORT D2Game.6FCC42B0
6FCC426B   PUSH EBP                              ; current level
6FCC426C   CALL <JMP.&D2Common.#11249>           ; get value of ExpRatio
6FCC4271   MOV EDI,EAX
6FCC4273   PUSH 0                                ; record 0 is MaxLvl
6FCC4275   CALL <JMP.&D2Common.#11249>           ; get value of ExpRatio
6FCC427A   TEST EAX,EAX
6FCC427C   JLE SHORT D2Game.6FCC42B0             ; ExpRatio(MaxLvl) is a scaling factor
6FCC427E   CMP EAX,20                            ; It is a bit shift, from 1 to 19 bits
6FCC4281   JGE SHORT D2Game.6FCC42B0             ; otherwise the field is ignored
Note the unmodded bit shift is 10 and the 100% value for ExpRatio is 1024 (which is 2^10). What about ExpRatio > 1024 (or the 100% point)? It does just what you might expect, it increases the experience granted.

Here is something new, items adding experience:

Code: Select all

6FCC42B0   PUSH 0
6FCC42B2   PUSH 55                               ; stat item_addexperience
6FCC42B4   PUSH EBX                              ; ptUnit (Player)
6FCC42B5   CALL <JMP.&D2Common.#10519>           ; get experience effect of items
6FCC42BA   MOV ECX,EAX
6FCC42BC   TEST ECX,ECX
6FCC42BE   JE D2Game.6FCC4354                    ; jump if no exp-adding items
EDIT - corrected a mistake to "And the penalty for clvl >= 25 and mlvl >= (clvl+10) is now 2% instead of 5%"
Last edited by Myhrginoc on Tue Sep 23, 2003 2:25 am, edited 4 times in total.
Do the right thing. It will gratify some people and astonish the rest.
~ Mark Twain
Run Diablo II in any version for mods: tutorial
The Terms of Service!! Know them, abide by them, and enjoy the forums at peace.
The Beginner's Guide v1.4: (MS Word | PDF) || Mod Running Scripts || TFW: Awakening

User avatar
om
Junior Member
Champion of the Light
Posts: 464
Joined: Fri Aug 16, 2002 12:48 am
Location: Canada

Re: Exp cutoff / level

Post by om » Fri Sep 19, 2003 4:23 pm

thanks for the info , but i make mods with 1.09d :)
My new msn: om_silverbolt@hotmail.com
Add me :)

User avatar
Myhrginoc
Retired Admin
Cherub
Posts: 12062
Joined: Sat May 25, 2002 7:28 am
Location: Percussion U

Hand-picked

Re: Exp cutoff / level

Post by Myhrginoc » Sat Sep 20, 2003 1:50 am

Ah, but other modders are working in 1.10s now, they might be interested too, no?
Do the right thing. It will gratify some people and astonish the rest.
~ Mark Twain
Run Diablo II in any version for mods: tutorial
The Terms of Service!! Know them, abide by them, and enjoy the forums at peace.
The Beginner's Guide v1.4: (MS Word | PDF) || Mod Running Scripts || TFW: Awakening

User avatar
om
Junior Member
Champion of the Light
Posts: 464
Joined: Fri Aug 16, 2002 12:48 am
Location: Canada

Re: Exp cutoff / level

Post by om » Sat Sep 20, 2003 7:09 am

NO! ;)
My new msn: om_silverbolt@hotmail.com
Add me :)

User avatar
pmpch
Forum Legend
Arch-Angel
Posts: 1171
Joined: Thu Dec 19, 2002 12:21 am
Location: Switzerland
Contact:

Re: Exp cutoff / level

Post by pmpch » Mon Sep 22, 2003 12:05 pm

[quote=Myhrginoc";p="128540"]
So the delta multipliers are (in decimal numbers):

Code: Select all

clvl - mlvl = 0-5  256  1.00       mlvl - clvl = 0-5  256  1.00
                6  207  0.81                       6  225  0.88
                7  159  0.62                       7  174  0.68
                8  110  0.43                       8   92  0.36
                9   61  0.24                       9   38  0.15
               10   13  0.05                      10    5  0.02
Notice this table is no longer symmetrical! And the penalty for clvl >= 25 and clvl >= (mlvl+10) is now 2% instead of 5%, that is a really steep penalty for getting experience from a monster much higher than you. Obviously an anti-leeching measure.[/quote]

mlvl - clvl => mlvl is larger
clvl >= (mlvl+10) => clvl is larger

... or in other words, the table doesn't reflect what the text is saying.
Bedevere: Well, now, uh, Launcelot, Galahad, and I, uh, wait until nightfall, and then leap out of the RABBIT, taking the French, uh, by surprise. Not only by surprise, but totally unarmed!
King Arthur: Who leaps out?

User avatar
Myhrginoc
Retired Admin
Cherub
Posts: 12062
Joined: Sat May 25, 2002 7:28 am
Location: Percussion U

Hand-picked

Re: Exp cutoff / level

Post by Myhrginoc » Tue Sep 23, 2003 2:27 am

Nice pickup, that went sailing right by me. The correct description is "mlvl >= (clvl + 10)." :oops: :oops: I have updated the main post.
Last edited by Myhrginoc on Tue Sep 23, 2003 2:28 am, edited 1 time in total.
Do the right thing. It will gratify some people and astonish the rest.
~ Mark Twain
Run Diablo II in any version for mods: tutorial
The Terms of Service!! Know them, abide by them, and enjoy the forums at peace.
The Beginner's Guide v1.4: (MS Word | PDF) || Mod Running Scripts || TFW: Awakening

User avatar
pmpch
Forum Legend
Arch-Angel
Posts: 1171
Joined: Thu Dec 19, 2002 12:21 am
Location: Switzerland
Contact:

Re: Exp cutoff / level

Post by pmpch » Tue Sep 23, 2003 1:12 pm

[quote=Myhrginoc";p="128540"]

Notice this table is no longer symmetrical! And the penalty for clvl >= 25 and mlvl >= (clvl+10) is now 2% instead of 5%, that is a really steep penalty for getting experience from a monster much higher than you. Obviously an anti-leeching measure.[/quote]

Sorry to bother again, but AFAIK the penalty of 1.09d was clvl / mlvl for clvl >= 25 and mlvl >= (clvl+10), it was never 5%.
Also, clvl / mlvl is still in place. I just tested it (1.10s), lvl 38 char / lvl 50 monster, resulted in 0.76 of the base exp, which is 38/50, just like in 1.09d.
I assume you meant clvl < 25, not clvl >= 25. In your words:

[quote=Myhrginoc";p="128540"]
Notice this table is no longer symmetrical! And the penalty for clvl < 25 and mlvl >= (clvl+10) is now 2% instead of 5%, that is a really steep penalty for getting experience from a monster much lower than you. [strike]Obviously an anti-leeching measure.[/strike][/quote]


Code: Select all

6FCC4230   CMP EBP,19                            ; character achieved L25 yet?
[color=#ffaa00]6FCC4233   JL SHORT D2Game.6FCC423E
6FCC4235   TEST EAX,EAX
6FCC4237   JLE SHORT D2Game.6FCC423E
6FCC4239   PUSH EAX
6FCC423A   MOV EDX,EBP
6FCC423C   JMP SHORT D2Game.6FCC425E[/color]
6FCC423E   SUB EAX,EBP                           ; monster level - character level
6FCC4240   CMP EAX,0B                            ; difference more than 10?
6FCC4243   JL SHORT D2Game.6FCC424A
6FCC4245   MOV EAX,0A                            ; yes, evaluate at delta = 10
6FCC424A   MOV EDX,DWORD PTR DS:[EAX*4+6FD293C0] ; look up penalty in a table
6FCC4251   CMP EDX,100
6FCC4257   JE SHORT D2Game.6FCC4267              ; jump if no penalty
Here, I can't follow. The first jump is for clvl < 25, what is the second and third?



Additional information:

The 1.09d numbers, if I recall correctly, are:

clvl < 25

Code: Select all

clvl - mlvl = 0-5  256  1.00       mlvl - clvl = 0-5  256  1.00
                6  207  0.81                       6  225  0.88
                7  159  0.62                       7  174  0.68
                8  110  0.43                       8   92  0.36
                9   61  0.24                       9   38  0.15
               10   13  0.05                      10   13  0.05
clvl >= 25

Code: Select all

clvl - mlvl = 0-5  256  1.00       mlvl - clvl > 0    clvl / mlvl
                6  207  0.81                       
                7  159  0.62                       
                8  110  0.43                       
                9   61  0.24                       
               10    5  0.05

So for 1.10s there would only be one small change, marked red:

clvl < 25

Code: Select all

[color=#007fff]clvl - mlvl = 0-5  256  1.00[/color]       mlvl - clvl = 0-5  256  1.00
                [color=#007fff]6  207  0.81[/color]                       6  225  0.88
                [color=#007fff]7  159  0.62[/color]                       7  174  0.68
                [color=#007fff]8  110  0.43[/color]                       8   92  0.36
                [color=#007fff]9   61  0.24[/color]                       9   38  0.15
               [color=#007fff]10   13  0.05[/color]                      [color=#ff0000]10    5  0.02[/color]
clvl >= 25

Code: Select all

[color=#007fff]clvl - mlvl = 0-5  256  1.00[/color]       mlvl - clvl > 0  clvl / mlvl
                [color=#007fff]6  207  0.81[/color]                       
                [color=#007fff]7  159  0.62[/color]                       
                [color=#007fff]8  110  0.43[/color]
                [color=#007fff]9   61  0.24[/color]                       
               [color=#007fff]10   13  0.05[/color]
I edited this post way too often :mrgreen:!
Last edited by pmpch on Sun Oct 12, 2003 2:22 pm, edited 21 times in total.
Bedevere: Well, now, uh, Launcelot, Galahad, and I, uh, wait until nightfall, and then leap out of the RABBIT, taking the French, uh, by surprise. Not only by surprise, but totally unarmed!
King Arthur: Who leaps out?

User avatar
Myhrginoc
Retired Admin
Cherub
Posts: 12062
Joined: Sat May 25, 2002 7:28 am
Location: Percussion U

Hand-picked

Re: Exp cutoff / level

Post by Myhrginoc » Wed Sep 24, 2003 2:30 am

Sheesh...I am knocked down, flattened, hung out to dry, burned by the sun. 8-O :oops: :roll: I am not looking at any more code until after my vacation---I obviously need it! I'll take another look at it when I return, if the function isn't thoroughly analyzed and documented by then.

Here is that block you were wondering about with a couple additional comments. The call to 6FC6A930 sets up the division you referred to.

Code: Select all

6FCC4230   CMP EBP,19                            ; character achieved L25 yet?
6FCC4233   JL SHORT D2Game.6FCC423E
6FCC4235   TEST EAX,EAX                          ; mlvl > 0?
6FCC4237   JLE SHORT D2Game.6FCC423E
6FCC4239   PUSH EAX
6FCC423A   MOV EDX,EBP                           ; clvl
6FCC423C   JMP SHORT D2Game.6FCC425E
6FCC423E   SUB EAX,EBP                           ; monster level - character level
6FCC4240   CMP EAX,0B                            ; difference more than 10?
6FCC4243   JL SHORT D2Game.6FCC424A
6FCC4245   MOV EAX,0A                            ; yes, evaluate at delta = 10
6FCC424A   MOV EDX,DWORD PTR DS:[EAX*4+6FD293C0] ; look up penalty in a table
6FCC4251   CMP EDX,100
6FCC4257   JE SHORT D2Game.6FCC4267
6FCC4259   PUSH 100
6FCC425E   MOV ECX,EDI                           ; monster exp
6FCC4260   CALL D2Game.6FC6A930
Do the right thing. It will gratify some people and astonish the rest.
~ Mark Twain
Run Diablo II in any version for mods: tutorial
The Terms of Service!! Know them, abide by them, and enjoy the forums at peace.
The Beginner's Guide v1.4: (MS Word | PDF) || Mod Running Scripts || TFW: Awakening

DakkinBB
Posts: 3
Joined: Thu Dec 04, 2003 9:09 am

Re: Exp cutoff / level

Post by DakkinBB » Sat Dec 06, 2003 9:00 am

So how do you remove the penalty for killing monsters much lower level than yourself?

User avatar
afterlife1488
Junior Member
Champion of the Light
Posts: 431
Joined: Tue Mar 04, 2003 3:47 am
Location: New Jersey
Contact:

Re: Exp cutoff / level

Post by afterlife1488 » Sun Dec 07, 2003 12:44 am

Could you show us something simple as to just eliminating the mlvl>clvl and clvl>mlvl caps? Or even just give us the modified dlls?
thanks.
Valhalla Mod for D2:LoD v1.1

God invented whiskey to prevent the Irish from taking over the world!

User avatar
pmpch
Forum Legend
Arch-Angel
Posts: 1171
Joined: Thu Dec 19, 2002 12:21 am
Location: Switzerland
Contact:

Re: Exp cutoff / level

Post by pmpch » Sun Dec 07, 2003 4:52 am

You just have to find the tables mentioned above for version 1.10
and replace the values you want by 256 (00 01 00 00) to get full exp, or set other values that serve your needs. Expanding the tables is a bit more complicated. I won't go into that atm.

IIRC the tables are d2game.dll @ 6FD293A4 and 6FD293D0

Good Luck
Bedevere: Well, now, uh, Launcelot, Galahad, and I, uh, wait until nightfall, and then leap out of the RABBIT, taking the French, uh, by surprise. Not only by surprise, but totally unarmed!
King Arthur: Who leaps out?

User avatar
afterlife1488
Junior Member
Champion of the Light
Posts: 431
Joined: Tue Mar 04, 2003 3:47 am
Location: New Jersey
Contact:

Re: Exp cutoff / level

Post by afterlife1488 » Sun Dec 07, 2003 6:42 pm

How and where do you edit the tables and what do you do it with?
Valhalla Mod for D2:LoD v1.1

God invented whiskey to prevent the Irish from taking over the world!

User avatar
Myhrginoc
Retired Admin
Cherub
Posts: 12062
Joined: Sat May 25, 2002 7:28 am
Location: Percussion U

Hand-picked

Re: Exp cutoff / level

Post by Myhrginoc » Mon Dec 08, 2003 6:08 am

In 1.10 final, the experience function is at d2game.6FCC2EC0. The table references are

Code: Select all

6FCC2F2F   |>  8B0C8D A493D26F           MOV ECX,DWORD PTR DS:[ECX*4+6FD293A4]
and

Code: Select all

6FCC2FDA   |>  8B1485 D093D26F           MOV EDX,DWORD PTR DS:[EAX*4+6FD293D0]
The actual tables can be edited with a hex editor. Go to the locations pmpch provided. This output here is from a debugger, so for hex editing subtract 6FC30000 from any address to get the file offset.

Code: Select all

6FD293A0  [color=#afafaf]04 00 00 00[/color] 00 01 00 00 00 01 00 00 00 01 00 00  ............
6FD293B0  00 01 00 00 00 01 00 00 00 01 00 00 CF 00 00 00  .........Ï...
6FD293C0  9F 00 00 00 6E 00 00 00 3D 00 00 00 0D 00 00 00  Ÿ...n...=.......
[color=#7f00ff]6FD293D0  00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00  ............
6FD293E0  00 01 00 00 00 01 00 00 E1 00 00 00 AE 00 00 00  ......á...®...
6FD293F0  5C 00 00 00 26 00 00 00 05 00 00 00[/color] [color=#afafaf]00 00 00 00[/color]  \...&..........
Each table has eleven values, representing the difference in level, from 0 up to ±10. Anything more than ±10 gets the ±10 value. Each value in the table is a dword, which in the Intel world is little-endian. So to change any table entry to have no effect, edit it to 00 01 00 00 as pmpch mentioned.
Do the right thing. It will gratify some people and astonish the rest.
~ Mark Twain
Run Diablo II in any version for mods: tutorial
The Terms of Service!! Know them, abide by them, and enjoy the forums at peace.
The Beginner's Guide v1.4: (MS Word | PDF) || Mod Running Scripts || TFW: Awakening

User avatar
ChaosEnergy
Forum Regular
Angel
Posts: 676
Joined: Wed Dec 03, 2003 3:48 pm
Location: NRW
Contact:

Re: Exp cutoff / level

Post by ChaosEnergy » Wed Mar 10, 2004 6:14 pm

Hi

I dont want to remove the exp behaviour but i want to move the LvL25 behavior...so where is the 25 located, so that I can move it around...like 35 or 10 as example

Regards
Chaos

User avatar
pmpch
Forum Legend
Arch-Angel
Posts: 1171
Joined: Thu Dec 19, 2002 12:21 am
Location: Switzerland
Contact:

Re: Exp cutoff / level

Post by pmpch » Thu Mar 11, 2004 12:00 am

Code: Select all

[color=#ffaa00]6FCC4230   CMP EBP,19                 ; character achieved L25 yet?[/color]
6FCC4233   JL SHORT D2Game.6FCC423E
6FCC4235   TEST EAX,EAX
6FCC4237   JLE SHORT D2Game.6FCC423E
6FCC4239   PUSH EAX
6FCC423A   MOV EDX,EBP
6FCC423C   JMP SHORT D2Game.6FCC425E
6FCC423E   SUB EAX,EBP                           ; monster level - character level
6FCC4240   CMP EAX,0B                            ; difference more than 10?
6FCC4243   JL SHORT D2Game.6FCC424A
6FCC4245   MOV EAX,0A                            ; yes, evaluate at delta = 10
6FCC424A   MOV EDX,DWORD PTR DS:[EAX*4+6FD293C0] ; look up penalty in a table
6FCC4251   CMP EDX,100
6FCC4257   JE SHORT D2Game.6FCC4267              ; jump if no penalty

Myhrginoc has given the 1.10 final offsets above.
Last edited by pmpch on Thu Mar 11, 2004 12:05 am, edited 5 times in total.
Bedevere: Well, now, uh, Launcelot, Galahad, and I, uh, wait until nightfall, and then leap out of the RABBIT, taking the French, uh, by surprise. Not only by surprise, but totally unarmed!
King Arthur: Who leaps out?

User avatar
ChaosEnergy
Forum Regular
Angel
Posts: 676
Joined: Wed Dec 03, 2003 3:48 pm
Location: NRW
Contact:

Re: Exp cutoff / level

Post by ChaosEnergy » Thu Mar 11, 2004 1:23 am

Post has been from end september 2003, thaught it has been based on 1.10s patch

it must be from 110s or older...at this adress i cant find this code with ollydbg
Last edited by ChaosEnergy on Thu Mar 11, 2004 1:28 am, edited 1 time in total.

User avatar
Myhrginoc
Retired Admin
Cherub
Posts: 12062
Joined: Sat May 25, 2002 7:28 am
Location: Percussion U

Hand-picked

Re: Exp cutoff / level

Post by Myhrginoc » Sat Mar 13, 2004 2:16 am

If you look at my post on December 7, you'll see where the code starts in the final version.
Do the right thing. It will gratify some people and astonish the rest.
~ Mark Twain
Run Diablo II in any version for mods: tutorial
The Terms of Service!! Know them, abide by them, and enjoy the forums at peace.
The Beginner's Guide v1.4: (MS Word | PDF) || Mod Running Scripts || TFW: Awakening

User avatar
ChaosEnergy
Forum Regular
Angel
Posts: 676
Joined: Wed Dec 03, 2003 3:48 pm
Location: NRW
Contact:

Re: Exp cutoff / level

Post by ChaosEnergy » Sat Mar 13, 2004 3:10 am

The content of post from 8. december i could find

but i m looking for

Code: Select all

6FCC4230   CMP EBP,[b]19[/b]                 ; character achieved L25 yet? 
i only wanna move the value 25 to another value

Edit:
offset 92FC2
change 19 into eg 07
Last edited by ChaosEnergy on Sat Mar 13, 2004 4:45 am, edited 2 times in total.

User avatar
kingpin
Senior Admin
Cherub
Posts: 10916
Joined: Sat Jan 11, 2003 12:51 pm
Contact:
Sweden

Hand-picked

Re: Exp cutoff / level

Post by kingpin » Sat Mar 13, 2004 4:34 am

Code: Select all

:6FCC2FB7 03C2                    add eax, edx
:6FCC2FB9 8BF0                    mov esi, eax
:6FCC2FBB C1FE08                  sar esi, 08
:6FCC2FBE EB37                    jmp 6FCC2FF7

* Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:6FCC2F1B(C)
|
:6FCC2FC0 83FD19                  cmp ebp, 00000019
:6FCC2FC3 7C09                    jl 6FCC2FCE
:6FCC2FC5 85C0                    test eax, eax
:6FCC2FC7 7E05                    jle 6FCC2FCE
:6FCC2FC9 50                      push eax
:6FCC2FCA 8BD5                    mov edx, ebp
:6FCC2FCC EB20                    jmp 6FCC2FEE
I think the code is located here (d2game.dll), I just made a search, but havn't tried anything.

User avatar
Sduibek
Junior Member
Paladin
Posts: 169
Joined: Mon Mar 15, 2004 10:21 pm
Location: Los Angeles, CA, USA
Contact:
United States of America

Re: Exp cutoff / level

Post by Sduibek » Wed Mar 24, 2004 9:22 pm

Just edited the code from the Dec 7th post to be all "00 01 00 00"

does that mean the exp. penalty is gone, or do i have to edit the other posted code as well?

thanks.

User avatar
pmpch
Forum Legend
Arch-Angel
Posts: 1171
Joined: Thu Dec 19, 2002 12:21 am
Location: Switzerland
Contact:

Re: Exp cutoff / level

Post by pmpch » Fri Mar 26, 2004 6:55 am

Sduibek";p="162896" wrote:Just edited the code from the Dec 7th post to be all "00 01 00 00"

does that mean the exp. penalty is gone, or do i have to edit the other posted code as well?

thanks.

The mlvl / clvl is still there. You get that when clvl > 24 and mlvl > clvl.
Bedevere: Well, now, uh, Launcelot, Galahad, and I, uh, wait until nightfall, and then leap out of the RABBIT, taking the French, uh, by surprise. Not only by surprise, but totally unarmed!
King Arthur: Who leaps out?

User avatar
pmpch
Forum Legend
Arch-Angel
Posts: 1171
Joined: Thu Dec 19, 2002 12:21 am
Location: Switzerland
Contact:

Re: Exp cutoff / level

Post by pmpch » Fri Mar 26, 2004 7:00 am

The following was put into a separate post for visibility reasons. (View @ 1280x1024)

This is 1.10 code, and some of it doesn't make any sense to me at all. Looks like the parts (marked by NOP) could be left away, since they are never used by the actual game.

I documented most of it. Feedback would be nice.

Edit: All NOPs only valid for exp < 800000h and penalty < 10000h (valid in unmodified games)



ebp = clvl
edi = exp

Mlvl_Clvl penalty code:

[code]
6FCC2F12 8B4424 18 MOV EAX,DWORD PTR SS:[ESP+18] EAX = mlvl
6FCC2F16 56 PUSH ESI
6FCC2F17 3BC5 CMP EAX,EBP
6FCC2F19 8BF7 MOV ESI,EDI ESI = EDI = exp
6FCC2F1B 0F8F 9F000000 JG D2Game.6FCC2FC0 ? mlvl > clvl

(clvl >= mlvl)
6FCC2F21 8BCD MOV ECX,EBP ECX = clvl
6FCC2F23 2BC8 SUB ECX,EAX ECX = clvl - mlvl
6FCC2F25 83F9 0B CMP ECX,0B
6FCC2F28 7C 05 JL SHORT D2Game.6FCC2F2F ? clvl - mlvl < 11

(clvl - mlvl > 10)
6FCC2F2A B9 0A000000 MOV ECX,0A ECX = 10

(clvl - mlvl < 11)
6FCC2F2F 8B0C8D A493D26F MOV ECX,DWORD PTR DS:[ECX*4+6FD293A4] ECX = penalty
6FCC2F36 81F9 00010000 CMP ECX,100 ECX = 256
6FCC2F3C 0F84 B5000000 JE D2Game.6FCC2FF7 ? ECX = 256 -> done

(ECX != 256)
6FCC2F42 81FF 00001000 CMP EDI,100000
6FCC2F48 7E 27 JLE SHORT D2Game.6FCC2F71 ? EDI <= 100000h

(exp > 100000h)
6FCC2F4A 8BC7 MOV EAX,EDI
6FCC2F4C 24 F0 AND AL,0F0 EAX = ???????0
6FCC2F4E 3D 00100000 CMP EAX,1000
6FCC2F53 7D 04 JGE SHORT D2Game.6FCC2F59 *TRUE (EAX >= 1000h)

6FCC2F55 8BC1 MOV EAX,ECX (NOP)
6FCC2F57 EB 2F JMP SHORT D2Game.6FCC2F88 (NOP)

(for EDI < 7FFFFFFF replacable by MOV ESI, EDI & NOP*)
6FCC2F59 8BC7 MOV EAX,EDI (NOP) EAX = exp
6FCC2F5B 99 CDQ (NOP) EDX = 0 (EAX < 7FFFFFh)
6FCC2F5C 81E2 FF000000 AND EDX,0FF (NOP) EDX = 0
6FCC2F62 03C2 ADD EAX,EDX (NOP) EAX + 0
6FCC2F64 8BF0 MOV ESI,EAX (NOP) ESI = exp
6FCC2F66 C1FE 08 SAR ESI,8 ESI / 256
6FCC2F69 0FAFF1 IMUL ESI,ECX ESI = ESI * penalty
6FCC2F6C E9 86000000 JMP D2Game.6FCC2FF7 done

(exp <= 100000h)
6FCC2F71 81F9 00000100 CMP ECX,10000 (NOP) make JLE->JMP
6FCC2F77 8BC1 MOV EAX,ECX EAX = penalty
6FCC2F79 7E 32 JLE SHORT D2Game.6FCC2FAD *TRUE (ECX < 256)

(NOP land!!)
6FCC2F7B 8BD1 MOV EDX,ECX (NOP)
6FCC2F7D 83E2 F0 AND EDX,FFFFFFF0 (NOP)
6FCC2F80 81FA 00100000 CMP EDX,1000 (NOP)
6FCC2F86 7D 12 JGE SHORT D2Game.6FCC2F9A (NOP)
6FCC2F88 F7EF IMUL EDI (NOP)
6FCC2F8A 6A 00 PUSH 0 (NOP)
6FCC2F8C 68 00010000 PUSH 100 (NOP)
6FCC2F91 52 PUSH EDX (NOP)
6FCC2F92 50 PUSH EAX (NOP)
6FCC2F93 E8 58990500 CALL D2Game.6FD1C8F0 (NOP)
6FCC2F98 EB 5B JMP SHORT D2Game.6FCC2FF5 (NOP)
6FCC2F9A 99 CDQ (NOP)
6FCC2F9B 81E2 FF000000 AND EDX,0FF (NOP)
6FCC2FA1 03C2 ADD EAX,EDX (NOP)
6FCC2FA3 8BF0 MOV ESI,EAX (NOP)
6FCC2FA5 C1FE 08 SAR ESI,8 (NOP)
6FCC2FA8 0FAFF7 IMUL ESI,EDI (NOP)
6FCC2FAB EB 4A JMP SHORT D2Game.6FCC2FF7 (NOP)

6FCC2FAD 0FAFC7 IMUL EAX,EDI EAX = EAX * exp (EAX = penalty)
6FCC2FB0 99 CDQ
6FCC2FB1 81E2 FF000000 AND EDX,0FF
6FCC2FB7 03C2 ADD EAX,EDX
6FCC2FB9 8BF0 MOV ESI,EAX
6FCC2FBB C1FE 08 SAR ESI,8 ESI = EAX / 256
6FCC2FBE EB 37 JMP SHORT D2Game.6FCC2FF7 done

----------------------------------------------------

(mlvl > clvl)
6FCC2FC0 83FD 19 CMP EBP,19
6FCC2FC3 7C 09 JL SHORT D2Game.6FCC2FCE ? clvl < 25

(clvl >= 25)
6FCC2FC5 85C0 TEST EAX,EAX
6FCC2FC7 7E 05 JLE SHORT D2Game.6FCC2FCE ? mlvl = 0 ***

(mlvl > 0)
6FCC2FC9 50 PUSH EAX
6FCC2FCA 8BD5 MOV EDX,EBP EDX = clvl
6FCC2FCC EB 20 JMP SHORT D2Game.6FCC2FEE

(clvl < 25)
6FCC2FCE 2BC5 SUB EAX,EBP EAX = mlvl - clvl


6FCC2FD0 83F8 0B CMP EAX,0B
6FCC2FD3 7C 05 JL SHORT D2Game.6FCC2FDA ? mlvl - clvl < 11

(mlvl - clvl > 10)
6FCC2FD5 B8 0A000000 MOV EAX,0A EAX = 10

(mlvl - clvl < 11)
6FCC2FDA 8B1485 D093D26F MOV EDX,DWORD PTR DS:[EAX*4+6FD293D0] EDX = penalty
6FCC2FE1 81FA 00010000 CMP EDX,100
6FCC2FE7 74 0E JE SHORT D2Game.6FCC2FF7 ? EDX = 256 -> done

(penalty != 256)
6FCC2FE9 68 00010000 PUSH 100

6FCC2FEE 8BCF MOV ECX,EDI ECX = exp
6FCC2FF0 E8 7B7FFAFF CALL D2Game.6FC6AF70 penalty calculation

6FCC2FF5 8BF0 MOV ESI,EAX
6FCC2FF7 85F6 TEST ESI,ESI
6FCC2FF9 7E 45 JLE SHORT D2Game.6FCC3040
[/code]




*
TRUE => always happens (unmodified game), hence NOP


***
mlvl = 0 (first off, why is this only checked for clvl >= 25)

Well anyway it does some weird stuff, so I guess this shuould never happen!

Code: Select all

6FCC2FCE   2BC5             SUB EAX,EB                     this goes negative
6FCC2FD0   83F8 0B          CMP EAX,0B
6FCC2FD3   7C 05            JL SHORT D2Game.6FCC2FDA       so we get a cond jmp here to

6FCC2FDA   8B1485 D093D26F  MOV EDX,DWORD PTR DS:[EAX*4+6FD293D0]
Now that doesn't seem a good idea with EAX = FFFFFFxx !!
Last edited by pmpch on Sun Mar 28, 2004 8:42 am, edited 15 times in total.
Bedevere: Well, now, uh, Launcelot, Galahad, and I, uh, wait until nightfall, and then leap out of the RABBIT, taking the French, uh, by surprise. Not only by surprise, but totally unarmed!
King Arthur: Who leaps out?

Post Reply

Return to “Code Editing”