SmartHunter icon indicating copy to clipboard operation
SmartHunter copied to clipboard

Want to track Latent Power Counter / Time remaining

Open ScottSilLew opened this issue 4 years ago • 2 comments

I want to be able to track the Latent Power activation behavior. I don't know if it's a status effect that get applied, and I don't know where to look for memory addresses. Can someone point me in that direction?

ScottSilLew avatar Mar 13 '20 16:03 ScottSilLew

same, but for coalesce!

sheryl-rihacek avatar Mar 14 '20 13:03 sheryl-rihacek

Hey,

I'll be very happy if you want to contribute to SmartHunter. For statuses you can understand how it works inside the file PlayerDataConfig.cs:

// For example
new StatusEffectConfig("Horn", "LOC_STATUS_EFFECT_SELF_IMPROVEMENT", (uint)(uint)StatusEffectConfig.MemorySource.Base, indexToHexStrNoOffset(14))
 
/*
*There you can see it calls the function private static string indexToHexStrNoOffset(int index)
*Which basically call private static string indexToHexStr(int index, ulong baseOffset) which calculate
*the offset and convert it to a string
*
*
*private static string indexToHexStr(int index, ulong baseOffset)
*{
*   ulong multiplier = 0x4;
*   string prefix = "";
*   if (index < 0)
*   {
*      index = (-1) * index;
*      prefix = "-";
*   }
*   ulong hex = baseOffset + multiplier * (ulong)index; // Here it is the IMPORTANT THING as every status will be 4 bytes (multiplier) away from each other
*   return $"{prefix}{hex.ToString("X")}";
*}
*
*Regarding duration and maxduration that should be done insde MhwHelper.cs under UpdatePlayerWidget function but for getting new statuses you need only what I said before
*/

So in the end if you want to discover new statuses i recommend you to debug the code in my git repo and place a breakpoint at line 183 of MhwMemoryUpdater.cs Then, based on what status you are looking for (equipment, weapon, base) take the appropriate one:

ulong equipmentAddress = MemoryHelper.Read<ulong>(Process, lastBuffAddress + 0x14F8);
ulong weaponAddress = MemoryHelper.Read<ulong>(Process, lastBuffAddress + 0x76B0);
ulong buffAddress = MemoryHelper.Read<ulong>(Process, lastBuffAddress + 0x7D20);

Then:

1)Open CheatEngine; 2)Attach it to MonsterHunter; 3)Open MemoryView and navigate to the address you chose; 4)Scroll to the specific offset: from PlayerDataConfig.cs you can see that Hunting Horn's statuses start around offset indexToHexStrNoOffset(14) = 14 * 4 + 0 = 56 (38 in HEX), player afflicted statuses around indexToHexStrNoOffset(375) = 375 * 4 + 0 = 1500 (4DC in HEX), consumables around indexToHexStrNoOffset(421) = 421 * 4 + 0 = 1684 (694 in HEX) and finally weapons which i got only katan buffs so they might start also sooner around indexToHexStrNoOffset(2402) = 2402 * 4 + 0 = 9608 (2588 in HEX); 4)Enlarge the view; 5)Enter training room in MonsterHunter; 6)Trigger the buff; 7)Look at MemoryView what changed and if there's a value that is decrementing (that previously wasn't there); 8)Take note of the offset (it is in HEX so convert it to decimal) then divide it by 4; 9)Add it to PlayerDataConfig.cs; 10)Repeat.

Teorically you can add a lot of new statuses definitions with incremental numbers, like

new StatusEffectConfig("ID", "LOC", (uint)StatusEffectConfig.MemorySource.X, indexToHexStrNoOffset(x++));

And see if you get something useful

gabrielefilipp avatar Mar 14 '20 15:03 gabrielefilipp