Rydian wrote: ↑Fri Oct 04, 2019 4:34 pm
Alright let's talk loot chances.
I've tried three ways to mess with it.
A - Relics that grant luck.
B - The luck Guardian stat.
While I have been able to find values relating to both of these, raising them doesn't seem to do much, so I came to the conclusion that these are capped. The fact that 9999 guardian tokens grants the same bonuses as 120 seems to verify that the Guardian stat at least is capped.
C - Making assumptions about which items have higher or lower values than others, and searching after loot is generated.
There's multiple problems with the last method though.
- Many things drop multiple pieces of loot, and I can't tell which one was last to generate. Theoretically I could record lossless at a high framerate but they may all generate before rendering and that's too much effort anyways. So I had to stick to things that could do single drops at a time.
- Some things in the map seem to use the function when you get within loading distance for some reason. So I started checking only right after a drop happened and nothing else seemed to be going on.
- I neglected to realize that loot value ranges are converted into the output some way. So like, a specific number roll when a boss is dropping a weapon might be a legendary weapon, but the same number roll on an ammo box won't be (they can't make weapons).
After theorizing this stuff, I started targeting primarily those upright/tall lockers and trying to map out what sort of things I got. They can drop pretty much anything (saw a screenshot of a legendary in one) and they only drop one thing at a time. I killed some enemies too and only searched if I found something notable (like a blue gun when the last drop was a white). I managed to find some info that would change when loot was generated, and I found some related code (that worked on a modified value) and started mapping things out.
I focused on the code instead of the orignal data...
- So I could set a breakpoint on it and easily watch the registers and use shortcut keys and such (since it would change rapidly when generating actual gear or more than one item).
- Because the function seems to mainly use rdp and rsp and I'm scared of touching/hooking those.
This is the code I found (first opcode, eax's value is the important part to override)...
Code: Select all
15FF06DBE - 66 0F6E C0 - movd xmm0,eax
15FF06DC2 - 48 8D 45 78 - lea rax,[rbp+78]
15FF06DC6 - C7 45 B4 01000000 - mov [rbp-4C],00000001 { 1 }
Unfortunately
I don't have notes on how I got here. I wrote down some info but it seems I copied it to move somewhere and then overwrite my clipboard with ShareX's screenshot function (for the images lower in this post). Whoops. So I really hope this doesn't break next patch.
Anyways I was able to watch the modified values, but they didn't seem to really map out like I expected them to. I was hoping to find some sort of range of values for rarities like the slots in BL2, instead it just seemed to be two hex bytes of randomness. 2817 would be ammo, 3E1F would be health, but then 028E and 6259 would both be ammo...
Frustrated, I decided to see if the value was actually involved or not at all so I'd know if I was wasting my time on it, so I used "change register at this location" to lock it to set values and see what happened.
Well, it certainly did something!
So I started killing Traunt a lot (he has no phasing) to figure out which values would make which types of rarities. (If the value was set too high, ammo boxes no longer generated anything. That was a quick way to see if drops would work or not.)
0000 = whites
1000 = greens
2000 = greens
3000 = blues
4000 = blues
5000 = blues
6000 = blues
7000 = purples
7500 = purples
7600 = legendaries
7700 = legendaries
7C00 = legendaries
8000 = no drops
9000 = no drops
FFFF = no drops
This seemed great! Whoo hoo, I found it!
Then I started looking at the actual loot and noticed some problems...
The RNG-ish function-like-thing seems to run multiple times when it comes to gear generation, and uses the successive numbers to determine which type of gear and such to generate. So if I override it to a value that grants legendaries (like 7C00), they'll all be mods/relics and SMGs, nothing else. Overriding it to 4000 gets blues that always seem to be shotguns and mods/relics. Chests would generate the same core items from the same manufacturers (with part differences).
(Also doesn't help that the list I made only applies to Traunt. Using the same values on Troy results in mostly purples with a legendary.)
Now the thing is, I did not want to go and fiddle around way earlier in the function (or the call) and make a bunch of conditionals based on item format info (
that I don't even know to begin with) to make it only change the desired rarity. I noticed that r11 and r12 seem to have some sort of counters or info when something more complex than ammo is being made, so I decided to make the script check to see if those were equal or above some value (fiddling around) and skip the modification if so.
These are the r11/r12 values I got when Traunt farted out a bunch of gear normally.
5/201
3/101
6/201
5/201
3/101
4/101
5/201
5/201
3/101
5/201
5/201
6/201
It took a lot of guessing and testing before I found a comparison that actually did what I wanted.
Code: Select all
cmp r11,5 //Check r11.
jne skip //Skip over the override if it's something?
That finally did it, I started getting a good variety of gear from Traunt. Snipers, pistols, shotguns, grenades... I finally did it, yay! Only took... uh... too much of my sanity.
Anyways I was thinking that the other possibility could be that the 2 bytes of hex I've been dealing with is actually a bitfield or something like that, and I could edit parts of the value individually but that sounds like 2 much math 4 me, so I'm glad that making it skip the override on some of the rolls did it.
Now the downside is this was so much work that I don't want to do it again if it breaks beyond more than a small sig update. I've see how golden keys changed structure formats before, so who knows what future patches could do to this...
Anyways.
Updating the download in a minute.