Jump to content
  • 0

Agit Denfed Ranking


Bringer

Question


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  742
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

anyone can convert this to rathena version



https://herc.ws/board/topic/15948-agit-denfed-ranking/

CREATE TABLE `agit_defend_stats` (
  `auto_id` int(11) unsigned NOT NULL auto_increment,
  `castle_name` varchar(34) NOT NULL default '',
  `guild_id` INT(11) NOT NULL,
  `conquest_time` DATETIME NULL,
  `lost_time` DATETIME NULL,
  `woe_ended` TINYINT(1) NOT NULL,
  `defend_time` DATETIME NULL,
  PRIMARY KEY (`auto_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

 

// The Emperium has been broken.
OnAgitBreak:
	set .@GID,getcharid(2);
	// Show and log error if an unguilded player breaks the Emperium. (Should NEVER happen)
	if (.@GID <= 0) {
		set .@notice$,"Character "+strcharinfo(0)+" ("+getcharid(0)+") broke the Emperium in Castle: "+strnpcinfo(2)+" while guildless. No data will be saved and Emperium respawned.";
 		logmes .@notice$; debugmes .@notice$;
		donpcevent "Agit#"+strnpcinfo(2)+"::OnStartArena";
		end;
	}

	query_sql "SELECT `auto_id` FROM `agit_defend_stats` WHERE `castle_name`='" + getcastlename(strnpcinfo(2)) + "' AND `woe_ended`='0' ORDER BY `auto_id` DESC LIMIT 1",.@last_conquest;

	if( getarraysize(.@last_conquest) ){
		query_sql "UPDATE `agit_defend_stats` SET `lost_time`=NOW() WHERE `auto_id`='" + .@last_conquest + "'";

		query_sql "SELECT `conquest_time` FROM `agit_defend_stats` WHERE `auto_id`='" + .@last_conquest + "'", .@conquest_time$;

		query_sql "UPDATE `agit_defend_stats` SET `defend_time`=TIMEDIFF(NOW(),'" + .@conquest_time$ + "') WHERE `auto_id`='" + .@last_conquest + "'";
	}

 

// War of Emperium has ended.
OnAgitEnd:
	if (strnpcinfo(0) == "Gld_Agit_Manager") end;
	GvgOff strnpcinfo(2);
	// If the castle has no owner at the end of WoE, do not kill Emperium.
	if (GetCastleData(strnpcinfo(2),CD_GUILD_ID)) {
		KillMonster strnpcinfo(2),"Agit#"+strnpcinfo(2)+"::OnAgitBreak";
	}

	query_sql "SELECT `auto_id` FROM `agit_defend_stats` WHERE `castle_name`='" + getcastlename(strnpcinfo(2)) + "' AND `woe_ended`='0' ORDER BY `auto_id` DESC LIMIT 1",.@last_conquest;

	if( getarraysize(.@last_conquest) ){

		query_sql "SELECT `conquest_time` FROM `agit_defend_stats` WHERE `auto_id`='" + .@last_conquest + "'", .@conquest_time$;

		query_sql "UPDATE `agit_defend_stats` SET `defend_time`=TIMEDIFF(NOW(),'" + .@conquest_time$ + "') WHERE `auto_id`='" + .@last_conquest + "'";

		query_sql "UPDATE `agit_defend_stats` SET `woe_ended`='1' WHERE `auto_id`='" + .@last_conquest + "'";
	}
	end;

error console

image.thumb.png.1229096b3fc938578220d598c324a692.png

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...