Jump to content

Recommended Posts

  • Honorable Member
2 minutes ago, PeaceMaker said:

There is no need to extend the packet. 
You can simply do it in python ....

wtf?

Where do you get times?? It's not same everytime. If you open exchange or anything it will change

 

16 minutes ago, Mali61 said:

wtf?

Where do you get times?? It's not same everytime. If you open exchange or anything it will change

I've looked again over your code and yes every calculation you did on CalculateDeadTime can be done client side. 
I know it would take more time to do that as you need to set the last time you traded or opened a shop then do the calculation ... 

 
But i just don't like using extra unnecessary packets that can be prevented. 

  • Honorable Member
27 minutes ago, PeaceMaker said:

I've looked again over your code and yes every calculation you did on CalculateDeadTime can be done client side. 
I know it would take more time to do that as you need to set the last time you traded or opened a shop then do the calculation ... 

 
But i just don't like using extra unnecessary packets that can be prevented. 

Yes client side can make but this is the easiest way. Why do we do the hardest?

You don't like packets but you like longest and weirds codes?

  • Love 3

 

  • Active+ Member

@Mali61 I just implemented your code and I got some problems.

1. If you die for the first time -  you can see timers

2. If you die for the second time and you used restart here in the first death - you cannot see timers

3. After using restart in town - timers will start working but again only after first death (second, third etc. deaths won't show the timers)

Only after restarting in town you can see timers everytime.

Hope you will look into it and try to provide us some solution. 

Thanks!

I'll be always helpful!  😉

  • Honorable Member
7 hours ago, ReFresh said:

@Mali61 I just implemented your code and I got some problems.

1. If you die for the first time -  you can see timers

2. If you die for the second time and you used restart here in the first death - you cannot see timers

3. After using restart in town - timers will start working but again only after first death (second, third etc. deaths won't show the timers)

Only after restarting in town you can see timers everytime.

Hope you will look into it and try to provide us some solution. 

Thanks!

fixed

  • Love 1

 

  • Honorable Member

This is the hidden content, please

Spoiler

//<srv&client:packet.h
#ifdef ENABLE_REVIVE_BOARD_RENEWAL
enum EReviveTypes
{
	REVIVE_TYPE_HERE,
	REVIVE_TYPE_TOWN,
	REVIVE_TYPE_AUTO_TOWN,
	REVIVE_TYPE_MAX
};
#endif

typedef struct packet_dead
{
#ifdef ENABLE_REVIVE_BOARD_RENEWAL
	packet_dead()
	{
		memset(&reviveTime, 0, sizeof(reviveTime));
	}
#endif
	BYTE	header;
	DWORD	vid;
#ifdef ENABLE_REVIVE_BOARD_RENEWAL
	BYTE	reviveTime[REVIVE_TYPE_MAX];
#endif
} TPacketGCDead;
//>

//<srv:char.h
#ifdef ENABLE_REVIVE_BOARD_RENEWAL
	public:
		BYTE		CalcReviveTimeDelay(uint8_t bType);
#endif
//>

//<srv:char.cpp
#ifdef ENABLE_REVIVE_BOARD_RENEWAL
BYTE CHARACTER::CalcReviveTimeDelay(uint8_t bType)
{
	if (!m_pkDeadEvent)
		return 0;

	BYTE bTimeToDead = BYTE(event_time(m_pkDeadEvent) / passes_per_sec);
	if (bType == REVIVE_TYPE_AUTO_TOWN)
		return bTimeToDead-7;

	if (!test_server && bType == REVIVE_TYPE_HERE && (!GetWarMap() || GetWarMap()->GetType() == GUILD_WAR_TYPE_FLAG))
	{
		if (IsHack(false) && !CThreeWayWar::instance().IsSungZiMapIndex(GetMapIndex()))
			return bTimeToDead - (180 - g_nPortalLimitTime);
		if (bTimeToDead > 170)
			return bTimeToDead - 170;
	}

	if (IsHack(false) && ((!GetWarMap() || GetWarMap()->GetType() == GUILD_WAR_TYPE_FLAG) || !CThreeWayWar::instance().IsSungZiMapIndex(GetMapIndex())))
		return bTimeToDead - (180 - g_nPortalLimitTime);

	if (bTimeToDead > 173)
		return bTimeToDead - 173;

	return 0;
}
#endif
//>

//<srv:char_battle.cpp
#ifdef ENABLE_REVIVE_BOARD_RENEWAL
	TPacketGCDead pack;
	pack.header = HEADER_GC_DEAD;
	pack.vid = m_vid;
	pack.reviveTime[REVIVE_TYPE_HERE] = CalcReviveTimeDelay(REVIVE_TYPE_HERE);
	pack.reviveTime[REVIVE_TYPE_TOWN] = CalcReviveTimeDelay(REVIVE_TYPE_TOWN);
	pack.reviveTime[REVIVE_TYPE_AUTO_TOWN] = CalcReviveTimeDelay(REVIVE_TYPE_AUTO_TOWN);
	PacketAround(&pack, sizeof(pack));
#endif
//>

//<srv:char_horse.cpp
// You can skip it.
//>

//<client:PythonNetworkStreamPhaseGame.cpp
			if (false == pkInstMain->GetDuelMode())
			{
#ifdef ENABLE_REVIVE_BOARD_RENEWAL
				PyObject *times = PyTuple_New(REVIVE_TYPE_MAX);
				PyTuple_SetItem(times, 0, PyInt_FromLong(DeadPacket.reviveTime[REVIVE_TYPE_HERE]));
				PyTuple_SetItem(times, 1, PyInt_FromLong(DeadPacket.reviveTime[REVIVE_TYPE_TOWN]));
				PyTuple_SetItem(times, 2, PyInt_FromLong(DeadPacket.reviveTime[REVIVE_TYPE_AUTO_TOWN]));
				PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnGameOver", Py_BuildValue("(O)", times));
#else
				PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnGameOver", Py_BuildValue("()"));
#endif

//>

//<srv:PythonPlayerModule.cpp
#ifdef ENABLE_REVIVE_BOARD_RENEWAL
	PyModule_AddIntConstant(poModule, "REVIVE_TYPE_HERE",		REVIVE_TYPE_HERE);
	PyModule_AddIntConstant(poModule, "REVIVE_TYPE_TOWN",		REVIVE_TYPE_TOWN);
	PyModule_AddIntConstant(poModule, "REVIVE_TYPE_AUTO_TOWN",	REVIVE_TYPE_AUTO_TOWN);
	PyModule_AddIntConstant(poModule, "REVIVE_TYPE_MAX",		REVIVE_TYPE_MAX);
#endif
//>

//<root:game.py
	if app.ENABLE_REVIVE_BOARD_RENEWAL:
		def OnGameOver(self, times):
			self.CloseTargetBoard()
			self.OpenRestartDialog(times)

		def OpenRestartDialog(self, times):
			self.interface.OpenRestartDialog(times)
	else:
		def OnGameOver(self):
			self.CloseTargetBoard()
			self.OpenRestartDialog()

		def OpenRestartDialog(self):
			self.interface.OpenRestartDialog()
//>

//<root:interfaceModule.py
	if app.ENABLE_REVIVE_BOARD_RENEWAL:
		def OpenRestartDialog(self, times):
			self.dlgRestart.OpenDialog(times)
			self.dlgRestart.SetTop()
	else:
		def OpenRestartDialog(self):
			self.dlgRestart.OpenDialog()
			self.dlgRestart.SetTop()
//>

//<root:localeInfo.py
def SecondToMS(time):
	if time < 60:
		return "%d%s" % (time, SECOND)

	second = int(time % 60)
	minute = int((time / 60) % 60)

	text = ""

	if minute > 0:
		text += str(minute) + MINUTE
		if minute > 0:
			text += " "

	if second > 0:
		text += str(second) + SECOND

	return text
//>

//<locale/locale_game.txt
REVIVE_AUTO_TOWN_MESSAGE	Autorestart at town in: {}
//>

 

You can follow the tutorial from the original post, I have changed some names, you can compare them.

  • Metin2 Dev 15
  • Good 3
  • Love 22

Is there any possibility @p3ng3r bis Version to ignore at gamemaster?

Because i changed some Line at cmd_general.cpp that gamemaster are possible to start here/start in City without waiting

But now i have to wait...

I tested with return 0 but i will get the negative time

 

I hope, someone know a solution.

Best regards

vor 3 Stunden schrieb Koray:

if 0. < endtime <= .1:

change with


if endtime < 0:

 

dont work -> cant click on buttons. (No syserr)

https://metin2.download/picture/oQ1pbK3R4lKPk78yNRO4C9woo7PuwUSK/.gif

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 2
Am 2.8.2019 um 16:40 schrieb JeeX:

dont work -> cant click on buttons. (No syserr)

https://metin2.download/picture/oQ1pbK3R4lKPk78yNRO4C9woo7PuwUSK/.gif

 

 

Am 28.7.2019 um 19:28 schrieb Helia01:

THX :3

Nice system ?


 

GIF.gif

No Solution?

hope anyone knows

best regards.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Honorable Member
On 8/6/2019 at 6:22 PM, JeeX said:

 

No Solution?

hope anyone knows

best regards.

I checked all codes but I did not find any error in py codes. Then I checked ui enable/disable command at client src(PythonWindow.cpp) and I found little mistake. Now I fixed that code and bug solved.

->Update EterPythonLib/PythonWindow.cpp

 

  • 9 months later...
On 7/15/2019 at 6:27 PM, Mali61 said:

This is the hidden content, please

giphy.gif

 

hi i found a little "bug" on the system:

 

in guildwar you have a timer from 7 seconds but normally it's 0 seconds

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Good 1

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.