require( "common" ) require( "ID/WarNH/WarNHData" ) require( "ID/WarNH/WarNHFunc" ) require( "ID/WarNH/WarNHRoutine" ) function Main( Field ) cExecCheck( "Main" ) local Var = InstanceField[Field] if Var == nil then InstanceField[Field] = {} Var = InstanceField[Field] Var["MapIndex"] = Field Var["StepControl"] = StepControl Var["StepFunc"] = DummyFunc cSetFieldScript( Var["MapIndex"], SCRIPT_MAIN ) cFieldScriptFunc( Var["MapIndex"], "MapLogin", "PlayerMapLogin" ) end Var["StepControl"]( Var ) Var["StepFunc"]( Var ) end function DummyFunc( Var ) cExecCheck( "DummyFunc" ) end function StepControl( Var ) cExecCheck( "StepControl" ) if Var == nil then return end MapMarking( Var ) -- ¸Ê¸¶Å· ó¸® local CurSec = cCurrentSecond() -- ÃʱâÈ­, ±âº» ¸÷ µµ¾î ¸®Á¨ if Var["Step"] == nil then Var["Step"] = 1 Var["StepFunc"] = InitInstanceDungeon -- ÃʱâÈ­ ³»¿ëÀº ÀÌ ÇÔ¼ö¿¡¼­ È®ÀÎ return end -- ¾ÆÀ̸® ±¸ÃâºÎÅÍ ½ÃÀÛ. -- ElementClearEvent -> CenterSetting -> NormalClearEvent -> ElementSetting -- ÇÔ¼ö ¹Ýº¹ if Var["Step"] == 1 then Var["Step"] = Var["Step"] + 1 Var["StepFunc"] = ElementClearEvent return end -- º¸½º Ŭ¸®¾î üũ -- ¾ÆÀ̸®¿Í °¡µð¾ð º¸½º¹æ¿¡¼­ ¸®Á¨Çؼ­ À̵¿ ó¸® if Var["Step"] == 2 then local OreNum = 0 -- ±¤¼® °¹¼ö·Î Ŭ¸®¾î ¿©ºÎ ÆÇ´Ü for index, value in pairs( Var["OreList"] ) do OreNum = OreNum + 1 end if OreNum < Var["RoomNum"] then return end Var["Step"] = Var["Step"] + 1 Var["StepFunc"] = ClearDungeon return end -- ¾ÆÀ̸®¿Í ±¤¼® °Å¸® üũ if Var["Step"] == 3 then if Var["Airi"] == nil then Var["Step"] = 99 return end if Var["BossOre"] == nil then Var["Step"] = 99 return end local CurDistSqr = cDistanceSquar( Var["Airi"], Var["BossOre"] ) local ChkDist = WARN_END_EVENT["Flw_Gap"] + WARN_END_EVENT["EventDist"] if CurDistSqr < ChkDist * ChkDist then Var["Step"] = Var["Step"] + 1 Var["StepFunc"] = DummyFunc end return end -- ´ëÈ­ 1Â÷ if Var["Step"] == 4 then if WarN_Dialog( Var, DialogInfo["WarN_Clear_1"] ) ~= nil then return end Var["Step"] = Var["Step"] + 1 Var["StepFunc"] = DummyFunc return end -- ¾ÆÀ̸® ±¤¼® °¡±îÀÌ Çѹø ´õ À̵¿ if Var["Step"] == 5 then if Var["Airi"] == nil then Var["Step"] = 99 return end if Var["BossOre"] == nil then Var["Step"] = 99 return end cFollow( Var["Airi"], Var["BossOre"], WARN_END_EVENT["Flw_Airi"], WARN_END_EVENT["Flw_Airi"] + WARN_END_EVENT["Flw_Gap"] ) Var["Step"] = Var["Step"] + 1 Var["StepFunc"] = DummyFunc return end -- ¾ÆÀ̸®¿Í ±¤¼® °Å¸® üũ if Var["Step"] == 6 then if Var["Airi"] == nil then Var["Step"] = 99 return end if Var["BossOre"] == nil then Var["Step"] = 99 return end local CurDistSqr = cDistanceSquar( Var["Airi"], Var["BossOre"] ) local ChkDist = WARN_END_EVENT["Flw_Airi"] + WARN_END_EVENT["EventDist"] if CurDistSqr < ChkDist * ChkDist then Var["Step"] = Var["Step"] + 1 Var["StepFunc"] = DummyFunc end return end -- ¾ÆÀ̸® Á¶»ç ¾Ö´Ï¸ÅÀÌ¼Ç if Var["Step"] == 7 then if Var["Airi"] == nil then Var["Step"] = 99 return end -- ¾ÆÀ̸® À̵¿ÀÌ ¾ÆÁ÷ ´ú³¡³ª¼­ ¾Ö´Ï¸ÅÀ̼ÇÀÌ ´Ù½Ã ¹Ù²ð °¡´É¼ºÀ» »ý°¢Çؼ­ ¿©À¯½Ã°£µ¿¾È ´ë±â if Var["StepWait"] == nil then Var["StepWait"] = CurSec end if Var["StepWait"] + WARN_END_EVENT["WaitAiriMove"] > CurSec then return end cAnimate( Var["Airi"], "start", AiriData["ResearchAniIndex"] ) Var["StepWait"] = nil Var["Step"] = Var["Step"] + 1 Var["StepFunc"] = DummyFunc return end -- ´ëÈ­ 2Â÷ if Var["Step"] == 8 then if WarN_Dialog( Var, DialogInfo["WarN_Clear_2"] ) ~= nil then return end -- Ãⱸ °ÔÀÌÆ® ¸®Á¨ if Var["BossOre"] == nil then Var["Step"] = 99 return end if Var["OreList"][Var["BossOre"]] == nil then Var["Step"] = 99 return end local CurRoomNum = Var["RoomOrder"][#Var["RoomOrder"]] local CenterCoord = RoomCoordDataTable[Var["RoomData"][CurRoomNum]["Data"]["RoomCoordData"]]["CenterCoord"] local RegenCoord = {} RegenCoord["x"], RegenCoord["y"] = cGetAroundCoord( Var["BossOre"], CenterCoord["dir"], WARN_END_EVENT["GateDist"] ) local ExitGate = {} ExitGate["Handle"] = cMobRegen_XY( Var["MapIndex"], GateData["Index"], RegenCoord["x"], RegenCoord["y"], CenterCoord["dir"] ) if ExitGate["Handle"] ~= nil then ExitGate["Data"] = GateData["LinkTo"] cSetAIScript( SCRIPT_MAIN, ExitGate["Handle"] ) cAIScriptFunc( ExitGate["Handle"], "Entrance", "GateRoutine" ) cAIScriptFunc( ExitGate["Handle"], "NPCClick", "GateClick" ) Var["ExitGateList"][ExitGate["Handle"]] = ExitGate GateMapIndex[ExitGate["Handle"]] = Var["MapIndex"] -- ¸ÊÀ妽º ÀúÀå end Var["Step"] = 99 Var["StepFunc"] = DummyFunc return end if Var["Step"] == 99 then if WarN_Notice( Var, NoticeInfo["KQReturn"] ) ~= nil then return end Var["Step"] = Var["Step"] + 1 Var["StepFunc"] = DummyFunc end if Var["Step"] == 100 then cLinkToAll( Var["MapIndex"], GateData["LinkTo"]["Field"], GateData["LinkTo"]["x"], GateData["LinkTo"]["y"] ) Var["Step"] = Var["Step"] + 1 Var["StepFunc"] = DummyFunc return end end