<commit_before>//===== Hercules Script ======================================
// BattleGround System - Flavius
//===== By: ================================================== 
//= L0ne_W0lf
//===== Current Version: ===================================== 
//= 1.4
//===== Description: ========================================= 
//= [AEGIS Conversion]
//= Flavius Battleground.
//= - Winning Team: 9 badges
//= - Losing Team: 3 badge
//===== Additional Comments: ================================= 
//= 1.0 First Version.
//= 1.1 Fixed pink crystal spawning as blue. [L0ne_W0lf]
//= 1.2 Updated 'waitingroom' to support required zeny/lvl. [Kisuka]
//= 1.3 Removed MaxLvl check in waitingrooms. Replaced setwall with setcell.
//= 1.4 Attempt at implementing BG Queue [Ind/Hercules]
//============================================================


//Tacham, while the script is under testings the original will remain, meaning if you wanna test this you need to disable the other, or they'll conflict.
bat_b01,15,15,3	script	start#bat_b01	844,{
OnInit:
	mapwarp "bat_b01","bat_room",154,150;
	end;

//$@bg_queue_id is cleared after this event ends
OnPlayerListReady:
 	set $@FlaviusBG1_id1, bg_create_team("bat_b01",10,290);
	set $@FlaviusBG1_id2, bg_create_team("bat_b01",390,10);

	set $@Croix_QueueBG1, queue();
	set $@Guill_QueueBG1, queue();
	
	queueopt($@Guill_QueueBG1,HQO_OnLogout,"start#bat_b01::OnGuillaumeQuit");
	queueopt($@Croix_QueueBG1,HQO_OnLogout,"start#bat_b01::OnCroixQuit");
	
	set .@it,queueiterator($@bg_queue_id);
	set .@i, 0;
	
	for( set .@member, qiget(.@it); qicheck(.@it); set .@member,qiget(.@it) ) {
	announce "bg_queue:running_for:"+.@member,8;
		if( .@i % 2 == 0 ) {
			bg_join_team($@FlaviusBG1_id1,.@member);
			queueadd($@Guill_QueueBG1,.@member);
		} else {
			bg_join_team($@FlaviusBG1_id2,.@member);
			queueadd($@Croix_QueueBG1,.@member);
		}
		set .@i,.@i + 1;
	}
	qiclear(.@it);

	set $@FlaviusBG1, 1;
	set $@FlaviusBG1_Victory, 0;
	set $@Croix_ScoreBG1, 0;
	set $@Guill_ScoreBG1, 0;
	
	bg_updatescore "bat_b01",$@Guill_ScoreBG1,$@Croix_ScoreBG1;

	donpcevent "OBJ#bat_b01_a::Onkill";
	donpcevent "OBJ#bat_b01_a::OnEnable";
	donpcevent "OBJ#bat_b01_b::Onkill";
	donpcevent "OBJ#bat_b01_b::OnEnable";
	donpcevent "guardian#bat_b01_a::Onkill";
	donpcevent "guardian#bat_b01_b::Onkill";
	donpcevent "guardian#bat_b01_a::OnEnable";
	donpcevent "guardian#bat_b01_b::OnEnable";
	donpcevent "cell#bat_b01_a::Onred";
	donpcevent "cell#bat_b01_b::Onred";
	donpcevent "time#bat_b01::OnEnable";
	disablenpc "Guillaume Vintenar#b01_a";
	disablenpc "Croix Vintenar#b01_b";
	disablenpc "Vintenar#bat_b01_aover";
	disablenpc "Vintenar#bat_b01_bover";
	bg_warp $@FlaviusBG1_id1,"bat_b01",87,75;
	bg_warp $@FlaviusBG1_id2,"bat_b01",311,224;
	donpcevent "countdown#bat_b01::OnEnable";
	initnpctimer;
	end;

OnReset:
	donpcevent "OBJ#bat_b01_a::Onkill";
	donpcevent "OBJ#bat_b01_a::OnEnable";
	donpcevent "OBJ#bat_b01_b::Onkill";
	donpcevent "OBJ#bat_b01_b::OnEnable";
	donpcevent "guardian#bat_b01_a::Onkill";
	donpcevent "guardian#bat_b01_b::Onkill";
	donpcevent "guardian#bat_b01_a::OnEnable";
	donpcevent "guardian#bat_b01_b::OnEnable";
	donpcevent "cell#bat_b01_a::Onred";
	donpcevent "cell#bat_b01_b::Onred";
	donpcevent "time#bat_b01::OnEnable";
	disablenpc "Guillaume Vintenar#b01_a";
	disablenpc "Croix Vintenar#b01_b";
	disablenpc "Vintenar#bat_b01_aover";
	disablenpc "Vintenar#bat_b01_bover";
	bg_warp $@FlaviusBG1_id1,"bat_b01",87,75;
	bg_warp $@FlaviusBG1_id2,"bat_b01",311,224;
	end;

OnGuillaumeQuit:
OnCroixQuit:
	bg_leave;
	end;

OnTimer10000:
	stopnpctimer;
	donpcevent "#bat_b01_timer::OnEnable";
	end;
	
OnMatchOver:
	bg_match_over("Flavius");
	queuedel($@Croix_QueueBG1);
	queuedel($@Guill_QueueBG1);
	end;
}

bat_b01,1,1,3	script	OBJ#bat_b01_a	844,{
OnEnable:
	bg_monster $@FlaviusBG1_id1,"bat_b01",61,150,"Pink Crystal",1915,"OBJ#bat_b01_a::OnMyMobDead";
	end;

Onkill:
	killmonster "bat_b01","OBJ#bat_b01_a::OnMyMobDead";
	end;

OnMyMobDead:
	if (mobcount("bat_b01","OBJ#bat_b01_a::OnMyMobDead") < 1) {
		mapannounce "bat_b01", "Guillaume's Crystal has been destroyed.",bc_map,"0xFFCE00";
		if ($@Croix_ScoreBG1 > 0) {
			set $@FlaviusBG1_Victory,2;
			set $@Croix_ScoreBG1,$@Croix_ScoreBG1+1;
			enablenpc "Guillaume Vintenar#b01_a";
			enablenpc "Croix Vintenar#b01_b";
			donpcevent "time#bat_b01::Onstop";
			donpcevent "start#bat_b01::OnMatchOver";
		}
		else {
			set $@Croix_ScoreBG1,1;
			donpcevent "time#bat_b01::OnEnable";
			donpcevent "start#bat_b01::onReset";
		}
		donpcevent "#bat_b01_timer::OnStop";
		bg_updatescore "bat_b01",$@Guill_ScoreBG1,$@Croix_ScoreBG1;
		bg_warp $@FlaviusBG1_id1,"bat_b01",10,290;
		bg_warp $@FlaviusBG1_id2,"bat_b01",390,10;
		donpcevent "#bat_b01_timer::OnEnable";
	}
	end;
}
bat_room,2,151,3	script	#bat_b01_timer	844,{
	end;

OnEnable:
	initnpctimer;
	end;

OnStop:
	stopnpctimer;
	end;

OnTimer1000:
	stopnpctimer;
	initnpctimer;
	set .@chk_bat_a01,getmapusers("bat_b01");
	if (.@chk_bat_a01 < 1) {
	announce "bg_destroy:running_for:"+.@chk_bat_a01,8;
	
		set $@FlaviusBG1, 0;
		if( $@FlaviusBG1_id1 ) { bg_destroy $@FlaviusBG1_id1; set $@FlaviusBG1_id1, 0; }
		if( $@FlaviusBG1_id2 ) { bg_destroy $@FlaviusBG1_id2; set $@FlaviusBG1_id2, 0; }
	}
	end;
}

bat_b01,1,2,3	script	OBJ#bat_b01_b	844,{
OnEnable:
	bg_monster $@FlaviusBG1_id2,"bat_b01",328,150,"Blue Crystal",1914,"OBJ#bat_b01_b::OnMyMobDead";
	end;

Onkill:
	killmonster "bat_b01","OBJ#bat_b01_b::OnMyMobDead";
	end;

OnMyMobDead:
	if (mobcount("bat_b01","OBJ#bat_b01_b::OnMyMobDead") < 1) {
		mapannounce "bat_b01", "Croix's Crystal has been destroyed.",bc_map,"0xFFCE00";
		if ($@Guill_ScoreBG1 > 0) {
			set $@FlaviusBG1_Victory,1;
			set $@Guill_ScoreBG1,$@Guill_ScoreBG1+1;
			enablenpc "Guillaume Vintenar#b01_a";
			enablenpc "Croix Vintenar#b01_b";
			donpcevent "time#bat_b01::Onstop";
			donpcevent "start#bat_b01::OnMatchOver";
		}<commit_msg>Follow up 918b1123963ac2f91a4d074b092ceef1db71b4e8<commit_after>//===== Hercules Script ======================================
// BattleGround System - Flavius
//===== By: ================================================== 
//= L0ne_W0lf
//===== Current Version: ===================================== 
//= 1.4
//===== Description: ========================================= 
//= [AEGIS Conversion]
//= Flavius Battleground.
//= - Winning Team: 9 badges
//= - Losing Team: 3 badge
//===== Additional Comments: ================================= 
//= 1.0 First Version.
//= 1.1 Fixed pink crystal spawning as blue. [L0ne_W0lf]
//= 1.2 Updated 'waitingroom' to support required zeny/lvl. [Kisuka]
//= 1.3 Removed MaxLvl check in waitingrooms. Replaced setwall with setcell.
//= 1.4 Attempt at implementing BG Queue [Ind/Hercules]
//============================================================


//Tacham, while the script is under testings the original will remain, meaning if you wanna test this you need to disable the other, or they'll conflict.
bat_b01,15,15,3	script	start#bat_b01	844,{
OnInit:
	mapwarp "bat_b01","bat_room",154,150;
	end;

//$@bg_queue_id is cleared after this event ends
OnPlayerListReady:
 	set $@FlaviusBG1_id1, bg_create_team("bat_b01",10,290);
	set $@FlaviusBG1_id2, bg_create_team("bat_b01",390,10);

	set $@Croix_QueueBG1, queue();
	set $@Guill_QueueBG1, queue();
	
	queueopt($@Guill_QueueBG1,HQO_OnLogout,"start#bat_b01::OnGuillaumeQuit");
	queueopt($@Croix_QueueBG1,HQO_OnLogout,"start#bat_b01::OnCroixQuit");
	
	set .@it,queueiterator($@bg_queue_id);
	set .@i, 0;
	
	for( set .@member, qiget(.@it); qicheck(.@it); set .@member,qiget(.@it) ) {
		if( .@i % 2 == 0 ) {
			bg_join_team($@FlaviusBG1_id1,.@member);
			queueadd($@Guill_QueueBG1,.@member);
		} else {
			bg_join_team($@FlaviusBG1_id2,.@member);
			queueadd($@Croix_QueueBG1,.@member);
		}
		set .@i,.@i + 1;
	}
	qiclear(.@it);

	set $@FlaviusBG1, 1;
	set $@FlaviusBG1_Victory, 0;
	set $@Croix_ScoreBG1, 0;
	set $@Guill_ScoreBG1, 0;
	
	bg_updatescore "bat_b01",$@Guill_ScoreBG1,$@Croix_ScoreBG1;

	donpcevent "OBJ#bat_b01_a::Onkill";
	donpcevent "OBJ#bat_b01_a::OnEnable";
	donpcevent "OBJ#bat_b01_b::Onkill";
	donpcevent "OBJ#bat_b01_b::OnEnable";
	donpcevent "guardian#bat_b01_a::Onkill";
	donpcevent "guardian#bat_b01_b::Onkill";
	donpcevent "guardian#bat_b01_a::OnEnable";
	donpcevent "guardian#bat_b01_b::OnEnable";
	donpcevent "cell#bat_b01_a::Onred";
	donpcevent "cell#bat_b01_b::Onred";
	donpcevent "time#bat_b01::OnEnable";
	disablenpc "Guillaume Vintenar#b01_a";
	disablenpc "Croix Vintenar#b01_b";
	disablenpc "Vintenar#bat_b01_aover";
	disablenpc "Vintenar#bat_b01_bover";
	bg_warp $@FlaviusBG1_id1,"bat_b01",87,75;
	bg_warp $@FlaviusBG1_id2,"bat_b01",311,224;
	donpcevent "countdown#bat_b01::OnEnable";
	initnpctimer;
	end;

OnReset:
	donpcevent "OBJ#bat_b01_a::Onkill";
	donpcevent "OBJ#bat_b01_a::OnEnable";
	donpcevent "OBJ#bat_b01_b::Onkill";
	donpcevent "OBJ#bat_b01_b::OnEnable";
	donpcevent "guardian#bat_b01_a::Onkill";
	donpcevent "guardian#bat_b01_b::Onkill";
	donpcevent "guardian#bat_b01_a::OnEnable";
	donpcevent "guardian#bat_b01_b::OnEnable";
	donpcevent "cell#bat_b01_a::Onred";
	donpcevent "cell#bat_b01_b::Onred";
	donpcevent "time#bat_b01::OnEnable";
	disablenpc "Guillaume Vintenar#b01_a";
	disablenpc "Croix Vintenar#b01_b";
	disablenpc "Vintenar#bat_b01_aover";
	disablenpc "Vintenar#bat_b01_bover";
	bg_warp $@FlaviusBG1_id1,"bat_b01",87,75;
	bg_warp $@FlaviusBG1_id2,"bat_b01",311,224;
	end;

OnGuillaumeQuit:
OnCroixQuit:
	bg_leave;
	end;

OnTimer10000:
	stopnpctimer;
	donpcevent "#bat_b01_timer::OnEnable";
	end;
	
OnMatchOver:
	bg_match_over("Flavius");
	queuedel($@Croix_QueueBG1);
	queuedel($@Guill_QueueBG1);
	end;
}

bat_b01,1,1,3	script	OBJ#bat_b01_a	844,{
OnEnable:
	bg_monster $@FlaviusBG1_id1,"bat_b01",61,150,"Pink Crystal",1915,"OBJ#bat_b01_a::OnMyMobDead";
	end;

Onkill:
	killmonster "bat_b01","OBJ#bat_b01_a::OnMyMobDead";
	end;

OnMyMobDead:
	if (mobcount("bat_b01","OBJ#bat_b01_a::OnMyMobDead") < 1) {
		mapannounce "bat_b01", "Guillaume's Crystal has been destroyed.",bc_map,"0xFFCE00";
		if ($@Croix_ScoreBG1 > 0) {
			set $@FlaviusBG1_Victory,2;
			set $@Croix_ScoreBG1,$@Croix_ScoreBG1+1;
			enablenpc "Guillaume Vintenar#b01_a";
			enablenpc "Croix Vintenar#b01_b";
			donpcevent "time#bat_b01::Onstop";
			donpcevent "start#bat_b01::OnMatchOver";
		}
		else {
			set $@Croix_ScoreBG1,1;
			donpcevent "time#bat_b01::OnEnable";
			donpcevent "start#bat_b01::onReset";
		}
		donpcevent "#bat_b01_timer::OnStop";
		bg_updatescore "bat_b01",$@Guill_ScoreBG1,$@Croix_ScoreBG1;
		bg_warp $@FlaviusBG1_id1,"bat_b01",10,290;
		bg_warp $@FlaviusBG1_id2,"bat_b01",390,10;
		donpcevent "#bat_b01_timer::OnEnable";
	}
	end;
}
bat_room,2,151,3	script	#bat_b01_timer	844,{
	end;

OnEnable:
	initnpctimer;
	end;

OnStop:
	stopnpctimer;
	end;

OnTimer1000:
	stopnpctimer;
	initnpctimer;
	set .@chk_bat_a01,getmapusers("bat_b01");
	if (.@chk_bat_a01 < 1) {	
		set $@FlaviusBG1, 0;
		if( $@FlaviusBG1_id1 ) { bg_destroy $@FlaviusBG1_id1; set $@FlaviusBG1_id1, 0; }
		if( $@FlaviusBG1_id2 ) { bg_destroy $@FlaviusBG1_id2; set $@FlaviusBG1_id2, 0; }
	}
	end;
}

bat_b01,1,2,3	script	OBJ#bat_b01_b	844,{
OnEnable:
	bg_monster $@FlaviusBG1_id2,"bat_b01",328,150,"Blue Crystal",1914,"OBJ#bat_b01_b::OnMyMobDead";
	end;

Onkill:
	killmonster "bat_b01","OBJ#bat_b01_b::OnMyMobDead";
	end;

OnMyMobDead:
	if (mobcount("bat_b01","OBJ#bat_b01_b::OnMyMobDead") < 1) {
		mapannounce "bat_b01", "Croix's Crystal has been destroyed.",bc_map,"0xFFCE00";
		if ($@Guill_ScoreBG1 > 0) {
			set $@FlaviusBG1_Victory,1;
			set $@Guill_ScoreBG1,$@Guill_ScoreBG1+1;
			enablenpc "Guillaume Vintenar#b01_a";
			enablenpc "Croix Vintenar#b01_b";
			donpcevent "time#bat_b01::Onstop";
			donpcevent "start#bat_b01::OnMatchOver";
		}
{'fraction_non_alphanumeric': 0.19388363574410086, 'fraction_numerical': 0.06567850753897266, 'mean_word_length': 6.847593582887701, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7366612', 'n_tokens_mistral': 5968, 'n_tokens_neox': 5279, 'n_words': 780}