Changing Experience with Rerolling

General MajorMUD Discussion
Post Reply
Zelgadis
Posts: 3
Joined: Mon Mar 03, 2025 5:39 pm

Changing Experience with Rerolling

Post by Zelgadis »

Does anyone know where the value is for this? I'm trying to edit it above 10% but can't find where this is contained

TYIA


User avatar
syntax
Site Admin
Posts: 553
Joined: Tue Jun 02, 2009 10:02 am

Re: Changing Experience with Rerolling

Post by syntax »

You are in luck as I have been doing a lot of work in the dll lately and I was able to find where this is easily enough. Looks like it's in the "_save_permanent_info" function which writes data to a worldgroup database file, stored outside majormud (WGSGEN2.DAT).

From what I've, partly learned and partly recalled, MajorMUD uses two methods to determine what exp value to store. Effectively, it calculates the exp required for half of the current character's level and compares that to 10% of the current character's exp. Whichever is greater is what gets stored. The level / 2 is handled through a bit shift ("edx_12 >> 1" or "sar edx, 0x1"). This is bit tougher to modify.

Starts off grabbing the class and race records of the user(character) so it get the exp tables.
Image

Here is where all of the math happens. There are 3 values you probably want to alter. I've made comments inline.
Image

I hope I have found these offsets properly in the dll. You should see three sequences of "B9 0A 00 00 00" and you are changing the 0A's (10 in hex).
1 - 0x716B8
2 - 0x716CC
3 - 0x716E6

Here is where it decides which values to store.
Image


Zelgadis
Posts: 3
Joined: Mon Mar 03, 2025 5:39 pm

Re: Changing Experience with Rerolling

Post by Zelgadis »

Many many thanks!


User avatar
Kyau
Posts: 80
Joined: Sun Jul 13, 2014 2:35 am
Location: Seattle, WA
Contact:

Re: Changing Experience with Rerolling

Post by Kyau »

There has to be something still missing here, I tried to do these edits and my toons still only retain 10% despite editing all 3 values to 80% (hex 50).


User avatar
syntax
Site Admin
Posts: 553
Joined: Tue Jun 02, 2009 10:02 am

Re: Changing Experience with Rerolling

Post by syntax »

So.... yup, there is something missing. Firstly, and don't feel bad for missing this because I did the same thing at first, but these calculations are divisions. Dividing by 10 just happens to be the same as 10%. So, when you change the 10 to an 80, or to a 50 as I did, then you're just dividing it by 80 pieces instead of 10, doing the opposite of what you want. It gets weird with the billions vs millions too.

However, through checking this all again, there is another number that needs to be adjusted as well, and that's the multiplication by 100,000,000 (which is 10% of 1 billion). That is there to shift some of the billions over to the millions to complete the math.

In full, here is how it is calculated:

Code: Select all

EXP = 1234567890
M = EXP % 1000000000 (the "millions" part of EXP)
B = EXP / 1000000000 (the "billions" part of EXP)

M = M / 10
M = M + ((B % 10) * 100000000)
B = B / 10

FINAL_EXP = (B * 1,000,000,000) + M

M = M + ((B % 10) * 100000000)
Here, B % 10 gives you the remainder of B after dividing by 10
meaning, divide 10 into B as many times as it can and then give me what's leftover
5 % 10 == 5 because 10 goes into 5 zero times,
22 % 10 == 2 because 10 goes into 20 twice and then there is 2 leftover
then multiply that by 100,000,000 (which is 10% of 1 billion)

Using values, this works out like this for a value of 22,123,456,789...

EXP == 22,123,456,789
M = EXP % 1000000000 == 123,456,789
B = EXP / 1000000000 == 22

//M = M / 10:
12,345,678 = 123,456,789 / 10

//M = M + ((B % 10) * 100000000):
//M = 12345678 + ((22 % 10) * 100000000)
//M = 12345678 + ((2) * 100000000)
//M = 12345678 + 200000000
212,345,678 = 12345678 + 200,000,000

//B = B / 10
2 = 22 / 10

//M == 212,345,678
//B == 2

//FINAL_EXP = (B * 1,000,000,000) + M
2,212,345,678 = (2 * 1,000,000,000) + 212,345,678
(and 10% of the original 22,123,456,789 is 2,212,345,678)

I'm gonna put a TL:DR as a separate post after this one for how to actually do this now...


User avatar
syntax
Site Admin
Posts: 553
Joined: Tue Jun 02, 2009 10:02 am

Re: Changing Experience with Rerolling

Post by syntax »

TLDR:

Working within the confines of being able to hex edit this without adjusting the way it's doing the math, there are 4 values to edit and those values will depend on what you want to adjust it by.
  • z = your desired percentage of exp to keep
  • x = 100 / z
  • y = 1,000,000,000 / x
Then hex edit as follows:
  • 0x716B8 = x
  • 0x716CC = x
  • 0x716D7 = y ...but written "backwards" with a total of 4 bytes. 100,000,000 == 05F5E100 in hex and would be written in the editor as 00 E1 F5 05.
  • 0x716E6 = x
50PCT.png
The above/attached image is to keep 50% exp...

z = 50 (for 50%)
x = 100 / 50 (x = 2 or 0x02)
y = 1000000000 / 2 (y = 500,000,000 or 0x1DCD6500)

0x716B8 = x (0x02)
0x716CC = x (0x02)
0x716D7 = y (0x1DCD6500) written "backwards" as 00 65 CD 1D (4 total bytes)
0x716E6 = x (0x02)


Post Reply