-------------------------------------------------------------------------------- -- Promote Job2_Gamb Sub Functions -- -------------------------------------------------------------------------------- function DummyFunc( Var ) cExecCheck "DummyFunc" end ---------------------------------------------------------------------- -- DiceLightOff : ¸ðµç ÁÖ»çÀ§ ºÒ ²ô±â ---------------------------------------------------------------------- function DiceLightOff( Var ) cExecCheck( "DiceLightOff" ) ---- DebugLog( "SubFunc _ DiceLightOff Start" ) if Var == nil or Var["Dice"]["Handle"] == nil then ErrorLog( "DiceLightOff::Var == nil" ); return end for i =1, #Var["Dice"]["Handle"] do cAnimate( Var["Dice"]["Handle"][i], "start", AnimationInfo["Dice"]["AniOff"] ) end end ---------------------------------------------------------------------- -- FindDiceNum : Çڵ鿡 ¸Â´Â ÁÖ»çÀ§¹øÈ£ ã¾ÆÁÖ´Â ÇÔ¼ö ---------------------------------------------------------------------- function FindDiceNum( Var ) cExecCheck( "FindDiceNum" ) -- DebugLog( "SubFunc _ FindDiceNum Start" ) if Var == nil then ErrorLog( "FindDiceNum::Var == nil" ); return end local PlayRouletteGameInfo = Var["PlayRouletteGame"] if PlayRouletteGameInfo == nil then ErrorLog( "FindDiceNum::PlayRouletteGameInfo == nil" ); return end local FindCurDiceHandle = PlayRouletteGameInfo["SelectedDiceHandle"] for i = 1, #Var["Dice"]["Handle"] do if FindCurDiceHandle == Var["Dice"]["Handle"][i] then PlayRouletteGameInfo["SelectedDiceNum"] = i -- DebugLog( "PlayRouletteGameInfo[\"SelectedDiceNum\"] : "..PlayRouletteGameInfo["SelectedDiceNum"] ) end end end ---------------------------------------------------------------------- -- SetAnswerDice : ·ê·¿ÀÌ ÁÖ»çÀ§ ¸î¹ø ¼±ÅÃÇÒÁö ·£´ýó¸®ÇÏ´Â ÇÔ¼ö ---------------------------------------------------------------------- function SetAnswerDice( Var ) cExecCheck( "SetAnswerDice" ) -- DebugLog( "SubFunc _ SetAnswerDice Start" ) if Var == nil then ErrorLog( "SetAnswerDice::Var == nil" ); return end if Var["PlayRouletteGame"]["SelectedDiceNum"] == nil then ErrorLog( "SetAnswerDice::SelectedDiceNum == nil" ); return end -- DebugLog("ÇöÀç ·ê·¿ ±¼¸° Ƚ¼ö : "..Var["RouletteCount"] ) -- ·ê·¿ÀÌ ¸ØÃâ ¹øÈ£¸¦ ¸ÕÀú ·£´ýÀ¸·Î °í¸¥´Ù(½ÃµµÈ½¼ö°¡ 10¹ø ÀÌ»óÀÎ °æ¿ì´Â 100% ´ç÷) if Var["RouletteCount"] >= ROULETTEGAME_PLAY_NUM then Var["PlayRouletteGame"]["AnswerDiceNum"] = Var["PlayRouletteGame"]["SelectedDiceNum"] -- DebugLog( "ROULETTEGAME_PLAY_NUM º¸´Ù ¸¹ÀÌ ½Ãµµ, 100% ´ç÷") else Var["PlayRouletteGame"]["AnswerDiceNum"] = cRandomInt( 1, 6 ) end -- DebugLog( "·ê·¿ÀÌ ÅÃÇÑ ÁÖ»çÀ§´Â : "..Var["PlayRouletteGame"]["AnswerDiceNum"] ) end ---------------------------------------------------------------------- -- VanishMob : ÁöÁ¤µÈ ¸÷À» ¸Ê¿¡¼­ »èÁ¦(fadeout)ÇÑ´Ù ---------------------------------------------------------------------- function VanishMob( Var ) cExecCheck( "VanishMob" ) for i = 1, #RegenInfo["MobList"] do cVanishAll( Var["MapIndex"], RegenInfo["MobList"][i] ) end end ---------------------------------------------------------------------- -- IsTimeOver : ŸÀÌ¸Ó Ã¼Å© ---------------------------------------------------------------------- function IsTimeOver( Var ) cExecCheck( "IsTimeOver" ) if Var == nil then ErrorLog( "IsTimeOver::Var == nil" ) return end if Var["LimitTime"] == nil then ErrorLog( "IsTimeOver::Var[\"LimitTime\"] == nil" ) return end if Var["CurSec"] == nil then ErrorLog( "IsTimeOver::Var[\"CurSec\"] == nil" ) return end if Var["LimitTime"] == "NoLimit" then -- DebugLog( "SubFunc _ IsTimeOver : Äù½ºÆ® ¼º°ø/½ÇÆзÎ, Á¦Çѽð£ Àǹ̾ø¾îÁü" ) return false elseif Var["LimitTime"] < Var["CurSec"] then -- DebugLog( "SubFunc _ IsTimeOver : ½Ã°£ÃÊ°ú" ) return true else return false end end ---------------------------------------------------------------------- -- IsFail : Fail ÀÎÁö üũ ---------------------------------------------------------------------- function IsFail( Var ) cExecCheck( "IsFail" ) if Var == nil then ErrorLog( "IsFail::Var == nil" ) return end -- Fail Case : ¸Ê¿¡ À¯Àú°¡ ¾øÀ½ if cGetPlayerList( Var["MapIndex"] ) == nil then -- DebugLog( "IsFail : ¸Ê¿¡ À¯Àú ¾øÀ½" ) Var["StepFunc"] = QuestFailed return true end -- Fail Case : À¯Àú°¡ Á×Àº °æ¿ì if cIsObjectDead( Var["PlayerHandle"] ) == 1 then -- DebugLog("IsFail : À¯Àú°¡ Á×À½") Var["StepFunc"] = QuestFailed return true end -- Fail Case : ŸÀÓ ¿À¹ö if IsTimeOver( Var ) == true then -- DebugLog("IsFail : TimeOver") Var["StepFunc"] = QuestFailed return true end end ------------------------------------------------------ -- Roulette_Click : ·ê·¿ Ŭ¸¯µÇ¾úÀ»¶§ ÀÛµ¿ÇÏ´Â ÇÔ¼ö ------------------------------------------------------ function Roulette_Click( NPCHandle, PlyHandle ) cExecCheck ( "Roulette_Click" ) -- DebugLog("·ê·¿ ¼±ÅÃ!") if NPCHandle == nil then ErrorLog( "Roulette_Click::RouletteHandle == nil" ) return end if PlyHandle == nil then ErrorLog( "Roulette_Click::RouletteHandle == nil" ) return end local MapIndex = cGetCurMapIndex( NPCHandle ) if MapIndex == nil then ErrorLog( "Roulette_Click::MapIndex == nil" ) return end local Var = InstanceField[ MapIndex ] if Var == nil then ErrorLog( "Roulette_Click::Var == nil" ) return end if Var["Roulette"] == nil then ErrorLog( "Roulette_Click::Var[\"Roulette\"] == nil" ) return end if Var["Roulette"]["Handle"] == nil then ErrorLog( "Roulette_Click::Var[\"Roulette\"][Handle] == nil" ) return end if NPCHandle ~= Var["Roulette"]["Handle"] then ErrorLog( "Ŭ¸¯ÇÑ ·ê·¿À̶û, ¸®Á¨½ÃÄѳõÀº ½ÇÁ¦ ·ê·¿ Çڵ鰪ÀÌ ´Ù¸¥°æ¿ì" ) return end local PlayRouletteGameInfo = Var["PlayRouletteGame"] if PlayRouletteGameInfo == nil then ErrorLog( "Roulette_Click::Var[\"PlayRouletteGame\"] == nil" ) return end -- ÁÖ»çÀ§,·ê·¿ ¸ðµÎ Ŭ¸¯µÇ¾ú´Ù¸é, Ãß°¡ÀûÀÎ ·ê·¿ Ŭ¸¯ ¹«½Ã if PlayRouletteGameInfo["ReadyToGame"] == true then ---- DebugLog("ÀÌ¹Ì ´Ù ¼±ÅõǾú±â¿¡, Ŭ¸¯ ¹«½Ã") return end PlayRouletteGameInfo["RouletteHandle"] = NPCHandle -- ÁÖ»çÀ§ ¸ÕÀú Ŭ¸¯ÇÏÁö¾Ê°í, ·ê·¿ Ŭ¸¯ÇÑ °æ¿ì if PlayRouletteGameInfo["SelectedDiceHandle"] == nil then cMobDialog( Var["MapIndex"], ChatInfo["Roulette_Click"]["SpeakerIndex"], ChatInfo["ScriptFileName"], ChatInfo["Roulette_Click"]["MsgIndex"] ) return end if PlayRouletteGameInfo["SelectedDiceNum"] < 1 or PlayRouletteGameInfo["SelectedDiceNum"] > 6 then ErrorLog( "1~6À» ¹þ¾î³­ ÁÖ»çÀ§¹øÈ£" ) return end -- ±ÔÄ¢¿¡ ¸Â°Ô ·ê·¿ Ŭ¸¯ÇÑ °æ¿ì PlayRouletteGameInfo["ReadyToGame"] = true return end ------------------------------------------------------ -- Dice_Click : ÁÖ»çÀ§ Ŭ¸¯µÇ¾úÀ»¶§ ÀÛµ¿ÇÏ´Â ÇÔ¼ö ------------------------------------------------------ function Dice_Click( NPCHandle, PlyHandle ) cExecCheck ( "Dice_Click" ) if NPCHandle == nil then ErrorLog( "Dice_Click::DiceHandle == nil" ) return end if PlyHandle == nil then ErrorLog( "Dice_Click::PlyHandle == nil" ) return end local MapIndex = cGetCurMapIndex( NPCHandle ) if MapIndex == nil then ErrorLog( "Dice_Click::MapIndex == nil" ) return end local Var = InstanceField[ MapIndex ] if Var == nil then ErrorLog( "Dice_Click::Var == nil" ) return end if Var["Dice"] == nil then ErrorLog( "Dice_Click::Var[\"Dice\"] == nil" ) return end if Var["Dice"]["Handle"] == nil then ErrorLog( "Dice_Click::Var[\"Dice\"][Handle] == nil" ) return end local PlayRouletteGameInfo = Var["PlayRouletteGame"] if PlayRouletteGameInfo == nil then ErrorLog( "Dice_Click::Var[\"PlayRouletteGame\"] == nil" ) return end -- ÁÖ»çÀ§,·ê·¿ ¸ðµÎ Ŭ¸¯µÇ¾ú´Ù¸é, Ãß°¡ÀûÀÎ ÁÖ»çÀ§ Ŭ¸¯ ¹«½Ã if PlayRouletteGameInfo["ReadyToGame"] == true then ---- DebugLog("ÀÌ¹Ì ´Ù ¼±ÅõǾú±â¿¡, Ŭ¸¯ ¹«½Ã") return end -- ¼±ÅÃÇÑ ÁÖ»çÀ§ Çڵ鰪 ÀúÀå PlayRouletteGameInfo["SelectedDiceHandle"] = NPCHandle -- DebugLog( "Your Selected DiceHandle : "..PlayRouletteGameInfo["SelectedDiceHandle"] ) -- ¼±ÅÃÇÑ ÁÖ»çÀ§ Çڵ鰪 ¹Þ¾Æ, ¸î¹ø ÁÖ»çÀ§ÀÎÁö °Ë»ö FindDiceNum ( Var ) -- ¸ðµç ÁÖ»çÀ§ ºÒ ²ô±â DiceLightOff( Var ) -- ¼±ÅÃÇÑ ÁÖ»çÀ§ ºÒÅ°±â cAnimate( PlayRouletteGameInfo["SelectedDiceHandle"], "start", AnimationInfo["Dice"]["AniOn"] ) return end ---------------------------------------------------------------------- -- Log Functions ---------------------------------------------------------------------- function GoToFail( Var, Msg ) cExecCheck( "GoToFail" ) if Var == nil then ErrorLog( "GoToFail : Var nil" ); return end ErrorLog( Msg ) -- ¸ðµç °´Ã¼ »èÁ¦ if Var["Door"]["Handle"] ~= nil then for i = 1, #Var["Door"]["Handle"] do cNPCVanish( Var["Door"]["Handle"][i] ) end end if Var["Roulette"]["Handle"] ~= nil then cNPCVanish( Var["Roulette"]["Handle"] ) end if Var["Dice"]["Handle"] ~= nil then for i = 1, #Var["Dice"]["Handle"] do cNPCVanish( Var["Door"]["Handle"][i] ) end end if Var["NPC"]["Handle"] ~= nil then cNPCVanish( Var["NPC"]["Handle"] ) end Var["StepFunc"] = ReturnToHome end ---------------------------------------------------------------------- -- Log Functions ---------------------------------------------------------------------- function DebugLog( String ) cExecCheck ( "-- DebugLog" ) if String == nil then cAssertLog( "-- DebugLog::String == nil" ) return end cAssertLog( "Debug - "..String ) end function ErrorLog( String ) cExecCheck ( "ErrorLog" ) if String == nil then cAssertLog( "ErrorLog::String == nil" ) return end cAssertLog( "Error - "..String ) end