Jump to content
Mali61

[RLS]Restart Dialog Timer

Recommended Posts

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

  • Love 1

Share this post


Link to post
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

Share this post


Link to post
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. 

Share this post


Link to post
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

Share this post


Link to post
47 minutes ago, avertuss said:

@Mali61

Does it need higher version c++? Because in client i always have 0s. 

No doesn't needed.

Share this post


Link to post
8 minut temu, Mali61 napisał:

No doesn't needed.

How can i add debug mode? I mean send chat packet when game should send packet to client? I have no idea why it doesn't work for me. 

Share this post


Link to post

@Mali61 Maybe good improvement should be make the timers dissapear when they reach 0 time?

Share this post


Link to post
18 hours ago, ReFresh said:

@Mali61 Maybe good improvement should be make the timers dissapear when they reach 0 time?

updated

  • Love 1

Share this post


Link to post

@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!

Share this post


Link to post
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

Share this post


Link to post

resources

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.

  • Love 9

Share this post


Link to post

Thanks penger. I am not at home. Topic will be updated in few days

Edit:Updated

  • Love 1

Share this post


Link to post
On 7/28/2019 at 7:28 PM, Helia01 said:

THX :3

Nice system 🤔


 

GIF.gif

I'm facing the same issue, did you get it fixed?

Share this post


Link to post
if 0. < endtime <= .1:

change with

if endtime < 0:

 

Share this post


Link to post

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

Share this post


Link to post

Sorry for waiting i am little bit busy.

Fixed and added mini codes for Close GM wait time

Share this post


Link to post
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

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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.