Jump to content

playtime system change


Recommended Posts

hello

The time is reset when I change the map. I just want to reset when quit or character change. thx

 

DWORD CHARACTER::GetLogonTime(){
	return (get_dword_time() - m_dwLogonTime) / 1000 + 0.5; //now - logon_time -> convert ms to sec > convert float to int
}

void CHARACTER::CheckLogonTime(int time){
	if (time / 60 > 180 && !m_iLogonIsRewarded){
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("rewardplaytime.")); //You are won 10M for that 3 hours in the game
		PointChange(POINT_GOLD, 10000000, false); //10.000.000
		DBManager::instance().SendMoneyLog(MONEY_LOG_QUEST, 1, 10000000);

		m_iLogonIsRewarded = 1;
	}

	ChatPacket(CHAT_TYPE_COMMAND, "ClientLogonUpdate %d", time / 60);
}

EVENTFUNC(logontime_check_event)
{
	char_event_info* info = dynamic_cast<char_event_info*>(event->info);
	if (info == NULL)
	{
		sys_err("logontime_check_event> <Factor> Null pointer");
		return 0;
	}

	LPCHARACTER	ch = info->ch;
	if (ch == NULL) { // <Factor>
		return 0;
	}

	ch->CheckLogonTime(ch->GetLogonTime());

	return PASSES_PER_SEC(60); //1min
}

void CHARACTER::InitCharLogonEvent(){
	if (m_pkLogonEvent)
		return;

	if (m_iLogonIsStarted != 1) {
		ChatPacket(CHAT_TYPE_COMMAND, "ClientLogonStart 0");
		m_iLogonIsStarted = 1;
	}

	char_event_info* info = AllocEventInfo<char_event_info>();

	info->ch = this;

	m_pkLogonEvent = event_create(logontime_check_event, info, PASSES_PER_SEC(60));
}

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 13

      Metin2 Closed Beta Content (2003-2004)

    2. 0

      PRESENTATION PAGE [OLDGODSMT2 RELEASE]

    3. 25

      [SRC] Metin2 on LINUX - The Old Metin2 Project

    4. 2

      United/Club/Midgard serverfiles?

    5. 13

      Metin2 Closed Beta Content (2003-2004)

    6. 13

      Metin2 Closed Beta Content (2003-2004)

  • Recently Browsing

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