Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Private Server > SRO PServer Guides & Releases
You last visited: Today at 23:43

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Source] Fix the old exp bar - by writing code!

Discussion on [Source] Fix the old exp bar - by writing code! within the SRO PServer Guides & Releases forum part of the SRO Private Server category.

Reply
 
Old   #1
 
elite*gold: 100
Join Date: Apr 2008
Posts: 860
Received Thanks: 1,487
[Source] Fix the old exp bar - by writing code!

Hello beloved, dead community,

its time for another release. Its more of a proof of concept and I hope it might inspire people to continue working on it. You don't need the source to accomplish cool things. Just write your own source.



Ye, its super ugly looking. I choose to be a coder, not a designer. I'd be happy, if someone supplies me a proper version of the 2dt and ddj files so I can update this embarrassing screenshot.

Anyway. It allows you to write code and access GUI-Elements of SRO like you got the original source. It results in an injectable Dll.
This allows you to change the weird scaling of the new Expbar:

Code:
#include "CNIFUnderMenuBar.h"

#include "CICPlayer.h"

#include <stdio.h>
#include "CGlobalDataManager.h"

#include <cmath>

void CNIFUnderMenuBar::Update() {
	// Skip, if player object is not loaded yet (KEEP!)
	if (!g_CICPlayer) {
		return;
	}

	// Some other call that is important (KEEP!)
	((void (__thiscall * )(CNIFUnderMenuBar*))0x46CD80)(this);

	// Retrieve LevelData for current Level
	// (this is one line of Media\server_dep\silkroad\textdata\leveldata.txt)
	CLevelData* data = g_CGlobalDataManager->GetLevelData(g_CICPlayer->level);

	// Calculate EXP as percentage value
	double exp_percentage = g_CICPlayer->exp_current * 100.0 / data->Exp_C;

	// Limit maximum percentage to 99.99%
	if (exp_percentage > 99.99)
		exp_percentage = 99.99;

	// Calculate the number of bars that are full
	int barnum = floor(exp_percentage / 10.0);

	for (int i = 0; i < 10; i++) {

		// Fill or empty bars
		if (barnum <= i) {
			gauges[i]->background_value = 0.0;
			gauges[i]->foreground_value = 0.0;
		} else {
			gauges[i]->background_value = 1.0;
			gauges[i]->foreground_value = 1.0;
		}
	}

	// Fill the bar that is neither full or empty with the remaining percentage
	double exp_remain = (exp_percentage - (barnum * 10.0)) / 10.0;

	gauges[barnum]->background_value = exp_remain;
	gauges[barnum]->foreground_value = exp_remain;


	// Assign more texts
	this->lbl_level->SetText(L"Level: %d", g_CICPlayer->level);
	this->lbl_percentage->SetText(L"%.2lf %%", exp_percentage);

	// Skillpoints
	this->lbl_spcount->SetText(L"%d", g_CICPlayer->skillpoints);
	this->gauge_skillexp->background_value = g_CICPlayer->skill_exp / 400.0;
	this->gauge_skillexp->foreground_value = g_CICPlayer->skill_exp / 400.0;

	// You can also draw text directly at the gauge. It will be centered automatically
	// this->gauge_skillexp->SetText(L"%d", g_CICPlayer->skill_exp);
	

	this->lbl_exp_bar_scaler->SetText(L""); // Prescaler is disabled
	
	// This label is right in the middle of the EXP-Bar
	//this->lbl_360->SetText(L"lbl_360");
};
Important checklist:
  1. Compile using Visual Studio 2005
  2. Compile on RELEASE
  3. Never compile on DEBUG
  4. IF and only IF you know how to make the 2005 compiler work in other VS versions, dare to use other VS versions. If not, simply don't even think about it. I have supplied my v2010 project-file .
  5. Wanna try newer compilers? Go for it! But don't cry <3

Have fun
Attached Files
File Type: zip CustomUnderbar-1.0.zip (9.5 KB, 299 views)
File Type: zip CustomUnderbar-1.1.zip (8.9 KB, 189 views)
File Type: zip CustomUnderbar-1.2.zip (9.5 KB, 541 views)
florian0 is offline  
Thanks
31 Users
Old 03/12/2017, 18:23   #2

 
XxGhostSpiriTxX's Avatar
 
elite*gold: 53
Join Date: Jul 2012
Posts: 542
Received Thanks: 191
thanks
XxGhostSpiriTxX is offline  
Old 03/12/2017, 18:48   #3

 
KingDollar's Avatar
 
elite*gold: 1117
Join Date: Dec 2013
Posts: 858
Received Thanks: 806
That's what you can do when you got sro srcs xD
kk nice keep it up :"D
KingDollar is offline  
Old 03/12/2017, 18:55   #4
dotCom
 
Devsome's Avatar
 
elite*gold: 9842
The Black Market: 107/0/0
Join Date: Mar 2009
Posts: 16,856
Received Thanks: 4,683
Quote:
Originally Posted by Alexiuns* View Post
That's what you can do when you got sro srcs xD
kk nice keep it up :"D
he does not have the source, but okay.
@florian0 nice release :+1:
Devsome is offline  
Old 03/12/2017, 18:57   #5

 
KingDollar's Avatar
 
elite*gold: 1117
Join Date: Dec 2013
Posts: 858
Received Thanks: 806
Post

Quote:
Originally Posted by Devsome View Post
he does not have the source, but okay.
@florian0 nice release :+1:
no he has
KingDollar is offline  
Old 03/12/2017, 19:08   #6
 
elite*gold: 100
Join Date: Apr 2008
Posts: 860
Received Thanks: 1,487
Sadly no, I don't. I've never seen a single line of the source. And, TBH, that would be pretty boring xD.

All that stuff is guessed from runtime type info, error messages and a good portion of luck.
florian0 is offline  
Thanks
2 Users
Old 03/12/2017, 19:12   #7

 
KingDollar's Avatar
 
elite*gold: 1117
Join Date: Dec 2013
Posts: 858
Received Thanks: 806
Post

Quote:
Originally Posted by florian0 View Post
Sadly no, I don't. I've never seen a single line of the source. And, TBH, that would be pretty boring xD.

All that stuff is guessed from runtime type info, error messages and a good portion of luck.
i thought that you are painkiller because of your github account description and as fair as i know painkiller has sro src he has showed me them before
KingDollar is offline  
Old 03/12/2017, 19:33   #8
 
elite*gold: 0
Join Date: Oct 2014
Posts: 19
Received Thanks: 74
Quote:
Originally Posted by Alexiuns* View Post
i thought that you are painkiller because of your github account description and as fair as i know painkiller has sro src he has showed me them before
You would think that Florian0 has the source, but indeed what he has is a big brain:
devtekve is offline  
Thanks
1 User
Old 03/12/2017, 19:41   #9
 
elite*gold: 100
Join Date: Apr 2008
Posts: 860
Received Thanks: 1,487
Nah, i'm not pain. I got in touch with him last year. This is where this text on my github originates. It's just a random chat-quote of pain and qqdev describing my social-life precisely xD.
florian0 is offline  
Thanks
2 Users
Old 03/12/2017, 19:45   #10

 
KingDollar's Avatar
 
elite*gold: 1117
Join Date: Dec 2013
Posts: 858
Received Thanks: 806
Quote:
Originally Posted by florian0 View Post
Nah, i'm not pain. I got in touch with him last year. This is where this text on my github originates. It's just a random chat-quote of pain and qqdev describing my social-life precisely xD.
aha i got it! xD sorry for understood wrong
KingDollar is offline  
Old 03/12/2017, 20:11   #11
 
elite*gold: 0
Join Date: Feb 2013
Posts: 79
Received Thanks: 10
not bad, unfortunately don't have vs2005 at the moment to try messing with it
OFF Topic: i saw your wordpress you've shared a lot of good documentations
have you investigated about the max slots that item mall (client side) can handle?
i figured out that client completely crashes after slot No.381 and between 371~381 random crashes
like Megamax said to me it's a freaking bug in the GUI itself
but there must be a work around to expand it like in Metin2 src
ZeonNETWORK is offline  
Old 03/13/2017, 00:00   #12
 
elite*gold: 100
Join Date: Apr 2008
Posts: 860
Received Thanks: 1,487
Quote:
Originally Posted by ZeonNETWORK View Post
not bad, unfortunately don't have vs2005 at the moment to try messing with it
Yeah. I had a little trouble finding it.

Quote:
Originally Posted by ZeonNETWORK View Post
OFF Topic: i saw your wordpress you've shared a lot of good documentations
have you investigated about the max slots that item mall (client side) can handle?
Never dealt with it. Sounds interesting. I will stumble upon this sooner or later on my way through the interface ...
florian0 is offline  
Old 03/13/2017, 22:20   #13
 
elite*gold: 25
Join Date: Sep 2012
Posts: 209
Received Thanks: 343
Nicely done. Thank you for your time and effort, nice reverse engineering skills btw.
VEssence is offline  
Thanks
1 User
Old 03/14/2017, 08:30   #14
 
elite*gold: 50
Join Date: Mar 2017
Posts: 40
Received Thanks: 5
Quote:
Originally Posted by Alexiuns* View Post
aha i got it! xD sorry for understood wrong
Jumping to conclusions are never good.
Gooby. is offline  
Old 04/23/2017, 20:49   #15
 
elite*gold: 100
Join Date: Apr 2008
Posts: 860
Received Thanks: 1,487
Ace notified me of a weird, random crash in my implementation.

It took me some time, but I found two bugs:

1. When the current exp gets close to the max exp, the percentage will round to 100%
I guessed this would only have visual effects, but i was taught other xD.

Having a percentage of 100 will cause this line
Code:
	int barnum = floor(exp_percentage / 10.0);
to return 10 as the highest bar-index to be filled, but there are only 0-9 bars available causing this line:
Code:
	gauges[barnum]->background_value = exp_remain;
	gauges[barnum]->foreground_value = exp_remain;
to crash the application.

Luckily, there is a simple fix for this:

Code:
	// Calculate EXP as percentage value
	double exp_percentage = g_CICPlayer->exp_current * 100.0 / data->Exp_C;

	if (exp_percentage > 99.99)
		exp_percentage = 99.99;
2. GetLevelData sometimes returns nullptr
I actually noticed that during testing, but considered it being a bug of my own. When i fixed several offset-issues regarding g_CICPlayer->level, it did not occur again so i considered it fixed.

It still seems to appear, so ... wtf?

Definitely needs more research, but there is a quick fix that will solve it for now.
Code:
	// Retrieve LevelData for current Level
	// (this is one line of Media\server_dep\silkroad\textdata\leveldata.txt)
	CLevelData* data = g_CGlobalDataManager->GetLevelData(g_CICPlayer->level);

	if (data == 0)
		return;
Edit: Many months later, I seem to have finally figured out whats wrong. The level of the player is stored as a byte, while I am interpreting it as an int (4 byte). While the other 3 bytes are null, there is no problem. If the other bytes are not null, they are interpreted as the level, too, resulting in levels greater than 1000 or even a couple of million. As a result, GetLevelData(1 Million) will return crap, causing my code to do crap and eventually crash.

Long story short: Make level a char instead of int. Problem solved

Thanks to $Wegs for debugging this out with me and supplying helpful crashdumps.
florian0 is offline  
Thanks
2 Users
Reply

Tags
c++, fix, old exp bar, silkroad


Similar Threads Similar Threads
[Source] Memory Reading / Writing SRO / VB6
07/07/2011 - SRO Hacks, Bots, Cheats & Exploits - 3 Replies
here is a simple source i made to show a buddy of mine how to call the read and write memory functions in vb6. right now it will call target / hp / mp ... you may want to update the offsets. this is a good example to show those out ther that want to learn. please if you use my code's give me credit /./
plz help me iin writing ver code
10/04/2009 - Silkroad Online - 3 Replies
hi plz help me i can't write the verification code
Writing my first line of code in c# need some help
10/16/2008 - CO2 Private Server - 5 Replies
Hey guys, I am busy trying to write a little command that gives a player a starter pack, but it's a little confusing. I wanna make it to where if the players IP has already received a starter pack he will be unable to do it again. sigh, I wish this was php, would be so much easier >.< . Here is what I have so far. if (Splitter == "/starter") { MyChar.CPs += 54;...



All times are GMT +1. The time now is 23:43.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.