Преглед изворни кода

- Fixed item script of Chicken_Hat (5431). (bugreport:4174)
- Fixed a typo in script_commands.txt (bugreport:4270)
- Fixed some links in the README html files.
- Fixed the range of 'max_guild_alliance' in battle.c (0 to 3).
- Set svn:eol-style=native for some recently added text files.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14328 54d463be-8e91-2dee-dedb-b68131a5f0ec

brianluau пре 15 година
родитељ
комит
1552a1841c

+ 1 - 1
db/item_db.txt

@@ -2591,7 +2591,7 @@
 5428,Bread_Bag1,RWC Anniversary Bread Envelope,5,,,100,,0,,0,0xFFFFFFFF,7,2,769,,0,1,429,{ bonus2 bSubRace,RC_DemiHuman,12; },{},{}
 //5429,Bogy_Cap,Bogy Cap,5,,,100,,2,,1,0xFFFFFFFF,7,2,256,,0,1,430,{},{},{}
 5430,Sacred_Torch_Coronet,Torch Cap,5,,,250,,3,,0,0xFFFFFFFF,7,2,256,,0,0,431,{ bonus2 bSubEle,Ele_Fire,20; skill "MG_FIREBALL",5; },{},{}
-5431,Chicken_Hat,Chicken Hat,5,,,100,,0,,0,0xFFFFFFFF,7,2,256,,30,0,432,{ bonus bAspdRate,-10; },{},{}
+5431,Chicken_Hat,Chicken Hat,5,,,100,,0,,0,0xFFFFFFFF,7,2,256,,30,0,432,{ bonus3 bAutoSpell,"MC_LOUD",1,30; bonus bAspdRate,5; },{},{}
 //5432,Brazil_Baseball_Cap,bRO 4th Anniversary Hat,5,,,100,,0,,0,0xFFFFFFFF,7,2,256,,0,0,433,{ bonus bAllStats,4; },{},{}
 //5433,Golden_Wreath,Golden Laurel,5,,,100,,0,,0,0xFFFFFFFF,7,2,256,,0,0,434,{},{},{}
 5434,Coke_Hat,Coca Cola Can Hat,5,,,100,,2,,1,0xFFFFFFFF,7,2,256,,0,1,435,{},{},{}

+ 2 - 2
doc/script_commands.txt

@@ -4710,9 +4710,9 @@ The disguise lasts until 'undisguise' is issued or the player logs out.
 
 Example:
 
-disquise 1002; //Yay! You're a Poring!!!
+disguise 1002; //Yay! You're a Poring!!!
 next;
-undisquise; //Yay!!!! You're a human again!!
+undisguise; //Yay!!!! You're a human again!!
 
 ---------------------------------------
 \\

+ 391 - 391
npc/battleground/bg_kvm01.txt

@@ -1,391 +1,391 @@
-// ==============================================================================
-// BattleGround System - KvM 80~99
-// ==============================================================================
-
-// Registration NPC's
-// *********************************************************************
-
-bat_room,253,227,4	script	Registration::KvM01R_Guillaume	418,{ // KvM Guillaume
-	end;
-
-OnInit:
-	waitingroom "Battle Station 5 Players",5,"KvM01_BG::OnGuillaumeJoin",1;
-	end;
-	
-OnEnterBG:
-	set $@KvM01BG_id1, waitingroom2bg("bat_c01",53,128,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
-	end;
-}
-
-bat_room,253,204,0	script	Registration::KvM01R_Croix	414,{ // KvM Croix
-	end;
-
-OnInit:
-	waitingroom "Battle Station 5 Players",5,"KvM01_BG::OnCroixJoin",1;
-	end;
-
-OnEnterBG:
-	set $@KvM01BG_id2, waitingroom2bg("bat_c01",146,55,"KvM01_BG::OnCroixQuit","KvM01_BG::OnCroixDie");
-	end;
-}
-
-// Light Effects
-// *********************************************************************
-
-bat_c01,54,123,0	script	#bat_c01a	111,{
-	end;
-
-OnKvM01LightA: misceffect 54; end;
-OnKvM01LightB: misceffect 55; end;
-OnKvM01LightC: misceffect 56; end;
-}
-
-bat_c01,56,125,0	duplicate(#bat_c01a)	#bat_c01b	111
-bat_c01,58,127,0	duplicate(#bat_c01a)	#bat_c01c	111
-bat_c01,141,56,0	duplicate(#bat_c01a)	#bat_c01d	111
-bat_c01,143,58,0	duplicate(#bat_c01a)	#bat_c01e	111
-bat_c01,145,60,0	duplicate(#bat_c01a)	#bat_c01f	111
-
-// Battleground Engine
-// *********************************************************************
-
--	script	KvM01_BG	-1,{
-	end;
-
-OnInit:
-	setwall "bat_c01",54,122,6,7,0,"batc01wall_a";
-	setwall "bat_c01",55,122,5,7,0,"batc01wall_b";
-	setwall "bat_c01",140,56,6,7,0,"batc01wall_c";
-	setwall "bat_c01",140,57,5,7,0,"batc01wall_d";
-	disablenpc "TherapistKvM01a";
-	disablenpc "TherapistKvM01b";
-	disablenpc "VintenarKvM01a";
-	disablenpc "VintenarKvM01b";
-	end;
-
-OnGuillaumeJoin:
-OnCroixJoin:
-	donpcevent "KvM01_BG::OnReadyCheck";
-	end;
-
-OnGuillaumeQuit:
-	set BG_Delay_Tick, gettimetick(2) + 1200;
-OnGuillaumeDie:
-	if( $@KvM01BG == 2 )
-	{
-		set .Guillaume_Count, .Guillaume_Count - 1;
-		set .Croix_Score, .Croix_Score + 1;
-		bg_updatescore "bat_c01",.Guillaume_Score,.Croix_Score;
-		if( .Guillaume_Count < 1 ) donpcevent "KvM01_BG::OnCroixWin";
-	}
-	end;
-
-OnCroixQuit:
-	set BG_Delay_Tick, gettimetick(2) + 1200;
-OnCroixDie:
-	if( $@KvM01BG == 2 )
-	{
-		set .Croix_Count, .Croix_Count - 1;
-		set .Guillaume_Score, .Guillaume_Score + 1;
-		bg_updatescore "bat_c01",.Guillaume_Score,.Croix_Score;
-		if( .Croix_Count < 1 ) donpcevent "KvM01_BG::OnGuillaumeWin";
-	}
-	end;
-
-OnReadyCheck:
-	if( $@KvM01BG )
-		end;
-	set .@Guillaume, getwaitingroomstate(0,"KvM01R_Guillaume");
-	set .@Croix, getwaitingroomstate(0,"KvM01R_Croix");
-
-	if( .@Guillaume < 5 || .@Croix < 5 )
-	{
-		if( .@Guillaume > 3 && .@Croix > 3 && !agitcheck() && $@KvM_Flood < gettimetick(2) )
-		{
-			announce "Battleground -- Kreiger Von Midgard [80-99] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",0,0x696969;
-			set $@KvM_Flood, gettimetick(2) + 15;
-		}
-		else
-			mapannounce "bat_room","Battleground -- Kreiger Von Midgard [80-99] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",1,0x696969;
-		end;
-	}
-
-	set $@KvM01BG, 1; // Starting
-	donpcevent "KvM01R_Croix::OnEnterBG";
-	donpcevent "KvM01R_Guillaume::OnEnterBG";
-	donpcevent "KvM01_BG::OnStart";
-	end;
-
-OnStart:
-	announce "Battleground -- Kreiger Von Midgard [80-99] has started!",0,0x696969;
-	enablenpc "TherapistKvM01a";
-	enablenpc "TherapistKvM01b";
-	disablenpc "VintenarKvM01a";
-	disablenpc "VintenarKvM01b";
-	set $@KvM01BG_Victory, 0;
-	sleep 2000;
-	// Warp Teams
-	bg_warp $@KvM01BG_id1,"bat_c01",53,128;
-	bg_warp $@KvM01BG_id2,"bat_c01",146,55;
-	// ScoreBoard
-	set .Guillaume_Score, 0;
-	set .Croix_Score, 0;
-	initnpctimer;
-	end;
-
-OnTimer5000:
-	areapercentheal "bat_c01",50,123,58,131,100,100;
-	areapercentheal "bat_c01",141,52,149,60,100,100;
-	mapannounce "bat_c01","The Battle will start in 25 seconds!!",1,0x696969;
-	end;
-
-OnTimer26000:
-	mapannounce "bat_c01","The Battle will start in 4 seconds!!",1,0x696969;
-	end;
-
-OnTimer27000:
-	donpcevent "::OnKvM01LightA";
-	end;
-
-OnTimer28000:
-	donpcevent "::OnKvM01LightB";
-	end;
-	
-OnTimer29000:
-	donpcevent "::OnKvM01LightC";
-	end;
-
-OnTimer30000:
-	// Team Members
-	set .Guillaume_Count, bg_get_data($@KvM01BG_id1, 0);
-	set .Croix_Count, bg_get_data($@KvM01BG_id2, 0);
-	if( .Guillaume_Count < 5 || .Croix_Count < 5 )
-	{
-		set $@KvM01BG_Victory, 3;
-		set $@KvM01BG, 3;
-		mapannounce "bat_c01","There are not enough players to start the battle",1,0x696969;
-		stopnpctimer;
-		sleep 2000;
-		donpcevent "KvM01_BG::OnStop";
-		end;
-	}
-
-	set $@KvM01BG, 2; // Playing
-	areapercentheal "bat_c01",50,123,58,131,100,100;
-	bg_warp $@KvM01BG_id1,"bat_c01",62,119;
-	areapercentheal "bat_c01",141,52,149,60,100,100;
-	bg_warp $@KvM01BG_id2,"bat_c01",137,64;
-	end;
-
-OnTimer32000:
-	mapannounce "bat_c01","The Battle of Kreiger Von Midgard has begun!!",1,0x696969;
-	end;
-
-OnTimer300000:
-	mapannounce "bat_c01","The Battle will ends in 30 seconds!!",1,0x696969;
-	end;
-
-OnTimer330000:
-	if( .Croix_Count > .Guillaume_Count )
-		donpcevent "KvM01_BG::OnCroixWin";
-	else if( .Croix_Count < .Guillaume_Count )
-		donpcevent "KvM01_BG::OnGuillaumeWin";
-	else
-	{ // Draw Game
-		set $@KvM01BG, 3;
-		set $@KvM01BG_Victory, 3;
-
-		stopnpctimer;
-		sleep 2000;
-		mapannounce "bat_c01","The time is out! This is a Tie...",1,0x696969;
-		donpcevent "KvM01_BG::OnStop";
-	}
-	end;
-
-OnGuillaumeWin:
-	set $@KvM01BG, 3;
-	set $@KvM01BG_Victory, 1;
-	
-	stopnpctimer;
-	sleep 2000;
-	mapannounce "bat_c01","The Guillaume Army has won the Battle of Kreiger Von Midgard",1,0x0000FF;
-	donpcevent "KvM01_BG::OnStop";
-	end;
-
-OnCroixWin:
-	set $@KvM01BG, 3;
-	set $@KvM01BG_Victory, 2;
-
-	stopnpctimer;
-	sleep 2000;
-	mapannounce "bat_c01","The Croix Army has won the Battle of Kreiger Von Midgard",1,0xFF0000;
-	donpcevent "KvM01_BG::OnStop";
-	end;
-
-OnStop:
-	disablenpc "TherapistKvM01a";
-	disablenpc "TherapistKvM01b";
-	enablenpc "VintenarKvM01a";
-	enablenpc "VintenarKvM01b";
-	// Warp Teams
-	bg_warp $@KvM01BG_id1,"bat_c01",53,128;
-	bg_warp $@KvM01BG_id2,"bat_c01",146,55;
-	donpcevent "KvM01_BG_Out::OnBegin";
-	end;
-
-OnReset:
-	stopnpctimer;
-	stopnpctimer "KvM01_BG_Out";
-	set .Croix_Count, 0;
-	set .Guillaume_Count, 0;
-	set .Croix_Score, 0;
-	set .Guillaume_Score, 0;
-	set $@KvM01BG_Victory, 0;
-	if( $@KvM01BG_id1 ) { bg_destroy $@KvM01BG_id1; set $@KvM01BG_id1, 0; }
-	if( $@KvM01BG_id2 ) { bg_destroy $@KvM01BG_id2; set $@KvM01BG_id2, 0; }
-	disablenpc "TherapistKvM01a";
-	disablenpc "TherapistKvM01b";
-	disablenpc "VintenarKvM01a";
-	disablenpc "VintenarKvM01b";
-	sleep 1000;
-	mapwarp "bat_c01","bat_room",155,150;
-	sleep 2000;
-	maprespawnguildid "bat_c01",0,3; // Just in case someone else
-	bg_updatescore "bat_c01",0,0;
-	sleep 2000;
-	set $@KvM01BG, 0;
-	donpcevent "KvM01_BG::OnReadyCheck"; // Maybe a game is ready to start
-	end;
-}
-
--	script	KvM01_BG_Out	-1,{
-	end;
-
-OnBegin:
-	initnpctimer;
-	end;
-
-OnTimer3000:
-	mapannounce "bat_c01","Battle of Kreiger Von Midgard will close in 1 minute!",1,0x696969;
-	end;
-OnTimer30000:
-	mapannounce "bat_c01","Battle of Kreiger Von Midgard will close in 30 seconds!",1,0x696969;
-	end;
-OnTimer50000:
-	mapannounce "bat_c01","Battle of Kreiger Von Midgard will close in 10 seconds!",1,0x696969;
-	end;
-OnTimer60000:
-	donpcevent "KvM01_BG::OnReset";
-	end;
-}
-
-// Battleground Therapist
-// *********************************************************************
-
-bat_c01,51,130,5	script	Therapist in battle::TherapistKvM01a	95,{
-	mes "[Therapist in battle]";
-	mes "Just close your eyes, and take a deep breathe.";
-	mes "You can be free from pain.";
-	specialeffect2 312;
-	close;
-}
-
-bat_c01,148,53,1	script	Therapist in battle::TherapistKvM01b	95,{
-	mes "[Therapist in battle]";
-	mes "Just close your eyes, and take a deep breathe.";
-	mes "You can be free from pain.";
-	specialeffect2 312;
-	close;
-}
-
-// Battleground rewards
-// *********************************************************************
-
-bat_c01,51,130,5	script	Guillaume Vintenar::VintenarKvM01a	419,{
-	if( $@KvM01BG_Victory )
-	{
-		if( $@KvM01BG_Victory == 3 )
-		{
-			setquest 6025;
-			bg_leave;
-			warp "bat_room",155,150;
-			end;
-		}
-		else if( $@KvM01BG_Victory == Bat_Team )
-		{ // Victory
-			set .@Reward, 5;
-			mes "[Swandery]";
-			mes "Blessed Guillaume!!";
-			mes "Let's enjoy our glorious victory!";
-			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
-			close2;
-		}
-		else
-		{ // 
-			set .@Reward, 1;
-			mes "[Swandery]";
-			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 a lesson, and later you would definitely learn.";
-			close2;
-		}
-
-		setquest 6025;
-		getitem 7773, .@Reward;
-		bg_leave;
-		warp "bat_room",155,150;
-		end;
-	}
-	end;
-}
-
-bat_c01,148,53,1	script	Croix Vintenar::VintenarKvM01b	415,{
-	if( $@KvM01BG_Victory )
-	{
-		if( $@KvM01BG_Victory == 3 )
-		{
-			setquest 6025;
-			bg_leave;
-			warp "bat_room",155,150;
-			end;
-		}
-		else if( $@KvM01BG_Victory == Bat_Team )
-		{ // Victory
-			set .@Reward, 5;
-			mes "[Swandery]";
-			mes "Blessed Croax!!";
-			mes "Let's enjoy our glorious victory!";
-			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
-			close2;
-		}
-		else
-		{ // 
-			set .@Reward, 1;
-			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 can win the next.";
-			close2;
-		}
-
-		setquest 6025;
-		getitem 7773, .@Reward;
-		bg_leave;
-		warp "bat_room",155,150;
-		end;
-	}
-	end;
-}
-
-// MapFlags
-// *********************************************************************
-
-bat_c01	mapflag	battleground	2
-bat_c01	mapflag	nomemo
-bat_c01	mapflag	nosave	SavePoint
-bat_c01	mapflag	noteleport
-bat_c01	mapflag	nowarp
-bat_c01	mapflag	nowarpto
-bat_c01	mapflag	noreturn
-bat_c01	mapflag	nobranch
-bat_c01	mapflag	nopenalty
+// ==============================================================================
+// BattleGround System - KvM 80~99
+// ==============================================================================
+
+// Registration NPC's
+// *********************************************************************
+
+bat_room,253,227,4	script	Registration::KvM01R_Guillaume	418,{ // KvM Guillaume
+	end;
+
+OnInit:
+	waitingroom "Battle Station 5 Players",5,"KvM01_BG::OnGuillaumeJoin",1;
+	end;
+	
+OnEnterBG:
+	set $@KvM01BG_id1, waitingroom2bg("bat_c01",53,128,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
+	end;
+}
+
+bat_room,253,204,0	script	Registration::KvM01R_Croix	414,{ // KvM Croix
+	end;
+
+OnInit:
+	waitingroom "Battle Station 5 Players",5,"KvM01_BG::OnCroixJoin",1;
+	end;
+
+OnEnterBG:
+	set $@KvM01BG_id2, waitingroom2bg("bat_c01",146,55,"KvM01_BG::OnCroixQuit","KvM01_BG::OnCroixDie");
+	end;
+}
+
+// Light Effects
+// *********************************************************************
+
+bat_c01,54,123,0	script	#bat_c01a	111,{
+	end;
+
+OnKvM01LightA: misceffect 54; end;
+OnKvM01LightB: misceffect 55; end;
+OnKvM01LightC: misceffect 56; end;
+}
+
+bat_c01,56,125,0	duplicate(#bat_c01a)	#bat_c01b	111
+bat_c01,58,127,0	duplicate(#bat_c01a)	#bat_c01c	111
+bat_c01,141,56,0	duplicate(#bat_c01a)	#bat_c01d	111
+bat_c01,143,58,0	duplicate(#bat_c01a)	#bat_c01e	111
+bat_c01,145,60,0	duplicate(#bat_c01a)	#bat_c01f	111
+
+// Battleground Engine
+// *********************************************************************
+
+-	script	KvM01_BG	-1,{
+	end;
+
+OnInit:
+	setwall "bat_c01",54,122,6,7,0,"batc01wall_a";
+	setwall "bat_c01",55,122,5,7,0,"batc01wall_b";
+	setwall "bat_c01",140,56,6,7,0,"batc01wall_c";
+	setwall "bat_c01",140,57,5,7,0,"batc01wall_d";
+	disablenpc "TherapistKvM01a";
+	disablenpc "TherapistKvM01b";
+	disablenpc "VintenarKvM01a";
+	disablenpc "VintenarKvM01b";
+	end;
+
+OnGuillaumeJoin:
+OnCroixJoin:
+	donpcevent "KvM01_BG::OnReadyCheck";
+	end;
+
+OnGuillaumeQuit:
+	set BG_Delay_Tick, gettimetick(2) + 1200;
+OnGuillaumeDie:
+	if( $@KvM01BG == 2 )
+	{
+		set .Guillaume_Count, .Guillaume_Count - 1;
+		set .Croix_Score, .Croix_Score + 1;
+		bg_updatescore "bat_c01",.Guillaume_Score,.Croix_Score;
+		if( .Guillaume_Count < 1 ) donpcevent "KvM01_BG::OnCroixWin";
+	}
+	end;
+
+OnCroixQuit:
+	set BG_Delay_Tick, gettimetick(2) + 1200;
+OnCroixDie:
+	if( $@KvM01BG == 2 )
+	{
+		set .Croix_Count, .Croix_Count - 1;
+		set .Guillaume_Score, .Guillaume_Score + 1;
+		bg_updatescore "bat_c01",.Guillaume_Score,.Croix_Score;
+		if( .Croix_Count < 1 ) donpcevent "KvM01_BG::OnGuillaumeWin";
+	}
+	end;
+
+OnReadyCheck:
+	if( $@KvM01BG )
+		end;
+	set .@Guillaume, getwaitingroomstate(0,"KvM01R_Guillaume");
+	set .@Croix, getwaitingroomstate(0,"KvM01R_Croix");
+
+	if( .@Guillaume < 5 || .@Croix < 5 )
+	{
+		if( .@Guillaume > 3 && .@Croix > 3 && !agitcheck() && $@KvM_Flood < gettimetick(2) )
+		{
+			announce "Battleground -- Kreiger Von Midgard [80-99] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",0,0x696969;
+			set $@KvM_Flood, gettimetick(2) + 15;
+		}
+		else
+			mapannounce "bat_room","Battleground -- Kreiger Von Midgard [80-99] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",1,0x696969;
+		end;
+	}
+
+	set $@KvM01BG, 1; // Starting
+	donpcevent "KvM01R_Croix::OnEnterBG";
+	donpcevent "KvM01R_Guillaume::OnEnterBG";
+	donpcevent "KvM01_BG::OnStart";
+	end;
+
+OnStart:
+	announce "Battleground -- Kreiger Von Midgard [80-99] has started!",0,0x696969;
+	enablenpc "TherapistKvM01a";
+	enablenpc "TherapistKvM01b";
+	disablenpc "VintenarKvM01a";
+	disablenpc "VintenarKvM01b";
+	set $@KvM01BG_Victory, 0;
+	sleep 2000;
+	// Warp Teams
+	bg_warp $@KvM01BG_id1,"bat_c01",53,128;
+	bg_warp $@KvM01BG_id2,"bat_c01",146,55;
+	// ScoreBoard
+	set .Guillaume_Score, 0;
+	set .Croix_Score, 0;
+	initnpctimer;
+	end;
+
+OnTimer5000:
+	areapercentheal "bat_c01",50,123,58,131,100,100;
+	areapercentheal "bat_c01",141,52,149,60,100,100;
+	mapannounce "bat_c01","The Battle will start in 25 seconds!!",1,0x696969;
+	end;
+
+OnTimer26000:
+	mapannounce "bat_c01","The Battle will start in 4 seconds!!",1,0x696969;
+	end;
+
+OnTimer27000:
+	donpcevent "::OnKvM01LightA";
+	end;
+
+OnTimer28000:
+	donpcevent "::OnKvM01LightB";
+	end;
+	
+OnTimer29000:
+	donpcevent "::OnKvM01LightC";
+	end;
+
+OnTimer30000:
+	// Team Members
+	set .Guillaume_Count, bg_get_data($@KvM01BG_id1, 0);
+	set .Croix_Count, bg_get_data($@KvM01BG_id2, 0);
+	if( .Guillaume_Count < 5 || .Croix_Count < 5 )
+	{
+		set $@KvM01BG_Victory, 3;
+		set $@KvM01BG, 3;
+		mapannounce "bat_c01","There are not enough players to start the battle",1,0x696969;
+		stopnpctimer;
+		sleep 2000;
+		donpcevent "KvM01_BG::OnStop";
+		end;
+	}
+
+	set $@KvM01BG, 2; // Playing
+	areapercentheal "bat_c01",50,123,58,131,100,100;
+	bg_warp $@KvM01BG_id1,"bat_c01",62,119;
+	areapercentheal "bat_c01",141,52,149,60,100,100;
+	bg_warp $@KvM01BG_id2,"bat_c01",137,64;
+	end;
+
+OnTimer32000:
+	mapannounce "bat_c01","The Battle of Kreiger Von Midgard has begun!!",1,0x696969;
+	end;
+
+OnTimer300000:
+	mapannounce "bat_c01","The Battle will ends in 30 seconds!!",1,0x696969;
+	end;
+
+OnTimer330000:
+	if( .Croix_Count > .Guillaume_Count )
+		donpcevent "KvM01_BG::OnCroixWin";
+	else if( .Croix_Count < .Guillaume_Count )
+		donpcevent "KvM01_BG::OnGuillaumeWin";
+	else
+	{ // Draw Game
+		set $@KvM01BG, 3;
+		set $@KvM01BG_Victory, 3;
+
+		stopnpctimer;
+		sleep 2000;
+		mapannounce "bat_c01","The time is out! This is a Tie...",1,0x696969;
+		donpcevent "KvM01_BG::OnStop";
+	}
+	end;
+
+OnGuillaumeWin:
+	set $@KvM01BG, 3;
+	set $@KvM01BG_Victory, 1;
+	
+	stopnpctimer;
+	sleep 2000;
+	mapannounce "bat_c01","The Guillaume Army has won the Battle of Kreiger Von Midgard",1,0x0000FF;
+	donpcevent "KvM01_BG::OnStop";
+	end;
+
+OnCroixWin:
+	set $@KvM01BG, 3;
+	set $@KvM01BG_Victory, 2;
+
+	stopnpctimer;
+	sleep 2000;
+	mapannounce "bat_c01","The Croix Army has won the Battle of Kreiger Von Midgard",1,0xFF0000;
+	donpcevent "KvM01_BG::OnStop";
+	end;
+
+OnStop:
+	disablenpc "TherapistKvM01a";
+	disablenpc "TherapistKvM01b";
+	enablenpc "VintenarKvM01a";
+	enablenpc "VintenarKvM01b";
+	// Warp Teams
+	bg_warp $@KvM01BG_id1,"bat_c01",53,128;
+	bg_warp $@KvM01BG_id2,"bat_c01",146,55;
+	donpcevent "KvM01_BG_Out::OnBegin";
+	end;
+
+OnReset:
+	stopnpctimer;
+	stopnpctimer "KvM01_BG_Out";
+	set .Croix_Count, 0;
+	set .Guillaume_Count, 0;
+	set .Croix_Score, 0;
+	set .Guillaume_Score, 0;
+	set $@KvM01BG_Victory, 0;
+	if( $@KvM01BG_id1 ) { bg_destroy $@KvM01BG_id1; set $@KvM01BG_id1, 0; }
+	if( $@KvM01BG_id2 ) { bg_destroy $@KvM01BG_id2; set $@KvM01BG_id2, 0; }
+	disablenpc "TherapistKvM01a";
+	disablenpc "TherapistKvM01b";
+	disablenpc "VintenarKvM01a";
+	disablenpc "VintenarKvM01b";
+	sleep 1000;
+	mapwarp "bat_c01","bat_room",155,150;
+	sleep 2000;
+	maprespawnguildid "bat_c01",0,3; // Just in case someone else
+	bg_updatescore "bat_c01",0,0;
+	sleep 2000;
+	set $@KvM01BG, 0;
+	donpcevent "KvM01_BG::OnReadyCheck"; // Maybe a game is ready to start
+	end;
+}
+
+-	script	KvM01_BG_Out	-1,{
+	end;
+
+OnBegin:
+	initnpctimer;
+	end;
+
+OnTimer3000:
+	mapannounce "bat_c01","Battle of Kreiger Von Midgard will close in 1 minute!",1,0x696969;
+	end;
+OnTimer30000:
+	mapannounce "bat_c01","Battle of Kreiger Von Midgard will close in 30 seconds!",1,0x696969;
+	end;
+OnTimer50000:
+	mapannounce "bat_c01","Battle of Kreiger Von Midgard will close in 10 seconds!",1,0x696969;
+	end;
+OnTimer60000:
+	donpcevent "KvM01_BG::OnReset";
+	end;
+}
+
+// Battleground Therapist
+// *********************************************************************
+
+bat_c01,51,130,5	script	Therapist in battle::TherapistKvM01a	95,{
+	mes "[Therapist in battle]";
+	mes "Just close your eyes, and take a deep breathe.";
+	mes "You can be free from pain.";
+	specialeffect2 312;
+	close;
+}
+
+bat_c01,148,53,1	script	Therapist in battle::TherapistKvM01b	95,{
+	mes "[Therapist in battle]";
+	mes "Just close your eyes, and take a deep breathe.";
+	mes "You can be free from pain.";
+	specialeffect2 312;
+	close;
+}
+
+// Battleground rewards
+// *********************************************************************
+
+bat_c01,51,130,5	script	Guillaume Vintenar::VintenarKvM01a	419,{
+	if( $@KvM01BG_Victory )
+	{
+		if( $@KvM01BG_Victory == 3 )
+		{
+			setquest 6025;
+			bg_leave;
+			warp "bat_room",155,150;
+			end;
+		}
+		else if( $@KvM01BG_Victory == Bat_Team )
+		{ // Victory
+			set .@Reward, 5;
+			mes "[Swandery]";
+			mes "Blessed Guillaume!!";
+			mes "Let's enjoy our glorious victory!";
+			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
+			close2;
+		}
+		else
+		{ // 
+			set .@Reward, 1;
+			mes "[Swandery]";
+			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 a lesson, and later you would definitely learn.";
+			close2;
+		}
+
+		setquest 6025;
+		getitem 7773, .@Reward;
+		bg_leave;
+		warp "bat_room",155,150;
+		end;
+	}
+	end;
+}
+
+bat_c01,148,53,1	script	Croix Vintenar::VintenarKvM01b	415,{
+	if( $@KvM01BG_Victory )
+	{
+		if( $@KvM01BG_Victory == 3 )
+		{
+			setquest 6025;
+			bg_leave;
+			warp "bat_room",155,150;
+			end;
+		}
+		else if( $@KvM01BG_Victory == Bat_Team )
+		{ // Victory
+			set .@Reward, 5;
+			mes "[Swandery]";
+			mes "Blessed Croax!!";
+			mes "Let's enjoy our glorious victory!";
+			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
+			close2;
+		}
+		else
+		{ // 
+			set .@Reward, 1;
+			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 can win the next.";
+			close2;
+		}
+
+		setquest 6025;
+		getitem 7773, .@Reward;
+		bg_leave;
+		warp "bat_room",155,150;
+		end;
+	}
+	end;
+}
+
+// MapFlags
+// *********************************************************************
+
+bat_c01	mapflag	battleground	2
+bat_c01	mapflag	nomemo
+bat_c01	mapflag	nosave	SavePoint
+bat_c01	mapflag	noteleport
+bat_c01	mapflag	nowarp
+bat_c01	mapflag	nowarpto
+bat_c01	mapflag	noreturn
+bat_c01	mapflag	nobranch
+bat_c01	mapflag	nopenalty

+ 391 - 391
npc/battleground/bg_kvm02.txt

@@ -1,391 +1,391 @@
-// ==============================================================================
-// BattleGround System - KvM 60~79
-// ==============================================================================
-
-// Registration NPC's
-// *********************************************************************
-
-bat_room,225,227,4	script	Registration::KvM02R_Guillaume	418,{ // KvM Guillaume
-	end;
-
-OnInit:
-	waitingroom "Battle Station 5 Players",5,"KvM02_BG::OnGuillaumeJoin",1;
-	end;
-	
-OnEnterBG:
-	set $@KvM02BG_id1, waitingroom2bg("bat_c02",53,128,"KvM02_BG::OnGuillaumeQuit","KvM02_BG::OnGuillaumeDie");
-	end;
-}
-
-bat_room,225,204,0	script	Registration::KvM02R_Croix	414,{ // KvM Croix
-	end;
-
-OnInit:
-	waitingroom "Battle Station 5 Players",5,"KvM02_BG::OnCroixJoin",1;
-	end;
-
-OnEnterBG:
-	set $@KvM02BG_id2, waitingroom2bg("bat_c02",146,55,"KvM02_BG::OnCroixQuit","KvM02_BG::OnCroixDie");
-	end;
-}
-
-// Light Effects
-// *********************************************************************
-
-bat_c02,54,123,0	script	#bat_c02a	111,{
-	end;
-
-OnKvM02LightA: misceffect 54; end;
-OnKvM02LightB: misceffect 55; end;
-OnKvM02LightC: misceffect 56; end;
-}
-
-bat_c02,56,125,0	duplicate(#bat_c02a)	#bat_c02b	111
-bat_c02,58,127,0	duplicate(#bat_c02a)	#bat_c02c	111
-bat_c02,141,56,0	duplicate(#bat_c02a)	#bat_c02d	111
-bat_c02,143,58,0	duplicate(#bat_c02a)	#bat_c02e	111
-bat_c02,145,60,0	duplicate(#bat_c02a)	#bat_c02f	111
-
-// Battleground Engine
-// *********************************************************************
-
--	script	KvM02_BG	-1,{
-	end;
-
-OnInit:
-	setwall "bat_c02",54,122,6,7,0,"batc02wall_a";
-	setwall "bat_c02",55,122,5,7,0,"batc02wall_b";
-	setwall "bat_c02",140,56,6,7,0,"batc02wall_c";
-	setwall "bat_c02",140,57,5,7,0,"batc02wall_d";
-	disablenpc "TherapistKvM02a";
-	disablenpc "TherapistKvM02b";
-	disablenpc "VintenarKvM02a";
-	disablenpc "VintenarKvM02b";
-	end;
-
-OnGuillaumeJoin:
-OnCroixJoin:
-	donpcevent "KvM02_BG::OnReadyCheck";
-	end;
-
-OnGuillaumeQuit:
-	set BG_Delay_Tick, gettimetick(2) + 1200;
-OnGuillaumeDie:
-	if( $@KvM02BG == 2 )
-	{
-		set .Guillaume_Count, .Guillaume_Count - 1;
-		set .Croix_Score, .Croix_Score + 1;
-		bg_updatescore "bat_c02",.Guillaume_Score,.Croix_Score;
-		if( .Guillaume_Count < 1 ) donpcevent "KvM02_BG::OnCroixWin";
-	}
-	end;
-
-OnCroixQuit:
-	set BG_Delay_Tick, gettimetick(2) + 1200;
-OnCroixDie:
-	if( $@KvM02BG == 2 )
-	{
-		set .Croix_Count, .Croix_Count - 1;
-		set .Guillaume_Score, .Guillaume_Score + 1;
-		bg_updatescore "bat_c02",.Guillaume_Score,.Croix_Score;
-		if( .Croix_Count < 1 ) donpcevent "KvM02_BG::OnGuillaumeWin";
-	}
-	end;
-
-OnReadyCheck:
-	if( $@KvM02BG )
-		end;
-	set .@Guillaume, getwaitingroomstate(0,"KvM02R_Guillaume");
-	set .@Croix, getwaitingroomstate(0,"KvM02R_Croix");
-
-	if( .@Guillaume < 5 || .@Croix < 5 )
-	{
-		if( .@Guillaume > 3 && .@Croix > 3 && !agitcheck() && $@KvM_Flood < gettimetick(2) )
-		{
-			announce "Battleground -- Kreiger Von Midgard [60-79] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",0,0x808080;
-			set $@KvM_Flood, gettimetick(2) + 15;
-		}
-		else
-			mapannounce "bat_room","Battleground -- Kreiger Von Midgard [60-79] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",1,0x808080;
-		end;
-	}
-
-	set $@KvM02BG, 1; // Starting
-	donpcevent "KvM02R_Croix::OnEnterBG";
-	donpcevent "KvM02R_Guillaume::OnEnterBG";
-	donpcevent "KvM02_BG::OnStart";
-	end;
-
-OnStart:
-	announce "Battleground -- Kreiger Von Midgard [60-79] has started!",0,0x808080;
-	enablenpc "TherapistKvM02a";
-	enablenpc "TherapistKvM02b";
-	disablenpc "VintenarKvM02a";
-	disablenpc "VintenarKvM02b";
-	set $@KvM02BG_Victory, 0;
-	sleep 2000;
-	// Warp Teams
-	bg_warp $@KvM02BG_id1,"bat_c02",53,128;
-	bg_warp $@KvM02BG_id2,"bat_c02",146,55;
-	// ScoreBoard
-	set .Guillaume_Score, 0;
-	set .Croix_Score, 0;
-	initnpctimer;
-	end;
-
-OnTimer5000:
-	areapercentheal "bat_c02",50,123,58,131,100,100;
-	areapercentheal "bat_c02",141,52,149,60,100,100;
-	mapannounce "bat_c02","The Battle will start in 25 seconds!!",1,0x808080;
-	end;
-
-OnTimer26000:
-	mapannounce "bat_c02","The Battle will start in 4 seconds!!",1,0x808080;
-	end;
-
-OnTimer27000:
-	donpcevent "::OnKvM02LightA";
-	end;
-
-OnTimer28000:
-	donpcevent "::OnKvM02LightB";
-	end;
-	
-OnTimer29000:
-	donpcevent "::OnKvM02LightC";
-	end;
-
-OnTimer30000:
-	// Team Members
-	set .Guillaume_Count, bg_get_data($@KvM02BG_id1, 0);
-	set .Croix_Count, bg_get_data($@KvM02BG_id2, 0);
-	if( .Guillaume_Count < 5 || .Croix_Count < 5 )
-	{
-		set $@KvM02BG_Victory, 3;
-		set $@KvM02BG, 3;
-		mapannounce "bat_c02","There are not enough players to start the battle",1,0x808080;
-		stopnpctimer;
-		sleep 2000;
-		donpcevent "KvM02_BG::OnStop";
-		end;
-	}
-
-	set $@KvM02BG, 2; // Playing
-	areapercentheal "bat_c02",50,123,58,131,100,100;
-	bg_warp $@KvM02BG_id1,"bat_c02",62,119;
-	areapercentheal "bat_c02",141,52,149,60,100,100;
-	bg_warp $@KvM02BG_id2,"bat_c02",137,64;
-	end;
-
-OnTimer32000:
-	mapannounce "bat_c02","The Battle of Kreiger Von Midgard has begun!!",1,0x808080;
-	end;
-
-OnTimer300000:
-	mapannounce "bat_c02","The Battle will ends in 30 seconds!!",1,0x808080;
-	end;
-
-OnTimer330000:
-	if( .Croix_Count > .Guillaume_Count )
-		donpcevent "KvM02_BG::OnCroixWin";
-	else if( .Croix_Count < .Guillaume_Count )
-		donpcevent "KvM02_BG::OnGuillaumeWin";
-	else
-	{ // Draw Game
-		set $@KvM02BG, 3;
-		set $@KvM02BG_Victory, 3;
-
-		stopnpctimer;
-		sleep 2000;
-		mapannounce "bat_c02","The time is out! This is a Tie...",1,0x808080;
-		donpcevent "KvM02_BG::OnStop";
-	}
-	end;
-
-OnGuillaumeWin:
-	set $@KvM02BG, 3;
-	set $@KvM02BG_Victory, 1;
-	
-	stopnpctimer;
-	sleep 2000;
-	mapannounce "bat_c02","The Guillaume Army has won the Battle of Kreiger Von Midgard",1,0x0000FF;
-	donpcevent "KvM02_BG::OnStop";
-	end;
-
-OnCroixWin:
-	set $@KvM02BG, 3;
-	set $@KvM02BG_Victory, 2;
-
-	stopnpctimer;
-	sleep 2000;
-	mapannounce "bat_c02","The Croix Army has won the Battle of Kreiger Von Midgard",1,0xFF0000;
-	donpcevent "KvM02_BG::OnStop";
-	end;
-
-OnStop:
-	disablenpc "TherapistKvM02a";
-	disablenpc "TherapistKvM02b";
-	enablenpc "VintenarKvM02a";
-	enablenpc "VintenarKvM02b";
-	// Warp Teams
-	bg_warp $@KvM02BG_id1,"bat_c02",53,128;
-	bg_warp $@KvM02BG_id2,"bat_c02",146,55;
-	donpcevent "KvM02_BG_Out::OnBegin";
-	end;
-
-OnReset:
-	stopnpctimer;
-	stopnpctimer "KvM02_BG_Out";
-	set .Croix_Count, 0;
-	set .Guillaume_Count, 0;
-	set .Croix_Score, 0;
-	set .Guillaume_Score, 0;
-	set $@KvM02BG_Victory, 0;
-	if( $@KvM02BG_id1 ) { bg_destroy $@KvM02BG_id1; set $@KvM02BG_id1, 0; }
-	if( $@KvM02BG_id2 ) { bg_destroy $@KvM02BG_id2; set $@KvM02BG_id2, 0; }
-	disablenpc "TherapistKvM02a";
-	disablenpc "TherapistKvM02b";
-	disablenpc "VintenarKvM02a";
-	disablenpc "VintenarKvM02b";
-	sleep 1000;
-	mapwarp "bat_c02","bat_room",155,150;
-	sleep 2000;
-	maprespawnguildid "bat_c02",0,3; // Just in case someone else
-	bg_updatescore "bat_c02",0,0;
-	sleep 2000;
-	set $@KvM02BG, 0;
-	donpcevent "KvM02_BG::OnReadyCheck"; // Maybe a game is ready to start
-	end;
-}
-
--	script	KvM02_BG_Out	-1,{
-	end;
-
-OnBegin:
-	initnpctimer;
-	end;
-
-OnTimer3000:
-	mapannounce "bat_c02","Battle of Kreiger Von Midgard will close in 1 minute!",1,0x808080;
-	end;
-OnTimer30000:
-	mapannounce "bat_c02","Battle of Kreiger Von Midgard will close in 30 seconds!",1,0x808080;
-	end;
-OnTimer50000:
-	mapannounce "bat_c02","Battle of Kreiger Von Midgard will close in 10 seconds!",1,0x808080;
-	end;
-OnTimer60000:
-	donpcevent "KvM02_BG::OnReset";
-	end;
-}
-
-// Battleground Therapist
-// *********************************************************************
-
-bat_c02,51,130,5	script	Therapist in battle::TherapistKvM02a	95,{
-	mes "[Therapist in battle]";
-	mes "Just close your eyes, and take a deep breathe.";
-	mes "You can be free from pain.";
-	specialeffect2 312;
-	close;
-}
-
-bat_c02,148,53,1	script	Therapist in battle::TherapistKvM02b	95,{
-	mes "[Therapist in battle]";
-	mes "Just close your eyes, and take a deep breathe.";
-	mes "You can be free from pain.";
-	specialeffect2 312;
-	close;
-}
-
-// Battleground rewards
-// *********************************************************************
-
-bat_c02,51,130,5	script	Guillaume Vintenar::VintenarKvM02a	419,{
-	if( $@KvM02BG_Victory )
-	{
-		if( $@KvM02BG_Victory == 3 )
-		{
-			setquest 6025;
-			bg_leave;
-			warp "bat_room",155,150;
-			end;
-		}
-		else if( $@KvM02BG_Victory == Bat_Team )
-		{ // Victory
-			set .@Reward, 3;
-			mes "[Swandery]";
-			mes "Blessed Guillaume!!";
-			mes "Let's enjoy our glorious victory!";
-			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
-			close2;
-		}
-		else
-		{ // 
-			set .@Reward, 1;
-			mes "[Swandery]";
-			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 a lesson, and later you would definitely learn.";
-			close2;
-		}
-
-		setquest 6025;
-		getitem 7773, .@Reward;
-		bg_leave;
-		warp "bat_room",155,150;
-		end;
-	}
-	end;
-}
-
-bat_c02,148,53,1	script	Croix Vintenar::VintenarKvM02b	415,{
-	if( $@KvM02BG_Victory )
-	{
-		if( $@KvM02BG_Victory == 3 )
-		{
-			setquest 6025;
-			bg_leave;
-			warp "bat_room",155,150;
-			end;
-		}
-		else if( $@KvM02BG_Victory == Bat_Team )
-		{ // Victory
-			set .@Reward, 3;
-			mes "[Swandery]";
-			mes "Blessed Croax!!";
-			mes "Let's enjoy our glorious victory!";
-			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
-			close2;
-		}
-		else
-		{ // 
-			set .@Reward, 1;
-			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 can win the next.";
-			close2;
-		}
-
-		setquest 6025;
-		getitem 7773, .@Reward;
-		bg_leave;
-		warp "bat_room",155,150;
-		end;
-	}
-	end;
-}
-
-// MapFlags
-// *********************************************************************
-
-bat_c02	mapflag	battleground	2
-bat_c02	mapflag	nomemo
-bat_c02	mapflag	nosave	SavePoint
-bat_c02	mapflag	noteleport
-bat_c02	mapflag	nowarp
-bat_c02	mapflag	nowarpto
-bat_c02	mapflag	noreturn
-bat_c02	mapflag	nobranch
-bat_c02	mapflag	nopenalty
+// ==============================================================================
+// BattleGround System - KvM 60~79
+// ==============================================================================
+
+// Registration NPC's
+// *********************************************************************
+
+bat_room,225,227,4	script	Registration::KvM02R_Guillaume	418,{ // KvM Guillaume
+	end;
+
+OnInit:
+	waitingroom "Battle Station 5 Players",5,"KvM02_BG::OnGuillaumeJoin",1;
+	end;
+	
+OnEnterBG:
+	set $@KvM02BG_id1, waitingroom2bg("bat_c02",53,128,"KvM02_BG::OnGuillaumeQuit","KvM02_BG::OnGuillaumeDie");
+	end;
+}
+
+bat_room,225,204,0	script	Registration::KvM02R_Croix	414,{ // KvM Croix
+	end;
+
+OnInit:
+	waitingroom "Battle Station 5 Players",5,"KvM02_BG::OnCroixJoin",1;
+	end;
+
+OnEnterBG:
+	set $@KvM02BG_id2, waitingroom2bg("bat_c02",146,55,"KvM02_BG::OnCroixQuit","KvM02_BG::OnCroixDie");
+	end;
+}
+
+// Light Effects
+// *********************************************************************
+
+bat_c02,54,123,0	script	#bat_c02a	111,{
+	end;
+
+OnKvM02LightA: misceffect 54; end;
+OnKvM02LightB: misceffect 55; end;
+OnKvM02LightC: misceffect 56; end;
+}
+
+bat_c02,56,125,0	duplicate(#bat_c02a)	#bat_c02b	111
+bat_c02,58,127,0	duplicate(#bat_c02a)	#bat_c02c	111
+bat_c02,141,56,0	duplicate(#bat_c02a)	#bat_c02d	111
+bat_c02,143,58,0	duplicate(#bat_c02a)	#bat_c02e	111
+bat_c02,145,60,0	duplicate(#bat_c02a)	#bat_c02f	111
+
+// Battleground Engine
+// *********************************************************************
+
+-	script	KvM02_BG	-1,{
+	end;
+
+OnInit:
+	setwall "bat_c02",54,122,6,7,0,"batc02wall_a";
+	setwall "bat_c02",55,122,5,7,0,"batc02wall_b";
+	setwall "bat_c02",140,56,6,7,0,"batc02wall_c";
+	setwall "bat_c02",140,57,5,7,0,"batc02wall_d";
+	disablenpc "TherapistKvM02a";
+	disablenpc "TherapistKvM02b";
+	disablenpc "VintenarKvM02a";
+	disablenpc "VintenarKvM02b";
+	end;
+
+OnGuillaumeJoin:
+OnCroixJoin:
+	donpcevent "KvM02_BG::OnReadyCheck";
+	end;
+
+OnGuillaumeQuit:
+	set BG_Delay_Tick, gettimetick(2) + 1200;
+OnGuillaumeDie:
+	if( $@KvM02BG == 2 )
+	{
+		set .Guillaume_Count, .Guillaume_Count - 1;
+		set .Croix_Score, .Croix_Score + 1;
+		bg_updatescore "bat_c02",.Guillaume_Score,.Croix_Score;
+		if( .Guillaume_Count < 1 ) donpcevent "KvM02_BG::OnCroixWin";
+	}
+	end;
+
+OnCroixQuit:
+	set BG_Delay_Tick, gettimetick(2) + 1200;
+OnCroixDie:
+	if( $@KvM02BG == 2 )
+	{
+		set .Croix_Count, .Croix_Count - 1;
+		set .Guillaume_Score, .Guillaume_Score + 1;
+		bg_updatescore "bat_c02",.Guillaume_Score,.Croix_Score;
+		if( .Croix_Count < 1 ) donpcevent "KvM02_BG::OnGuillaumeWin";
+	}
+	end;
+
+OnReadyCheck:
+	if( $@KvM02BG )
+		end;
+	set .@Guillaume, getwaitingroomstate(0,"KvM02R_Guillaume");
+	set .@Croix, getwaitingroomstate(0,"KvM02R_Croix");
+
+	if( .@Guillaume < 5 || .@Croix < 5 )
+	{
+		if( .@Guillaume > 3 && .@Croix > 3 && !agitcheck() && $@KvM_Flood < gettimetick(2) )
+		{
+			announce "Battleground -- Kreiger Von Midgard [60-79] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",0,0x808080;
+			set $@KvM_Flood, gettimetick(2) + 15;
+		}
+		else
+			mapannounce "bat_room","Battleground -- Kreiger Von Midgard [60-79] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",1,0x808080;
+		end;
+	}
+
+	set $@KvM02BG, 1; // Starting
+	donpcevent "KvM02R_Croix::OnEnterBG";
+	donpcevent "KvM02R_Guillaume::OnEnterBG";
+	donpcevent "KvM02_BG::OnStart";
+	end;
+
+OnStart:
+	announce "Battleground -- Kreiger Von Midgard [60-79] has started!",0,0x808080;
+	enablenpc "TherapistKvM02a";
+	enablenpc "TherapistKvM02b";
+	disablenpc "VintenarKvM02a";
+	disablenpc "VintenarKvM02b";
+	set $@KvM02BG_Victory, 0;
+	sleep 2000;
+	// Warp Teams
+	bg_warp $@KvM02BG_id1,"bat_c02",53,128;
+	bg_warp $@KvM02BG_id2,"bat_c02",146,55;
+	// ScoreBoard
+	set .Guillaume_Score, 0;
+	set .Croix_Score, 0;
+	initnpctimer;
+	end;
+
+OnTimer5000:
+	areapercentheal "bat_c02",50,123,58,131,100,100;
+	areapercentheal "bat_c02",141,52,149,60,100,100;
+	mapannounce "bat_c02","The Battle will start in 25 seconds!!",1,0x808080;
+	end;
+
+OnTimer26000:
+	mapannounce "bat_c02","The Battle will start in 4 seconds!!",1,0x808080;
+	end;
+
+OnTimer27000:
+	donpcevent "::OnKvM02LightA";
+	end;
+
+OnTimer28000:
+	donpcevent "::OnKvM02LightB";
+	end;
+	
+OnTimer29000:
+	donpcevent "::OnKvM02LightC";
+	end;
+
+OnTimer30000:
+	// Team Members
+	set .Guillaume_Count, bg_get_data($@KvM02BG_id1, 0);
+	set .Croix_Count, bg_get_data($@KvM02BG_id2, 0);
+	if( .Guillaume_Count < 5 || .Croix_Count < 5 )
+	{
+		set $@KvM02BG_Victory, 3;
+		set $@KvM02BG, 3;
+		mapannounce "bat_c02","There are not enough players to start the battle",1,0x808080;
+		stopnpctimer;
+		sleep 2000;
+		donpcevent "KvM02_BG::OnStop";
+		end;
+	}
+
+	set $@KvM02BG, 2; // Playing
+	areapercentheal "bat_c02",50,123,58,131,100,100;
+	bg_warp $@KvM02BG_id1,"bat_c02",62,119;
+	areapercentheal "bat_c02",141,52,149,60,100,100;
+	bg_warp $@KvM02BG_id2,"bat_c02",137,64;
+	end;
+
+OnTimer32000:
+	mapannounce "bat_c02","The Battle of Kreiger Von Midgard has begun!!",1,0x808080;
+	end;
+
+OnTimer300000:
+	mapannounce "bat_c02","The Battle will ends in 30 seconds!!",1,0x808080;
+	end;
+
+OnTimer330000:
+	if( .Croix_Count > .Guillaume_Count )
+		donpcevent "KvM02_BG::OnCroixWin";
+	else if( .Croix_Count < .Guillaume_Count )
+		donpcevent "KvM02_BG::OnGuillaumeWin";
+	else
+	{ // Draw Game
+		set $@KvM02BG, 3;
+		set $@KvM02BG_Victory, 3;
+
+		stopnpctimer;
+		sleep 2000;
+		mapannounce "bat_c02","The time is out! This is a Tie...",1,0x808080;
+		donpcevent "KvM02_BG::OnStop";
+	}
+	end;
+
+OnGuillaumeWin:
+	set $@KvM02BG, 3;
+	set $@KvM02BG_Victory, 1;
+	
+	stopnpctimer;
+	sleep 2000;
+	mapannounce "bat_c02","The Guillaume Army has won the Battle of Kreiger Von Midgard",1,0x0000FF;
+	donpcevent "KvM02_BG::OnStop";
+	end;
+
+OnCroixWin:
+	set $@KvM02BG, 3;
+	set $@KvM02BG_Victory, 2;
+
+	stopnpctimer;
+	sleep 2000;
+	mapannounce "bat_c02","The Croix Army has won the Battle of Kreiger Von Midgard",1,0xFF0000;
+	donpcevent "KvM02_BG::OnStop";
+	end;
+
+OnStop:
+	disablenpc "TherapistKvM02a";
+	disablenpc "TherapistKvM02b";
+	enablenpc "VintenarKvM02a";
+	enablenpc "VintenarKvM02b";
+	// Warp Teams
+	bg_warp $@KvM02BG_id1,"bat_c02",53,128;
+	bg_warp $@KvM02BG_id2,"bat_c02",146,55;
+	donpcevent "KvM02_BG_Out::OnBegin";
+	end;
+
+OnReset:
+	stopnpctimer;
+	stopnpctimer "KvM02_BG_Out";
+	set .Croix_Count, 0;
+	set .Guillaume_Count, 0;
+	set .Croix_Score, 0;
+	set .Guillaume_Score, 0;
+	set $@KvM02BG_Victory, 0;
+	if( $@KvM02BG_id1 ) { bg_destroy $@KvM02BG_id1; set $@KvM02BG_id1, 0; }
+	if( $@KvM02BG_id2 ) { bg_destroy $@KvM02BG_id2; set $@KvM02BG_id2, 0; }
+	disablenpc "TherapistKvM02a";
+	disablenpc "TherapistKvM02b";
+	disablenpc "VintenarKvM02a";
+	disablenpc "VintenarKvM02b";
+	sleep 1000;
+	mapwarp "bat_c02","bat_room",155,150;
+	sleep 2000;
+	maprespawnguildid "bat_c02",0,3; // Just in case someone else
+	bg_updatescore "bat_c02",0,0;
+	sleep 2000;
+	set $@KvM02BG, 0;
+	donpcevent "KvM02_BG::OnReadyCheck"; // Maybe a game is ready to start
+	end;
+}
+
+-	script	KvM02_BG_Out	-1,{
+	end;
+
+OnBegin:
+	initnpctimer;
+	end;
+
+OnTimer3000:
+	mapannounce "bat_c02","Battle of Kreiger Von Midgard will close in 1 minute!",1,0x808080;
+	end;
+OnTimer30000:
+	mapannounce "bat_c02","Battle of Kreiger Von Midgard will close in 30 seconds!",1,0x808080;
+	end;
+OnTimer50000:
+	mapannounce "bat_c02","Battle of Kreiger Von Midgard will close in 10 seconds!",1,0x808080;
+	end;
+OnTimer60000:
+	donpcevent "KvM02_BG::OnReset";
+	end;
+}
+
+// Battleground Therapist
+// *********************************************************************
+
+bat_c02,51,130,5	script	Therapist in battle::TherapistKvM02a	95,{
+	mes "[Therapist in battle]";
+	mes "Just close your eyes, and take a deep breathe.";
+	mes "You can be free from pain.";
+	specialeffect2 312;
+	close;
+}
+
+bat_c02,148,53,1	script	Therapist in battle::TherapistKvM02b	95,{
+	mes "[Therapist in battle]";
+	mes "Just close your eyes, and take a deep breathe.";
+	mes "You can be free from pain.";
+	specialeffect2 312;
+	close;
+}
+
+// Battleground rewards
+// *********************************************************************
+
+bat_c02,51,130,5	script	Guillaume Vintenar::VintenarKvM02a	419,{
+	if( $@KvM02BG_Victory )
+	{
+		if( $@KvM02BG_Victory == 3 )
+		{
+			setquest 6025;
+			bg_leave;
+			warp "bat_room",155,150;
+			end;
+		}
+		else if( $@KvM02BG_Victory == Bat_Team )
+		{ // Victory
+			set .@Reward, 3;
+			mes "[Swandery]";
+			mes "Blessed Guillaume!!";
+			mes "Let's enjoy our glorious victory!";
+			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
+			close2;
+		}
+		else
+		{ // 
+			set .@Reward, 1;
+			mes "[Swandery]";
+			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 a lesson, and later you would definitely learn.";
+			close2;
+		}
+
+		setquest 6025;
+		getitem 7773, .@Reward;
+		bg_leave;
+		warp "bat_room",155,150;
+		end;
+	}
+	end;
+}
+
+bat_c02,148,53,1	script	Croix Vintenar::VintenarKvM02b	415,{
+	if( $@KvM02BG_Victory )
+	{
+		if( $@KvM02BG_Victory == 3 )
+		{
+			setquest 6025;
+			bg_leave;
+			warp "bat_room",155,150;
+			end;
+		}
+		else if( $@KvM02BG_Victory == Bat_Team )
+		{ // Victory
+			set .@Reward, 3;
+			mes "[Swandery]";
+			mes "Blessed Croax!!";
+			mes "Let's enjoy our glorious victory!";
+			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
+			close2;
+		}
+		else
+		{ // 
+			set .@Reward, 1;
+			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 can win the next.";
+			close2;
+		}
+
+		setquest 6025;
+		getitem 7773, .@Reward;
+		bg_leave;
+		warp "bat_room",155,150;
+		end;
+	}
+	end;
+}
+
+// MapFlags
+// *********************************************************************
+
+bat_c02	mapflag	battleground	2
+bat_c02	mapflag	nomemo
+bat_c02	mapflag	nosave	SavePoint
+bat_c02	mapflag	noteleport
+bat_c02	mapflag	nowarp
+bat_c02	mapflag	nowarpto
+bat_c02	mapflag	noreturn
+bat_c02	mapflag	nobranch
+bat_c02	mapflag	nopenalty

+ 391 - 391
npc/battleground/bg_kvm03.txt

@@ -1,391 +1,391 @@
-// ==============================================================================
-// BattleGround System - KvM 1~59
-// ==============================================================================
-
-// Registration NPC's
-// *********************************************************************
-
-bat_room,197,227,4	script	Registration::KvM03R_Guillaume	418,{ // KvM Guillaume
-	end;
-
-OnInit:
-	waitingroom "Battle Station 5 Players",5,"KvM03_BG::OnGuillaumeJoin",1;
-	end;
-	
-OnEnterBG:
-	set $@KvM03BG_id1, waitingroom2bg("bat_c03",53,128,"KvM03_BG::OnGuillaumeQuit","KvM03_BG::OnGuillaumeDie");
-	end;
-}
-
-bat_room,197,204,0	script	Registration::KvM03R_Croix	414,{ // KvM Croix
-	end;
-
-OnInit:
-	waitingroom "Battle Station 5 Players",5,"KvM03_BG::OnCroixJoin",1;
-	end;
-
-OnEnterBG:
-	set $@KvM03BG_id2, waitingroom2bg("bat_c03",146,55,"KvM03_BG::OnCroixQuit","KvM03_BG::OnCroixDie");
-	end;
-}
-
-// Light Effects
-// *********************************************************************
-
-bat_c03,54,123,0	script	#bat_c03a	111,{
-	end;
-
-OnKvM03LightA: misceffect 54; end;
-OnKvM03LightB: misceffect 55; end;
-OnKvM03LightC: misceffect 56; end;
-}
-
-bat_c03,56,125,0	duplicate(#bat_c03a)	#bat_c03b	111
-bat_c03,58,127,0	duplicate(#bat_c03a)	#bat_c03c	111
-bat_c03,141,56,0	duplicate(#bat_c03a)	#bat_c03d	111
-bat_c03,143,58,0	duplicate(#bat_c03a)	#bat_c03e	111
-bat_c03,145,60,0	duplicate(#bat_c03a)	#bat_c03f	111
-
-// Battleground Engine
-// *********************************************************************
-
--	script	KvM03_BG	-1,{
-	end;
-
-OnInit:
-	setwall "bat_c03",54,122,6,7,0,"batc03wall_a";
-	setwall "bat_c03",55,122,5,7,0,"batc03wall_b";
-	setwall "bat_c03",140,56,6,7,0,"batc03wall_c";
-	setwall "bat_c03",140,57,5,7,0,"batc03wall_d";
-	disablenpc "TherapistKvM03a";
-	disablenpc "TherapistKvM03b";
-	disablenpc "VintenarKvM03a";
-	disablenpc "VintenarKvM03b";
-	end;
-
-OnGuillaumeJoin:
-OnCroixJoin:
-	donpcevent "KvM03_BG::OnReadyCheck";
-	end;
-
-OnGuillaumeQuit:
-	set BG_Delay_Tick, gettimetick(2) + 1200;
-OnGuillaumeDie:
-	if( $@KvM03BG == 2 )
-	{
-		set .Guillaume_Count, .Guillaume_Count - 1;
-		set .Croix_Score, .Croix_Score + 1;
-		bg_updatescore "bat_c03",.Guillaume_Score,.Croix_Score;
-		if( .Guillaume_Count < 1 ) donpcevent "KvM03_BG::OnCroixWin";
-	}
-	end;
-
-OnCroixQuit:
-	set BG_Delay_Tick, gettimetick(2) + 1200;
-OnCroixDie:
-	if( $@KvM03BG == 2 )
-	{
-		set .Croix_Count, .Croix_Count - 1;
-		set .Guillaume_Score, .Guillaume_Score + 1;
-		bg_updatescore "bat_c03",.Guillaume_Score,.Croix_Score;
-		if( .Croix_Count < 1 ) donpcevent "KvM03_BG::OnGuillaumeWin";
-	}
-	end;
-
-OnReadyCheck:
-	if( $@KvM03BG )
-		end;
-	set .@Guillaume, getwaitingroomstate(0,"KvM03R_Guillaume");
-	set .@Croix, getwaitingroomstate(0,"KvM03R_Croix");
-
-	if( .@Guillaume < 5 || .@Croix < 5 )
-	{
-		if( .@Guillaume > 3 && .@Croix > 3 && !agitcheck() && $@KvM_Flood < gettimetick(2) )
-		{
-			announce "Battleground -- Kreiger Von Midgard [1-59] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",0,0xC0C0C0;
-			set $@KvM_Flood, gettimetick(2) + 15;
-		}
-		else
-			mapannounce "bat_room","Battleground -- Kreiger Von Midgard [1-59] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",1,0xC0C0C0;
-		end;
-	}
-
-	set $@KvM03BG, 1; // Starting
-	donpcevent "KvM03R_Croix::OnEnterBG";
-	donpcevent "KvM03R_Guillaume::OnEnterBG";
-	donpcevent "KvM03_BG::OnStart";
-	end;
-
-OnStart:
-	announce "Battleground -- Kreiger Von Midgard [1-59] has started!",0,0xC0C0C0;
-	enablenpc "TherapistKvM03a";
-	enablenpc "TherapistKvM03b";
-	disablenpc "VintenarKvM03a";
-	disablenpc "VintenarKvM03b";
-	set $@KvM03BG_Victory, 0;
-	sleep 2000;
-	// Warp Teams
-	bg_warp $@KvM03BG_id1,"bat_c03",53,128;
-	bg_warp $@KvM03BG_id2,"bat_c03",146,55;
-	// ScoreBoard
-	set .Guillaume_Score, 0;
-	set .Croix_Score, 0;
-	initnpctimer;
-	end;
-
-OnTimer5000:
-	areapercentheal "bat_c03",50,123,58,131,100,100;
-	areapercentheal "bat_c03",141,52,149,60,100,100;
-	mapannounce "bat_c03","The Battle will start in 25 seconds!!",1,0xC0C0C0;
-	end;
-
-OnTimer26000:
-	mapannounce "bat_c03","The Battle will start in 4 seconds!!",1,0xC0C0C0;
-	end;
-
-OnTimer27000:
-	donpcevent "::OnKvM03LightA";
-	end;
-
-OnTimer28000:
-	donpcevent "::OnKvM03LightB";
-	end;
-	
-OnTimer29000:
-	donpcevent "::OnKvM03LightC";
-	end;
-
-OnTimer30000:
-	// Team Members
-	set .Guillaume_Count, bg_get_data($@KvM03BG_id1, 0);
-	set .Croix_Count, bg_get_data($@KvM03BG_id2, 0);
-	if( .Guillaume_Count < 5 || .Croix_Count < 5 )
-	{
-		set $@KvM03BG_Victory, 3;
-		set $@KvM03BG, 3;
-		mapannounce "bat_c03","There are not enough players to start the battle",1,0xC0C0C0;
-		stopnpctimer;
-		sleep 2000;
-		donpcevent "KvM03_BG::OnStop";
-		end;
-	}
-
-	set $@KvM03BG, 2; // Playing
-	areapercentheal "bat_c03",50,123,58,131,100,100;
-	bg_warp $@KvM03BG_id1,"bat_c03",62,119;
-	areapercentheal "bat_c03",141,52,149,60,100,100;
-	bg_warp $@KvM03BG_id2,"bat_c03",137,64;
-	end;
-
-OnTimer32000:
-	mapannounce "bat_c03","The Battle of Kreiger Von Midgard has begun!!",1,0xC0C0C0;
-	end;
-
-OnTimer300000:
-	mapannounce "bat_c03","The Battle will ends in 30 seconds!!",1,0xC0C0C0;
-	end;
-
-OnTimer330000:
-	if( .Croix_Count > .Guillaume_Count )
-		donpcevent "KvM03_BG::OnCroixWin";
-	else if( .Croix_Count < .Guillaume_Count )
-		donpcevent "KvM03_BG::OnGuillaumeWin";
-	else
-	{ // Draw Game
-		set $@KvM03BG, 3;
-		set $@KvM03BG_Victory, 3;
-
-		stopnpctimer;
-		sleep 2000;
-		mapannounce "bat_c03","The time is out! This is a Tie...",1,0xC0C0C0;
-		donpcevent "KvM03_BG::OnStop";
-	}
-	end;
-
-OnGuillaumeWin:
-	set $@KvM03BG, 3;
-	set $@KvM03BG_Victory, 1;
-	
-	stopnpctimer;
-	sleep 2000;
-	mapannounce "bat_c03","The Guillaume Army has won the Battle of Kreiger Von Midgard",1,0x0000FF;
-	donpcevent "KvM03_BG::OnStop";
-	end;
-
-OnCroixWin:
-	set $@KvM03BG, 3;
-	set $@KvM03BG_Victory, 2;
-
-	stopnpctimer;
-	sleep 2000;
-	mapannounce "bat_c03","The Croix Army has won the Battle of Kreiger Von Midgard",1,0xFF0000;
-	donpcevent "KvM03_BG::OnStop";
-	end;
-
-OnStop:
-	disablenpc "TherapistKvM03a";
-	disablenpc "TherapistKvM03b";
-	enablenpc "VintenarKvM03a";
-	enablenpc "VintenarKvM03b";
-	// Warp Teams
-	bg_warp $@KvM03BG_id1,"bat_c03",53,128;
-	bg_warp $@KvM03BG_id2,"bat_c03",146,55;
-	donpcevent "KvM03_BG_Out::OnBegin";
-	end;
-
-OnReset:
-	stopnpctimer;
-	stopnpctimer "KvM03_BG_Out";
-	set .Croix_Count, 0;
-	set .Guillaume_Count, 0;
-	set .Croix_Score, 0;
-	set .Guillaume_Score, 0;
-	set $@KvM03BG_Victory, 0;
-	if( $@KvM03BG_id1 ) { bg_destroy $@KvM03BG_id1; set $@KvM03BG_id1, 0; }
-	if( $@KvM03BG_id2 ) { bg_destroy $@KvM03BG_id2; set $@KvM03BG_id2, 0; }
-	disablenpc "TherapistKvM03a";
-	disablenpc "TherapistKvM03b";
-	disablenpc "VintenarKvM03a";
-	disablenpc "VintenarKvM03b";
-	sleep 1000;
-	mapwarp "bat_c03","bat_room",155,150;
-	sleep 2000;
-	maprespawnguildid "bat_c03",0,3; // Just in case someone else
-	bg_updatescore "bat_c03",0,0;
-	sleep 2000;
-	set $@KvM03BG, 0;
-	donpcevent "KvM03_BG::OnReadyCheck"; // Maybe a game is ready to start
-	end;
-}
-
--	script	KvM03_BG_Out	-1,{
-	end;
-
-OnBegin:
-	initnpctimer;
-	end;
-
-OnTimer3000:
-	mapannounce "bat_c03","Battle of Kreiger Von Midgard will close in 1 minute!",1,0xC0C0C0;
-	end;
-OnTimer30000:
-	mapannounce "bat_c03","Battle of Kreiger Von Midgard will close in 30 seconds!",1,0xC0C0C0;
-	end;
-OnTimer50000:
-	mapannounce "bat_c03","Battle of Kreiger Von Midgard will close in 10 seconds!",1,0xC0C0C0;
-	end;
-OnTimer60000:
-	donpcevent "KvM03_BG::OnReset";
-	end;
-}
-
-// Battleground Therapist
-// *********************************************************************
-
-bat_c03,51,130,5	script	Therapist in battle::TherapistKvM03a	95,{
-	mes "[Therapist in battle]";
-	mes "Just close your eyes, and take a deep breathe.";
-	mes "You can be free from pain.";
-	specialeffect2 312;
-	close;
-}
-
-bat_c03,148,53,1	script	Therapist in battle::TherapistKvM03b	95,{
-	mes "[Therapist in battle]";
-	mes "Just close your eyes, and take a deep breathe.";
-	mes "You can be free from pain.";
-	specialeffect2 312;
-	close;
-}
-
-// Battleground rewards
-// *********************************************************************
-
-bat_c03,51,130,5	script	Guillaume Vintenar::VintenarKvM03a	419,{
-	if( $@KvM03BG_Victory )
-	{
-		if( $@KvM03BG_Victory == 3 )
-		{
-			setquest 6025;
-			bg_leave;
-			warp "bat_room",155,150;
-			end;
-		}
-		else if( $@KvM03BG_Victory == Bat_Team )
-		{ // Victory
-			set .@Reward, 1;
-			mes "[Swandery]";
-			mes "Blessed Guillaume!!";
-			mes "Let's enjoy our glorious victory!";
-			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
-			close2;
-		}
-		else
-		{ // 
-			set .@Reward, 0;
-			mes "[Swandery]";
-			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 a lesson, and later you would definitely learn.";
-			close2;
-		}
-
-		setquest 6025;
-		getitem 7773, .@Reward;
-		bg_leave;
-		warp "bat_room",155,150;
-		end;
-	}
-	end;
-}
-
-bat_c03,148,53,1	script	Croix Vintenar::VintenarKvM03b	415,{
-	if( $@KvM03BG_Victory )
-	{
-		if( $@KvM03BG_Victory == 3 )
-		{
-			setquest 6025;
-			bg_leave;
-			warp "bat_room",155,150;
-			end;
-		}
-		else if( $@KvM03BG_Victory == Bat_Team )
-		{ // Victory
-			set .@Reward, 1;
-			mes "[Swandery]";
-			mes "Blessed Croax!!";
-			mes "Let's enjoy our glorious victory!";
-			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
-			close2;
-		}
-		else
-		{ // 
-			set .@Reward, 0;
-			mes "[Swandery]";
-			mes "Oh, " + strcharinfo(0) + ". Don't be sad.";
-			mes "Even though we didn't win, we did our best.";
-			mes "Please don't forget this battle. We can win the next.";
-			close2;
-		}
-
-		setquest 6025;
-		getitem 7773, .@Reward;
-		bg_leave;
-		warp "bat_room",155,150;
-		end;
-	}
-	end;
-}
-
-// MapFlags
-// *********************************************************************
-
-bat_c03	mapflag	battleground	2
-bat_c03	mapflag	nomemo
-bat_c03	mapflag	nosave	SavePoint
-bat_c03	mapflag	noteleport
-bat_c03	mapflag	nowarp
-bat_c03	mapflag	nowarpto
-bat_c03	mapflag	noreturn
-bat_c03	mapflag	nobranch
-bat_c03	mapflag	nopenalty
+// ==============================================================================
+// BattleGround System - KvM 1~59
+// ==============================================================================
+
+// Registration NPC's
+// *********************************************************************
+
+bat_room,197,227,4	script	Registration::KvM03R_Guillaume	418,{ // KvM Guillaume
+	end;
+
+OnInit:
+	waitingroom "Battle Station 5 Players",5,"KvM03_BG::OnGuillaumeJoin",1;
+	end;
+	
+OnEnterBG:
+	set $@KvM03BG_id1, waitingroom2bg("bat_c03",53,128,"KvM03_BG::OnGuillaumeQuit","KvM03_BG::OnGuillaumeDie");
+	end;
+}
+
+bat_room,197,204,0	script	Registration::KvM03R_Croix	414,{ // KvM Croix
+	end;
+
+OnInit:
+	waitingroom "Battle Station 5 Players",5,"KvM03_BG::OnCroixJoin",1;
+	end;
+
+OnEnterBG:
+	set $@KvM03BG_id2, waitingroom2bg("bat_c03",146,55,"KvM03_BG::OnCroixQuit","KvM03_BG::OnCroixDie");
+	end;
+}
+
+// Light Effects
+// *********************************************************************
+
+bat_c03,54,123,0	script	#bat_c03a	111,{
+	end;
+
+OnKvM03LightA: misceffect 54; end;
+OnKvM03LightB: misceffect 55; end;
+OnKvM03LightC: misceffect 56; end;
+}
+
+bat_c03,56,125,0	duplicate(#bat_c03a)	#bat_c03b	111
+bat_c03,58,127,0	duplicate(#bat_c03a)	#bat_c03c	111
+bat_c03,141,56,0	duplicate(#bat_c03a)	#bat_c03d	111
+bat_c03,143,58,0	duplicate(#bat_c03a)	#bat_c03e	111
+bat_c03,145,60,0	duplicate(#bat_c03a)	#bat_c03f	111
+
+// Battleground Engine
+// *********************************************************************
+
+-	script	KvM03_BG	-1,{
+	end;
+
+OnInit:
+	setwall "bat_c03",54,122,6,7,0,"batc03wall_a";
+	setwall "bat_c03",55,122,5,7,0,"batc03wall_b";
+	setwall "bat_c03",140,56,6,7,0,"batc03wall_c";
+	setwall "bat_c03",140,57,5,7,0,"batc03wall_d";
+	disablenpc "TherapistKvM03a";
+	disablenpc "TherapistKvM03b";
+	disablenpc "VintenarKvM03a";
+	disablenpc "VintenarKvM03b";
+	end;
+
+OnGuillaumeJoin:
+OnCroixJoin:
+	donpcevent "KvM03_BG::OnReadyCheck";
+	end;
+
+OnGuillaumeQuit:
+	set BG_Delay_Tick, gettimetick(2) + 1200;
+OnGuillaumeDie:
+	if( $@KvM03BG == 2 )
+	{
+		set .Guillaume_Count, .Guillaume_Count - 1;
+		set .Croix_Score, .Croix_Score + 1;
+		bg_updatescore "bat_c03",.Guillaume_Score,.Croix_Score;
+		if( .Guillaume_Count < 1 ) donpcevent "KvM03_BG::OnCroixWin";
+	}
+	end;
+
+OnCroixQuit:
+	set BG_Delay_Tick, gettimetick(2) + 1200;
+OnCroixDie:
+	if( $@KvM03BG == 2 )
+	{
+		set .Croix_Count, .Croix_Count - 1;
+		set .Guillaume_Score, .Guillaume_Score + 1;
+		bg_updatescore "bat_c03",.Guillaume_Score,.Croix_Score;
+		if( .Croix_Count < 1 ) donpcevent "KvM03_BG::OnGuillaumeWin";
+	}
+	end;
+
+OnReadyCheck:
+	if( $@KvM03BG )
+		end;
+	set .@Guillaume, getwaitingroomstate(0,"KvM03R_Guillaume");
+	set .@Croix, getwaitingroomstate(0,"KvM03R_Croix");
+
+	if( .@Guillaume < 5 || .@Croix < 5 )
+	{
+		if( .@Guillaume > 3 && .@Croix > 3 && !agitcheck() && $@KvM_Flood < gettimetick(2) )
+		{
+			announce "Battleground -- Kreiger Von Midgard [1-59] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",0,0xC0C0C0;
+			set $@KvM_Flood, gettimetick(2) + 15;
+		}
+		else
+			mapannounce "bat_room","Battleground -- Kreiger Von Midgard [1-59] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",1,0xC0C0C0;
+		end;
+	}
+
+	set $@KvM03BG, 1; // Starting
+	donpcevent "KvM03R_Croix::OnEnterBG";
+	donpcevent "KvM03R_Guillaume::OnEnterBG";
+	donpcevent "KvM03_BG::OnStart";
+	end;
+
+OnStart:
+	announce "Battleground -- Kreiger Von Midgard [1-59] has started!",0,0xC0C0C0;
+	enablenpc "TherapistKvM03a";
+	enablenpc "TherapistKvM03b";
+	disablenpc "VintenarKvM03a";
+	disablenpc "VintenarKvM03b";
+	set $@KvM03BG_Victory, 0;
+	sleep 2000;
+	// Warp Teams
+	bg_warp $@KvM03BG_id1,"bat_c03",53,128;
+	bg_warp $@KvM03BG_id2,"bat_c03",146,55;
+	// ScoreBoard
+	set .Guillaume_Score, 0;
+	set .Croix_Score, 0;
+	initnpctimer;
+	end;
+
+OnTimer5000:
+	areapercentheal "bat_c03",50,123,58,131,100,100;
+	areapercentheal "bat_c03",141,52,149,60,100,100;
+	mapannounce "bat_c03","The Battle will start in 25 seconds!!",1,0xC0C0C0;
+	end;
+
+OnTimer26000:
+	mapannounce "bat_c03","The Battle will start in 4 seconds!!",1,0xC0C0C0;
+	end;
+
+OnTimer27000:
+	donpcevent "::OnKvM03LightA";
+	end;
+
+OnTimer28000:
+	donpcevent "::OnKvM03LightB";
+	end;
+	
+OnTimer29000:
+	donpcevent "::OnKvM03LightC";
+	end;
+
+OnTimer30000:
+	// Team Members
+	set .Guillaume_Count, bg_get_data($@KvM03BG_id1, 0);
+	set .Croix_Count, bg_get_data($@KvM03BG_id2, 0);
+	if( .Guillaume_Count < 5 || .Croix_Count < 5 )
+	{
+		set $@KvM03BG_Victory, 3;
+		set $@KvM03BG, 3;
+		mapannounce "bat_c03","There are not enough players to start the battle",1,0xC0C0C0;
+		stopnpctimer;
+		sleep 2000;
+		donpcevent "KvM03_BG::OnStop";
+		end;
+	}
+
+	set $@KvM03BG, 2; // Playing
+	areapercentheal "bat_c03",50,123,58,131,100,100;
+	bg_warp $@KvM03BG_id1,"bat_c03",62,119;
+	areapercentheal "bat_c03",141,52,149,60,100,100;
+	bg_warp $@KvM03BG_id2,"bat_c03",137,64;
+	end;
+
+OnTimer32000:
+	mapannounce "bat_c03","The Battle of Kreiger Von Midgard has begun!!",1,0xC0C0C0;
+	end;
+
+OnTimer300000:
+	mapannounce "bat_c03","The Battle will ends in 30 seconds!!",1,0xC0C0C0;
+	end;
+
+OnTimer330000:
+	if( .Croix_Count > .Guillaume_Count )
+		donpcevent "KvM03_BG::OnCroixWin";
+	else if( .Croix_Count < .Guillaume_Count )
+		donpcevent "KvM03_BG::OnGuillaumeWin";
+	else
+	{ // Draw Game
+		set $@KvM03BG, 3;
+		set $@KvM03BG_Victory, 3;
+
+		stopnpctimer;
+		sleep 2000;
+		mapannounce "bat_c03","The time is out! This is a Tie...",1,0xC0C0C0;
+		donpcevent "KvM03_BG::OnStop";
+	}
+	end;
+
+OnGuillaumeWin:
+	set $@KvM03BG, 3;
+	set $@KvM03BG_Victory, 1;
+	
+	stopnpctimer;
+	sleep 2000;
+	mapannounce "bat_c03","The Guillaume Army has won the Battle of Kreiger Von Midgard",1,0x0000FF;
+	donpcevent "KvM03_BG::OnStop";
+	end;
+
+OnCroixWin:
+	set $@KvM03BG, 3;
+	set $@KvM03BG_Victory, 2;
+
+	stopnpctimer;
+	sleep 2000;
+	mapannounce "bat_c03","The Croix Army has won the Battle of Kreiger Von Midgard",1,0xFF0000;
+	donpcevent "KvM03_BG::OnStop";
+	end;
+
+OnStop:
+	disablenpc "TherapistKvM03a";
+	disablenpc "TherapistKvM03b";
+	enablenpc "VintenarKvM03a";
+	enablenpc "VintenarKvM03b";
+	// Warp Teams
+	bg_warp $@KvM03BG_id1,"bat_c03",53,128;
+	bg_warp $@KvM03BG_id2,"bat_c03",146,55;
+	donpcevent "KvM03_BG_Out::OnBegin";
+	end;
+
+OnReset:
+	stopnpctimer;
+	stopnpctimer "KvM03_BG_Out";
+	set .Croix_Count, 0;
+	set .Guillaume_Count, 0;
+	set .Croix_Score, 0;
+	set .Guillaume_Score, 0;
+	set $@KvM03BG_Victory, 0;
+	if( $@KvM03BG_id1 ) { bg_destroy $@KvM03BG_id1; set $@KvM03BG_id1, 0; }
+	if( $@KvM03BG_id2 ) { bg_destroy $@KvM03BG_id2; set $@KvM03BG_id2, 0; }
+	disablenpc "TherapistKvM03a";
+	disablenpc "TherapistKvM03b";
+	disablenpc "VintenarKvM03a";
+	disablenpc "VintenarKvM03b";
+	sleep 1000;
+	mapwarp "bat_c03","bat_room",155,150;
+	sleep 2000;
+	maprespawnguildid "bat_c03",0,3; // Just in case someone else
+	bg_updatescore "bat_c03",0,0;
+	sleep 2000;
+	set $@KvM03BG, 0;
+	donpcevent "KvM03_BG::OnReadyCheck"; // Maybe a game is ready to start
+	end;
+}
+
+-	script	KvM03_BG_Out	-1,{
+	end;
+
+OnBegin:
+	initnpctimer;
+	end;
+
+OnTimer3000:
+	mapannounce "bat_c03","Battle of Kreiger Von Midgard will close in 1 minute!",1,0xC0C0C0;
+	end;
+OnTimer30000:
+	mapannounce "bat_c03","Battle of Kreiger Von Midgard will close in 30 seconds!",1,0xC0C0C0;
+	end;
+OnTimer50000:
+	mapannounce "bat_c03","Battle of Kreiger Von Midgard will close in 10 seconds!",1,0xC0C0C0;
+	end;
+OnTimer60000:
+	donpcevent "KvM03_BG::OnReset";
+	end;
+}
+
+// Battleground Therapist
+// *********************************************************************
+
+bat_c03,51,130,5	script	Therapist in battle::TherapistKvM03a	95,{
+	mes "[Therapist in battle]";
+	mes "Just close your eyes, and take a deep breathe.";
+	mes "You can be free from pain.";
+	specialeffect2 312;
+	close;
+}
+
+bat_c03,148,53,1	script	Therapist in battle::TherapistKvM03b	95,{
+	mes "[Therapist in battle]";
+	mes "Just close your eyes, and take a deep breathe.";
+	mes "You can be free from pain.";
+	specialeffect2 312;
+	close;
+}
+
+// Battleground rewards
+// *********************************************************************
+
+bat_c03,51,130,5	script	Guillaume Vintenar::VintenarKvM03a	419,{
+	if( $@KvM03BG_Victory )
+	{
+		if( $@KvM03BG_Victory == 3 )
+		{
+			setquest 6025;
+			bg_leave;
+			warp "bat_room",155,150;
+			end;
+		}
+		else if( $@KvM03BG_Victory == Bat_Team )
+		{ // Victory
+			set .@Reward, 1;
+			mes "[Swandery]";
+			mes "Blessed Guillaume!!";
+			mes "Let's enjoy our glorious victory!";
+			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
+			close2;
+		}
+		else
+		{ // 
+			set .@Reward, 0;
+			mes "[Swandery]";
+			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 a lesson, and later you would definitely learn.";
+			close2;
+		}
+
+		setquest 6025;
+		getitem 7773, .@Reward;
+		bg_leave;
+		warp "bat_room",155,150;
+		end;
+	}
+	end;
+}
+
+bat_c03,148,53,1	script	Croix Vintenar::VintenarKvM03b	415,{
+	if( $@KvM03BG_Victory )
+	{
+		if( $@KvM03BG_Victory == 3 )
+		{
+			setquest 6025;
+			bg_leave;
+			warp "bat_room",155,150;
+			end;
+		}
+		else if( $@KvM03BG_Victory == Bat_Team )
+		{ // Victory
+			set .@Reward, 1;
+			mes "[Swandery]";
+			mes "Blessed Croax!!";
+			mes "Let's enjoy our glorious victory!";
+			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
+			close2;
+		}
+		else
+		{ // 
+			set .@Reward, 0;
+			mes "[Swandery]";
+			mes "Oh, " + strcharinfo(0) + ". Don't be sad.";
+			mes "Even though we didn't win, we did our best.";
+			mes "Please don't forget this battle. We can win the next.";
+			close2;
+		}
+
+		setquest 6025;
+		getitem 7773, .@Reward;
+		bg_leave;
+		warp "bat_room",155,150;
+		end;
+	}
+	end;
+}
+
+// MapFlags
+// *********************************************************************
+
+bat_c03	mapflag	battleground	2
+bat_c03	mapflag	nomemo
+bat_c03	mapflag	nosave	SavePoint
+bat_c03	mapflag	noteleport
+bat_c03	mapflag	nowarp
+bat_c03	mapflag	nowarpto
+bat_c03	mapflag	noreturn
+bat_c03	mapflag	nobranch
+bat_c03	mapflag	nopenalty

+ 311 - 311
npc/events/halloween_2008.txt

@@ -1,312 +1,312 @@
-//===== eAthena Script =======================================
-//= iRO Halloween (2008)
-//===== By: ==================================================
-//= Kisuka
-//===== Current Version: =====================================
-//= 1.0
-//===== Compatible With: =====================================
-//= eAthena SVN
-//===== Description: =========================================
-//= iRO Halloween (2008)
-//= Run away from the zombies for tickets.
-//= Redeem tickets for prizes.
-//===== Notes: ===============================================
-//= You must enable the event monsters in mob_db2.
-//===== Additional Comments: =================================
-//= 1.0 First version. [Kisuka]
-//============================================================
-
-payon,162,176,4	script	Halloween Magician#iRO08	704,{
-	
-	if(Hallow08 < 1) {
-			mes "[Halloween Magician]";
-			mes "Kkkkkkkkk!";
-			mes "I have a special event this";
-			mes "Halloween that tests your luck and";
-			mes "agility.";
-			mes "Are you interested?";
-			next;
-			mes "[Halloween Magician]";
-			mes "Come on! Don't be a wuss!";
-			mes "If you collect enough tickets";
-			mes "you can get good prizes!";
-			mes "So what do you say?";
-			next;
-			goto MainMenu;
-	}
-
-	if (Hallow08Kill == 1) {
-		mes "[Halloween Magician]";
-		mes "You a 'fraidy cat or something?!";
-		mes "You know you want to try again...";
-		mes "Do you know the rules?";
-		next;
-		set Hallow08Kill,0;
-		if(select("Yes, I know.:No, I don't know.") == 2) {
-			goto Rules;
-		}
-		goto Participate;
-	}
-
-	if (Hallow08Kill == 2) {
-		mes "[Halloween Magician]";
-		mes "Oh, well done! You are alright!";
-		mes "Isn't it fun with zombies??";
-		mes "You know, zombies were people too!";
-		mes "Ha!";
-		mes "Kkkkkkk.";
-		next;
-		getitem 7941,1;
-		set Hallow08Kill,0;
-		mes "[Halloween Magician]";
-		mes "As I promised";
-		mes "You can get Halloween tickets";
-		mes "for cool items.";
-		close;
-	}
-
-	if(Hallow08 > 0) {
-		mes "[Halloween Magician]";
-		mes "Well, do you want to hear the rules";
-		mes "again or,";
-		mes "just get back to it...";
-		next;
-		goto MainMenu2;
-	}
-	
-		Rules:
-			mes "[Halloween Magician]";
-			mes "This village is like a virtual";
-			mes "Payon. There are zombies and ghouls";
-			mes "roaming around";
-			mes "and three southern exits, but only";
-			mes "one works.";
-			mes "That's up to you to find out.";
-			next;
-			mes "[Halloween Magician]";
-			mes "You can't use any skills";
-			mes "to kill the ghouls or zombies.";
-			mes "And one more thing...";
-			mes "you shouldn't forget...";
-			next;
-			mes "[Halloween Magician]";
-			mes "All participants";
-			mes "should be wearing nothing.";
-			mes "Put all belongings in your storage";
-			mes "and come back here when your weight";
-			mes "is '0'.";
-			next;
-			mes "[Halloween Magician]";
-			mes "Oh and one more thing!";
-			mes "You can't be riding a PecoPeco or";
-			mes "have a Cart.";
-			mes "If you are, then I will remove them";
-			mes "before you enter.";
-			mes "Got it?";
-			next;
-			mes "[Halloween Magician]";
-			mes "Remember, there are three exits but";
-			mes "only one works randomly,";
-			mes "the zombies and ghouls roaming";
-			mes "around there can't be killed";
-			mes "and you can't be wearing anything.";
-			next;
-			if (Hallow08 > 0) {
-				mes "[Halloween Magician]";
-				mes "Hey...";
-				mes "Come back once you're ready.";
-				close;
-			}else{
-				goto MainMenu;
-			}
-			
-		Participate:
-			mes "[Halloween Magician]";
-			mes "Ok, you are ready.";
-			mes "Let me check your weight.";
-			next;
-			if (Weight > 0) {
-				mes "[Halloween Magician]";
-				mes "Gosh!";
-				mes "There's always a black sheep";
-				mes "anywhere.";
-				next;
-				mes "[Halloween Magician]";
-				mes "You think I wouldn't notice that";
-				mes "your weight is above '0'?";
-				mes "You're overweight...";
-				close;
-			}else{
-				mes "[Halloween Magician]";
-				mes "You seem good to go,";
-				mes "and your weight is just right.";
-				next;
-				mes "[Halloween Magician]";
-				mes "I was quite swamped with my work,";
-				mes "so I'm exhausted.";
-				next;
-				mes "[Halloween Magician]";
-				mes "I sometimes forget to send you";
-				mes "there...";
-				next;
-				mes "[Halloween Magician]";
-				mes "I hope you come back well.";
-				close2;
-				if (Hallow08 < 1) {
-					set Hallow08,1;
-				}
-				set Hallow08Kill,1;
-				set @Hallow08Warp, rand(1,3);
-				percentheal -98,0;
-				setriding 0;
-				setcart 0;
-				warp "evt_zombie",155,246;
-				end;
-			}
-			
-		TicketExchange:
-			mes "[Halloween Magician]";
-			mes "You want to exchange tickets for";
-			mes "prizes?";
-			mes "Good job! Kkkkkk!";
-			next;
-			mes "[Halloween Magician]";
-			mes "Lemme tell you what items you can";
-			mes "exchange for.";
-			next;
-			mes "[Halloween Magician]";
-			mes "5 tickets for Pumpkin Pie.";
-			mes "20 tickets for Pumpkin-Head.";
-			mes "50 tickets for Old Blue Box.";
-			mes "70 tickets for Old Purple Box.";
-			mes "200 tickets for Old Card Album.";
-			next;
-			mes "[Halloween Magician]";
-			mes "What would you like to exchange";
-			mes "for?";
-			next;
-			switch(select("Pumpkin Pie:Pumpkin-Head:Old Blue Box:Old Purple Box:Old Card Album")) {
-				case 1:
-					if(countitem(7941) < 5) {
-						goto NotEnough;
-					}else{
-						delitem 7941,5;
-						getitem 12192,1;
-						goto Enough;
-					}
-					break;
-				case 2:
-					if(countitem(7941) < 20) {
-						goto NotEnough;
-					}else{
-						delitem 7941,20;
-						getitem 5134,1;
-						goto Enough;
-					}
-					break;
-				case 3:
-					if(countitem(7941) < 50) {
-						goto NotEnough;
-					}else{
-						delitem 7941,50;
-						getitem 603,1;
-						goto Enough;
-					}
-					break;
-				case 4:
-					if(countitem(7941) < 70) {
-						goto NotEnough;
-					}else{
-						delitem 7941,70;
-						getitem 617,1;
-						goto Enough;
-					}
-					break;			
-				case 5:
-					if(countitem(7941) < 200) {
-						goto NotEnough;
-					}else{
-						delitem 7941,200;
-						getitem 616,1;
-						goto Enough;
-					}
-			}
-					
-		NextTime:
-			mes "[Halloween Magician]";
-			mes "Ok, see you then.";
-			mes "Kkkkkkkk.";
-			close;
-
-	MainMenu:
-		menu "Explain it to me.",Rules,"I want to participate.",Participate,"I want to exchange tickets for prizes.",TicketExchange,"I'll come back next time.",NextTime;
-
-	MainMenu2:
-		menu "Get me back there now!",Participate,"Please, tell me the rules",Rules,"I want to exchange tickets for prizes.",TicketExchange,"I'll come back next time.",NextTime;
-
-	NotEnough:
-		mes "[Halloween Magician]";
-		mes "You don't have enough tickets!";
-		mes "Can't you even count?";
-		mes "Please come here with the right";
-		mes "number of tickets.";
-		close;
-
-	Enough:
-		mes "[Halloween Magician]";
-		mes "Here it is.";
-		mes "Do you need...";
-		mes "anything else?";
-		next;
-		if (Hallow08 == 1) {
-			goto MainMenu2;
-		}else{
-			goto MainMenu;
-		}
-}
-	
-// --------------- MapFlags ---------------
-
-evt_zombie	mapflag	nightenabled
-evt_zombie	mapflag	nobranch
-evt_zombie	mapflag	nomemo
-evt_zombie	mapflag	nopenalty
-evt_zombie	mapflag	pvp	off
-evt_zombie	mapflag	noreturn
-evt_zombie	mapflag	nosave	SavePoint
-evt_zombie	mapflag	noskill
-evt_zombie	mapflag	noteleport
-
-evt_zombie,16,142,1	script	zombiewarp001	45,2,2,{
-	OnTouch:
-	if (@Hallow08Warp == 1) {
-		set Hallow08Kill,2;
-		specialeffect 16;
-		warp "payon",28,142;
-	}
-	end;
-}
-
-evt_zombie,122,27,1	script	zombiewarp002	45,2,2,{
-	OnTouch:
-	if (@Hallow08Warp == 2) {
-		set Hallow08Kill,2;
-		specialeffect 16;
-		warp "payon",121,40;
-	}
-	end;
-}
-
-evt_zombie,267,89,1	script	zombiewarp003	45,2,2,{
-	OnTouch:
-	if (@Hallow08Warp == 3) {
-		set Hallow08Kill,2;
-		specialeffect 16;
-		warp "payon",253,95;
-	}
-	end;
-}
-
-evt_zombie,0,0,0,0	monster	Zombie	3000,150,0,0,0
-evt_zombie,0,0,0,0	monster	Ghoul	3001,80,0,0,0
+//===== eAthena Script =======================================
+//= iRO Halloween (2008)
+//===== By: ==================================================
+//= Kisuka
+//===== Current Version: =====================================
+//= 1.0
+//===== Compatible With: =====================================
+//= eAthena SVN
+//===== Description: =========================================
+//= iRO Halloween (2008)
+//= Run away from the zombies for tickets.
+//= Redeem tickets for prizes.
+//===== Notes: ===============================================
+//= You must enable the event monsters in mob_db2.
+//===== Additional Comments: =================================
+//= 1.0 First version. [Kisuka]
+//============================================================
+
+payon,162,176,4	script	Halloween Magician#iRO08	704,{
+	
+	if(Hallow08 < 1) {
+			mes "[Halloween Magician]";
+			mes "Kkkkkkkkk!";
+			mes "I have a special event this";
+			mes "Halloween that tests your luck and";
+			mes "agility.";
+			mes "Are you interested?";
+			next;
+			mes "[Halloween Magician]";
+			mes "Come on! Don't be a wuss!";
+			mes "If you collect enough tickets";
+			mes "you can get good prizes!";
+			mes "So what do you say?";
+			next;
+			goto MainMenu;
+	}
+
+	if (Hallow08Kill == 1) {
+		mes "[Halloween Magician]";
+		mes "You a 'fraidy cat or something?!";
+		mes "You know you want to try again...";
+		mes "Do you know the rules?";
+		next;
+		set Hallow08Kill,0;
+		if(select("Yes, I know.:No, I don't know.") == 2) {
+			goto Rules;
+		}
+		goto Participate;
+	}
+
+	if (Hallow08Kill == 2) {
+		mes "[Halloween Magician]";
+		mes "Oh, well done! You are alright!";
+		mes "Isn't it fun with zombies??";
+		mes "You know, zombies were people too!";
+		mes "Ha!";
+		mes "Kkkkkkk.";
+		next;
+		getitem 7941,1;
+		set Hallow08Kill,0;
+		mes "[Halloween Magician]";
+		mes "As I promised";
+		mes "You can get Halloween tickets";
+		mes "for cool items.";
+		close;
+	}
+
+	if(Hallow08 > 0) {
+		mes "[Halloween Magician]";
+		mes "Well, do you want to hear the rules";
+		mes "again or,";
+		mes "just get back to it...";
+		next;
+		goto MainMenu2;
+	}
+	
+		Rules:
+			mes "[Halloween Magician]";
+			mes "This village is like a virtual";
+			mes "Payon. There are zombies and ghouls";
+			mes "roaming around";
+			mes "and three southern exits, but only";
+			mes "one works.";
+			mes "That's up to you to find out.";
+			next;
+			mes "[Halloween Magician]";
+			mes "You can't use any skills";
+			mes "to kill the ghouls or zombies.";
+			mes "And one more thing...";
+			mes "you shouldn't forget...";
+			next;
+			mes "[Halloween Magician]";
+			mes "All participants";
+			mes "should be wearing nothing.";
+			mes "Put all belongings in your storage";
+			mes "and come back here when your weight";
+			mes "is '0'.";
+			next;
+			mes "[Halloween Magician]";
+			mes "Oh and one more thing!";
+			mes "You can't be riding a PecoPeco or";
+			mes "have a Cart.";
+			mes "If you are, then I will remove them";
+			mes "before you enter.";
+			mes "Got it?";
+			next;
+			mes "[Halloween Magician]";
+			mes "Remember, there are three exits but";
+			mes "only one works randomly,";
+			mes "the zombies and ghouls roaming";
+			mes "around there can't be killed";
+			mes "and you can't be wearing anything.";
+			next;
+			if (Hallow08 > 0) {
+				mes "[Halloween Magician]";
+				mes "Hey...";
+				mes "Come back once you're ready.";
+				close;
+			}else{
+				goto MainMenu;
+			}
+			
+		Participate:
+			mes "[Halloween Magician]";
+			mes "Ok, you are ready.";
+			mes "Let me check your weight.";
+			next;
+			if (Weight > 0) {
+				mes "[Halloween Magician]";
+				mes "Gosh!";
+				mes "There's always a black sheep";
+				mes "anywhere.";
+				next;
+				mes "[Halloween Magician]";
+				mes "You think I wouldn't notice that";
+				mes "your weight is above '0'?";
+				mes "You're overweight...";
+				close;
+			}else{
+				mes "[Halloween Magician]";
+				mes "You seem good to go,";
+				mes "and your weight is just right.";
+				next;
+				mes "[Halloween Magician]";
+				mes "I was quite swamped with my work,";
+				mes "so I'm exhausted.";
+				next;
+				mes "[Halloween Magician]";
+				mes "I sometimes forget to send you";
+				mes "there...";
+				next;
+				mes "[Halloween Magician]";
+				mes "I hope you come back well.";
+				close2;
+				if (Hallow08 < 1) {
+					set Hallow08,1;
+				}
+				set Hallow08Kill,1;
+				set @Hallow08Warp, rand(1,3);
+				percentheal -98,0;
+				setriding 0;
+				setcart 0;
+				warp "evt_zombie",155,246;
+				end;
+			}
+			
+		TicketExchange:
+			mes "[Halloween Magician]";
+			mes "You want to exchange tickets for";
+			mes "prizes?";
+			mes "Good job! Kkkkkk!";
+			next;
+			mes "[Halloween Magician]";
+			mes "Lemme tell you what items you can";
+			mes "exchange for.";
+			next;
+			mes "[Halloween Magician]";
+			mes "5 tickets for Pumpkin Pie.";
+			mes "20 tickets for Pumpkin-Head.";
+			mes "50 tickets for Old Blue Box.";
+			mes "70 tickets for Old Purple Box.";
+			mes "200 tickets for Old Card Album.";
+			next;
+			mes "[Halloween Magician]";
+			mes "What would you like to exchange";
+			mes "for?";
+			next;
+			switch(select("Pumpkin Pie:Pumpkin-Head:Old Blue Box:Old Purple Box:Old Card Album")) {
+				case 1:
+					if(countitem(7941) < 5) {
+						goto NotEnough;
+					}else{
+						delitem 7941,5;
+						getitem 12192,1;
+						goto Enough;
+					}
+					break;
+				case 2:
+					if(countitem(7941) < 20) {
+						goto NotEnough;
+					}else{
+						delitem 7941,20;
+						getitem 5134,1;
+						goto Enough;
+					}
+					break;
+				case 3:
+					if(countitem(7941) < 50) {
+						goto NotEnough;
+					}else{
+						delitem 7941,50;
+						getitem 603,1;
+						goto Enough;
+					}
+					break;
+				case 4:
+					if(countitem(7941) < 70) {
+						goto NotEnough;
+					}else{
+						delitem 7941,70;
+						getitem 617,1;
+						goto Enough;
+					}
+					break;			
+				case 5:
+					if(countitem(7941) < 200) {
+						goto NotEnough;
+					}else{
+						delitem 7941,200;
+						getitem 616,1;
+						goto Enough;
+					}
+			}
+					
+		NextTime:
+			mes "[Halloween Magician]";
+			mes "Ok, see you then.";
+			mes "Kkkkkkkk.";
+			close;
+
+	MainMenu:
+		menu "Explain it to me.",Rules,"I want to participate.",Participate,"I want to exchange tickets for prizes.",TicketExchange,"I'll come back next time.",NextTime;
+
+	MainMenu2:
+		menu "Get me back there now!",Participate,"Please, tell me the rules",Rules,"I want to exchange tickets for prizes.",TicketExchange,"I'll come back next time.",NextTime;
+
+	NotEnough:
+		mes "[Halloween Magician]";
+		mes "You don't have enough tickets!";
+		mes "Can't you even count?";
+		mes "Please come here with the right";
+		mes "number of tickets.";
+		close;
+
+	Enough:
+		mes "[Halloween Magician]";
+		mes "Here it is.";
+		mes "Do you need...";
+		mes "anything else?";
+		next;
+		if (Hallow08 == 1) {
+			goto MainMenu2;
+		}else{
+			goto MainMenu;
+		}
+}
+	
+// --------------- MapFlags ---------------
+
+evt_zombie	mapflag	nightenabled
+evt_zombie	mapflag	nobranch
+evt_zombie	mapflag	nomemo
+evt_zombie	mapflag	nopenalty
+evt_zombie	mapflag	pvp	off
+evt_zombie	mapflag	noreturn
+evt_zombie	mapflag	nosave	SavePoint
+evt_zombie	mapflag	noskill
+evt_zombie	mapflag	noteleport
+
+evt_zombie,16,142,1	script	zombiewarp001	45,2,2,{
+	OnTouch:
+	if (@Hallow08Warp == 1) {
+		set Hallow08Kill,2;
+		specialeffect 16;
+		warp "payon",28,142;
+	}
+	end;
+}
+
+evt_zombie,122,27,1	script	zombiewarp002	45,2,2,{
+	OnTouch:
+	if (@Hallow08Warp == 2) {
+		set Hallow08Kill,2;
+		specialeffect 16;
+		warp "payon",121,40;
+	}
+	end;
+}
+
+evt_zombie,267,89,1	script	zombiewarp003	45,2,2,{
+	OnTouch:
+	if (@Hallow08Warp == 3) {
+		set Hallow08Kill,2;
+		specialeffect 16;
+		warp "payon",253,95;
+	}
+	end;
+}
+
+evt_zombie,0,0,0,0	monster	Zombie	3000,150,0,0,0
+evt_zombie,0,0,0,0	monster	Ghoul	3001,80,0,0,0
 evt_zombie,0,0,0,0	monster	Zombie Master	3002,20,0,0,0

+ 441 - 441
npc/events/halloween_2009.txt

@@ -1,442 +1,442 @@
-//===== eAthena Script =======================================
-//= iRO Halloween (2009)
-//===== By: ==================================================
-//= Kisuka
-//===== Current Version: =====================================
-//= 1.1
-//===== Compatible With: =====================================
-//= eAthena SVN
-//===== Description: =========================================
-//= iRO Halloween (2009)
-//= Quest for Weird Pumpkin Hat.
-//= Exchange treats for buffs.
-//= Summon event monsters in towns.
-//===== Notes: ===============================================
-//= You must enable the event items in item_db2.
-//= You must enable the event mobs in mob_db2, mob_avail, and
-//= their skills in mob_skill_db2.
-//===== Additional Comments: =================================
-//= 1.0 First version. [Kisuka]
-//= 1.1 Fixed even exploit, fixed mobs overlap. [Lupus]
-//============================================================
-
-// Headgear Quest - Pumpkin Hat
-// ============================
-prontera,152,192,5	script	Pumpkin Hat Researcher	712,{
-	if(BaseLevel < 45) {
-		mes "[Pumpkin Hat Researcher]";
-		mes "Shoo, I don't need a child. Shoo! I don't talk to novices.";
-		next;
-		mes "[Pumpkin Hat Researcher]";
-		mes "Go reach a level that can fight with stronger monsters and come back.";
-		close;
-	}
-	mes "[Pumpkin Hat Researcher]";
-	mes "Say do you like Pumpkin Pies?";
-	next;
-	mes "[Pumpkin Hat Researcher]";
-	mes "I'm a Pumpkin Hat researcher, Why don't you listen to my story?";
-	next;
-	while(1) {
-		switch(select("Listen to the story.:Ask about Pumpkin Hat.:Get a Pumpkin Hat.:Stop the conversation.")) {
-			case 1:
-				mes "[Pumpkin Hat Researcher]";
-				mes "I've been studying about an upgraded Pumpkin Hat.";
-				mes "I have discovered that it is a very simple process.";
-				next;
-				mes "[Pumpkin Hat Researcher]";
-				mes "The process is quite simple.";
-				mes "If you bring me ^4a4aff20 Jack o' Pumpkin^000000 I can show you.";
-				mes "Isn't that a tempting proposal?";
-				next;
-				break;
-			case 2:
-				mes "[Pumpkin Hat Researcher]";
-				mes "This upgraded pumpkin hat is powerful stuff!";
-				next;
-				mes "[Pumpkin Hat Researcher]";
-				mes "It can make a Pumpkin Pie that restores a large percentage of HP & SP using condensed energy to the person who wears it.";
-				next;
-				mes "[Pumpkin Hat Researcher]";
-				mes "All you need is ^4a4aff20 Jack o' Pumpkin^000000s.";
-				next;
-				break;
-			case 3:
-				mes "[Pumpkin Hat Researcher]";
-				mes "Do you want to get Pumpkin Pies? Okay, let me count the Jack o' Pumpkins you've brought.";
-				next;
-				if(countitem(1062) < 20) {
-					mes "[Pumpkin Hat Researcher]";
-					mes "I need ^4a4aff20 Jack o' Pumpkin^000000.";
-					mes "I'm not an alchemist or a wizard to create something from nothing.";
-					next;
-					mes "[Pumpkin Hat Researcher]";
-					mes "Okay, go hunting monsters and come back.";
-					mes "I'm going to stay here for a while so take your time.";
-					next;
-					break;
-				}else{
-					mes "[Pumpkin Hat Researcher]";
-					mes "I hope this will be useful to you. Don't forget to wear it while fighting to get your Pumpkin Pies.";
-					delitem 1062,20;	// Jack o' Pumpkin
-					getitem 5668,1;		// Weird Pumpkin Hat
-					next;
-					mes "[Pumpkin Hat Researcher]";
-					mes "I guess that I should get back to my research.";
-					close;
-				}
-			case 4:
-				mes "[Pumpkin Hat Researcher]";
-				mes "Bye, until we'll see each other again.";
-				mes "I wish you well...";
-				close;
-		}
-	}
-}
-
-// Buffs - Trick or Treaters
-// =========================
--	script	Trick or Treater::09Treats	706,2,2,{
-OnTouch:
-	hideoffnpc strnpcinfo(3);
-	initnpctimer;
-	mes "[Trick or Treater]";
-	mes "Hooray! hooray! Hooray!";
-	mes "Trick or Treat?";
-	next;
-	if(select("Trick.:Treat.") == 1) {
-		mes "[Trick or Treater]";
-		mes "!!!!";
-		mes "Fine. I have no choice but to trick you back!";
-		sc_start SC_Stun,5000,0;
-		close;
-	}
-	mes "[Trick or Treater]";
-	mes "Oh yay! What kind of treat do you have?";
-	next;
-	switch(select("Candy:Candy Cane:Well-baked Cookie:Nothing")) {
-		case 1:
-			if(countitem(529) > 0) {
-				mes "[Trick or Treater]";
-				mes "Yay thank you!";
-				mes "Here, take this for being so nice!";
-				sc_start SC_STRFood, 1800000, 5;
-				sc_start SC_INTFood, 1800000, 5;
-				sc_start SC_VITFood, 1800000, 5;
-				sc_start SC_AGIFood, 1800000, 5;
-				sc_start SC_DEXFood, 1800000, 5;
-				sc_start SC_LUKFood, 1800000, 5;
-				sc_start SC_FLEEFOOD, 1800000, 15;
-				delitem 529,1;	// Candy
-				close;
-			}else{
-				mes "[Trick or Treater]";
-				mes "At least a Candy, a Candy Cane or a Well-baked Cookie is all I ask for a treat.";
-				mes "Fine. I have no choice but to trick you!";
-				sc_start SC_Stun,5000,0;
-				close;
-			}
-		case 2:
-			if(countitem(530) > 0) {
-				mes "[Trick or Treater]";
-				mes "Yay thank you!";
-				mes "Here, take this for being so nice!";
-				sc_start SC_STRFood, 1800000, 5;
-				sc_start SC_INTFood, 1800000, 5;
-				sc_start SC_VITFood, 1800000, 5;
-				sc_start SC_AGIFood, 1800000, 5;
-				sc_start SC_DEXFood, 1800000, 5;
-				sc_start SC_LUKFood, 1800000, 5;
-				sc_start SC_FLEEFOOD, 1800000, 15;
-				delitem 530,1;	// Candy Cane
-				close;
-			}else{
-				mes "[Trick or Treater]";
-				mes "At least a Candy, a Candy Cane or a Well-baked Cookie is all I ask for a treat.";
-				mes "Fine. I have no choice but to trick you!";
-				sc_start SC_Stun,5000,0;
-				close;
-			}	
-		case 3:
-			if(countitem(538) > 0) {
-				mes "[Trick or Treater]";
-				mes "Yay thank you!";
-				mes "Here, take this for being so nice!";
-				sc_start SC_STRFood, 1800000, 5;
-				sc_start SC_INTFood, 1800000, 5;
-				sc_start SC_VITFood, 1800000, 5;
-				sc_start SC_AGIFood, 1800000, 5;
-				sc_start SC_DEXFood, 1800000, 5;
-				sc_start SC_LUKFood, 1800000, 5;
-				sc_start SC_FLEEFOOD, 1800000, 15;
-				delitem 538,1;	// Well-baked Cookie
-				close;
-			}else{
-				mes "[Trick or Treater]";
-				mes "At least a Candy, a Candy Cane or a Well-baked Cookie is all I ask for a treat.";
-				mes "Fine. I have no choice but to trick you!";
-				sc_start SC_Stun,5000,0;
-				close;
-			}	
-		case 4:
-			mes "[Trick or Treater]";
-			mes "At least a Candy, a Candy Cane or a Well-baked Cookie is all I ask for a treat.";
-			mes "Fine. I have no choice but to trick you!";
-			sc_start SC_Stun,5000,0;
-			close;
-	}
-OnInit:
-	hideonnpc "Trick or Treater#iRO1";
-	hideonnpc "Trick or Treater#iRO2";
-	hideonnpc "Trick or Treater#iRO3";
-	hideonnpc "Trick or Treater#iRO4";
-	hideonnpc "Trick or Treater#iRO5";
-	hideonnpc "Trick or Treater#iRO6";
-	hideonnpc "Trick or Treater#iRO7";
-	hideonnpc "Trick or Treater#iRO8";
-	end;
-	
-OnEnableTreat:
-	enablenpc strnpcinfo(3);
-	hideonnpc strnpcinfo(3);
-	end;
-	
-OnTimer15000:
-	hideonnpc strnpcinfo(3);
-	disablenpc strnpcinfo(3);
-	end;
-		
-OnTimer300000:
-	donpcevent strnpcinfo(3)+"::OnEnableTreat";
-	stopnpctimer;
-	end;
-}
-prontera,151,173,5	duplicate(09Treats)	Trick or Treater#iRO1	706,2,2
-prontera,270,350,5	duplicate(09Treats)	Trick or Treater#iRO2	706,2,2
-prontera,234,310,5	duplicate(09Treats)	Trick or Treater#iRO3	706,2,2
-prontera,156,321,5	duplicate(09Treats)	Trick or Treater#iRO4	706,2,2
-prontera,156,283,5	duplicate(09Treats)	Trick or Treater#iRO5	706,2,2
-prontera,142,214,5	duplicate(09Treats)	Trick or Treater#iRO6	706,2,2
-prontera,134,125,5	duplicate(09Treats)	Trick or Treater#iRO7	706,2,2
-prontera,220,72,5	duplicate(09Treats)	Trick or Treater#iRO8	706,2,2
-
-// Monster Summoning - Halloween Wizard
-// ====================================
--	script	Halloween Wizard#iRO09::09HallowWiz	737,{
-	mes "[Halloween Wizard]";
-	mes "...";
-	mes "Do you want to play a trick on someone?";
-	next;
-	while(1) {
-		switch(select("What trick?:Sure:No.")) {
-			case 1:
-				mes "[Halloween Wizard]";
-				mes "I can summon monsters in other parts of the world with just a few materials.";
-				next;
-				mes "[Halloween Wizard]";
-				mes "Sounds interesting huh?";
-				next;
-				mes "[Halloween Wizard]";
-				mes "If you bring me Fabric, Jack o' Pumpkins, Worn Fabric, or Crushed Pumpkins I can summon the monsters.";
-				next;
-				break;
-			case 2:
-				mes "[Halloween Wizard]";
-				mes "Which town do you want to play a trick on?";
-				next;
-				getmapxy(.@mapname$,.@mapx,.@mapy,0,""+strcharinfo(0)+"");
-				if (.@mapname$ == "prontera") {
-					switch(select("Geffen:Payon:Alberta:Aldebaran")) {
-						case 1:
-							set .@HallowTown,3;
-							break;
-						case 2:
-							set .@HallowTown,2;
-							break;
-						case 3:
-							set .@HallowTown,4;
-							break;
-						case 4:
-							set .@HallowTown,5;
-							break;
-					}
-				}
-				else if (.@mapname$ == "payon") {
-					switch(select("Prontera:Geffen:Alberta:Aldebaran")) {
-						case 1:
-							set .@HallowTown,1;
-							break;
-						case 2:
-							set .@HallowTown,3;
-							break;
-						case 3:
-							set .@HallowTown,4;
-							break;
-						case 4:
-							set .@HallowTown,5;
-							break;
-					}
-				}
-				else if (.@mapname$ == "geffen") {
-					switch(select("Prontera:Payon:Alberta:Aldebaran")) {
-						case 1:
-							set .@HallowTown,1;
-							break;
-						case 2:
-							set .@HallowTown,2;
-							break;
-						case 3:
-							set .@HallowTown,4;
-							break;
-						case 4:
-							set .@HallowTown,5;
-							break;
-					}
-				}
-				else if (.@mapname$ == "alberta") {
-					switch(select("Prontera:Geffen:Payon:Aldebaran")) {
-						case 1:
-							set .@HallowTown,1;
-							break;
-						case 2:
-							set .@HallowTown,3;
-							break;
-						case 3:
-							set .@HallowTown,2;
-							break;
-						case 4:
-							set .@HallowTown,5;
-							break;
-					}
-				}
-				else if (.@mapname$ == "aldebaran") {
-					switch(select("Prontera:Geffen:Payon:Alberta")) {
-						case 1:
-							set .@HallowTown,1;
-							break;
-						case 2:
-							set .@HallowTown,3;
-							break;
-						case 3:
-							set .@HallowTown,2;
-							break;
-						case 4:
-							set .@HallowTown,4;
-							break;
-					}
-				}
-				setarray .@HallowTowns$[1],"prontera","payon","geffen","alberta","aldebaran";
-				mes "[Halloween Wizard]";
-				mes "Ok then let's go to the next step.";
-				next;
-				mes "[Halloween Wizard]";
-				mes "How many Fabrics or Jack o' Pumpkins do you want to use? Don't go over 100 because that is the max amount that I can use.";
-				next;
-				input .@input;
-				if (.@input == 0) {
-					mes "[Halloween Wizard]";
-					mes "You have no definite idea.";
-					mes "It's not a big deal.";
-					mes "Let me know.";
-					next;
-					break;
-				}
-				else if (.@input > 100) {
-					mes "[Halloween Wizard]";
-					mes "I told you that it must be between 1 to 100!";
-					mes "You didn't pay attention!";
-					next;
-					break;
-				}
-				else {
-					set .@fabric,countitem(1059);
-					set .@jack,countitem(1062);
-					set .@worn,countitem(6299);
-					set .@crushed,countitem(6298);
-					set .@whispers,0;
-					set .@darklords,0;
-
-					set .@total,.@fabric + .@jack + .@worn + .@crushed;
-
-					if(.@total < .@input) {
-						mes "[Halloween Wizard]";
-						mes "Recount the number of items you have and tell me the total.";
-						mes "Huhuhuhuhuhu...";
-						next;
-						break;
-					}
-
-					if(.@fabric > 0) {
-						if(.@fabric >= .@input) {
-							delitem 1059,.@input;
-							set .@whispers,.@whispers+.@input;
-							set .@input,0;
-						}
-						else{
-							delitem 1059,.@fabric;
-							set .@input,.@input - .@fabric;
-							set .@whispers,.@whispers+.@fabric;
-						}
-					}
-					if(.@worn > 0 && .@input != 0) {
-						if(.@worn >= .@input) {
-							delitem 6299,.@input;
-							set .@whispers,.@whispers+.@input;
-							set .@input,0;
-						}
-						else{
-							delitem 6299,.@worn;
-							set .@input,.@input - .@worn;
-							set .@whispers,.@whispers+.@worn;
-						}
-					}
-					if(.@jack > 0 && .@input != 0) {
-						if(.@jack >= .@input) {
-							delitem 1062,.@input;
-							set .@darklords,.@darklords+.@input;
-							set .@input,0;
-						}
-						else{
-							delitem 1062,.@jack;
-							set .@input,.@input - .@jack;
-							set .@darklords,.@darklords+.@jack;
-						}
-					}
-					if(.@crushed > 0 && .@input != 0) {
-						if(.@crushed >= .@input) {
-							delitem 6298,.@input;
-							set .@darklords,.@darklords+.@input;
-							set .@input,0;
-						}
-						else{
-							delitem 6298,.@crushed;
-							set .@input,.@input - .@crushed;
-							set .@darklords,.@darklords+.@crushed;
-						}
-					}
-					if (.@input > 0) {
-						mes "Theres a problem.";
-						close;
-					}
-					monster ""+.@HallowTowns$[.@HallowTown]+"",0,0,"Halloween Whisper",3014,.@whispers;
-					monster ""+.@HallowTowns$[.@HallowTown]+"",0,0,"Halloween Dark Lord",3015,.@darklords;
-					mes "[Halloween Wizard]";
-					mes "Here's what you wanted.";
-					mes "Imagine what the people must be thinking in the other villages?";
-					mes "Muahahaha";
-					close;
-				}
-			case 3:
-				mes "[Halloween Wizard]";
-				mes "If you change your mind, come back here...";
-				mes "I'll stay here for a while...";
-				mes "Kkkk...";
-				close;
-		}
-	}
-}
-prontera,156,195,5	duplicate(09HallowWiz)	Halloween Wizard#1	737
-geffen,133,122,5	duplicate(09HallowWiz)	Halloween Wizard#2	737
-payon,156,196,5	duplicate(09HallowWiz)	Halloween Wizard#3	737
-alberta,96,57,5	duplicate(09HallowWiz)	Halloween Wizard#4	737
+//===== eAthena Script =======================================
+//= iRO Halloween (2009)
+//===== By: ==================================================
+//= Kisuka
+//===== Current Version: =====================================
+//= 1.1
+//===== Compatible With: =====================================
+//= eAthena SVN
+//===== Description: =========================================
+//= iRO Halloween (2009)
+//= Quest for Weird Pumpkin Hat.
+//= Exchange treats for buffs.
+//= Summon event monsters in towns.
+//===== Notes: ===============================================
+//= You must enable the event items in item_db2.
+//= You must enable the event mobs in mob_db2, mob_avail, and
+//= their skills in mob_skill_db2.
+//===== Additional Comments: =================================
+//= 1.0 First version. [Kisuka]
+//= 1.1 Fixed even exploit, fixed mobs overlap. [Lupus]
+//============================================================
+
+// Headgear Quest - Pumpkin Hat
+// ============================
+prontera,152,192,5	script	Pumpkin Hat Researcher	712,{
+	if(BaseLevel < 45) {
+		mes "[Pumpkin Hat Researcher]";
+		mes "Shoo, I don't need a child. Shoo! I don't talk to novices.";
+		next;
+		mes "[Pumpkin Hat Researcher]";
+		mes "Go reach a level that can fight with stronger monsters and come back.";
+		close;
+	}
+	mes "[Pumpkin Hat Researcher]";
+	mes "Say do you like Pumpkin Pies?";
+	next;
+	mes "[Pumpkin Hat Researcher]";
+	mes "I'm a Pumpkin Hat researcher, Why don't you listen to my story?";
+	next;
+	while(1) {
+		switch(select("Listen to the story.:Ask about Pumpkin Hat.:Get a Pumpkin Hat.:Stop the conversation.")) {
+			case 1:
+				mes "[Pumpkin Hat Researcher]";
+				mes "I've been studying about an upgraded Pumpkin Hat.";
+				mes "I have discovered that it is a very simple process.";
+				next;
+				mes "[Pumpkin Hat Researcher]";
+				mes "The process is quite simple.";
+				mes "If you bring me ^4a4aff20 Jack o' Pumpkin^000000 I can show you.";
+				mes "Isn't that a tempting proposal?";
+				next;
+				break;
+			case 2:
+				mes "[Pumpkin Hat Researcher]";
+				mes "This upgraded pumpkin hat is powerful stuff!";
+				next;
+				mes "[Pumpkin Hat Researcher]";
+				mes "It can make a Pumpkin Pie that restores a large percentage of HP & SP using condensed energy to the person who wears it.";
+				next;
+				mes "[Pumpkin Hat Researcher]";
+				mes "All you need is ^4a4aff20 Jack o' Pumpkin^000000s.";
+				next;
+				break;
+			case 3:
+				mes "[Pumpkin Hat Researcher]";
+				mes "Do you want to get Pumpkin Pies? Okay, let me count the Jack o' Pumpkins you've brought.";
+				next;
+				if(countitem(1062) < 20) {
+					mes "[Pumpkin Hat Researcher]";
+					mes "I need ^4a4aff20 Jack o' Pumpkin^000000.";
+					mes "I'm not an alchemist or a wizard to create something from nothing.";
+					next;
+					mes "[Pumpkin Hat Researcher]";
+					mes "Okay, go hunting monsters and come back.";
+					mes "I'm going to stay here for a while so take your time.";
+					next;
+					break;
+				}else{
+					mes "[Pumpkin Hat Researcher]";
+					mes "I hope this will be useful to you. Don't forget to wear it while fighting to get your Pumpkin Pies.";
+					delitem 1062,20;	// Jack o' Pumpkin
+					getitem 5668,1;		// Weird Pumpkin Hat
+					next;
+					mes "[Pumpkin Hat Researcher]";
+					mes "I guess that I should get back to my research.";
+					close;
+				}
+			case 4:
+				mes "[Pumpkin Hat Researcher]";
+				mes "Bye, until we'll see each other again.";
+				mes "I wish you well...";
+				close;
+		}
+	}
+}
+
+// Buffs - Trick or Treaters
+// =========================
+-	script	Trick or Treater::09Treats	706,2,2,{
+OnTouch:
+	hideoffnpc strnpcinfo(3);
+	initnpctimer;
+	mes "[Trick or Treater]";
+	mes "Hooray! hooray! Hooray!";
+	mes "Trick or Treat?";
+	next;
+	if(select("Trick.:Treat.") == 1) {
+		mes "[Trick or Treater]";
+		mes "!!!!";
+		mes "Fine. I have no choice but to trick you back!";
+		sc_start SC_Stun,5000,0;
+		close;
+	}
+	mes "[Trick or Treater]";
+	mes "Oh yay! What kind of treat do you have?";
+	next;
+	switch(select("Candy:Candy Cane:Well-baked Cookie:Nothing")) {
+		case 1:
+			if(countitem(529) > 0) {
+				mes "[Trick or Treater]";
+				mes "Yay thank you!";
+				mes "Here, take this for being so nice!";
+				sc_start SC_STRFood, 1800000, 5;
+				sc_start SC_INTFood, 1800000, 5;
+				sc_start SC_VITFood, 1800000, 5;
+				sc_start SC_AGIFood, 1800000, 5;
+				sc_start SC_DEXFood, 1800000, 5;
+				sc_start SC_LUKFood, 1800000, 5;
+				sc_start SC_FLEEFOOD, 1800000, 15;
+				delitem 529,1;	// Candy
+				close;
+			}else{
+				mes "[Trick or Treater]";
+				mes "At least a Candy, a Candy Cane or a Well-baked Cookie is all I ask for a treat.";
+				mes "Fine. I have no choice but to trick you!";
+				sc_start SC_Stun,5000,0;
+				close;
+			}
+		case 2:
+			if(countitem(530) > 0) {
+				mes "[Trick or Treater]";
+				mes "Yay thank you!";
+				mes "Here, take this for being so nice!";
+				sc_start SC_STRFood, 1800000, 5;
+				sc_start SC_INTFood, 1800000, 5;
+				sc_start SC_VITFood, 1800000, 5;
+				sc_start SC_AGIFood, 1800000, 5;
+				sc_start SC_DEXFood, 1800000, 5;
+				sc_start SC_LUKFood, 1800000, 5;
+				sc_start SC_FLEEFOOD, 1800000, 15;
+				delitem 530,1;	// Candy Cane
+				close;
+			}else{
+				mes "[Trick or Treater]";
+				mes "At least a Candy, a Candy Cane or a Well-baked Cookie is all I ask for a treat.";
+				mes "Fine. I have no choice but to trick you!";
+				sc_start SC_Stun,5000,0;
+				close;
+			}	
+		case 3:
+			if(countitem(538) > 0) {
+				mes "[Trick or Treater]";
+				mes "Yay thank you!";
+				mes "Here, take this for being so nice!";
+				sc_start SC_STRFood, 1800000, 5;
+				sc_start SC_INTFood, 1800000, 5;
+				sc_start SC_VITFood, 1800000, 5;
+				sc_start SC_AGIFood, 1800000, 5;
+				sc_start SC_DEXFood, 1800000, 5;
+				sc_start SC_LUKFood, 1800000, 5;
+				sc_start SC_FLEEFOOD, 1800000, 15;
+				delitem 538,1;	// Well-baked Cookie
+				close;
+			}else{
+				mes "[Trick or Treater]";
+				mes "At least a Candy, a Candy Cane or a Well-baked Cookie is all I ask for a treat.";
+				mes "Fine. I have no choice but to trick you!";
+				sc_start SC_Stun,5000,0;
+				close;
+			}	
+		case 4:
+			mes "[Trick or Treater]";
+			mes "At least a Candy, a Candy Cane or a Well-baked Cookie is all I ask for a treat.";
+			mes "Fine. I have no choice but to trick you!";
+			sc_start SC_Stun,5000,0;
+			close;
+	}
+OnInit:
+	hideonnpc "Trick or Treater#iRO1";
+	hideonnpc "Trick or Treater#iRO2";
+	hideonnpc "Trick or Treater#iRO3";
+	hideonnpc "Trick or Treater#iRO4";
+	hideonnpc "Trick or Treater#iRO5";
+	hideonnpc "Trick or Treater#iRO6";
+	hideonnpc "Trick or Treater#iRO7";
+	hideonnpc "Trick or Treater#iRO8";
+	end;
+	
+OnEnableTreat:
+	enablenpc strnpcinfo(3);
+	hideonnpc strnpcinfo(3);
+	end;
+	
+OnTimer15000:
+	hideonnpc strnpcinfo(3);
+	disablenpc strnpcinfo(3);
+	end;
+		
+OnTimer300000:
+	donpcevent strnpcinfo(3)+"::OnEnableTreat";
+	stopnpctimer;
+	end;
+}
+prontera,151,173,5	duplicate(09Treats)	Trick or Treater#iRO1	706,2,2
+prontera,270,350,5	duplicate(09Treats)	Trick or Treater#iRO2	706,2,2
+prontera,234,310,5	duplicate(09Treats)	Trick or Treater#iRO3	706,2,2
+prontera,156,321,5	duplicate(09Treats)	Trick or Treater#iRO4	706,2,2
+prontera,156,283,5	duplicate(09Treats)	Trick or Treater#iRO5	706,2,2
+prontera,142,214,5	duplicate(09Treats)	Trick or Treater#iRO6	706,2,2
+prontera,134,125,5	duplicate(09Treats)	Trick or Treater#iRO7	706,2,2
+prontera,220,72,5	duplicate(09Treats)	Trick or Treater#iRO8	706,2,2
+
+// Monster Summoning - Halloween Wizard
+// ====================================
+-	script	Halloween Wizard#iRO09::09HallowWiz	737,{
+	mes "[Halloween Wizard]";
+	mes "...";
+	mes "Do you want to play a trick on someone?";
+	next;
+	while(1) {
+		switch(select("What trick?:Sure:No.")) {
+			case 1:
+				mes "[Halloween Wizard]";
+				mes "I can summon monsters in other parts of the world with just a few materials.";
+				next;
+				mes "[Halloween Wizard]";
+				mes "Sounds interesting huh?";
+				next;
+				mes "[Halloween Wizard]";
+				mes "If you bring me Fabric, Jack o' Pumpkins, Worn Fabric, or Crushed Pumpkins I can summon the monsters.";
+				next;
+				break;
+			case 2:
+				mes "[Halloween Wizard]";
+				mes "Which town do you want to play a trick on?";
+				next;
+				getmapxy(.@mapname$,.@mapx,.@mapy,0,""+strcharinfo(0)+"");
+				if (.@mapname$ == "prontera") {
+					switch(select("Geffen:Payon:Alberta:Aldebaran")) {
+						case 1:
+							set .@HallowTown,3;
+							break;
+						case 2:
+							set .@HallowTown,2;
+							break;
+						case 3:
+							set .@HallowTown,4;
+							break;
+						case 4:
+							set .@HallowTown,5;
+							break;
+					}
+				}
+				else if (.@mapname$ == "payon") {
+					switch(select("Prontera:Geffen:Alberta:Aldebaran")) {
+						case 1:
+							set .@HallowTown,1;
+							break;
+						case 2:
+							set .@HallowTown,3;
+							break;
+						case 3:
+							set .@HallowTown,4;
+							break;
+						case 4:
+							set .@HallowTown,5;
+							break;
+					}
+				}
+				else if (.@mapname$ == "geffen") {
+					switch(select("Prontera:Payon:Alberta:Aldebaran")) {
+						case 1:
+							set .@HallowTown,1;
+							break;
+						case 2:
+							set .@HallowTown,2;
+							break;
+						case 3:
+							set .@HallowTown,4;
+							break;
+						case 4:
+							set .@HallowTown,5;
+							break;
+					}
+				}
+				else if (.@mapname$ == "alberta") {
+					switch(select("Prontera:Geffen:Payon:Aldebaran")) {
+						case 1:
+							set .@HallowTown,1;
+							break;
+						case 2:
+							set .@HallowTown,3;
+							break;
+						case 3:
+							set .@HallowTown,2;
+							break;
+						case 4:
+							set .@HallowTown,5;
+							break;
+					}
+				}
+				else if (.@mapname$ == "aldebaran") {
+					switch(select("Prontera:Geffen:Payon:Alberta")) {
+						case 1:
+							set .@HallowTown,1;
+							break;
+						case 2:
+							set .@HallowTown,3;
+							break;
+						case 3:
+							set .@HallowTown,2;
+							break;
+						case 4:
+							set .@HallowTown,4;
+							break;
+					}
+				}
+				setarray .@HallowTowns$[1],"prontera","payon","geffen","alberta","aldebaran";
+				mes "[Halloween Wizard]";
+				mes "Ok then let's go to the next step.";
+				next;
+				mes "[Halloween Wizard]";
+				mes "How many Fabrics or Jack o' Pumpkins do you want to use? Don't go over 100 because that is the max amount that I can use.";
+				next;
+				input .@input;
+				if (.@input == 0) {
+					mes "[Halloween Wizard]";
+					mes "You have no definite idea.";
+					mes "It's not a big deal.";
+					mes "Let me know.";
+					next;
+					break;
+				}
+				else if (.@input > 100) {
+					mes "[Halloween Wizard]";
+					mes "I told you that it must be between 1 to 100!";
+					mes "You didn't pay attention!";
+					next;
+					break;
+				}
+				else {
+					set .@fabric,countitem(1059);
+					set .@jack,countitem(1062);
+					set .@worn,countitem(6299);
+					set .@crushed,countitem(6298);
+					set .@whispers,0;
+					set .@darklords,0;
+
+					set .@total,.@fabric + .@jack + .@worn + .@crushed;
+
+					if(.@total < .@input) {
+						mes "[Halloween Wizard]";
+						mes "Recount the number of items you have and tell me the total.";
+						mes "Huhuhuhuhuhu...";
+						next;
+						break;
+					}
+
+					if(.@fabric > 0) {
+						if(.@fabric >= .@input) {
+							delitem 1059,.@input;
+							set .@whispers,.@whispers+.@input;
+							set .@input,0;
+						}
+						else{
+							delitem 1059,.@fabric;
+							set .@input,.@input - .@fabric;
+							set .@whispers,.@whispers+.@fabric;
+						}
+					}
+					if(.@worn > 0 && .@input != 0) {
+						if(.@worn >= .@input) {
+							delitem 6299,.@input;
+							set .@whispers,.@whispers+.@input;
+							set .@input,0;
+						}
+						else{
+							delitem 6299,.@worn;
+							set .@input,.@input - .@worn;
+							set .@whispers,.@whispers+.@worn;
+						}
+					}
+					if(.@jack > 0 && .@input != 0) {
+						if(.@jack >= .@input) {
+							delitem 1062,.@input;
+							set .@darklords,.@darklords+.@input;
+							set .@input,0;
+						}
+						else{
+							delitem 1062,.@jack;
+							set .@input,.@input - .@jack;
+							set .@darklords,.@darklords+.@jack;
+						}
+					}
+					if(.@crushed > 0 && .@input != 0) {
+						if(.@crushed >= .@input) {
+							delitem 6298,.@input;
+							set .@darklords,.@darklords+.@input;
+							set .@input,0;
+						}
+						else{
+							delitem 6298,.@crushed;
+							set .@input,.@input - .@crushed;
+							set .@darklords,.@darklords+.@crushed;
+						}
+					}
+					if (.@input > 0) {
+						mes "Theres a problem.";
+						close;
+					}
+					monster ""+.@HallowTowns$[.@HallowTown]+"",0,0,"Halloween Whisper",3014,.@whispers;
+					monster ""+.@HallowTowns$[.@HallowTown]+"",0,0,"Halloween Dark Lord",3015,.@darklords;
+					mes "[Halloween Wizard]";
+					mes "Here's what you wanted.";
+					mes "Imagine what the people must be thinking in the other villages?";
+					mes "Muahahaha";
+					close;
+				}
+			case 3:
+				mes "[Halloween Wizard]";
+				mes "If you change your mind, come back here...";
+				mes "I'll stay here for a while...";
+				mes "Kkkk...";
+				close;
+		}
+	}
+}
+prontera,156,195,5	duplicate(09HallowWiz)	Halloween Wizard#1	737
+geffen,133,122,5	duplicate(09HallowWiz)	Halloween Wizard#2	737
+payon,156,196,5	duplicate(09HallowWiz)	Halloween Wizard#3	737
+alberta,96,57,5	duplicate(09HallowWiz)	Halloween Wizard#4	737
 aldebaran,146,122,5	duplicate(09HallowWiz)	Halloween Wizard#5	737

+ 124 - 124
npc/merchants/cash_hair.txt

@@ -1,125 +1,125 @@
-//===== eAthena Script ======================================= 
-//= Cash Hair Stylist
-//===== By: ================================================== 
-//= Kisuka
-//===== Current Version: ===================================== 
-//= 1.0
-//===== Compatible With: ===================================== 
-//= eAthena SVN
-//===== Description: ========================================= 
-//= Exchange cash item, New_Style_Coupon, for new hair styles.
-//===== Additional Comments: ================================= 
-//= 1.0 First Version. [Kisuka]
-//============================================================
-
-itemmall,19,74,5	script	Stylist#cash	91,{
-	mes "[Stylist]";
-	mes "Hey, I'm Kaniki.";
-	mes "I'm here to start a new";
-	mes "trend by introducing my";
-	mes "special new hairstyles!";
-	mes "Give me a ^FF0000New Style Coupon^000000,";
-	mes "and I'll change your hair~";
-	next;
-	if (Sex == 1) {
-		mes "[Kaniki]";
-		mes "I have two special";
-		mes "hairstyles for men, the";
-		mes "Emergency Heal Perm";
-		mes "and the Aura Blade Cut.";
-		mes "and aura blade cut.";
-		next;
-		cutin "hair_m_24.bmp",4;
-		mes "[Kaniki]";
-		mes "This is the Emergency";
-		mes "Heal Perm. It's a brand";
-		mes "new style I invented recently.";
-		mes "What do you think? Cool, huh?";
-		next;
-		cutin "",255;
-		cutin "hair_m_25.bmp",4;
-		mes "[Kaniki]";
-		mes "Now this is the Aura";
-		mes "Blade Cut. You haven't";
-		mes "seen anything like it";
-		mes "before, haven't you?";
-		next;
-		cutin "",255;
-	}else{
-		mes "[Kaniki]";
-		mes "I have two new hairstyles for";
-		mes "women, the Assumptio Perm";
-		mes "and the Soul Changer Cut.";
-		mes "Do you want to see how";
-		mes "these styles look?";
-		next;
-		cutin "hair_f_24.bmp",4;
-		mes "[Kaniki]";
-		mes "This is the Assumptio";
-		mes "Perm. It'd really good";
-		mes "on you, wouldn't it?";
-		next;
-		cutin "",255;
-		cutin "hair_f_25.bmp",4;
-		mes "[Kaniki]";
-		mes "Next is the Soul";
-		mes "Changer Cut. What do";
-		mes "you think? Isn't it nice?";
-		next;
-		cutin "",255;
-	}
-	mes "[Kaniki]";
-	mes "Have you decided";
-	mes "if you'd like me to";
-	mes "change your hairstyle?";
-	next;
-	if(select("Change Hairstyle:Don't Change") == 1) {
-		if (countitem(7622) > 0) {
-			mes "[Kaniki]";
-			mes "Great, you brought";
-			mes "a New Style Coupon!";
-			mes "Alright, which hairstyle";
-			mes "did you want to have?";
-			next;
-			if (Sex == 1) {
-				if(select("Emergency Heal Perm:Aura Blade Cut") == 1) {
-					delitem 7622,1;	// New_Style_Coupon
-					setlook 1,24;
-				}else{
-					delitem 7622,1;	// New_Style_Coupon
-					setlook 1,25;
-				}
-			}else{
-				if(select("Assumptio Perm:Soul Changer Cut") == 1) {
-					delitem 7622,1;	// New_Style_Coupon
-					setlook 1,24;
-				}else{
-					delitem 7622,1;	// New_Style_Coupon
-					setlook 1,25;
-				}
-			}
-			mes "[Kaniki]";
-			mes "There--! It's done!";
-			mes "How do you like your";
-			mes "new hair? Well, I hope";
-			mes "to see you again. Take care!";
-			close;
-		}else{
-			mes "[Kaniki]";
-			mes "I'm sorry, but I can";
-			mes "only provide my hairstyling";
-			mes "service if you bring a New";
-			mes "Style Coupon. Please come";
-			mes "back to me after you manage to";
-			mes "get one of those coupons, okay?";
-			close;
-		}
-	}
-	mes "[Kaniki]";
-	mes "Really? Oh, that's too bad.";
-	mes "Well, if you ever change your";
-	mes "mind about updating your";
-	mes "hairstyle, come back";
-	mes "and let me know, okay?";
-	close;
+//===== eAthena Script ======================================= 
+//= Cash Hair Stylist
+//===== By: ================================================== 
+//= Kisuka
+//===== Current Version: ===================================== 
+//= 1.0
+//===== Compatible With: ===================================== 
+//= eAthena SVN
+//===== Description: ========================================= 
+//= Exchange cash item, New_Style_Coupon, for new hair styles.
+//===== Additional Comments: ================================= 
+//= 1.0 First Version. [Kisuka]
+//============================================================
+
+itemmall,19,74,5	script	Stylist#cash	91,{
+	mes "[Stylist]";
+	mes "Hey, I'm Kaniki.";
+	mes "I'm here to start a new";
+	mes "trend by introducing my";
+	mes "special new hairstyles!";
+	mes "Give me a ^FF0000New Style Coupon^000000,";
+	mes "and I'll change your hair~";
+	next;
+	if (Sex == 1) {
+		mes "[Kaniki]";
+		mes "I have two special";
+		mes "hairstyles for men, the";
+		mes "Emergency Heal Perm";
+		mes "and the Aura Blade Cut.";
+		mes "and aura blade cut.";
+		next;
+		cutin "hair_m_24.bmp",4;
+		mes "[Kaniki]";
+		mes "This is the Emergency";
+		mes "Heal Perm. It's a brand";
+		mes "new style I invented recently.";
+		mes "What do you think? Cool, huh?";
+		next;
+		cutin "",255;
+		cutin "hair_m_25.bmp",4;
+		mes "[Kaniki]";
+		mes "Now this is the Aura";
+		mes "Blade Cut. You haven't";
+		mes "seen anything like it";
+		mes "before, haven't you?";
+		next;
+		cutin "",255;
+	}else{
+		mes "[Kaniki]";
+		mes "I have two new hairstyles for";
+		mes "women, the Assumptio Perm";
+		mes "and the Soul Changer Cut.";
+		mes "Do you want to see how";
+		mes "these styles look?";
+		next;
+		cutin "hair_f_24.bmp",4;
+		mes "[Kaniki]";
+		mes "This is the Assumptio";
+		mes "Perm. It'd really good";
+		mes "on you, wouldn't it?";
+		next;
+		cutin "",255;
+		cutin "hair_f_25.bmp",4;
+		mes "[Kaniki]";
+		mes "Next is the Soul";
+		mes "Changer Cut. What do";
+		mes "you think? Isn't it nice?";
+		next;
+		cutin "",255;
+	}
+	mes "[Kaniki]";
+	mes "Have you decided";
+	mes "if you'd like me to";
+	mes "change your hairstyle?";
+	next;
+	if(select("Change Hairstyle:Don't Change") == 1) {
+		if (countitem(7622) > 0) {
+			mes "[Kaniki]";
+			mes "Great, you brought";
+			mes "a New Style Coupon!";
+			mes "Alright, which hairstyle";
+			mes "did you want to have?";
+			next;
+			if (Sex == 1) {
+				if(select("Emergency Heal Perm:Aura Blade Cut") == 1) {
+					delitem 7622,1;	// New_Style_Coupon
+					setlook 1,24;
+				}else{
+					delitem 7622,1;	// New_Style_Coupon
+					setlook 1,25;
+				}
+			}else{
+				if(select("Assumptio Perm:Soul Changer Cut") == 1) {
+					delitem 7622,1;	// New_Style_Coupon
+					setlook 1,24;
+				}else{
+					delitem 7622,1;	// New_Style_Coupon
+					setlook 1,25;
+				}
+			}
+			mes "[Kaniki]";
+			mes "There--! It's done!";
+			mes "How do you like your";
+			mes "new hair? Well, I hope";
+			mes "to see you again. Take care!";
+			close;
+		}else{
+			mes "[Kaniki]";
+			mes "I'm sorry, but I can";
+			mes "only provide my hairstyling";
+			mes "service if you bring a New";
+			mes "Style Coupon. Please come";
+			mes "back to me after you manage to";
+			mes "get one of those coupons, okay?";
+			close;
+		}
+	}
+	mes "[Kaniki]";
+	mes "Really? Oh, that's too bad.";
+	mes "Well, if you ever change your";
+	mes "mind about updating your";
+	mes "hairstyle, come back";
+	mes "and let me know, okay?";
+	close;
 }

+ 1 - 1
readme/gmcommands.html

@@ -96,7 +96,7 @@ commands are broken and don't work properly.
 											<td id="midtext">
 											</td>
 											<td id="righttext" valign="top">
-<iframe src="../conf-tmpl/help.txt" name="Help" title="eAthena Gm Commands" marginwidth="10" marginheight="10" frameborder="0" height="500" width="100%"></iframe>
+<iframe src="../conf/help.txt" name="Help" title="eAthena Gm Commands" marginwidth="10" marginheight="10" frameborder="0" height="500" width="100%"></iframe>
 
 
 

+ 1 - 1
readme/resources.html

@@ -89,7 +89,7 @@
 										<tr>
 											<td id="lefttext" valign="top">
 <h1>Official Sources</h1>
-<b><a href="http://eathena.deltaanime.net">http://eathena.deltaanime.net</a></b> 
+<b><a href="http://www.eathena.ws">http://www.eathena.ws</a></b> 
 	Our Official Webpage.<br>
 <b><a href="http://forum.asb-sakray.net">http://forum.asb-sakray.net</a></b>
 	Aegis Support Board.<br>

+ 1 - 1
sql-files/mob_db.sql

@@ -1196,7 +1196,7 @@ REPLACE INTO `mob_db` VALUES (2074,'CURUPIRA','Curupira','Curupira',68,8669,0,12
 # REPLACE INTO `mob_db` VALUES (2079,'CRYSTAL_H','Crystal','Crystal',1,50,0,0,0,1,7,10,0,5,1,1,1,1,6,30,10,12,1,3,21,0x120,400,1872,672,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
 # REPLACE INTO `mob_db` VALUES (2080,'CRYSTAL_L','Crystal','Crystal',1,50,0,0,0,1,7,10,0,5,1,1,1,1,6,30,10,12,1,3,21,0x120,400,1872,672,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
 # REPLACE INTO `mob_db` VALUES (2081,'E_HYDRA','Hydra','Hydra',1,50,0,0,0,1,7,10,0,5,1,1,1,1,6,30,10,12,1,3,21,0x120,400,1872,672,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
-REPLACE INTO `mob_db` VALUES (2082,'F_PIRANHA','Piranha','Piranha',75,4131,0,0,0,1,41,182,7,12,69,45,30,30,66,35,10,12,2,5,61,0x3885,200,1968,768,384,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0//2083');
+REPLACE INTO `mob_db` VALUES (2082,'F_PIRANHA','Piranha','Piranha',75,4131,0,0,0,1,41,182,7,12,69,45,30,30,66,35,10,12,2,5,61,0x3885,200,1968,768,384,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
 # REPLACE INTO `mob_db` VALUES (2084,'HORN_SCARABA2','Scaraba','Scaraba',1,50,0,0,0,1,7,10,0,5,1,1,1,1,6,30,10,12,1,3,21,0x120,400,1872,672,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
 # REPLACE INTO `mob_db` VALUES (2085,'ANTLER_SCARABA','Antler Scaraba','Antler Scaraba',1,50,0,0,0,1,7,10,0,5,1,1,1,1,6,30,10,12,1,3,21,0x120,400,1872,672,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
 # REPLACE INTO `mob_db` VALUES (2086,'RAKE_SCARABA','Rake Scaraba','Rake Scaraba',1,50,0,0,0,1,7,10,0,5,1,1,1,1,6,30,10,12,1,3,21,0x120,400,1872,672,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);

+ 2 - 2
sql-files/upgrade_svn14036.sql

@@ -1,3 +1,3 @@
-ALTER TABLE `quest` DROP `mob1`;
-ALTER TABLE `quest` DROP `mob2`;
+ALTER TABLE `quest` DROP `mob1`;
+ALTER TABLE `quest` DROP `mob2`;
 ALTER TABLE `quest` DROP `mob3`;

+ 1 - 1
src/map/battle.c

@@ -3866,7 +3866,7 @@ static const struct _battle_data {
 	{ "at_timeout",                         &battle_config.at_timeout,                      0,      0,      INT_MAX,        },
 	{ "homunculus_autoloot",                &battle_config.homunculus_autoloot,             0,      0,      1,              },
 	{ "idle_no_autoloot",                   &battle_config.idle_no_autoloot,                0,      0,      INT_MAX,        },
-	{ "max_guild_alliance",                 &battle_config.max_guild_alliance,              3,      1,      3,              },
+	{ "max_guild_alliance",                 &battle_config.max_guild_alliance,              3,      0,      3,              },
 	{ "ksprotection",                       &battle_config.ksprotection,                    5000,   0,      INT_MAX,        },
 	{ "auction_feeperhour",                 &battle_config.auction_feeperhour,              12000,  0,      INT_MAX,        },
 	{ "auction_maximumprice",               &battle_config.auction_maximumprice,            500000000, 0,   MAX_ZENY,       },

+ 452 - 452
src/map/instance.c

@@ -1,452 +1,452 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-#include "../common/cbasetypes.h"
-#include "../common/socket.h"
-#include "../common/timer.h"
-#include "../common/malloc.h"
-#include "../common/version.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/strlib.h"
-#include "../common/utils.h"
-#include "../common/db.h"
-
-#include "clif.h"
-#include "instance.h"
-#include "map.h"
-#include "npc.h"
-#include "party.h"
-#include "pc.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <time.h>
-
-int instance_start = 0; // To keep the last index + 1 of normal map inserted in the map[ARRAY]
-struct s_instance instance[MAX_INSTANCE];
-
-/*--------------------------------------
- * name : instance name
- * Return value could be
- * -4 = already exists | -3 = no free instances | -2 = missing parameter | -1 = invalid type
- * On success return instance_id
- *--------------------------------------*/
-int instance_create(int party_id, const char *name)
-{
-	int i;
-	struct party_data *p = NULL;
-
-	if( !party_id || !name )
-	{
-		ShowError("map_instance_create: missing parameter.\n");
-		return -2;
-	}
-
-	p = party_search(party_id);
-	if( !p || p->instance_id )
-		return -4; // Party already instancing
-
-	// Searching a Free Instance
-	// 0 is ignored as this mean "no instance" on maps
-	ARR_FIND(1, MAX_INSTANCE, i, instance[i].state == INSTANCE_FREE);
-	if( i == MAX_INSTANCE )
-	{
-		ShowError("map_instance_create: no free instances, consider increasing MAX_INSTANCE.\n");
-		return -3;
-	}
-
-	instance[i].state = INSTANCE_IDLE;
-	instance[i].instance_id = i;
-	instance[i].idle_timer = INVALID_TIMER;
-	instance[i].idle_timeout = instance[i].idle_timeoutval = 0;
-	instance[i].progress_timer = INVALID_TIMER;
-	instance[i].progress_timeout = instance[i].progress_timeoutval = 0;
-	instance[i].users = 0;
-	instance[i].party_id = party_id;
-	instance[i].ivar = NULL;
-	instance[i].svar = NULL;
-
-	memcpy( instance[i].name, name, sizeof(instance[i].name) );
-	memset( instance[i].map, 0x00, sizeof(instance[i].map) );
-	p->instance_id = i;
-
-	clif_instance(i, 1, 0); // Start instancing window
-	ShowInfo("[Instance] Created: %s.\n", name);
-	return i;
-}
-
-/*--------------------------------------
- * Add a map to the instance using src map "name"
- *--------------------------------------*/
-int instance_add_map(const char *name, int instance_id, bool usebasename)
-{
-	int m = map_mapname2mapid(name), i, im = -1;
-	size_t num_cell, size;
-
-	if( m < 0 )
-		return -1; // source map not found
-		
-	if( instance[instance_id].state == INSTANCE_FREE )
-	{
-		ShowError("instance_add_map: trying to attach '%s' map to non-existing instance %d.\n", name, instance_id);
-		return -1;
-	}
-	if( instance[instance_id].num_map >= MAX_MAP_PER_INSTANCE )
-	{
-		ShowError("instance_add_map: trying to add '%s' map to instance %d (%s) failed. Please increase MAX_MAP_PER_INSTANCE.\n", name, instance_id, instance[instance_id].name);
-		return -2;
-	}
-	if( map[m].instance_id != 0 )
-	{ // Source map already belong to a Instance.
-		ShowError("instance_add_map: trying to instance already instanced map %s.\n", name);
-		return -4;
-	}
-
-	ARR_FIND( instance_start, map_num, i, !map[i].name[0] ); // Searching for a Free Map
-	if( i < map_num ) im = i; // Unused map found (old instance)
-	else if( map_num - 1 >= MAX_MAP_PER_SERVER )
-	{ // No more free maps
-		ShowError("instance_add_map: no more free space to create maps on this server.\n");
-		return -5;
-	}
-	else im = map_num++; // Using next map index
-
-	memcpy( &map[im], &map[m], sizeof(struct map_data) ); // Copy source map
-	snprintf(map[im].name, MAP_NAME_LENGTH, (usebasename ? "%.3d#%s" : "%.3d%s"), instance_id, name); // Generate Name for Instance Map
-	map[im].index = mapindex_addmap(-1, map[im].name); // Add map index
-
-	if( !map[im].index )
-	{
-		map[im].name[0] = '\0';
-		ShowError("instance_add_map: no more free map indexes.\n");
-		return -3; // No free map index
-	}	
-
-	// Reallocate cells
-	num_cell = map[im].xs * map[im].ys;
-	CREATE( map[im].cell, struct mapcell, num_cell );
-	memcpy( map[im].cell, map[m].cell, num_cell * sizeof(struct mapcell) );
-
-	size = map[im].bxs * map[im].bys * sizeof(struct block_list*);
-	map[im].block = (struct block_list**)aCalloc(size, 1);
-	map[im].block_mob = (struct block_list**)aCalloc(size, 1);
-
-	memset(map[im].npc, 0x00, sizeof(map[i].npc));
-	map[im].npc_num = 0;
-
-	memset(map[im].moblist, 0x00, sizeof(map[im].moblist));
-	map[im].mob_delete_timer = INVALID_TIMER;
-
-	map[im].m = im;
-	map[im].instance_id = instance_id;
-	map[im].instance_src_map = m;
-	map[m].flag.src4instance = 1; // Flag this map as a src map for instances
-
-	instance[instance_id].map[instance[instance_id].num_map++] = im; // Attach to actual instance
-	map_addmap2db(&map[im]);
-
-	return im;
-}
-
-/*--------------------------------------
- * m : source map of this instance
- * party_id : source party of this instance
- * type : result (0 = map id | 1 = instance id)
- *--------------------------------------*/
-int instance_map2imap(int m, int instance_id)
-{
- 	int i;
-	for( i = 0; i < instance[instance_id].num_map; i++ )
- 	{
-		if( instance[instance_id].map[i] && map[instance[instance_id].map[i]].instance_src_map == m )
-			return instance[instance_id].map[i];
- 	}
- 	return -1;
-}
-
-/*--------------------------------------
- * m : source map
- * instance_id : where to search
- * result : mapid of map "m" in this instance
- *--------------------------------------*/
-int instance_mapid2imapid(int m, int instance_id)
-{
-	int i, max;
-	if( map[m].flag.src4instance == 0 )
-		return m; // not instances found for this map
-	else if( map[m].instance_id )
-	{ // This map is a instance, not a src map instance
-		ShowError("map_instance_mapid2imapid: already instanced (%d / %d)\n", m, instance_id);
-		return -1;
-	}
-
-	if( instance_id <= 0 )
-		return -1;
-
-	max = instance[instance_id].num_map;
-
-	for( i = 0; i < max; i++ )
-		if( map[instance[instance_id].map[i]].instance_src_map == m )
-			return instance[instance_id].map[i];
-
-	return -1;
-}
-
-/*--------------------------------------
- * map_instance_map_npcsub
- * Used on Init instance. Duplicates each script on source map
- *--------------------------------------*/
-int instance_map_npcsub(struct block_list* bl, va_list args)
-{
-	struct npc_data* nd = (struct npc_data*)bl;
-	int m = va_arg(args, int); // Destination Map
-
-	npc_duplicate4instance(nd, m);
-	return 1;
-}
-
-/*--------------------------------------
- * Init all map on the instance. Npcs are created here
- *--------------------------------------*/
-void instance_init(int instance_id)
-{
-	int i;
-
-	if( !instance_id )
-		return; // nothing to do
-
-	for( i = 0; i < instance[instance_id].num_map; i++ )
-		map_foreachinmap(instance_map_npcsub, map[instance[instance_id].map[i]].instance_src_map, BL_NPC, instance[instance_id].map[i]);
-
-	instance[instance_id].state = INSTANCE_BUSSY;
-	ShowInfo("[Instance] Initialized %s.\n", instance[instance_id].name);
-}
-
-/*--------------------------------------
- * Used on instance deleting process.
- * Warps all players on each instance map to its save points.
- *--------------------------------------*/
-int instance_del_load(struct map_session_data* sd, va_list args)
-{
-	int m = va_arg(args,int);
-	if( !sd || sd->bl.m != m )
-		return 0;
-
-	pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 0);
-	return 1;
-}
-
-/*--------------------------------------
- * Removes a simple instance map
- *--------------------------------------*/
-void instance_del_map(int m)
-{
-	int sm, i;
-	if( m <= 0 || !map[m].instance_id )
-	{
-		ShowError("Tried to remove non-existing instance map (%d)\n", m);
-		return;
-	}
-
-	sm = map[m].instance_src_map;
-	map_foreachpc(instance_del_load, m);
-	map_foreachinmap(cleanup_sub, m, BL_ALL);
-
-	if( map[m].mob_delete_timer != INVALID_TIMER )
-		delete_timer(map[m].mob_delete_timer, map_removemobs_timer);
-
-	mapindex_removemap( map[m].index );
-
-	// Free memory
-	aFree(map[m].cell);
-	aFree(map[m].block);
-	aFree(map[m].block_mob);
-
-	// Remove from instance
-	for( i = 0; i < instance[map[m].instance_id].num_map; i++ )
-	{
-		if( instance[map[m].instance_id].map[i] == m )
-		{
-			instance[map[m].instance_id].num_map--;
-			for( ; i < instance[map[m].instance_id].num_map; i++ )
-				instance[map[m].instance_id].map[i] = instance[map[m].instance_id].map[i+1];
-			i = -1;
-			break;
-		}
-	}
-	if( i == instance[map[m].instance_id].num_map )
-		ShowError("map_instance_del: failed to remove %s from instance list (%s): %d\n", map[m].name, instance[map[m].instance_id].name, m);
-
-	map_removemapdb(&map[m]);
-	memset(&map[m], 0x00, sizeof(map[0]));
-}
-
-/*--------------------------------------
- * Used for instance variables. Clean each variable from memory.
- *--------------------------------------*/
-void instance_destroy_freesvar(void *key, void *data, va_list args)
-{
-	if( data ) aFree(data);
-}
-
-/*--------------------------------------
- * Timer to destroy instance by process or idle
- *--------------------------------------*/
-int instance_destroy_timer(int tid, unsigned int tick, int id, intptr data)
-{
-	instance_destroy(id);
-	return 0;
-}
-
-/*--------------------------------------
- * Removes a instance, all its maps and npcs.
- *--------------------------------------*/
-void instance_destroy(int instance_id)
-{
-	int last = 0, type;
-	struct party_data *p;
-	time_t now = time(NULL);
-
-	if( !instance_id || instance[instance_id].state == INSTANCE_FREE )
-		return; // nothing to do
-
-	if( instance[instance_id].progress_timeout && instance[instance_id].progress_timeout <= now )
-		type = 1;
-	else if( instance[instance_id].idle_timeout && instance[instance_id].idle_timeout <= now )
-		type = 2;
-	else
-		type = 3;
-
-	clif_instance(instance_id, 5, type); // Report users this instance has been destroyed
-
-	while( instance[instance_id].num_map && last != instance[instance_id].map[0] )
-	{ // Remove all maps from instance
-		last = instance[instance_id].map[0];
-		instance_del_map( instance[instance_id].map[0] );
-	}
-
-	if( instance[instance_id].ivar )
-		linkdb_final( &instance[instance_id].ivar ); // Remove numeric vars
-
-	if( instance[instance_id].svar )
-	{ // Remove string vars
-		linkdb_foreach( &instance[instance_id].svar, instance_destroy_freesvar );
-		linkdb_final( &instance[instance_id].svar );
-	}
-
-	if( instance[instance_id].progress_timer != INVALID_TIMER )
-		delete_timer( instance[instance_id].progress_timer, instance_destroy_timer);
-	if( instance[instance_id].idle_timer != INVALID_TIMER )
-		delete_timer( instance[instance_id].idle_timer, instance_destroy_timer);
-
-	instance[instance_id].ivar = NULL;
-	instance[instance_id].svar = NULL;
-
-	if( instance[instance_id].party_id && (p = party_search(instance[instance_id].party_id)) != NULL )
-		p->instance_id = 0; // Update Party information
-
-	ShowInfo("[Instance] Destroyed %s.\n", instance[instance_id].name);
-	memset( &instance[instance_id], 0x00, sizeof(instance[0]) );
-
-	instance[instance_id].state = INSTANCE_FREE;
-}
-
-/*--------------------------------------
- * Checks if there are users in the instance or not to start idle timer
- *--------------------------------------*/
-void instance_check_idle(int instance_id)
-{
-	bool idle = true;
-	time_t now = time(NULL);
-
-	if( !instance_id || instance[instance_id].idle_timeoutval == 0 )
-		return;
-
-	if( instance[instance_id].users )
-		idle = false;
-
-	if( instance[instance_id].idle_timer != INVALID_TIMER && !idle )
-	{
-		delete_timer(instance[instance_id].idle_timer, instance_destroy_timer);
-		instance[instance_id].idle_timer = INVALID_TIMER;
-		instance[instance_id].idle_timeout = 0;
-		clif_instance(instance_id, 3, 0); // Notify instance users normal instance expiration
-	}
-	else if( instance[instance_id].idle_timer == INVALID_TIMER && idle )
-	{
-		instance[instance_id].idle_timeout = now + instance[instance_id].idle_timeoutval;
-		instance[instance_id].idle_timer = add_timer( gettick() + (unsigned int)instance[instance_id].idle_timeoutval * 1000, instance_destroy_timer, instance_id, 0);
-		clif_instance(instance_id, 4, 0); // Notify instance users it will be destroyed of no user join it again in "X" time
-	}
-}
-
-/*--------------------------------------
- * Set instance Timers
- *--------------------------------------*/
-void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsigned int idle_timeout)
-{
-	time_t now = time(0);
-
-	if( !instance_id )
-		return;
-		
-	if( instance[instance_id].progress_timer != INVALID_TIMER )
-		delete_timer( instance[instance_id].progress_timer, instance_destroy_timer);
-	if( instance[instance_id].idle_timer != INVALID_TIMER )
-		delete_timer( instance[instance_id].idle_timer, instance_destroy_timer);
-
-	if( progress_timeout )
-	{
-		instance[instance_id].progress_timeoutval = progress_timeout;
-		instance[instance_id].progress_timeout = now + progress_timeout;
-		instance[instance_id].progress_timer = add_timer( gettick() + progress_timeout * 1000, instance_destroy_timer, instance_id, 0);
-	}
-	else
-	{
-		instance[instance_id].progress_timeoutval = 0;
-		instance[instance_id].progress_timeout = 0;
-		instance[instance_id].progress_timer = INVALID_TIMER;
-	}
-		
-	if( idle_timeout )
-	{
-		instance[instance_id].idle_timeoutval = idle_timeout;
-		instance[instance_id].idle_timer = INVALID_TIMER;
-		instance_check_idle(instance_id);
-	}
-	else
-	{
-		instance[instance_id].idle_timeoutval = 0;
-		instance[instance_id].idle_timeout = 0;
-		instance[instance_id].idle_timer = INVALID_TIMER;
-	}
-
-	if( instance[instance_id].idle_timer == INVALID_TIMER && instance[instance_id].progress_timer != INVALID_TIMER )
-		clif_instance(instance_id, 3, 0);
-}
-
-/*--------------------------------------
- * Checks if sd in on a instance and should be kicked from it
- *--------------------------------------*/
-void instance_check_kick(struct map_session_data *sd)
-{
-	int m = sd->bl.m;
-
-	clif_instance_leave(sd->fd);
-	if( map[m].instance_id )
-	{ // User was on the instance map
-		if( map[m].save.map )
-			pc_setpos(sd, map[m].save.map, map[m].save.x, map[m].save.y, 3);
-		else
-			pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 3);
-	}
-}
-
-void do_init_instance(void)
-{
-	memset(instance, 0x00, sizeof(instance));
-	add_timer_func_list(instance_destroy_timer, "instance_destroy_timer");
-}
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+#include "../common/cbasetypes.h"
+#include "../common/socket.h"
+#include "../common/timer.h"
+#include "../common/malloc.h"
+#include "../common/version.h"
+#include "../common/nullpo.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../common/utils.h"
+#include "../common/db.h"
+
+#include "clif.h"
+#include "instance.h"
+#include "map.h"
+#include "npc.h"
+#include "party.h"
+#include "pc.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <time.h>
+
+int instance_start = 0; // To keep the last index + 1 of normal map inserted in the map[ARRAY]
+struct s_instance instance[MAX_INSTANCE];
+
+/*--------------------------------------
+ * name : instance name
+ * Return value could be
+ * -4 = already exists | -3 = no free instances | -2 = missing parameter | -1 = invalid type
+ * On success return instance_id
+ *--------------------------------------*/
+int instance_create(int party_id, const char *name)
+{
+	int i;
+	struct party_data *p = NULL;
+
+	if( !party_id || !name )
+	{
+		ShowError("map_instance_create: missing parameter.\n");
+		return -2;
+	}
+
+	p = party_search(party_id);
+	if( !p || p->instance_id )
+		return -4; // Party already instancing
+
+	// Searching a Free Instance
+	// 0 is ignored as this mean "no instance" on maps
+	ARR_FIND(1, MAX_INSTANCE, i, instance[i].state == INSTANCE_FREE);
+	if( i == MAX_INSTANCE )
+	{
+		ShowError("map_instance_create: no free instances, consider increasing MAX_INSTANCE.\n");
+		return -3;
+	}
+
+	instance[i].state = INSTANCE_IDLE;
+	instance[i].instance_id = i;
+	instance[i].idle_timer = INVALID_TIMER;
+	instance[i].idle_timeout = instance[i].idle_timeoutval = 0;
+	instance[i].progress_timer = INVALID_TIMER;
+	instance[i].progress_timeout = instance[i].progress_timeoutval = 0;
+	instance[i].users = 0;
+	instance[i].party_id = party_id;
+	instance[i].ivar = NULL;
+	instance[i].svar = NULL;
+
+	memcpy( instance[i].name, name, sizeof(instance[i].name) );
+	memset( instance[i].map, 0x00, sizeof(instance[i].map) );
+	p->instance_id = i;
+
+	clif_instance(i, 1, 0); // Start instancing window
+	ShowInfo("[Instance] Created: %s.\n", name);
+	return i;
+}
+
+/*--------------------------------------
+ * Add a map to the instance using src map "name"
+ *--------------------------------------*/
+int instance_add_map(const char *name, int instance_id, bool usebasename)
+{
+	int m = map_mapname2mapid(name), i, im = -1;
+	size_t num_cell, size;
+
+	if( m < 0 )
+		return -1; // source map not found
+		
+	if( instance[instance_id].state == INSTANCE_FREE )
+	{
+		ShowError("instance_add_map: trying to attach '%s' map to non-existing instance %d.\n", name, instance_id);
+		return -1;
+	}
+	if( instance[instance_id].num_map >= MAX_MAP_PER_INSTANCE )
+	{
+		ShowError("instance_add_map: trying to add '%s' map to instance %d (%s) failed. Please increase MAX_MAP_PER_INSTANCE.\n", name, instance_id, instance[instance_id].name);
+		return -2;
+	}
+	if( map[m].instance_id != 0 )
+	{ // Source map already belong to a Instance.
+		ShowError("instance_add_map: trying to instance already instanced map %s.\n", name);
+		return -4;
+	}
+
+	ARR_FIND( instance_start, map_num, i, !map[i].name[0] ); // Searching for a Free Map
+	if( i < map_num ) im = i; // Unused map found (old instance)
+	else if( map_num - 1 >= MAX_MAP_PER_SERVER )
+	{ // No more free maps
+		ShowError("instance_add_map: no more free space to create maps on this server.\n");
+		return -5;
+	}
+	else im = map_num++; // Using next map index
+
+	memcpy( &map[im], &map[m], sizeof(struct map_data) ); // Copy source map
+	snprintf(map[im].name, MAP_NAME_LENGTH, (usebasename ? "%.3d#%s" : "%.3d%s"), instance_id, name); // Generate Name for Instance Map
+	map[im].index = mapindex_addmap(-1, map[im].name); // Add map index
+
+	if( !map[im].index )
+	{
+		map[im].name[0] = '\0';
+		ShowError("instance_add_map: no more free map indexes.\n");
+		return -3; // No free map index
+	}	
+
+	// Reallocate cells
+	num_cell = map[im].xs * map[im].ys;
+	CREATE( map[im].cell, struct mapcell, num_cell );
+	memcpy( map[im].cell, map[m].cell, num_cell * sizeof(struct mapcell) );
+
+	size = map[im].bxs * map[im].bys * sizeof(struct block_list*);
+	map[im].block = (struct block_list**)aCalloc(size, 1);
+	map[im].block_mob = (struct block_list**)aCalloc(size, 1);
+
+	memset(map[im].npc, 0x00, sizeof(map[i].npc));
+	map[im].npc_num = 0;
+
+	memset(map[im].moblist, 0x00, sizeof(map[im].moblist));
+	map[im].mob_delete_timer = INVALID_TIMER;
+
+	map[im].m = im;
+	map[im].instance_id = instance_id;
+	map[im].instance_src_map = m;
+	map[m].flag.src4instance = 1; // Flag this map as a src map for instances
+
+	instance[instance_id].map[instance[instance_id].num_map++] = im; // Attach to actual instance
+	map_addmap2db(&map[im]);
+
+	return im;
+}
+
+/*--------------------------------------
+ * m : source map of this instance
+ * party_id : source party of this instance
+ * type : result (0 = map id | 1 = instance id)
+ *--------------------------------------*/
+int instance_map2imap(int m, int instance_id)
+{
+ 	int i;
+	for( i = 0; i < instance[instance_id].num_map; i++ )
+ 	{
+		if( instance[instance_id].map[i] && map[instance[instance_id].map[i]].instance_src_map == m )
+			return instance[instance_id].map[i];
+ 	}
+ 	return -1;
+}
+
+/*--------------------------------------
+ * m : source map
+ * instance_id : where to search
+ * result : mapid of map "m" in this instance
+ *--------------------------------------*/
+int instance_mapid2imapid(int m, int instance_id)
+{
+	int i, max;
+	if( map[m].flag.src4instance == 0 )
+		return m; // not instances found for this map
+	else if( map[m].instance_id )
+	{ // This map is a instance, not a src map instance
+		ShowError("map_instance_mapid2imapid: already instanced (%d / %d)\n", m, instance_id);
+		return -1;
+	}
+
+	if( instance_id <= 0 )
+		return -1;
+
+	max = instance[instance_id].num_map;
+
+	for( i = 0; i < max; i++ )
+		if( map[instance[instance_id].map[i]].instance_src_map == m )
+			return instance[instance_id].map[i];
+
+	return -1;
+}
+
+/*--------------------------------------
+ * map_instance_map_npcsub
+ * Used on Init instance. Duplicates each script on source map
+ *--------------------------------------*/
+int instance_map_npcsub(struct block_list* bl, va_list args)
+{
+	struct npc_data* nd = (struct npc_data*)bl;
+	int m = va_arg(args, int); // Destination Map
+
+	npc_duplicate4instance(nd, m);
+	return 1;
+}
+
+/*--------------------------------------
+ * Init all map on the instance. Npcs are created here
+ *--------------------------------------*/
+void instance_init(int instance_id)
+{
+	int i;
+
+	if( !instance_id )
+		return; // nothing to do
+
+	for( i = 0; i < instance[instance_id].num_map; i++ )
+		map_foreachinmap(instance_map_npcsub, map[instance[instance_id].map[i]].instance_src_map, BL_NPC, instance[instance_id].map[i]);
+
+	instance[instance_id].state = INSTANCE_BUSSY;
+	ShowInfo("[Instance] Initialized %s.\n", instance[instance_id].name);
+}
+
+/*--------------------------------------
+ * Used on instance deleting process.
+ * Warps all players on each instance map to its save points.
+ *--------------------------------------*/
+int instance_del_load(struct map_session_data* sd, va_list args)
+{
+	int m = va_arg(args,int);
+	if( !sd || sd->bl.m != m )
+		return 0;
+
+	pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 0);
+	return 1;
+}
+
+/*--------------------------------------
+ * Removes a simple instance map
+ *--------------------------------------*/
+void instance_del_map(int m)
+{
+	int sm, i;
+	if( m <= 0 || !map[m].instance_id )
+	{
+		ShowError("Tried to remove non-existing instance map (%d)\n", m);
+		return;
+	}
+
+	sm = map[m].instance_src_map;
+	map_foreachpc(instance_del_load, m);
+	map_foreachinmap(cleanup_sub, m, BL_ALL);
+
+	if( map[m].mob_delete_timer != INVALID_TIMER )
+		delete_timer(map[m].mob_delete_timer, map_removemobs_timer);
+
+	mapindex_removemap( map[m].index );
+
+	// Free memory
+	aFree(map[m].cell);
+	aFree(map[m].block);
+	aFree(map[m].block_mob);
+
+	// Remove from instance
+	for( i = 0; i < instance[map[m].instance_id].num_map; i++ )
+	{
+		if( instance[map[m].instance_id].map[i] == m )
+		{
+			instance[map[m].instance_id].num_map--;
+			for( ; i < instance[map[m].instance_id].num_map; i++ )
+				instance[map[m].instance_id].map[i] = instance[map[m].instance_id].map[i+1];
+			i = -1;
+			break;
+		}
+	}
+	if( i == instance[map[m].instance_id].num_map )
+		ShowError("map_instance_del: failed to remove %s from instance list (%s): %d\n", map[m].name, instance[map[m].instance_id].name, m);
+
+	map_removemapdb(&map[m]);
+	memset(&map[m], 0x00, sizeof(map[0]));
+}
+
+/*--------------------------------------
+ * Used for instance variables. Clean each variable from memory.
+ *--------------------------------------*/
+void instance_destroy_freesvar(void *key, void *data, va_list args)
+{
+	if( data ) aFree(data);
+}
+
+/*--------------------------------------
+ * Timer to destroy instance by process or idle
+ *--------------------------------------*/
+int instance_destroy_timer(int tid, unsigned int tick, int id, intptr data)
+{
+	instance_destroy(id);
+	return 0;
+}
+
+/*--------------------------------------
+ * Removes a instance, all its maps and npcs.
+ *--------------------------------------*/
+void instance_destroy(int instance_id)
+{
+	int last = 0, type;
+	struct party_data *p;
+	time_t now = time(NULL);
+
+	if( !instance_id || instance[instance_id].state == INSTANCE_FREE )
+		return; // nothing to do
+
+	if( instance[instance_id].progress_timeout && instance[instance_id].progress_timeout <= now )
+		type = 1;
+	else if( instance[instance_id].idle_timeout && instance[instance_id].idle_timeout <= now )
+		type = 2;
+	else
+		type = 3;
+
+	clif_instance(instance_id, 5, type); // Report users this instance has been destroyed
+
+	while( instance[instance_id].num_map && last != instance[instance_id].map[0] )
+	{ // Remove all maps from instance
+		last = instance[instance_id].map[0];
+		instance_del_map( instance[instance_id].map[0] );
+	}
+
+	if( instance[instance_id].ivar )
+		linkdb_final( &instance[instance_id].ivar ); // Remove numeric vars
+
+	if( instance[instance_id].svar )
+	{ // Remove string vars
+		linkdb_foreach( &instance[instance_id].svar, instance_destroy_freesvar );
+		linkdb_final( &instance[instance_id].svar );
+	}
+
+	if( instance[instance_id].progress_timer != INVALID_TIMER )
+		delete_timer( instance[instance_id].progress_timer, instance_destroy_timer);
+	if( instance[instance_id].idle_timer != INVALID_TIMER )
+		delete_timer( instance[instance_id].idle_timer, instance_destroy_timer);
+
+	instance[instance_id].ivar = NULL;
+	instance[instance_id].svar = NULL;
+
+	if( instance[instance_id].party_id && (p = party_search(instance[instance_id].party_id)) != NULL )
+		p->instance_id = 0; // Update Party information
+
+	ShowInfo("[Instance] Destroyed %s.\n", instance[instance_id].name);
+	memset( &instance[instance_id], 0x00, sizeof(instance[0]) );
+
+	instance[instance_id].state = INSTANCE_FREE;
+}
+
+/*--------------------------------------
+ * Checks if there are users in the instance or not to start idle timer
+ *--------------------------------------*/
+void instance_check_idle(int instance_id)
+{
+	bool idle = true;
+	time_t now = time(NULL);
+
+	if( !instance_id || instance[instance_id].idle_timeoutval == 0 )
+		return;
+
+	if( instance[instance_id].users )
+		idle = false;
+
+	if( instance[instance_id].idle_timer != INVALID_TIMER && !idle )
+	{
+		delete_timer(instance[instance_id].idle_timer, instance_destroy_timer);
+		instance[instance_id].idle_timer = INVALID_TIMER;
+		instance[instance_id].idle_timeout = 0;
+		clif_instance(instance_id, 3, 0); // Notify instance users normal instance expiration
+	}
+	else if( instance[instance_id].idle_timer == INVALID_TIMER && idle )
+	{
+		instance[instance_id].idle_timeout = now + instance[instance_id].idle_timeoutval;
+		instance[instance_id].idle_timer = add_timer( gettick() + (unsigned int)instance[instance_id].idle_timeoutval * 1000, instance_destroy_timer, instance_id, 0);
+		clif_instance(instance_id, 4, 0); // Notify instance users it will be destroyed of no user join it again in "X" time
+	}
+}
+
+/*--------------------------------------
+ * Set instance Timers
+ *--------------------------------------*/
+void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsigned int idle_timeout)
+{
+	time_t now = time(0);
+
+	if( !instance_id )
+		return;
+		
+	if( instance[instance_id].progress_timer != INVALID_TIMER )
+		delete_timer( instance[instance_id].progress_timer, instance_destroy_timer);
+	if( instance[instance_id].idle_timer != INVALID_TIMER )
+		delete_timer( instance[instance_id].idle_timer, instance_destroy_timer);
+
+	if( progress_timeout )
+	{
+		instance[instance_id].progress_timeoutval = progress_timeout;
+		instance[instance_id].progress_timeout = now + progress_timeout;
+		instance[instance_id].progress_timer = add_timer( gettick() + progress_timeout * 1000, instance_destroy_timer, instance_id, 0);
+	}
+	else
+	{
+		instance[instance_id].progress_timeoutval = 0;
+		instance[instance_id].progress_timeout = 0;
+		instance[instance_id].progress_timer = INVALID_TIMER;
+	}
+		
+	if( idle_timeout )
+	{
+		instance[instance_id].idle_timeoutval = idle_timeout;
+		instance[instance_id].idle_timer = INVALID_TIMER;
+		instance_check_idle(instance_id);
+	}
+	else
+	{
+		instance[instance_id].idle_timeoutval = 0;
+		instance[instance_id].idle_timeout = 0;
+		instance[instance_id].idle_timer = INVALID_TIMER;
+	}
+
+	if( instance[instance_id].idle_timer == INVALID_TIMER && instance[instance_id].progress_timer != INVALID_TIMER )
+		clif_instance(instance_id, 3, 0);
+}
+
+/*--------------------------------------
+ * Checks if sd in on a instance and should be kicked from it
+ *--------------------------------------*/
+void instance_check_kick(struct map_session_data *sd)
+{
+	int m = sd->bl.m;
+
+	clif_instance_leave(sd->fd);
+	if( map[m].instance_id )
+	{ // User was on the instance map
+		if( map[m].save.map )
+			pc_setpos(sd, map[m].save.map, map[m].save.x, map[m].save.y, 3);
+		else
+			pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 3);
+	}
+}
+
+void do_init_instance(void)
+{
+	memset(instance, 0x00, sizeof(instance));
+	add_timer_func_list(instance_destroy_timer, "instance_destroy_timer");
+}

+ 48 - 48
src/map/instance.h

@@ -1,48 +1,48 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-#ifndef _INSTANCE_H_
-#define _INSTANCE_H_
-
-#define MAX_MAP_PER_INSTANCE 10
-#define MAX_INSTANCE 500
-
-typedef enum instance_state { INSTANCE_FREE, INSTANCE_IDLE, INSTANCE_BUSSY } instance_state;
-
-struct s_instance {
-	char name[61]; // Instance Name - required for clif functions.
-	instance_state state;
-	short instance_id;
-	int party_id;
-
-	int map[MAX_MAP_PER_INSTANCE];
-	int num_map;
-	int users;
-
-	struct linkdb_node *ivar, *svar; // Instance Variable for scripts
-	
-	int progress_timer;
-	time_t progress_timeout, progress_timeoutval;
-
-	int idle_timer;
-	time_t idle_timeout, idle_timeoutval;
-};
-
-extern int instance_start;
-extern struct s_instance instance[MAX_INSTANCE];
-
-int instance_create(int party_id, const char *name);
-int instance_add_map(const char *name, int instance_id, bool usebasename);
-void instance_del_map(int m);
-int instance_map2imap(int m, int instance_id);
-int instance_mapid2imapid(int m, int instance_id);
-void instance_destroy(int instance_id);
-void instance_init(int instance_id);
-
-void instance_check_idle(int instance_id);
-void instance_check_kick(struct map_session_data *sd);
-void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsigned int idle_timeout);
-
-void do_init_instance();
-
-#endif
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+#ifndef _INSTANCE_H_
+#define _INSTANCE_H_
+
+#define MAX_MAP_PER_INSTANCE 10
+#define MAX_INSTANCE 500
+
+typedef enum instance_state { INSTANCE_FREE, INSTANCE_IDLE, INSTANCE_BUSSY } instance_state;
+
+struct s_instance {
+	char name[61]; // Instance Name - required for clif functions.
+	instance_state state;
+	short instance_id;
+	int party_id;
+
+	int map[MAX_MAP_PER_INSTANCE];
+	int num_map;
+	int users;
+
+	struct linkdb_node *ivar, *svar; // Instance Variable for scripts
+	
+	int progress_timer;
+	time_t progress_timeout, progress_timeoutval;
+
+	int idle_timer;
+	time_t idle_timeout, idle_timeoutval;
+};
+
+extern int instance_start;
+extern struct s_instance instance[MAX_INSTANCE];
+
+int instance_create(int party_id, const char *name);
+int instance_add_map(const char *name, int instance_id, bool usebasename);
+void instance_del_map(int m);
+int instance_map2imap(int m, int instance_id);
+int instance_mapid2imapid(int m, int instance_id);
+void instance_destroy(int instance_id);
+void instance_init(int instance_id);
+
+void instance_check_idle(int instance_id);
+void instance_check_kick(struct map_session_data *sd);
+void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsigned int idle_timeout);
+
+void do_init_instance();
+
+#endif