
Originally Posted by
numenor123
Dear all,
It is with great pleasure that I can tell we did the first step!
Using ollydbg, we set (a lot of !) breakpoints to analyse what was happening when a monster was killed.
Eventually, we found those lines:
1005C56C 837D 08 0A CMP DWORD PTR SS:[EBP+8],0A
1005C570 7C 07 JL SHORT SHO_GS_1.1005C579
This is the test between your level difference with the monster and ... 10, but in hexadecimal! We are stupid ^^' So our first guess was not that bad, just we should have looked for 0xA instead of 10.
What we would have like to do, is to change this 0x0A into a 0xD2 (210).
However, when putting a too big number, it creates a new line (SHR CL, 0EC). And this makes things crash.
I think it has something to do with the size of the stack ? I don't know, started learning assembly only a few days ago ^^
Does any of you with greater knowledge of assembly could help us telling what we should do to be able to compare with a bigger number?
Also I'd like to thank you, once again :)
Without the precious information you shared, we would have probably taken ten times more times (knowing the logic and that is in SHO_GS.DLL; you did 99% of the work ^^)
Next step is to remove the level difference in the computation of your drop chances... and of course to learn more assembly to be able to put D2 :)
NB: For the moment, we have changed the JL by a JMP. As a temporary fix. But we don't really like it since it breaks the mechanics.
- - - Updated - - -
Final update:
This is the whole piece of code we are interesting in:
1005C55D 837D 08 00 CMP DWORD PTR SS:[EBP+8],0
1005C561 7D 09 JGE SHORT SHO_GS_1.1005C56C
1005C563 C745 08 00000000 MOV DWORD PTR SS:[EBP+8],0
1005C56A EB 0D JMP SHORT SHO_GS_1.1005C579
1005C56C 837D 08 0A CMP DWORD PTR SS:[EBP+8],0A
1005C570 7C 07 JL SHORT SHO_GS_1.1005C579
DWORD PTR SS:[EBP+8] is apparently the level difference with the monster.
Therefore, we see that it could be read like the following:
//we assume the level difference definition is: level_diff = level_player - level_monster; else it doesn't match what we observe in-game.
if (level_diff >= 0){
if (level_diff < 10){
//go to the drop computation with this level_diff
}
else{
//no drop
}
}
else{
level_diff = 0;
//and go to the drop computation with this level_diff
}
So, if I understand well what is done at the moment:
If lvl_player < lvl_monster, it means the lvl_diff < 0 -->so we have a drop with the best possible chance (we drop and level_diff is force to 0)
if lvl_player > lvl_monster, it means we will drop until the difference is >= 10; and the closer we are to the monster lvl, the best drops we have.
Correct?
And so, if I want to change this to be able to always have the best chance to drop, all I have to do is the following change :
1) The "let's erase everything"
In assembly:
1005C55D 90 NOP
1005C55E 90 NOP
1005C55F 90 NOP
1005C560 90 NOP
1005C561 90 NOP
1005C562 90 NOP
1005C563 C745 08 00000000 MOV DWORD PTR SS:[EBP+8],0
1005C56A 90 NOP
1005C56B 90 NOP
1005C56C 90 NOP
1005C56D 90 NOP
1005C56E 90 NOP
1005C56F 90 NOP
1005C570 EB 07 JMP SHORT SHO_GS_1.1005C579
And if we translate this in C:
level_diff = 0;
//and go to the drop computation with this level_diff
2) The more soft version
In assembly:
1005C55D 837D 08 00 CMP DWORD PTR SS:[EBP+8],0
1005C561 7D 09 JGE SHORT SHO_GS_1.1005C56C
1005C563 C745 08 00000000 MOV DWORD PTR SS:[EBP+8],0
1005C56A EB 0D JMP SHORT SHO_GS_1.1005C579
1005C56C C745 08 00000000 MOV DWORD PTR SS:[EBP+8],0
1005C570 EB 07 JMP SHORT SHO_GS_1.1005C579
And if we translate this in C:
if (level_diff >= 0){
level_diff = 0;
//go to the drop computation with this level_diff
}
else{
level_diff = 0;
//and go to the drop computation with this level_diff
}
I don't know if you have something more clever to suggest.
For us, this topic is close and is a first great success !!!
Thanks again all :)