Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Fixing Experience Bar Bug.

Hybrid
Loyal Member
Joined
Mar 15, 2006
Messages
451
Reaction score
285
This is not actually Experience Bar Bug, it's Experience Bug =)
and usually u can meet it in servers with high rates, when Experience Bar overflows number 9, or doens't show exp progress, so u have to reselect character

Why this happens? If you will take a look on Exp values in Char Info Window, when killing some mobs and making lvl up, you will notice that Obtained Exp is just added to the current Exp value and nothing else is done

The point is that GS sends just obtained exp, and even when character levels up, main.exe uses calculated Value from Exp Table to set new value for New Needed Exp, so if you have different formulas in GS and Main of calcing Exp, you will have double Exp Bug :D, of course you can fix this 2 bugs by changing packets in main and GS, and it's not really hard, but we will fix just first bug, because not all of the servers change Exp formulas.

How we gonna do it? First let's take a look how gs do all the work:

1. Character obtains Exp
2. GS Adds Obtained Exp to the Current Exp value
3. Checks if Current Exp >= Needed Exp
4. And if this comparation results TRUE,
a. In Current Exp value GS moves Needed Exp value
b. In Needed Exp value moves next Needed Exp value for next lvl, from the Exp table
(and now attention)
c.Sends Lvl up to main.exe
5. Sends Obtained Exp to main.exe

First i thought that if i will just make step 4a in main.exe it will solve all the problems, but i forgot that GS first sends Lvl up and then Obtained Exp. We don't need to ADD value of Obtained Exp after Lvl Ups in main.exe, because when we fix all in Lvl Up proc, first packet after Lvl up with Obtained Exp spoils all the things =)

The solution is using a flag. When we receive Lvl Up in main.exe, we fix all the poop, Set Flag, and in Function that adds Obtained Exp we check if the flag is Set we don't need to add that value, we just skip this step and reset the flag. With this we will have fixed Exp in main.exe :D cool, no more character Reselection :D

We won't use dll for this thing, because we will just add a little code in main.exe, of course people who understand codding and programming can use their own DLL


Now i will try to explain how to find functions and what code to add


1. Open main.exe in ollydbg and go to the end of it, u will find empty space there. Some mains through error "Unable to locate data in executbale file", when u try to add some code. To check if there is space, select 1 empty line -> RB -> View -> Executable file, there u will find real empty space, check the picture.
Gembrid - Fixing Experience Bar Bug. - RaGEZONE Forums


This space might be not enough to add our code. Some mains have additional sections, may be there weren't delete after unpacking, or may be were added by someone, for example all 97 mains have this sections, there u have a lot of empty space. Other mains that i had to work with have enough space. But if u don't have empty sections and u don't have enough space at the end of the file, then you will have add additional sections =)

2. Here is our section, your main may have just 1 JMP. If you will scroll down you will find a lot of empty space, a lifetime empty space :D
Gembrid - Fixing Experience Bar Bug. - RaGEZONE Forums



But anyway we just need an empty space =)

3. Now we will find switch for packet codes. RB -> Search for -> All switches
Now with all your attention in appeared window find switch (cases 0..F4)
Gembrid - Fixing Experience Bar Bug. - RaGEZONE Forums


4. When you've found it - RB -> List switch cases and find there F3 value, and follow it.
Gembrid - Fixing Experience Bar Bug. - RaGEZONE Forums


5. Below F3 case find first switch, select this line, RB -> Go to -> Case 3
Gembrid - Fixing Experience Bar Bug. - RaGEZONE Forums


F3 03 - codes of Selected Char Info packet
F3 05 - codes of Level Up packet

In SelectedCharInfo proc we will find were is tored data of Current and Needed Exp

6. Step into SelectedCharInfo proc. In that proc -> RB -> Go to -> Next Procedure. Then begin to scroll up until u find code like on the image
Gembrid - Fixing Experience Bar Bug. - RaGEZONE Forums


Look at the underlined lines - EAX+10 and EAX+34, remember these offsets
+10 and +34, +10 - for Current Exp, +34 - for needed Exp, these values may be different in different mains

7. Now go back to the found procs SelectedCharInfo and LvlUp, and step into LvlUp function. RB -> go to -> next procedure. Once again scroll up until you find code like on the image
Gembrid - Fixing Experience Bar Bug. - RaGEZONE Forums


Now look on the underlined line and remember what register you have there, i have EAX, remember it. Look below at the CALL, we will hook it. Now write somewhere this call command, or press SPACE and copy it.

8. Now go to our empty space.
We will need at list 1 register, but not the one that was mentioned in last step, EAX for is resereved (remember from last step?), i need value from it, so use another one(EBX, ECX, EDX). I used ECX. Since we gonna use it, we have to save data that this register contains, so we will use STACK, we will put value from ECX register and then we will restore it.
Also we will need 1 byte memory for a flag, let's use our empty space =) I used offset 3 lines above of function, there I will store flag data. And don't forget to call the function that we have hooked =)
Take a look on the code:
Gembrid - Fixing Experience Bar Bug. - RaGEZONE Forums


Code:
[B]PUSH ECX[/B] ; save ECX data
[B]MOV ECX, [DWORD DS:EAX+34][/B] ; get Needed Exp value (use your offset, mine is +34)
[B]MOV [DWORD DS:EAX+10], ECX[/B] ; set Current Exp value to Needed Exp value (use your offset, mine is +10)

[B]MOV [BYTE DS:8B690D5], 1[/B] ; set flag
[B]POP ECX[/B] ; restore ECX data
[B]CALL 0047C040[/B] ; we hooked that function, in step 7 you saved somewhere it, now you will have to write it here
[B]RETN [/B]; return from the function

Now remember the offset of the function beginning(0x08B690DD) and go to the place, that we have found in step 7(lvl up proc + hooked function, use "-" key =) )

Now replace that call with the call to your function. Lvl up function is done, let's fix Obtained exp function =)

9. Go to the first switch we have found and go to CASE 16 (22.)
Gembrid - Fixing Experience Bar Bug. - RaGEZONE Forums


10. Step into the underlined function in the CASE 16 (22.), RB -> Go to -> Next procedure, and scroll up until u find code like on the image(You will meet 1 "Hash table full", it will help to find the code)
Gembrid - Fixing Experience Bar Bug. - RaGEZONE Forums



Remember 2 lines marked with arrows.
ADD ESI, ECX ; here obtained exp is added =)

11. Go to the offset where we added our first function, and add second.
First we have check our flag, if it's set, then we just skip ADD command, then reset flag, we will reset it no matter it was set or not =)
Look at the code:
Gembrid - Fixing Experience Bar Bug. - RaGEZONE Forums


Code:
[B]TEST [BYTE DS:8B690D5], 1[/B] ; check flag
[B]JNZ SHORT 08B69102 [/B]; if flag is set, then skip ADD command
[B]ADD ESI, ECX [/B]
[B]MOV ECX, 55C4C20[/B] ; these last 2 instructions we took from main, we remembered them in step 10
[B]MOV [BYTE DS:8B690D5], 0[/B] ; reset flag
[B]RETN[/B] ; return from function

Remember offset of second function(0x08B690F7).

12. Go back to the function that adds Obtained Exp(step 10). Remember those 2 marked lines? NOP'em - select them -> Binary -> Fill with NOPs.
Then Select first NOP and add there CALL to our second function.
Gembrid - Fixing Experience Bar Bug. - RaGEZONE Forums


And that's all, no more Exp Bar Bug =)

Don't know about S3EP2 but for other mains will work

Once again i used drakan mu server, thx them :D
 
Last edited:
Newbie Spellweaver
Joined
Oct 30, 2006
Messages
65
Reaction score
0
Re: [Guide] Fixing Experience Bar Bug.

Nice guide from you again. Thanks, it's fantastic. But 1 question, this guide for all versions?
 
Junior Spellweaver
Joined
Sep 12, 2004
Messages
134
Reaction score
14
Re: [Guide] Fixing Experience Bar Bug.

Tested and working on 1.02t...

Just followed the guide...

One problem only, olly2 don't have search of switches (yet)...

Maybe has a better way, or a simple way to fix this...
I don't have stopped to take a look at the code and analyse if has a better way!

Anyway, works fine...
Good work :)

Ah!!! A tip:

Alt+Shift+Number = Set Bookmark (very usefull)
Alt+Number = Goto Bookmark

[]'s
 
Newbie Spellweaver
Joined
May 2, 2006
Messages
45
Reaction score
0
Re: [Guide] Fixing Experience Bar Bug.

Tried on 1.04x main . It begin wrong when go to step 6.
Anyway , I have 1 question. This's just fix the visual of exp bar only ?
I have 1 problem . Cause of max level in my server is 800 900. So players usually gain to level 400 , 401 or more , they no get exp anymore . Some players pass all to lvl 800 , but some players stop at there. When that players kill mobs , they no get exp and mobs no drop anything. Can yours fix that ?
 
Hybrid
Loyal Member
Joined
Mar 15, 2006
Messages
451
Reaction score
285
Re: [Guide] Fixing Experience Bar Bug.

fisrt 1.04x is s3ep2 main
second if u change max lvl in GS, you can't just change Max Lvl with just simple hexing, otherwise u will get bugs + if you have high rate server + some bugs with exp, and it's in GS
 
Junior Spellweaver
Joined
May 1, 2007
Messages
134
Reaction score
17
Re: [Guide] Fixing Experience Bar Bug.

fisrt 1.04x is s3ep2 main
second if u change max lvl in GS, you can't just change Max Lvl with just simple hexing, otherwise u will get bugs + if you have high rate server + some bugs with exp, and it's in GS

Good Job pro ^^... Thanks for guides...... ;)...

And the final... good luck to you.... ^^ You can next post guides of MuServer... Guides of you is best Guides ^^:poster_ss
 
Hybrid
Loyal Member
Joined
Mar 15, 2006
Messages
451
Reaction score
285
Re: [Guide] Fixing Experience Bar Bug.

guides for server, only if i'll upgrade my pc :D cause it's like in the hell: server + client + olly :D
 
Newbie Spellweaver
Joined
Feb 18, 2006
Messages
24
Reaction score
0
Re: [Guide] Fixing Experience Bar Bug.

when i secelct search for -> all switches i just get this ? what is the problem? :S
 
Hybrid
Loyal Member
Joined
Mar 15, 2006
Messages
451
Reaction score
285
Re: [Guide] Fixing Experience Bar Bug.

open 'Executable modules' window and select there your main.exe, and search in main.exe, not in ntdll.dll =)
 
Newbie Spellweaver
Joined
Feb 18, 2006
Messages
24
Reaction score
0
Re: [Guide] Fixing Experience Bar Bug.

man i can't finish step 8! where did u find this empty space? is this one from the first page? cause i can't find this 08B6.....
 
Newbie Spellweaver
Joined
Feb 18, 2006
Messages
24
Reaction score
0
Re: [Guide] Fixing Experience Bar Bug.

in step8 how did u write the code?
 
Last edited:
Newbie Spellweaver
Joined
Feb 18, 2006
Messages
24
Reaction score
0
Re: [Guide] Fixing Experience Bar Bug.

i get this error! now?
 
Newbie Spellweaver
Joined
Feb 18, 2006
Messages
24
Reaction score
0
Re: [Guide] Fixing Experience Bar Bug.

i have done everything now! do i have to save it or there is auto-save?
 
Newbie Spellweaver
Joined
Feb 18, 2006
Messages
24
Reaction score
0
Re: [Guide] Fixing Experience Bar Bug.

nothing...this f**cking bar is stack again!
 
Experienced Elementalist
Joined
Jun 27, 2006
Messages
248
Reaction score
6
Re: [Guide] Fixing Experience Bar Bug.

Thats awesome Gembrid, and I see you also help people who got problems, nice work and continue like this!
 
Legendary Battlemage
Loyal Member
Joined
Dec 13, 2007
Messages
613
Reaction score
161
Re: [Guide] Fixing Experience Bar Bug.

any one can post 97D+99 Main With experience bug fix :D
 
Back
Top