Jump to content

Recommended Posts

  • Premium

Open db/ClientManagerBoot.cpp

 

bool CClientManager::InitializeLandTable()
{
	using namespace building;

under this add
 

	CDBManager::instance().DirectQuery(	"update land "
			"INNER JOIN guild ON land.guild_id = guild.id "
			"INNER JOIN player ON guild.`master` = player.id "
			"set guild_id=0 "
			"where guild_id > 0 and "
			"DATE_SUB(NOW(),INTERVAL 21 DAY) > last_play; " );
	CDBManager::instance().DirectQuery(	"DELETE object "
			"FROM object "
			"INNER JOIN land ON land.id = object.land_id "
			"WHERE land.guild_id=0; "	);

Extracted from Inception source.

  • Metin2 Dev 1
  • Sad 1
  • Love 8


 

Link to comment
https://metin2.dev/topic/21038-clear-old-guilds-lands-by-inactivity/
Share on other sites

  • 4 years later...

Thanks for the code!

I implemented plus one more thing, the guild leader get's back the land price also when this SQL script runs down as some compensation for the loss (I don't implemented that situation when the player's gold goes higher than 2 thousand million, I don't know how to do that).
 

	CDBManager::instance().DirectQuery(	"update land "
			"INNER JOIN guild ON land.guild_id = guild.id "
			"INNER JOIN player ON guild.master = player.id "
			"set land.guild_id=0, player.gold=player.gold+land.price "
			"where land.guild_id > 0 and "
			"DATE_SUB(NOW(),INTERVAL 90 DAY) > player.last_play; " );
	CDBManager::instance().DirectQuery(	"DELETE object "
			"FROM object "
			"INNER JOIN land ON land.id = object.land_id "
			"WHERE land.guild_id=0; "	);

(My edition is not strict as yours, I let 90 day offline time for the guild masters.)

Edited by Werwolf94

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.