@LabelIndex 37321
@StringIndex 6535
class 0 royal_rush_lock : default_npc {
parameter:
	string	fnHi = "black001.htm";
	string	fnNoItem = "";
	int	RoomIDX = 1;
	string	DoorName = "royal_rush_door_1a";
	int	AfflictMonster = 1020130;
	int	SpawnX1 = 0;
	int	SpawnY1 = 0;
	int	SpawnZ1 = 0;
	int	SpawnX2 = 0;
	int	SpawnY2 = 0;
	int	SpawnZ2 = 0;
	int	SpawnX3 = 0;
	int	SpawnY3 = 0;
	int	SpawnZ3 = 0;

handler:
	EventHandler CREATED() {
		myself.i_ai0 = 0;
		gg::Castle_GateOpenClose2(DoorName,1);
		myself::AddTimerEx(3000,1000);
	}

	EventHandler TALKED(talker) {
		myself::ShowPage(talker,fnHi);
	}

	EventHandler MENU_SELECTED(talker,ask,reply,i0) {
		if( gg::OwnItemCount(talker,7260) != 0 ) {
			myself::DeleteItem1(talker,7260,1);
			gg::Castle_GateOpenClose2(DoorName,0);
			if( myself.i_ai0 == 0 ) {
				myself::AddTimerEx(3001,( 1000 * 15 ));
				myself.i_ai0 = 1;
			}
			if( SpawnX1 != 0 ) {
				gg::SendScriptEvent(myself.boss,( 1000 + RoomIDX ),0);
				i0 = gg::Rand(3);
				switch(i0) {
					case 0: {
						myself::CreateOnePrivateEx(1018244,"d1_afflict_bomb",10,5,SpawnX1,SpawnY1,SpawnZ1,32768,1,0,0);
						myself::CreateOnePrivateEx(1018245,"d1_afflict_heal",10,5,SpawnX2,SpawnY2,SpawnZ2,32768,2,0,0);
						myself::CreateOnePrivateEx(1018246,"d1_afflict_debuff",10,5,SpawnX3,SpawnY2,SpawnZ3,32768,3,0,0);
						break;
					}
					case 1: {
						myself::CreateOnePrivateEx(1018244,"d1_afflict_bomb",10,5,SpawnX2,SpawnY2,SpawnZ2,32768,1,0,0);
						myself::CreateOnePrivateEx(1018245,"d1_afflict_heal",10,5,SpawnX3,SpawnY3,SpawnZ3,32768,2,0,0);
						myself::CreateOnePrivateEx(1018246,"d1_afflict_debuff",10,5,SpawnX1,SpawnY1,SpawnZ1,32768,3,0,0);
						break;
					}
					case 2: {
						myself::CreateOnePrivateEx(1018244,"d1_afflict_bomb",10,5,SpawnX3,SpawnY3,SpawnZ3,32768,1,0,0);
						myself::CreateOnePrivateEx(1018245,"d1_afflict_heal",10,5,SpawnX1,SpawnY1,SpawnZ1,32768,2,0,0);
						myself::CreateOnePrivateEx(1018246,"d1_afflict_debuff",10,5,SpawnX2,SpawnY2,SpawnZ2,32768,3,0,0);
						break;
					}
				}
				myself::Shout(gg::MakeFString(1000502,"","","","",""));
			} else {
				gg::SendScriptEvent(myself.boss,( 1000 + myself.sm.param1 ),0);
			}
		} else {
			myself::ShowPage(talker,fnNoItem);
		}
	}

	EventHandler TIMER_FIRED_EX(timer_id,i0,i1) {
		if( timer_id == 3000 ) {
			i0 = gg::GetDateTime(0,4);
			i1 = gg::GetDateTime(0,5);
			if( i0 == 55 && i1 == 0 ) {
				myself.i_ai0 = 0;
				gg::Castle_GateOpenClose2(DoorName,1);
			}
			myself::AddTimerEx(3000,1000);
		}
		if( timer_id == 3001 ) {
			gg::Castle_GateOpenClose2(DoorName,1);
			myself.i_ai0 = 0;
		}
	}

}
