[1.13c] Force an item to appear in the gamble window every time

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
keloman
Posts: 5
Joined: Tue Jul 23, 2019 4:02 pm

[1.13c] Force an item to appear in the gamble window every time

Post by keloman » Tue Jul 23, 2019 8:40 pm

Hello!

I am a newbie when it comes to code editing and I've been wondering how to force an item to appear in the gamble window.

For example, I want at least 1 jewel to appear every time in the gamble window. How can I force that (just like amulets and rings are forced to appear).

Thanks in advance!

EDIT: I've enabled jewels in gamble.txt already but I realize the chance for it to appear is very slim

User avatar
devurandom
Forum Regular
Angel
Posts: 806
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: [1.13c] Force an item to appear in the gamble window every time

Post by devurandom » Tue Jul 23, 2019 9:18 pm

The way Rings/Amulets are forced in Gamble screen is done in the loop that generates gamble items.
2 globals store the (EDIT CORRECTION) item Record for rin and amu. you'd have to do it like its done there & also check the loop count, cause those are the first items that get created.

You can find that code loop by looking at the code edit for increasing the number of items on gamble screen.

a simpler way is just to add the item to gamble.txt, but it won't guarantee that the item will get spawn every time on gamble screen.
Last edited by devurandom on Fri Jul 26, 2019 9:20 am, edited 1 time in total.
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

keloman
Posts: 5
Joined: Tue Jul 23, 2019 4:02 pm

Re: [1.13c] Force an item to appear in the gamble window every time

Post by keloman » Wed Jul 24, 2019 5:30 am

"code edit for increasing the number of items on the gamble screen" ? Is that to be found in the Knowledge Base ? I searched in the Code Editing forum and in the knowledge base but I cant seem to find anything like that.

User avatar
devurandom
Forum Regular
Angel
Posts: 806
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: [1.13c] Force an item to appear in the gamble window every time

Post by devurandom » Wed Jul 24, 2019 7:37 am

Look for Whist code edit collection I think its in there.
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

keloman
Posts: 5
Joined: Tue Jul 23, 2019 4:02 pm

Re: [1.13c] Force an item to appear in the gamble window every time

Post by keloman » Wed Jul 24, 2019 3:28 pm

devurandom wrote:
Wed Jul 24, 2019 7:37 am
Look for Whist code edit collection I think its in there.
I found his thread with the link to the code edits but it appears his website is no longer being actively hosted (Chrome gives me a "Can't find Server IP Adress" error). Can anybody here provide a link to the code edits?

User avatar
devurandom
Forum Regular
Angel
Posts: 806
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: [1.13c] Force an item to appear in the gamble window every time

Post by devurandom » Thu Jul 25, 2019 12:01 am

it is linked in that thread, you'll have to look further down.
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

keloman
Posts: 5
Joined: Tue Jul 23, 2019 4:02 pm

Re: [1.13c] Force an item to appear in the gamble window every time

Post by keloman » Thu Jul 25, 2019 7:36 am

Thanks, I found it.

Code: Select all

D2Game.dll - BE611

027BE611    837C24 14 0E    CMP DWORD PTR SS:[ESP+14],0E

Is this the supposed code I should look for? It is in a file called Gamble.asm and it doesn't look like an Assembler loop to me. It changes the amount of items in the gamble window but thats it.

User avatar
devurandom
Forum Regular
Angel
Posts: 806
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: [1.13c] Force an item to appear in the gamble window every time

Post by devurandom » Thu Jul 25, 2019 11:32 am

devurandom wrote:
Tue Jul 23, 2019 9:18 pm
You can find that code loop by looking at the code edit for increasing the number of items on gamble screen.
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

keloman
Posts: 5
Joined: Tue Jul 23, 2019 4:02 pm

Re: [1.13c] Force an item to appear in the gamble window every time

Post by keloman » Thu Jul 25, 2019 4:11 pm

editing1.png
editing1.png (1.78 KiB) Viewed 365 times
So using Ollydbg I disassembled my D2Game.dll and found this. I'm assuming that

Code: Select all

JL 000BE382
is to be executed next so I go to that offset.
editing2.png
This is where that offset brings me. Should any of this (when transformed to decimal) direct me towards an item code or something? I can only understand that a lot of values are being moved around between registers.

User avatar
devurandom
Forum Regular
Angel
Posts: 806
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: [1.13c] Force an item to appear in the gamble window every time

Post by devurandom » Fri Jul 26, 2019 2:36 am

This is the part of the code that you'd be interested in:

Code: Select all

000BE44C  ║► │8B4424 14     ║MOV EAX,DWORD PTR SS:[LOCAL.5]	LoopCount
000BE450  ║· │83F8 02       ║CMP EAX,2
000BE453  ║·▼│7D 10         ║JGE SHORT 6FCDE465
000BE455  ║· │85C0          ║TEST EAX,EAX
000BE457  ║· │8B35 801FD36F ║MOV ESI,DWORD PTR DS:[6FD31F80]	nRecord  gnGambleRin
000BE45D  ║·▼│74 06         ║JZ SHORT 6FCDE465
000BE45F  ║· │8B35 7C1FD36F ║MOV ESI,DWORD PTR DS:[6FD31F7C]	nRecord  gnGambleAmu
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

JayBrainDead
Posts: 58
Joined: Fri Mar 09, 2018 10:43 pm

Re: [1.13c] Force an item to appear in the gamble window every time

Post by JayBrainDead » Fri Aug 23, 2019 12:23 am

devurandom wrote:
Fri Jul 26, 2019 2:36 am
This is the part of the code that you'd be interested in:
Code: Select all

000BE44C ║► │8B4424 14 ║MOV EAX,DWORD PTR SS:[LOCAL.5] LoopCount
000BE450 ║· │83F8 02 ║CMP EAX,2
000BE453 ║·▼│7D 10 ║JGE SHORT 6FCDE465
000BE455 ║· │85C0 ║TEST EAX,EAX
000BE457 ║· │8B35 801FD36F ║MOV ESI,DWORD PTR DS:[6FD31F80] nRecord gnGambleRin
000BE45D ║·▼│74 06 ║JZ SHORT 6FCDE465
000BE45F ║· │8B35 7C1FD36F ║MOV ESI,DWORD PTR DS:[6FD31F7C] nRecord gnGambleAmu
How could one figure out what the value would be for any other item than Rings and Amulets ? I believe the information isnt inside D2Game.dll

User avatar
devurandom
Forum Regular
Angel
Posts: 806
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: [1.13c] Force an item to appear in the gamble window every time

Post by devurandom » Fri Aug 23, 2019 4:01 am

further up its done in D2Game.dll like so:

Code: Select all

000BE2FF  ║► │A1 7C1FD36F   MOV EAX,DWORD PTR DS:[6FD31F7C]	gGambleAmu
000BE304  ║· │85C0          TEST EAX,EAX
000BE306  ║·▼│75 0F         JNZ SHORT 6FCDE317
000BE308  ║· │68 7C1FD36F   PUSH OFFSET 6FD31F7C                     ; ╓Arg2 = D2Game.6FD31F7C
000BE30D  ║· │68 616D7520   PUSH 20756D61                            ; ║Arg1 = 20756D61 Amu
000BE312  ║· │E8 2BC7F4FF   CALL <JMP.&D2Common.#10450>              ; └D2Common.#10450
								GetItemRecordFromCode
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

JayBrainDead
Posts: 58
Joined: Fri Mar 09, 2018 10:43 pm

Re: [1.13c] Force an item to appear in the gamble window every time

Post by JayBrainDead » Sat Aug 24, 2019 6:22 am

devurandom wrote:
Fri Aug 23, 2019 4:01 am
further up its done in D2Game.dll like so:

Code: Select all

000BE2FF  ║► │A1 7C1FD36F   MOV EAX,DWORD PTR DS:[6FD31F7C]	gGambleAmu
000BE304  ║· │85C0          TEST EAX,EAX
000BE306  ║·▼│75 0F         JNZ SHORT 6FCDE317
000BE308  ║· │68 7C1FD36F   PUSH OFFSET 6FD31F7C                     ; ╓Arg2 = D2Game.6FD31F7C
000BE30D  ║· │68 616D7520   PUSH 20756D61                            ; ║Arg1 = 20756D61 Amu
000BE312  ║· │E8 2BC7F4FF   CALL <JMP.&D2Common.#10450>              ; └D2Common.#10450
								GetItemRecordFromCode
Thanks a lot! That was very helpful

User avatar
devurandom
Forum Regular
Angel
Posts: 806
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: [1.13c] Force an item to appear in the gamble window every time

Post by devurandom » Sat Aug 24, 2019 9:14 am

:toasting:
Cheers
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

JayBrainDead
Posts: 58
Joined: Fri Mar 09, 2018 10:43 pm

Re: [1.13c] Force an item to appear in the gamble window every time

Post by JayBrainDead » Tue Aug 27, 2019 4:14 am

Where could find an empty space to jump to to add some custom code inside D2Game ?
I've tried two location that caused an instant crash up entering gamble screen.
Unless the issue is because I cant add a JMP at BE2FF with a JMP to come back to the default code

User avatar
devurandom
Forum Regular
Angel
Posts: 806
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: [1.13c] Force an item to appear in the gamble window every time

Post by devurandom » Tue Aug 27, 2019 6:51 am

You can take a call and turn it into a long jump, then execute the missing call at the location of the long jump in the first command, with the args still on the stack. Next add your new code and jump back where you need to go.

Jumps and calls are the safest way to inject new code cause they're already in the dll's .reloc section.
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

Post Reply

Return to “Code Editing”