[Bug-Fix] Minus Guild Points

02/17/2020 23:43 #HB#1
Hey there,

It's been a while, but guess what... Hi.

Most of you should've faced this bug already, the bug is basically because joymax did not limit guild skill points or even make it unsigned.

The first thing that crossed my mind was doing it through game server, I did it actually but after testing in a live server, it actually caused a disconnect problem. Then I realized that it was because the value stored in the game server that I modified was fine, but SQL was not :D

I actually still could do it through game server, but a better idea crossed my mind, why don't we do it through sro client instead!

So, basically this limits guild point donation to provide positive values only. However, the bug can still occur if somebody donates with a packet injector unless you fix it in server-side too, but anyways who wants to harm himself with minus GP? Client-side shall be enough.

CInterfaceNetSender.h:
Code:
#pragma once
#include <iostream>

class CInterfaceNetSender
{
private:
	char pad_0000[8504]; //0x0000
	unsigned int GuildSkillPoints; //0x2138
	char pad_2140[8]; //0x213C
	std::wstring GuildName; //0x2140
	std::wstring CharName; //0x2160

public:
	void DonateGuildPoints(unsigned int GP);
};
CInterfaceNetSender.cpp:
Code:
#define GP_LIMIT 0x7FFFFFFF

void CInterfaceNetSender::DonateGuildPoints(unsigned int GP)
{
	if (GuildSkillPoints == GP_LIMIT)
	{
		CGInterface* g_interface = CGInterface::GetInterface();
		if (g_interface)
		{
			g_interface->HandleSystemMessages(1, L"You have reached maximum limit of guild skills points.");
			g_interface->ShowBlueNotify(L"You have reached maximum limit of guild skills points.");
		}
	}
	else
	{
		unsigned int TotalGP = GuildSkillPoints + GP;
		if (TotalGP > GP_LIMIT && GuildSkillPoints < GP_LIMIT)
			GP = GP_LIMIT - GuildSkillPoints;
		reinterpret_cast<void(__thiscall*)(CInterfaceNetSender*, unsigned int)>(0x0081FAB0)(this, GP);
	}
}
A small hook of flo's:
Code:
replaceOffset(0x0070BCF2, addr_from_this(&CInterfaceNetSender::DonateGuildPoints));
flo's lib, in case you're interested: [Only registered and activated users can see links. Click Here To Register...]

And that's it, good luck.

Special Thanks To: florian0

__________________________________________________ _______________________________

Offical Global Fix

As the topic went, apparently my client hotfix won't work because GP is increased on killing monsters too.

I've implemented a server files patch since its the only way to fix this annoying bug in SRO files.

I posted before the game server fix, and I declared after testing the game server patch only that it causes disconnect issues and database isn't affected by the patch and stays minus.

I've scanned both GS and shard manager memories and found out that shard manager is the one responsible for modifying database value and also has stored memory for guilds instances just like GS.

So, I applied a patch for shard manager too, and it seems to be working fine now, SQL and memory values are equivalent. I'm gonna be testing it in a live productive server and posting a feedback whether there were any errors or issues after applying both GS and shard manager patches.

How The Patch Works: It basically prevents GP from exceeding maximum integer value (2147483647 | 7FFFFFFF).

Patch Details:
Using the GP reference in GS/SM, I've hooked where GP is modified, and did some conditions to check if GP exceeded INT_MAX (aka went minus), then will re-set it to INT_MAX.

__________________________________________________ _______________________________

Final Patch

After exploring, it seemed like a normal message that I had to skip, but in case of GP intended donation, shard manager needs to respond to game server, otherwise user will be frozen for 10 ~ 15 seconds.

So anyways, I handled both cases and modified the old shard manager patch, this is probably the last patch to maintain this original bug.

Note: Please make sure your apply both GS and SM patches, otherwise you'll have some trouble going in.

Download: x64dbg patch is attached.
02/18/2020 00:59 JoleChow*#2
You getting better bro ;)
Keep it up and thanks for sharing
02/18/2020 10:37 VORTEX*#3
awesome release as always
02/18/2020 12:35 WickedNite.#4
This is why MMOs nowadays are flawed, because people choose to go the easy way which is nuke the client with everything.
02/18/2020 17:56 Hercules*#5
Amazing Release
02/18/2020 18:42 Empire1453#6
I think it will be enough to start automatic 5 lvl every time the guild is opened and prevent donation with filter...

Doesn't it prevent the score from falling to?
02/18/2020 19:38 Hercules*#7
Quote:
Originally Posted by Empire1453 View Post
I think it will be enough to start automatic 5 lvl every time the guild is opened and prevent donation with filter...

Doesn't it prevent the score from falling to?
wait what? :wat:
02/18/2020 19:41 #HB#8
Quote:
Originally Posted by WickedNite. View Post
This is why MMOs nowadays are flawed... which is nuke the client with everything.
Probably you don't know how this works internally.

Anyways, so you're saying that making extra comparison in client-side on donating skill points will make flaw in the client? Well, lets ignore the logic that people don't donate skill points each second, and stick with main topic. So, you wanna make it server-side, sure go ahead, and remember your words, "flawed".

Quote:
Originally Posted by WickedNite. View Post
people choose to go the easy way
This wasn't actually the easy way, editing game server was way easier to fix that.

But editing client will be more efficient, also I mentioned that you're free to do it in server-side too, like in filter or something if you're up to that.
02/18/2020 20:17 Empire1453#9
Quote:
Originally Posted by Hercules* View Post
wait what? :wat:
If there is an abundant skill point and a donation is made, the guild point drops to - .
I mean that if donation is prevented, this will be the solution.

With normal character gaining experience points, there will be no drop in guild point increase to -. Falling to - occurs at the time of an excessive donation.
02/18/2020 23:19 #HB#10
Quote:
Originally Posted by Empire1453 View Post
If there is an abundant skill point and a donation is made, the guild point drops to - .
I mean that if donation is prevented, this will be the solution.
You ruined the logic of GP with your idea.
02/19/2020 00:24 Empire1453#11
Quote:
Originally Posted by #HB View Post
You ruined the logic of GP with your idea.
[Only registered and activated users can see links. Click Here To Register...]
02/19/2020 01:57 #HB#12
Works [Only registered and activated users can see links. Click Here To Register...] for me, I am not sure what your compiler generated but that looks like you treated some unsigned as signed or the opposite.

Try to reset your skill points to 0 before you test it too.
02/19/2020 09:54 Laag#82#13
Quote:
Originally Posted by Empire1453 View Post
[Only registered and activated users can see links. Click Here To Register...]
Quote:
Originally Posted by #HB View Post
Works [Only registered and activated users can see links. Click Here To Register...] for me, I am not sure what your compiler generated but that looks like you treated some unsigned as signed or the opposite.

Try to reset your skill points to 0 before you test it too.
In the photo add 1 point and you system (work).

After

Use /zoe MOB_RM_ROC 1

GP -2147181077

good luck
02/19/2020 14:44 Empire1453#14
Quote:
Originally Posted by #HB View Post
Works [Only registered and activated users can see links. Click Here To Register...] for me, I am not sure what your compiler generated but that looks like you treated some unsigned as signed or the opposite.

Try to reset your skill points to 0 before you test it too.
Gained your character experience points. Get from any unique spawn. Use / zoe command or experience with bot. You will see that the guild score falls to -.

I completely added the codes you provided. There is no error in my compiler.
02/19/2020 17:17 #HB#15
Quote:
Originally Posted by Empire1453 View Post
Gained your character experience points. Get from any unique spawn. Use / zoe command or experience with bot. You will see that the guild score falls to -.

I completely added the codes you provided. There is no error in my compiler.
Hey,

I cannot test right now, because I am not home. But I can do a blind guess that you're right, its maybe because I edited the surface of the GP only or something else is editing it.

I'll have a look later and let you know.