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.

436 lines
9.4 KiB

--------------------------------------------------------------------------------
-- Promote Job2_Gamb Sub Functions --
--------------------------------------------------------------------------------
function DummyFunc( Var )
cExecCheck "DummyFunc"
end
----------------------------------------------------------------------
-- DiceLightOff : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
----------------------------------------------------------------------
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 : <EFBFBD>ڵ鿡 <EFBFBD>´<EFBFBD> <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ ã<EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD> <EFBFBD>Լ<EFBFBD>
----------------------------------------------------------------------
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 : <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>
----------------------------------------------------------------------
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>귿 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ƚ<EFBFBD><EFBFBD> : "..Var["RouletteCount"] )
-- <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><EFBFBD><EFBFBD><EFBFBD> 10<EFBFBD><EFBFBD> <EFBFBD>̻<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 100% <EFBFBD><EFBFBD>÷)
if Var["RouletteCount"] >= ROULETTEGAME_PLAY_NUM
then
Var["PlayRouletteGame"]["AnswerDiceNum"] = Var["PlayRouletteGame"]["SelectedDiceNum"]
-- DebugLog( "ROULETTEGAME_PLAY_NUM <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>õ<EFBFBD>, 100% <EFBFBD><EFBFBD>÷")
else
Var["PlayRouletteGame"]["AnswerDiceNum"] = cRandomInt( 1, 6 )
end
-- DebugLog( "<EFBFBD>귿<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : "..Var["PlayRouletteGame"]["AnswerDiceNum"] )
end
----------------------------------------------------------------------
-- VanishMob : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ʿ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>(fadeout)<EFBFBD>Ѵ<EFBFBD>
----------------------------------------------------------------------
function VanishMob( Var )
cExecCheck( "VanishMob" )
for i = 1, #RegenInfo["MobList"]
do
cVanishAll( Var["MapIndex"], RegenInfo["MobList"][i] )
end
end
----------------------------------------------------------------------
-- IsTimeOver : Ÿ<EFBFBD≯<EFBFBD> üũ
----------------------------------------------------------------------
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 : <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD><EFBFBD><EFBFBD>з<EFBFBD>, <EFBFBD><EFBFBD><EFBFBD>ѽð<EFBFBD> <EFBFBD>ǹ̾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" )
return false
elseif Var["LimitTime"] < Var["CurSec"]
then
-- DebugLog( "SubFunc _ IsTimeOver : <EFBFBD>ð<EFBFBD><EFBFBD>ʰ<EFBFBD>" )
return true
else
return false
end
end
----------------------------------------------------------------------
-- IsFail : Fail <EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
----------------------------------------------------------------------
function IsFail( Var )
cExecCheck( "IsFail" )
if Var == nil
then
ErrorLog( "IsFail::Var == nil" )
return
end
-- Fail Case : <EFBFBD>ʿ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if cGetPlayerList( Var["MapIndex"] ) == nil
then
-- DebugLog( "IsFail : <EFBFBD>ʿ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>" )
Var["StepFunc"] = QuestFailed
return true
end
-- Fail Case : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if cIsObjectDead( Var["PlayerHandle"] ) == 1
then
-- DebugLog("IsFail : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
Var["StepFunc"] = QuestFailed
return true
end
-- Fail Case : Ÿ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if IsTimeOver( Var ) == true
then
-- DebugLog("IsFail : TimeOver")
Var["StepFunc"] = QuestFailed
return true
end
end
------------------------------------------------------
-- Roulette_Click : <EFBFBD>귿 Ŭ<EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>۵<EFBFBD><EFBFBD>ϴ<EFBFBD> <EFBFBD>Լ<EFBFBD>
------------------------------------------------------
function Roulette_Click( NPCHandle, PlyHandle )
cExecCheck ( "Roulette_Click" )
-- DebugLog("<EFBFBD>귿 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>!")
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( "Ŭ<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>" )
return
end
local PlayRouletteGameInfo = Var["PlayRouletteGame"]
if PlayRouletteGameInfo == nil
then
ErrorLog( "Roulette_Click::Var[\"PlayRouletteGame\"] == nil" )
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>
if PlayRouletteGameInfo["ReadyToGame"] == true
then
---- DebugLog("<EFBFBD>̹<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>õǾ<EFBFBD><EFBFBD>⿡, Ŭ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
return
end
PlayRouletteGameInfo["RouletteHandle"] = NPCHandle
-- <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 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<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ" )
return
end
-- <EFBFBD><EFBFBD>Ģ<EFBFBD><EFBFBD> <EFBFBD>°<EFBFBD> <EFBFBD>귿 Ŭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PlayRouletteGameInfo["ReadyToGame"] = true
return
end
------------------------------------------------------
-- Dice_Click : <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD> Ŭ<EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>۵<EFBFBD><EFBFBD>ϴ<EFBFBD> <EFBFBD>Լ<EFBFBD>
------------------------------------------------------
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
-- <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 PlayRouletteGameInfo["ReadyToGame"] == true
then
---- DebugLog("<EFBFBD>̹<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>õǾ<EFBFBD><EFBFBD>⿡, Ŭ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
return
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ڵ鰪 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PlayRouletteGameInfo["SelectedDiceHandle"] = NPCHandle
-- DebugLog( "Your Selected DiceHandle : "..PlayRouletteGameInfo["SelectedDiceHandle"] )
-- <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>
FindDiceNum ( Var )
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
DiceLightOff( Var )
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>Ű<EFBFBD><EFBFBD>
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 )
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ü <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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