Jump to content

Recommended Posts

Players alignments are resetting when i reboot server.in player database alignments are randomaly values bigger 400k.i reset with query then players skill_groups are reset.

screenshot like:

problemlike.png

how to fix it? i have source.

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
https://metin2.dev/topic/12085-alignment-bug-40k/
Share on other sites

  • 2 months later...

Or you can make like that:

[File: /Src/server/game/src/char.cpp]

//1.) Search:

			addPacket.sAlignment = m_iAlignment / 10;

//2.) Replace with:

			addPacket.sAlignment = m_iAlignment;

//1.) Search:

	pack.sAlignment	= m_iAlignment / 10;

//2.) Replace with:

	pack.sAlignment	= m_iAlignment;

[File: /Src/server/game/src/char_battle.cpp]

//1.) Search:

void CHARACTER::UpdateAlignment(int iAmount)
{
	bool bShow = false;

	if (m_iAlignment == m_iRealAlignment)
		bShow = true;

	int i = m_iAlignment / 10;

	m_iRealAlignment = MINMAX(-200000, m_iRealAlignment + iAmount, 200000);

	if (bShow)
	{
		m_iAlignment = m_iRealAlignment;

		if (i != m_iAlignment / 10)
			UpdatePacket();
	}
}

//2.) Replace with:

void CHARACTER::UpdateAlignment(int iAmount)
{
	bool bShow = false;

	if (m_iAlignment == m_iRealAlignment)
		bShow = true;

	int i = m_iAlignment;

	m_iRealAlignment = MINMAX(-20000, m_iRealAlignment + iAmount, 20000);

	if (bShow)
	{
		m_iAlignment = m_iRealAlignment;

		if (i != m_iAlignment)
			UpdatePacket();
	}
}

 

[File: /Src/server/game/src/questlua_pc.cpp]

//1.) Search:

	int pc_get_real_alignment(lua_State* L)
	{
		lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetRealAlignment()/10);
		return 1;
	}
	int pc_get_alignment(lua_State* L)
	{
		lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetAlignment()/10);
		return 1;
	}
	int pc_change_alignment(lua_State * L)
	{
		int alignment = (int)(lua_tonumber(L, 1)*10);
		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();

		ch->UpdateAlignment(alignment);
		return 0;
	}

//2.) Replace with:

	int pc_get_real_alignment(lua_State* L)
	{
		lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetRealAlignment());
		return 1;
	}
	int pc_get_alignment(lua_State* L)
	{
		lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetAlignment());
		return 1;
	}
	int pc_change_alignment(lua_State * L)
	{
		int alignment = (int)(lua_tonumber(L, 1));
		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
		ch->UpdateAlignment(alignment);
		return 0;
	}

 

Now you'll get the real values, for example if your align in the game is 17214 in the database will show 17214 work good, before to make that  he show multiplied by *10 equals with 172 140 in database.

Now check is real for GetRealAlignment && GetAlignment.

6b9afc657f43439d819600680493f016.png

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
Link to comment
https://metin2.dev/topic/12085-alignment-bug-40k/#findComment-74835
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.