You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

411 lines
8.5 KiB

--------------------------------------------------------------------------------
-- Mini Dragon Progress Func --
--------------------------------------------------------------------------------
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ʱ<EFBFBD>ȭ
function InitDungeon( Var )
cExecCheck "InitDungeon"
if Var == nil
then
return
end
-- ŷ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>÷<EFBFBD><EFBFBD>̾<EFBFBD><EFBFBD><EFBFBD> ù <EFBFBD>α<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ٸ<EFBFBD><EFBFBD><EFBFBD>.
if Var["bPlayerMapLogin"] == nil
then
if Var["InitialSec"] + WAIT_PLAYER_MAP_LOGIN_SEC_MAX <= cCurrentSecond()
then
GoToFail( Var )
return
end
return
end
if Var["InitDungeon"] == nil
then
DebugLog( "Start InitDungeon" )
Var["InitDungeon"] = {}
Var["InitDungeon"]["WaitSecDuringInit"] = Var["CurSec"] + DelayTime["AfterInit"]
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ð<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ܰ<EFBFBD><EFBFBD><EFBFBD>
if Var["InitDungeon"]["WaitSecDuringInit"] <= Var["CurSec"]
then
local nLimitSec = cGetKQLimitSecond( Var["MapIndex"] )
if nLimitSec == nil
then
ErrorLog( "GuideOfGuard::nLimitSec == nil" )
else
-- Real Kingdom Quest <EFBFBD><EFBFBD><EFBFBD><EFBFBD> !!!!
Var["KQLimitTime"] = Var["CurSec"] + nLimitSec
-- Ÿ<EFBFBD≯<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>!
cShowKQTimerWithLife( Var["MapIndex"], nLimitSec )
end
GoToNextStep( Var )
Var["InitDungeon"] = nil
DebugLog( "End InitDungeon" )
return
end
end
-- 1, 2, 3, 4 <EFBFBD><EFBFBD>° <EFBFBD>ʵ<EFBFBD> <EFBFBD>̵<EFBFBD><EFBFBD><EFBFBD> <EFBFBD>߰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function MidBossStep( Var )
cExecCheck "MidBossStep"
if Var == nil
then
return
end
if Var["MidBossStep"] == nil
then
Var["MidBossStep"] = {}
end
if Var["MidBossStep"]["StepNumber"] == nil
then
Var["MidBossStep"]["StepNumber"] = 1
end
local CurStepNo = Var["MidBossStep"]["StepNumber"]
-- <EFBFBD><EFBFBD> <EFBFBD>ܰ<EFBFBD> <EFBFBD>ʱ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Var["MidBossStep"..CurStepNo ] == nil
then
DebugLog( "Start MidBossStep "..CurStepNo )
Var["MidBossStep"..CurStepNo ] = {}
-- <EFBFBD>ܰ<EFBFBD><EFBFBD≯<EFBFBD> <EFBFBD>޾ƿ<EFBFBD><EFBFBD><EFBFBD>
local CurStep = StepNameTable[ CurStepNo ]
-- <EFBFBD><EFBFBD> <EFBFBD>׷<EFBFBD> <EFBFBD><EFBFBD>
local CurStepRegen = RegenInfo["Group"][ CurStep ]
for i = 1, #CurStepRegen
do
cGroupRegenInstance( Var["MapIndex"], CurStepRegen[i] )
end
-- <EFBFBD>߰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
local RegenMidBoss = nil
local MidBossHandle = nil
for MobName, MobRegenInfo in pairs ( RegenInfo["Mob"][ CurStep ] )
do
RegenMidBoss = MobRegenInfo
MidBossHandle = cMobRegen_XY( Var["MapIndex"], RegenMidBoss["Index"], RegenMidBoss["x"], RegenMidBoss["y"], RegenMidBoss["dir"] )
end
if MidBossHandle ~= nil
then
Var["Enemy"][ MidBossHandle ] = RegenMidBoss
Var["MidBossStep"..CurStepNo ]["MidBossHandle"] = MidBossHandle
Var["RoutineTime"][ MidBossHandle ] = cCurrentSecond()
cSetAIScript ( MainLuaScriptPath, MidBossHandle )
cAIScriptFunc( MidBossHandle, "Entrance", "MidBossRoutine" )
end
end
-- Fail Case : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> Ȥ<EFBFBD><EFBFBD> <EFBFBD>÷<EFBFBD><EFBFBD>̾ <EFBFBD>ƹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if cObjectCount( Var["MapIndex"], ObjectType["Player"] ) <= 0
then
GoToFail( Var )
Var["MidBossStep"..CurStepNo ] = nil
Var["MidBossStep"] = nil
return
end
-- Fail Case : Ÿ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if IsKQTimeOver( Var ) == true
then
GoToFail( Var )
Var["MidBossStep"..CurStepNo ] = nil
Var["MidBossStep"] = nil
return
end
local nMidBossHandle = Var["MidBossStep"..CurStepNo ]["MidBossHandle"]
-- Next Case : <EFBFBD>߰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Var["Enemy"][ nMidBossHandle ] == nil
then
-- <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ܸ<EFBFBD> <EFBFBD>ڻ<EFBFBD>
cMobSuicide( Var["MapIndex"] )
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ܰ<EFBFBD><EFBFBD><EFBFBD>
Var["MidBossStep"..CurStepNo ] = nil
Var["MidBossStep"]["StepNumber"] = CurStepNo + 1
DebugLog( "End MidBossStep "..CurStepNo )
-- <EFBFBD>߰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> Ŭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Var["MidBossStep"]["StepNumber"] >= #StepNameTable
then
Var["MidBossStep"] = nil
GoToNextStep( Var )
return
end
return
end
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>̴ϵ巡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function BossBattle( Var )
cExecCheck "BossBattle"
if Var == nil
then
return
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Var["BossBattle"] == nil
then
DebugLog( "Start BossBattle" )
Var["BossBattle"] = {}
-- <EFBFBD>̴<EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
local RegenMiniDragon = RegenInfo["Mob"]["BossBattle"]["MiniDragon"]
local MiniDragonHandle = cMobRegen_XY( Var["MapIndex"], RegenMiniDragon["Index"], RegenMiniDragon["x"], RegenMiniDragon["y"], RegenMiniDragon["dir"] )
if MiniDragonHandle ~= nil
then
Var["Enemy"][ MiniDragonHandle ] = RegenMiniDragon
Var["BossBattle"]["BossHandle"] = MiniDragonHandle
cMobDetectRange( MiniDragonHandle, BossDetectRange["Regen"] )
Var["RoutineTime"][ MiniDragonHandle ] = cCurrentSecond()
cSetAIScript ( MainLuaScriptPath, MiniDragonHandle )
cAIScriptFunc( MiniDragonHandle, "Entrance", "MiniDragonRoutine" )
end
end
-- Fail Case : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> Ȥ<EFBFBD><EFBFBD> <EFBFBD>÷<EFBFBD><EFBFBD>̾ <EFBFBD>ƹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if cObjectCount( Var["MapIndex"], ObjectType["Player"] ) <= 0
then
GoToFail( Var )
Var["BossBattle"] = nil
return
end
-- Fail Case : Ÿ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if IsKQTimeOver( Var ) == true
then
GoToFail( Var )
Var["BossBattle"] = nil
return
end
-- Success Case : <EFBFBD>̴ϵ巡<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
local nBossHandle = Var["BossBattle"]["BossHandle"]
if Var["Enemy"][ nBossHandle ] == nil
then
GoToSuccess( Var )
Var["BossBattle"] = nil
DebugLog( "End BossBattle" )
return
end
end
-- ŷ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ Ŭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function QuestSuccess( Var )
cExecCheck "QuestSuccess"
if Var == nil
then
return
end
if Var["QuestSuccess"] == nil
then
DebugLog( "Start QuestSuccess" )
Var["QuestSuccess"] = {}
Var["QuestSuccess"]["WaitSecAfterKillBoss"] = Var["CurSec"] + DelayTime["WaitAfterKillBoss"]
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ٷ<EFBFBD> <EFBFBD><EFBFBD>
if Var["QuestSuccess"]["WaitSecAfterKillBoss"] <= Var["CurSec"]
then
-- Success <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cVanishTimer( Var["MapIndex"] )
cQuestResult( Var["MapIndex"], "Success" )
-- <EFBFBD>÷<EFBFBD><EFBFBD>̾<EFBFBD><EFBFBD> Ŭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ֱ<EFBFBD>
cReward( Var["MapIndex"], "KQ" )
-- Quest Mob Kill <EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
cQuestMobKill_AllInMap( Var["MapIndex"], QuestMobKillInfo["QuestID"], QuestMobKillInfo["MobIndex"], QuestMobKillInfo["MaxKillCount"] )
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׷<EFBFBD> <EFBFBD><EFBFBD>
cGroupRegenInstance( Var["MapIndex"], RegenInfo["Group"]["QuestSuccess"] )
-- <EFBFBD><EFBFBD>ȯ <EFBFBD>Ϸ<EFBFBD>
GoToNextStep( Var )
DebugLog( "End QuestSuccess" )
end
end
-- ŷ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function QuestFailed( Var )
cExecCheck "QuestFailed"
if Var == nil
then
return
end
DebugLog( "Start QuestFailed" )
-- Fail <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cVanishTimer( Var["MapIndex"] )
cQuestResult( Var["MapIndex"], "Fail" )
GoToNextStep( Var )
DebugLog( "End QuestFailed" )
end
-- <EFBFBD><EFBFBD>ȯ
function ReturnToHome( Var )
cExecCheck "ReturnToHome"
if Var == nil
then
return
end
if Var["ReturnToHome"] == nil
then
DebugLog( "Start ReturnToHome" )
Var["ReturnToHome"] = {}
Var["ReturnToHome"]["ReturnStepNo"] = 1
Var["ReturnToHome"]["ReturnStepSec"] = Var["CurSec"]
if Var["QuestSuccess"] ~= nil
then
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Var["ReturnToHome"]["ReturnNoticeIndex"] = "KQReturn"
Var["QuestSuccess"] = nil
else
-- <EFBFBD><EFBFBD><EFBFBD>н<EFBFBD>
Var["ReturnToHome"]["ReturnNoticeIndex"] = "KQFReturn"
end
end
local sReturnNoticeIndex = Var["ReturnToHome"]["ReturnNoticeIndex"]
-- Return : return notice substep
if Var["ReturnToHome"]["ReturnStepNo"] <= #NoticeInfo[ sReturnNoticeIndex ]
then
if Var["ReturnToHome"]["ReturnStepSec"] <= Var["CurSec"]
then
-- Notice of Escape
if NoticeInfo[ sReturnNoticeIndex ][ Var["ReturnToHome"]["ReturnStepNo"] ]["Index"] ~= nil
then
cNotice( Var["MapIndex"], NoticeInfo["ScriptFileName"], NoticeInfo[ sReturnNoticeIndex ][ Var["ReturnToHome"]["ReturnStepNo"] ]["Index"] )
end
-- Go To Next Notice
Var["ReturnToHome"]["ReturnStepNo"] = Var["ReturnToHome"]["ReturnStepNo"] + 1
Var["ReturnToHome"]["ReturnStepSec"] = Var["CurSec"] + DelayTime["GapKQReturnNotice"]
end
return
end
-- Return : linkto substep
if Var["ReturnToHome"]["ReturnStepNo"] > #NoticeInfo[ sReturnNoticeIndex ]
then
if Var["ReturnToHome"]["ReturnStepSec"] <= Var["CurSec"]
then
--Finish_KQ
cLinkToAll( Var["MapIndex"], LinkInfo["ReturnMap"]["MapIndex"], LinkInfo["ReturnMap"]["x"], LinkInfo["ReturnMap"]["y"] )
GoToNextStep( Var )
Var["ReturnToHome"] = nil
if cEndOfKingdomQuest( Var["MapIndex"] ) == nil
then
ErrorLog( "ReturnToHome::Function cEndOfKingdomQuest failed" )
end
DebugLog( "End ReturnToHome" )
end
return
end
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>Լ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ
KQ_StepsList =
{
{ Function = InitDungeon, Name = "InitDungeon", },
{ Function = MidBossStep, Name = "MidBossStep", },
{ Function = BossBattle, Name = "BossBattle", },
{ Function = QuestSuccess, Name = "QuestSuccess", },
{ Function = QuestFailed, Name = "QuestFailed", },
{ Function = ReturnToHome, Name = "ReturnToHome", },
}
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ
KQ_StepsIndexList =
{
}
for index, funcValue in pairs ( KQ_StepsList )
do
KQ_StepsIndexList[ funcValue["Name"] ] = index
end