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.

405 lines
7.7 KiB

--------------------------------------------------------------------------------
-- Kingkong 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
Var["QuestResult"] = "Fail"
GoToFail( Var )
return
end
return
end
-- 1<EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD> üũ
if Var["CurSec"] + 1 > cCurrentSecond()
then
return
else
Var["CurSec"] = cCurrentSecond()
end
if Var["InitDungeon"] == nil
then
DebugLog( "Start InitDungeon" )
Var["InitDungeon"] = {}
Var["InitDungeon"]["WaitSecDuringInit"] = Var["CurSec"]
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ð<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ܰ<EFBFBD><EFBFBD><EFBFBD>
if Var["InitDungeon"]["WaitSecDuringInit"] + DelayTime["AfterInit"] <= Var["CurSec"]
then
local nLimitSec = cGetKQLimitSecond( Var["MapIndex"] )
if nLimitSec == nil
then
ErrorLog( "InitDungeon::nLimitSec == nil" )
else
Var["KQLimitTime"] = Var["CurSec"] + nLimitSec
cShowKQTimerWithLife( Var["MapIndex"], nLimitSec )
end
Var["QuestResult"] = "Fail"
GoToNextStep( Var )
Var["InitDungeon"] = nil
DebugLog( "End InitDungeon" )
return
end
end
function FloorFunc( Var )
cExecCheck "FloorFunc"
if Var == nil
then
return
end
-- 1<EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD> üũ
if Var["CurSec"] + 1 > cCurrentSecond()
then
return
else
Var["CurSec"] = cCurrentSecond()
end
if Var["FloorInfo"] == nil
then
Var["FloorInfo"] = {}
end
if Var["FloorInfo"]["FloorNumber"] == nil
then
Var["FloorInfo"]["FloorNumber"] = 1
end
if Var["FloorInfo"]["Init"] == nil
then
Var["FloorInfo"]["Init"] = 0
end
-- <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD>ʱ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Var["FloorInfo"]["Init"] ~= Var["FloorInfo"]["FloorNumber"]
then
DebugLog( "Start Floor "..Var["FloorInfo"]["FloorNumber"] )
local CurFloor = FloorNameTable[ Var["FloorInfo"]["FloorNumber"] ] -- <EFBFBD><EFBFBD><EFBFBD≯<EFBFBD> <EFBFBD>޾ƿ<EFBFBD><EFBFBD><EFBFBD>
-- <EFBFBD>׷<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
local CurRegenGroup = RegenInfo["Group"][ CurFloor ]
for i = 1, #CurRegenGroup
do
cGroupRegenInstance( Var["MapIndex"], CurRegenGroup[i] )
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
local CurRegenMob = RegenInfo["BossMob"][ CurFloor ]
Var["FloorInfo"]["Success"] = nil
Var["FloorInfo"]["Fail"] = nil
-- <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
if CurRegenMob["Success"] ~= nil
then
local RegenMob = cMobRegen_XY( Var["MapIndex"], CurRegenMob["Success"]["Index"], CurRegenMob["Success"]["x"], CurRegenMob["Success"]["y"], CurRegenMob["Success"]["dir"] )
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ũ<EFBFBD><EFBFBD>Ʈ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Var["FloorInfo"]["FloorNumber"] >= #FloorNameTable
then
if RegenMob == nil
then
ErrorLog( "cMobRegen_XY LastBoss Regen failed" )
else
cSetAIScript( MainLuaScriptPath, RegenMob )
cAIScriptFunc( RegenMob, "Entrance", "BossRoutine" )
end
end
Var["FloorInfo"]["Success"] = RegenMob
end
-- <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
if CurRegenMob["Fail"] ~= nil
then
local RegenMob = cMobRegen_XY( Var["MapIndex"], CurRegenMob["Fail"]["Index"], CurRegenMob["Fail"]["x"], CurRegenMob["Fail"]["y"], CurRegenMob["Fail"]["dir"] )
Var["FloorInfo"]["Fail"] = RegenMob
end
Var["FloorInfo"]["Init"] = Var["FloorInfo"]["FloorNumber"];
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["FloorInfo"] = nil
return
end
-- Fail Case : Ÿ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if IsKQTimeOver( Var ) == true
then
GoToFail( Var )
Var["FloorInfo"] = nil
return
end
-- <EFBFBD><EFBFBD><EFBFBD≯<EFBFBD> <EFBFBD>ȵǴ¸<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Var["FloorInfo"]["Fail"] ~= nil
then
if cIsObjectDead( Var["FloorInfo"]["Fail"] ) == 1
then
cAIScriptSet( Var["FloorInfo"]["Fail"] )
GoToFail( Var )
Var["FloorInfo"] = nil
return
end
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Var["FloorInfo"]["Success"] ~= nil
then
if cIsObjectDead( Var["FloorInfo"]["Success"] ) == 1
then
cAIScriptSet( Var["FloorInfo"]["Success"] )
-- <EFBFBD><EFBFBD> Ŭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if cMobSuicide( Var["MapIndex"] ) == nil
then
ErrorLog( "FloorFunc::Suicide Fail" )
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>
if Var["FloorInfo"]["FloorNumber"] >= #FloorNameTable
then
GoToSuccess( Var )
return
else
Var["FloorInfo"]["FloorNumber"] = Var["FloorInfo"]["FloorNumber"] + 1
return
end
end
end
end
-- ŷ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ Ŭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function QuestSuccess( Var )
cExecCheck "QuestSuccess"
if Var == nil
then
return
end
-- 1<EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD> üũ
if Var["CurSec"] + 1 > cCurrentSecond()
then
return
end
Var["CurSec"] = cCurrentSecond()
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Var["QuestSuccessTime"] == nil
then
Var["QuestSuccessTime"] = Var["CurSec"]
end
if (Var["QuestSuccessTime"] + DelayTime["QuestSuccessDelay"]) > Var["CurSec"]
then
return
end
DebugLog( "Start QuestSuccess" )
Var["QuestResult"] = "Success"
-- 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"] )
GoToNextStep( Var )
DebugLog( "End QuestSuccess" )
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
-- 1<EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD> üũ
if Var["CurSec"] + 1 > cCurrentSecond()
then
return
end
Var["CurSec"] = cCurrentSecond()
if Var["ReturnToHome"] == nil
then
DebugLog( "Start ReturnToHome" )
Var["ReturnToHome"] = {}
Var["ReturnToHome"]["ReturnStepSec"] = Var["CurSec"]
Var["ReturnToHome"]["ReturnStepNo"] = 1
end
-- Return : return notice substep
if Var["ReturnToHome"]["ReturnStepNo"] <= #NoticeInfo["KQReturn"][Var["QuestResult"]]
then
if Var["ReturnToHome"]["ReturnStepSec"] <= Var["CurSec"]
then
-- Notice of Escape
if NoticeInfo["KQReturn"][Var["QuestResult"]][ Var["ReturnToHome"]["ReturnStepNo"] ]["Index"] ~= nil
then
cNotice( Var["MapIndex"], NoticeInfo["ScriptFileName"], NoticeInfo["KQReturn"][Var["QuestResult"]][ Var["ReturnToHome"]["ReturnStepNo"] ]["Index"] )
end
-- Go To Next Notice
Var["ReturnToHome"]["ReturnStepNo"] = Var["ReturnToHome"]["ReturnStepNo"] + 1
Var["ReturnToHome"]["ReturnStepSec"] = Var["CurSec"] + DelayTime["BetweenKQReturnNotice"]
end
return
end
-- Return : linkto substep
if Var["ReturnToHome"]["ReturnStepNo"] > #NoticeInfo["KQReturn"][Var["QuestResult"]]
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 = FloorFunc, Name = "FloorFunc", },
{ 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