summaryrefslogblamecommitdiff
path: root/npc/custom/bgqueue/flavius.txt
blob: 99a4d5e0a8917776c2a6f2df1ed0f524cf7de67a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11

                                                              
                                                              
             
                                                              
        
                                                              



                            
                                                              






                                                                             

                                                              
                                                                                                                                                         
                                                   





                                                
                                                               



                                                               
 

                                                                                      
 
                   
 


                                                                             
 



                                                                                        



                                                                     
                                                                                                  

                                                                                                                                                          


                                                                         

                                                                                                                  




                                                                                                     
         
 
















                                                                                                                     
 
                                           
                                                                            



























                                                                                                                                   
                 
         
                    




                                    
 

                                                                   
                                           
                                             
                                           
                                             

                                                

                                                  

                                           






                                                   
 
                        

                                                                                         
 
                                                 


            
                                           
                                             
                                           
                                             

                                                

                                                  

                                           








                                                   
            

                                                   

            
                
                                                   

                               
 




                                                                                                                                            
            
 
            
                                                    

                                           
                                         


                                                                                        


            
                                                   



                                                                                                      
       










                                                                                                   
                                                          




                                                                
                                                            
                 


                                                                           


            
                                                   



                                                                                                       
       










                                                                                               
                                                          




                                                                
                                                            
                 


                                                                           



            
                                                           




                                                                                                                       
       




                                                                        
                                                     




                                                                                                                       
                                                           




                                                                                                                   
       




                                                                        
                                                     




                                                                                                                   
                                                   
      



                                                        
        




                                                        
                                                   
      



                                                          
        




                                                          
                                                   




                                                      
       




                                                    
                                                                    

















                                         
                                                      






                                           
       





                                            
                                                                       









                                        
                                                                    

























                                                      
       





                                            
                                                                     











                                                
                                 





                                                        
                                 



                              
                                                                             


















































                                                                                                            
                                                                     


















































                                                                                                                                      
                                                           








                     
       































                                                                                                                                                                                    
                                          







                                                  
                                               



                                                
























                                                                             












































































                                                                                                                                
                                                                      











































































                                                                                                                                      
//===== Hercules Script ======================================
// BattleGround System - Flavius
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.5b
//===== 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]
//= 1.5  Attempt at implementing BG Queue team-algorithm [jaBote]
//= 1.5b Adjustments to the team-splitting algorithm [Haruna]
//============================================================

//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	CLEAR_NPC,{
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, QUEUEOPT_LOGOUT, "start#bat_b01::OnGuillaumeQuit");
	queueopt($@Croix_QueueBG1, QUEUEOPT_LOGOUT, "start#bat_b01::OnCroixQuit");

	set .@i, 0;

	copyarray .@bg_member[0],$@bg_member[0],$@bg_member_size;
	copyarray .@bg_member_group[0],$@bg_member_group[0],$@bg_member_size;
	copyarray .@bg_member_type[0],$@bg_member_type[0],$@bg_member_size;

	freeloop(1);
	// Counting all participants and determining sizes, condensing .@bg_member_group
	set .@nogroupcount, 0;
	for (set .@i, 0; .@i < getarraysize(.@bg_member); set .@i, .@i + 1) {
		if (.@bg_member_group[.@i] == 0) { // Just count them
			set .@nogroupcount, .@nogroupcount + 1;
			continue;
		}
		// check if .@bg_member_group and .@bg_member_type already exists on these groups.
		for (set .@j, 0; .@j < getarraysize(.@bg_groups); set .@j, .@j + 1) { // <= since it has to start working even if the array is still blank
			if ( (.@bg_member_group[.@i] == .@bg_groups[.@j]) && (.@bg_member_type[.@i] == .@bg_types[.@j]) ) {
				set .@bg_count[.@j], .@bg_count[.@j] + 1;
				break;
			}
			// Else keep running the loop until we find there's a group already made or make a new one
		}
		if (.@j == (getarraysize(.@bg_groups)) ) { // It isn't there, insert a new entry at j
			set .@bg_groups[.@j], .@bg_member_group[.@i];
			set .@bg_types[.@j], .@bg_member_type[.@i];
			set .@bg_count[.@j], 1;
		}
	}

	// Now, sorting the group arrays from amount of population descending! Bubble sort powers, I call upon thee!
	// Type doesn't matter here for precedence checks, but also needs to be sorted the same way along with groups
	for (set .@i, 0; .@i < getarraysize(.@bg_groups); set .@i, .@i + 1) {
		for (set .@j, 0; .@j < (getarraysize(.@bg_groups) - .@i); set .@j, .@j + 1) {
			if (.@bg_count[.@j] < .@bg_count[.@j+1]){
				set .@temp1, .@bg_groups[.@j];
				set .@temp2, .@bg_types[.@j];
				set .@temp3, .@bg_count[.@j];
				set .@bg_groups[.@j], .@bg_groups[.@j+1];
				set .@bg_types[.@j], .@bg_types[.@j+1];
				set .@bg_count[.@j], .@bg_count[.@j+1];
				set .@bg_groups[.@j+1], .@temp1;
				set .@bg_types[.@j+1], .@temp2;
				set .@bg_count[.@j+1], .@temp3;
			}
		}
	}

	// Add the groups to the queues! :D
	for (set .@i, 0; .@i < getarraysize(.@bg_groups); set .@i, .@i + 1){
		if (queuesize($@Croix_QueueBG1) <= queuesize($@Guill_QueueBG1)){ // Catch'em all and add to the queue!
			for (set .@j, 0; .@j < getarraysize(.@bg_member); set .@j, .@j + 1) {
				if ( (.@bg_groups[.@i] == .@bg_member_group[.@j]) && (.@bg_types[.@i] == .@bg_member_type[.@j]) ) {
					bg_join_team($@FlaviusBG1_id1,.@bg_member[.@j]);
					queueadd($@Croix_QueueBG1, .@bg_member[.@j]);
				}
			}
		}
		else {
			for (set .@j, 0; .@j < getarraysize(.@bg_member); set .@j, .@j + 1) {
				if ( (.@bg_groups[.@i] == .@bg_member_group[.@j]) && (.@bg_types[.@i] == .@bg_member_type[.@j]) ) {
					bg_join_team($@FlaviusBG1_id2,.@bg_member[.@j]);
					queueadd($@Guill_QueueBG1, .@bg_member[.@j]);
				}
			}
		}
	}
	// Don't forget the people that go on their own!
	for (set .@i, 0; .@i <= getarraysize(.@bg_member); set .@i, .@i+1) {
		if (.@bg_member_group[.@i] == 0) { // Get alone people only
			if (queuesize($@Croix_QueueBG1) <= queuesize($@Guill_QueueBG1)) {
				bg_join_team($@FlaviusBG1_id1,.@bg_member[.@i]);
				queueadd($@Croix_QueueBG1, .@bg_member[.@i]);
			}
			else {
				bg_join_team($@FlaviusBG1_id2,.@bg_member[.@i]);
				queueadd($@Guill_QueueBG1, .@bg_member[.@i]);
			}
		}
	}
	freeloop(0);

	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;

	/* after warp */
	queueopt($@Guill_QueueBG1, QUEUEOPT_MAPCHANGE, "start#bat_b01::OnGuillaumeQuit");
	queueopt($@Croix_QueueBG1, QUEUEOPT_MAPCHANGE, "start#bat_b01::OnCroixQuit");

	donpcevent "countdown#bat_b01::OnEnable";
	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;

OnCroixQuit:
	queueremove($@Croix_QueueBG1,getcharid(3));
	callsub L_OnPlayerQuit;
	end;

OnGuillaumeQuit:
	queueremove($@Guill_QueueBG1,getcharid(3));
	callsub L_OnPlayerQuit;
	end;

L_OnPlayerQuit:
	bg_leave;
	setd $@bg_delay_var$,gettimetick(2);
	if( queuesize($@Guill_QueueBG1) == 0 || queuesize($@Croix_QueueBG1) == 0 ) /* todo check score and decide a winner if anyone left */
		callsub OnMatchOver;
	end;

OnMatchOver:
	if( $@FlaviusBG1_id1 || $@FlaviusBG1_id2 ) {
		queuedel($@Croix_QueueBG1);
		queuedel($@Guill_QueueBG1);
		bg_match_over("Flavius");
	}
	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,1,3	script	OBJ#bat_b01_a	CLEAR_NPC,{
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";
		}
		bg_updatescore "bat_b01",$@Guill_ScoreBG1,$@Croix_ScoreBG1;
		bg_warp $@FlaviusBG1_id1,"bat_b01",10,290;
		bg_warp $@FlaviusBG1_id2,"bat_b01",390,10;
	}
	end;
}
bat_b01,1,2,3	script	OBJ#bat_b01_b	CLEAR_NPC,{
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";
		}
		else {
			set $@Guill_ScoreBG1,1;
			donpcevent "time#bat_b01::OnEnable";
			donpcevent "start#bat_b01::OnReset";
		}
		bg_updatescore "bat_b01",$@Guill_ScoreBG1,$@Croix_ScoreBG1;
		bg_warp $@FlaviusBG1_id1,"bat_b01",10,290;
		bg_warp $@FlaviusBG1_id2,"bat_b01",390,10;
	}
	end;
}

bat_b01,1,3,3	script	guardian#bat_b01_a	CLEAR_NPC,{
OnEnable:
	bg_monster $@FlaviusBG1_id1,"bat_b01",108,159,"Guillaume Camp Guardian",1949,"guardian#bat_b01_a::OnMyMobDead";
	bg_monster $@FlaviusBG1_id1,"bat_b01",108,141,"Guillaume Camp Guardian",1949,"guardian#bat_b01_a::OnMyMobDead";
	end;

OnKill:
	killmonster "bat_b01","guardian#bat_b01_a::OnMyMobDead";
	end;

OnMyMobDead:
	if (mobcount("bat_b01","guardian#bat_b01_a::OnMyMobDead") < 1) {
		donpcevent "cell#bat_b01_a::OnGreen";
		mapannounce "bat_b01", "The Guardian protecting Guillaume's Crystal has been slain.",bc_map,"0xFFCE00";
	}
	end;
}

bat_b01,1,3,3	script	guardian#bat_b01_b	CLEAR_NPC,{
OnEnable:
	bg_monster $@FlaviusBG1_id2,"bat_b01",307,160,"Croix Camp Guardian",1949,"guardian#bat_b01_b::OnMyMobDead";
	bg_monster $@FlaviusBG1_id2,"bat_b01",307,138,"Croix Camp Guardian",1949,"guardian#bat_b01_b::OnMyMobDead";
	end;

OnKill:
	killmonster "bat_b01","guardian#bat_b01_b::OnMyMobDead";
	end;

OnMyMobDead:
	if (mobcount("bat_b01","guardian#bat_b01_b::OnMyMobDead") < 1) {
		donpcevent "cell#bat_b01_b::OnGreen";
		mapannounce "bat_b01", "The Guardian protecting Croix's Crystal has been slain.",bc_map,"0xFFCE00";
	}
	end;
}

bat_b01,1,4,3	script	cell#bat_b01_a	CLEAR_NPC,{
OnRed:
	setcell "bat_b01",62,149,60,151,cell_basilica,1;
	setcell "bat_b01",62,149,60,151,cell_walkable,0;
	end;

OnGreen:
	setcell "bat_b01",62,149,60,151,cell_basilica,0;
	setcell "bat_b01",62,149,60,151,cell_walkable,1;
	end;
}

bat_b01,1,5,3	script	cell#bat_b01_b	CLEAR_NPC,{
OnRed:
	setcell "bat_b01",327,151,329,149,cell_basilica,1;
	setcell "bat_b01",327,151,329,149,cell_walkable,0;
	end;

OnGreen:
	setcell "bat_b01",327,151,329,149,cell_basilica,0;
	setcell "bat_b01",327,151,329,149,cell_walkable,1;
	end;
}

bat_b01,1,6,1	script	time#bat_b01	CLEAR_NPC,{
OnEnable:
	donpcevent "Battle Therapist#b01_a::OnEnable";
	donpcevent "Battle Therapist#b01_b::OnEnable";
	end;

OnStop:
	donpcevent "Battle Therapist#b01_a::OnStop";
	donpcevent "Battle Therapist#b01_b::OnStop";
	end;
}

bat_b01,10,294,3	script	Battle Therapist#b01_a	4_F_SISTER,{
	specialeffect2 EF_HEAL;
	mes "[Battle Therapist]";
	mes "Just close your eyes,";
	mes "and take a deep breath.";
	mes "You can be free from pain.";
	close;

OnTimer25000:
	specialeffect EF_SANCTUARY;
	enablenpc "bat_b01_rp1_a_warp";
	end;

OnTimer26000:
	disablenpc "bat_b01_rp1_a_warp";
	end;

OnTimer26500:
	stopnpctimer;
	donpcevent "Battle Therapist#b01_a::OnEnable";
	end;

OnEnable:
	initnpctimer;
	enablenpc "Battle Therapist#b01_a";
	end;

OnStop:
	disablenpc "bat_b01_rp1_a_warp";
	disablenpc "Battle Therapist#b01_a";
	stopnpctimer;
	end;
}

bat_b01,10,290,0	script	bat_b01_rp1_a_warp	WARPNPC,10,10,{
OnInit:
	disablenpc "bat_b01_rp1_a_warp";
	end;

OnTouch:
	percentheal 100,100;
	warp "bat_b01",87,73;
	end;
}

bat_b01,389,14,3	script	Battle Therapist#b01_b	4_F_SISTER,{
	specialeffect2 EF_HEAL;
	mes "[Battle Therapist]";
	mes "Just close your eyes,";
	mes "and take a deep breath.";
	mes "You can be free from pain.";
	close;

OnTimer25000:
	specialeffect EF_SANCTUARY;
	enablenpc "bat_b01_rp1_b_warp";
	end;

OnTimer26000:
	disablenpc "bat_b01_rp1_b_warp";
	end;

OnTimer26500:
	stopnpctimer;
	donpcevent "Battle Therapist#b01_b::OnEnable";
	end;

OnEnable:
	initnpctimer;
	enablenpc "Battle Therapist#b01_b";
	end;

OnStop:
	disablenpc "bat_b01_rp1_b_warp";
	disablenpc "Battle Therapist#b01_b";
	stopnpctimer;
	end;
}

bat_b01,389,10,0	script	bat_b01_rp1_b_warp	WARPNPC,9,9,{
OnInit:
	disablenpc "bat_b01_rp1_a_warp";
	end;

OnTouch:
	percentheal 100,100;
	warp "bat_b01",312,225;
	end;
}

bat_b01,87,76,0	script	A_CODE#bat_b01	-1,5,5,{
OnTouch:
	if (!questprogress(2070))
		setquest 2070;
	end;
}

bat_b01,312,224,0	script	B_CODE#bat_b01	-1,5,5,{
OnTouch:
	if (!questprogress(2070))
		setquest 2070;
	end;
}

bat_b01,10,294,3	script	Guillaume Vintenar#b01_a	4_M_RASWORD,{
	if ($@FlaviusBG1_id1 == getcharid(4)) {
		if ($@FlaviusBG1_Victory == 1) {
			set .@your_medal,countitem(7829);
			set .@medal_gap,500 - .@your_medal;
			if (.@medal_gap > 8) {
				mes "[Axl Rose]";
				mes "Blessed Guillaume!";
				mes "Let's enjoy our glorious victory!";
				mes ""+strcharinfo(0)+", it's a sign reflecting victory.";
				close2;
				getitem 7829,9; //BF_Badge2
			}
			else {
				mes "[Axl Rose]";
				mes "Blessed Guillaume!";
				mes "Let's enjoy our glorious victory!";
				mes ""+strcharinfo(0)+", it's a sign reflecting victory.";
				close2;
				getitem 7829,.@medal_gap; //BF_Badge2
			}
		}
		else {
			set .@your_medal,countitem(7829);
			set .@medal_gap,500 - .@your_medal;
			if (.@medal_gap > 2) {
				mes "[Axl Rose]";
				mes "You lost, but you're dedicated to this battle.";
				mes "This is a reward for your great dedication by Guillaume Marollo!";
				mes "Just take this defeat as a lesson, next time you will definitely win.";
				close2;
				getitem 7829,3; //BF_Badge2
			}
			else {
				mes "[Axl Rose]";
				mes "You lost, but you're dedicated to this battle.";
				mes "This is a reward for your great dedication by Guillaume Marollo!";
				mes "Just take this defeat as a lesson, next time you will definitely win.";
				close2;
				getitem 7829,.@medal_gap; //BF_Badge2
			}
		}
	}
	bg_leave;
	warp "bat_room",154,150;
	end;

OnInit:
	disablenpc "Guillaume Vintenar#b01_a";
	end;
}

bat_b01,389,14,3	script	Croix Vintenar#b01_b	4_M_RASWORD,{
	if ($@FlaviusBG1_id2 == getcharid(4)) {
		if ($@FlaviusBG1_Victory == 2) {
			set .@your_medal,countitem(7829);
			set .@medal_gap,500 - .@your_medal;
			if (.@medal_gap > 8) {
				mes "[Swandery]";
				mes "Blessed Croix!";
				mes "Let's enjoy our glorious victory!";
				mes ""+strcharinfo(0)+", it's a sign reflecting victory.";
				close2;
				getitem 7829,9; //BF_Badge2
			}
			else {
				mes "[Swandery]";
				mes "Blessed Croix!";
				mes "Let's enjoy our glorious victory!";
				mes ""+strcharinfo(0)+", it's a sign reflecting victory.";
				close2;
				getitem 7829,.@medal_gap; //BF_Badge2
			}
		}
		else {
			set .@your_medal,countitem(7829);
			set .@medal_gap,500 - .@your_medal;
			if (.@medal_gap > 2) {
				mes "[Swandery]";
				mes "Oh, "+strcharinfo(0)+". Don't be sad.";
				mes "Even though we didn't win, we did our best.";
				mes "This is a Royal gift from Croix, and please don't forget this battle. We will win the next one.";
				close2;
				getitem 7829,3; //BF_Badge2
			}
			else {
				mes "[Swandery]";
				mes "Oh, "+strcharinfo(0)+". Don't be sad.";
				mes "Even though we didn't win, we did our best.";
				mes "This is a Royal gift from Croix, and please don't forget this battle. We will win the next one.";
				close2;
				getitem 7829,.@medal_gap; //BF_Badge2
			}
		}
	}
	bg_leave;
	warp "bat_room",154,150;
	end;

OnInit:
	disablenpc "Croix Vintenar#b01_b";
	end;
}

bat_b01,1,5,3	script	countdown#bat_b01	CLEAR_NPC,{
OnInit:
	stopnpctimer;
	end;

OnEnable:
	stopnpctimer;
	initnpctimer;
	end;

OnStop:
	stopnpctimer;
	end;

OnTimer7000:
	mapannounce "bat_b01", "Guillaume Vintenar Axl Rose : Let's attack to destroy that Crystal!",bc_map,"0xFF9900";
	end;

OnTimer8000:
	mapannounce "bat_b01", "Croix Vintenar Swandery : Even though Guillaume is struggling to win against us, the victory is ours. Let's show them our power.",bc_map,"0xFF99CC";
	end;

OnTimer1800000:
	mapannounce "bat_b01", "Marollo VII : Guillaume Marollo, Croix Marollo! And their followers!",bc_map,"0x99CC00";
	end;

OnTimer1803000:
	mapannounce "bat_b01", "Marollo VII : Both camps are competitive, so it's hard to judge which team is superior.",bc_map,"0x99CC00";
	end;

OnTimer1808000:
	mapannounce "bat_b01", "Marollo VII : This battle of Flavian is such a waste of time. I will decide victory and defeat by your progress.",bc_map,"0x99CC00";
	end;

OnTimer1822000:
	mapannounce "bat_b01", "Marollo VII : If you can't accept the results, try again in another valley battle!",bc_map,"0x99CC00";
	end;

OnTimer1825000:
	mapannounce "bat_b01", "Axl Rose, Swandery : Yes, sir.",bc_map,"0x99CC00";
	end;

OnTimer1830000:
	donpcevent "time#bat_b01::OnStop";
	bg_warp $@FlaviusBG1_id1,"bat_b01",10,290;
	bg_warp $@FlaviusBG1_id2,"bat_b01",390,10;
	enablenpc "Vintenar#bat_b01_aover";
	enablenpc "Vintenar#bat_b01_bover";
	end;

OnTimer1900000:
	mapwarp "bat_b01","bat_room",154,150;
	donpcevent "countdown#bat_b01::OnStop";
	donpcevent "start#bat_b01::OnMatchOver";
	end;
}

bat_b01,81,83,3	script	Guillaume Camp#flag21	1_FLAG_LION,{ end; }
bat_b01,94,83,3	script	Guillaume Camp#flag22	1_FLAG_LION,{ end; }
bat_b01,81,66,3	script	Guillaume Camp#flag23	1_FLAG_LION,{ end; }
bat_b01,94,66,3	script	Guillaume Camp#flag24	1_FLAG_LION,{ end; }
bat_b01,139,142,3	script	Guillaume Camp#flag25	1_FLAG_LION,{ end; }
bat_b01,139,158,3	script	Guillaume Camp#flag26	1_FLAG_LION,{ end; }
bat_b01,110,161,3	script	Guillaume Camp#flag27	1_FLAG_LION,{ end; }
bat_b01,110,137,3	script	Guillaume Camp#flag28	1_FLAG_LION,{ end; }
bat_b01,63,135,3	script	Guillaume Camp#flag29	1_FLAG_LION,{ end; }
bat_b01,63,165,3	script	Guillaume Camp#flag30	1_FLAG_LION,{ end; }
bat_b01,10,296,3	script	Guillaume Camp#flag31	1_FLAG_LION,{ end; }

bat_b01,306,233,3	script	Croix Camp#flag21	1_FLAG_EAGLE,{ end; }
bat_b01,317,233,3	script	Croix Camp#flag22	1_FLAG_EAGLE,{ end; }
bat_b01,306,216,3	script	Croix Camp#flag23	1_FLAG_EAGLE,{ end; }
bat_b01,317,216,3	script	Croix Camp#flag24	1_FLAG_EAGLE,{ end; }
bat_b01,257,158,3	script	Croix Camp#flag25	1_FLAG_EAGLE,{ end; }
bat_b01,257,141,3	script	Croix Camp#flag26	1_FLAG_EAGLE,{ end; }
bat_b01,297,164,3	script	Croix Camp#flag27	1_FLAG_EAGLE,{ end; }
bat_b01,297,136,3	script	Croix Camp#flag28	1_FLAG_EAGLE,{ end; }
bat_b01,336,161,3	script	Croix Camp#flag29	1_FLAG_EAGLE,{ end; }
bat_b01,336,139,3	script	Croix Camp#flag30	1_FLAG_EAGLE,{ end; }
bat_b01,389,16,3	script	Croix Camp#flag31	1_FLAG_EAGLE,{ end; }

bat_b01,10,294,3	script	Vintenar#bat_b01_aover	4_M_KY_HEAD,{
	set .@A_B_gap,$@Guill_ScoreBG1 - $@Croix_ScoreBG1;
	if ($@FlaviusBG1_id1 == getcharid(4)) {
		if (.@A_B_gap > 0) {
			set .@your_medal,countitem(7829);
			set .@medal_gap,500 - .@your_medal;
			if (.@medal_gap > 8) {
				mes "[Axl Rose]";
				mes "Blessed Guillaume!";
				mes "Let's enjoy our glorious victory!";
				mes ""+strcharinfo(0)+", it's a sign reflecting victory.";
				close2;
				getitem 7829,9; //BF_Badge2
			}
			else {
				mes "[Axl Rose]";
				mes "Blessed Guillaume!";
				mes "Let's enjoy our glorious victory!";
				mes ""+strcharinfo(0)+", it's a sign reflecting victory.";
				close2;
				getitem 7829,.@medal_gap; //BF_Badge2
			}
		}
		else if (.@A_B_gap == 0) {
			set .@your_medal,countitem(7829);
			set .@medal_gap,500 - .@your_medal;
			if (.@medal_gap > 2) {
				mes "[Axl Rose]";
				mes "You lost, but you're dedicated to this battle.";
				mes "This is a reward for your great dedication by Guillaume Marollo!";
				mes "Just take this defeat as a lesson, next time you will definitely win.";
				close2;
				getitem 7829,3; //BF_Badge2
			}
			else {
				mes "[Axl Rose]";
				mes "You lost, but you're dedicated to this battle.";
				mes "This is a reward for your great dedication by Guillaume Marollo!";
				mes "Just take this defeat as a lesson, next time you will definitely win.";
				close2;
				getitem 7829,.@medal_gap; //BF_Badge2
			}
		}
		else {
			set .@your_medal,countitem(7829);
			set .@medal_gap,500 - .@your_medal;
			if (.@medal_gap > 2) {
				mes "[Axl Rose]";
				mes "You lost, but you're dedicated to this battle.";
				mes "This is a reward for your great dedication by Guillaume Marollo!";
				mes "Just take this defeat as a lesson, next time you will definitely win.";
				close2;
				getitem 7829,3; //BF_Badge2
			}
			else {
				mes "[Axl Rose]";
				mes "You lost, but you're dedicated to this battle.";
				mes "This is a reward for your great dedication by Guillaume Marollo!";
				mes "Just take this defeat as a lesson, next time you will definitely win.";
				close2;
				getitem 7829,.@medal_gap; //BF_Badge2
			}
		}
	}
	else {
		mes "[Axl Rose]";
		mes "Why are you here, Croix mercenary? I am definitely sure of victory against foolish Croix such as you. Ha!";
		close;
	}
	bg_leave;
	warp "bat_room",154,150;
	end;

OnInit:
	disablenpc "Vintenar#bat_b01_aover";
	end;
}

bat_b01,389,14,3	script	Vintenar#bat_b01_bover	4_M_CRU_HEAD,{
	set .@A_B_gap,$@Guill_ScoreBG1 - $@Croix_ScoreBG1;
	if ($@FlaviusBG1_id2 == getcharid(4)) {
		if (.@A_B_gap > 0) {
			set .@your_medal,countitem(7829);
			set .@medal_gap,500 - .@your_medal;
			if (.@medal_gap > 2) {
				mes "[Swandery]";
				mes "Oh, "+strcharinfo(0)+". Don't be sad.";
				mes "Even though we didn't win, we did our best.";
				mes "This is a Royal gift from Croix, and please don't forget this battle. We will win the next one.";
				close2;
				getitem 7829,3; //BF_Badge2
			}
			else {
				mes "[Swandery]";
				mes "Oh, "+strcharinfo(0)+". Don't be sad.";
				mes "Even though we didn't win, we did our best.";
				mes "This is a Royal gift from Croix, and please don't forget this battle. We will win the next one.";
				close2;
				getitem 7829,.@medal_gap; //BF_Badge2
			}
		}
		else if (.@A_B_gap == 0) {
			set .@your_medal,countitem(7829);
			set .@medal_gap,500 - .@your_medal;
			if (.@medal_gap > 2) {
				mes "[Swandery]";
				mes "Oh, "+strcharinfo(0)+". Don't be sad.";
				mes "Even though we didn't win, we did our best.";
				mes "This is a Royal gift from Croix, and please don't forget this battle. We will win the next one.";
				close2;
				getitem 7829,3; //BF_Badge2
			}
			else {
				mes "[Swandery]";
				mes "Oh, "+strcharinfo(0)+". Don't be sad.";
				mes "Even though we didn't win, we did our best.";
				mes "This is a Royal gift from Croix, and please don't forget this battle. We will win the next one.";
				close2;
				getitem 7829,.@medal_gap; //BF_Badge2
			}
		}
		else {
			set .@your_medal,countitem(7829);
			set .@medal_gap,500 - .@your_medal;
			if (.@medal_gap > 8) {
				mes "[Swandery]";
				mes "Blessed Croix!";
				mes "Let's enjoy our glorious victory!";
				mes ""+strcharinfo(0)+", it's a sign reflecting victory.";
				close2;
				getitem 7829,9; //BF_Badge2
			}
			else {
				mes "[Swandery]";
				mes "Blessed Croix!";
				mes "Let's enjoy our glorious victory!";
				mes ""+strcharinfo(0)+", it's a sign reflecting victory.";
				close2;
				getitem 7829,.@medal_gap; //BF_Badge2
			}
		}
	}
	else {
		mes "[Swandery]";
		mes "Why do you come here as a Guillaume? You will be sent to where you should be!";
		close;
	}
	bg_leave;
	warp "bat_room",154,150;
	end;

OnInit:
	disablenpc "Vintenar#bat_b01_bover";
	end;
}