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.
SigFiesta/LuaScript/AIScript/Xiaoming.lua

2342 lines
51 KiB

require( "common" )
--[[------------------------------------------------------------------------------------------------]]--
--[[ ]]--
--[[ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ]]--
--[[ ]]--
--[[------------------------------------------------------------------------------------------------]]--
PG_INVALID_VALUE = -1
PG_SUFFLE_COUNT = 500 -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ƚ<EFBFBD><EFBFBD>
PG_REWARD_RANGE = 1200 -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> <EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PG_NO_CLICK_TIME = 30 -- <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><EFBFBD><EFBFBD><EFBFBD>
PG_WATING_TIME = 15 -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ð<EFBFBD>
PG_PIECE_VANISH_TIME = 0.2
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PG_PUZZLE_MODE =
{
PGM_SLIME = 1,
PGM_HONEYING = 2,
PGM_ALL_PLAY = 3,
}
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> ũ<EFBFBD><EFBFBD>
-- ( <EFBFBD><EFBFBD><EFBFBD><EFBFBD> ũ<EFBFBD><EFBFBD>ٲ<EFBFBD><EFBFBD>ٸ<EFBFBD> PG_PIECE_INFO<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ʿ<EFBFBD><EFBFBD><EFBFBD> )
PG_PUZZLE_SIZE =
{
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{ PS_WIDTH = 4, PS_HEIGHT = 4 },
-- <EFBFBD>ϴ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{ PS_WIDTH = 4, PS_HEIGHT = 4 },
}
------------------------------------------------------------------------------------------
--**************************************************************************************--
-- --
-- ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ÿ<EFBFBD><EFBFBD>Ʋ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>( <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ij<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> ) --
-- --
--**************************************************************************************--
------------------------------------------------------------------------------------------
PG_GAME_DATA =
{
-- Slime
{
PGD_COST = 1000, -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>۽<EFBFBD> <EFBFBD>ʿ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ݾ<EFBFBD>
PGD_PLAYTIME = 150,
PGD_REWARD_ABSTATE = -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>
{
{ PRA_INDEX = "StaPzlReward_S", PRA_KEEPTIME = 60*60*1000 },
},
PGD_REWARD_CHARTITLE = { PRC_ID = 114, PRC_VALUE = 1 },
},
-- Honeying
{
PGD_COST = 1000,
PGD_PLAYTIME = 150,
PGD_REWARD_ABSTATE =
{
{ PRA_INDEX = "StaPzlReward_H", PRA_KEEPTIME = 60*60*1000 },
},
PGD_REWARD_CHARTITLE = { PRC_ID = 115, PRC_VALUE = 1 },
},
-- All
{
PGD_COST = 1000,
PGD_PLAYTIME = 300,
PGD_REWARD_ABSTATE =
{
{ PRA_INDEX = "StaPzlReward_SH1", PRA_KEEPTIME = 60*60*1000 },
{ PRA_INDEX = "StaPzlReward_SH2", PRA_KEEPTIME = 60*60*1000 },
},
PGD_REWARD_CHARTITLE = { PRC_ID = 116, PRC_VALUE = 1 },
},
}
PG_BASE_BOARD_DATA =
{
{ BB_INDEX = "PzlBoard_4x4", BB_REGEN_POS = { RP_X = 11430, RP_Y = 13608, RP_DIR = 90 } },
{ BB_INDEX = "PzlBoard_4x4", BB_REGEN_POS = { RP_X = 11430, RP_Y = 13269, RP_DIR = 90 } },
}
PG_COMPLETION_PUZZLE_DATA =
{
{ CP_INDEX = "PzlSlimeFull", CP_REGEN_POS = { RP_X = 11430, RP_Y = 13608, RP_DIR = 270 } },
{ CP_INDEX = "PzlHoneyFull", CP_REGEN_POS = { RP_X = 11430, RP_Y = 13269, RP_DIR = 270 } },
}
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PG_PIECE_INFO =
{
-- 4 X 4 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
{ PI_INDEX = "PzlSlime1_1", PI_REGEN_POS = { PI_X = 11355, PI_Y = 13533, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime1_2", PI_REGEN_POS = { PI_X = 11355, PI_Y = 13583, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime1_3", PI_REGEN_POS = { PI_X = 11355, PI_Y = 13633, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime1_4", PI_REGEN_POS = { PI_X = 11355, PI_Y = 13683, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime2_1", PI_REGEN_POS = { PI_X = 11405, PI_Y = 13533, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime2_2", PI_REGEN_POS = { PI_X = 11405, PI_Y = 13583, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime2_3", PI_REGEN_POS = { PI_X = 11405, PI_Y = 13633, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime2_4", PI_REGEN_POS = { PI_X = 11405, PI_Y = 13683, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime3_1", PI_REGEN_POS = { PI_X = 11455, PI_Y = 13533, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime3_2", PI_REGEN_POS = { PI_X = 11455, PI_Y = 13583, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime3_3", PI_REGEN_POS = { PI_X = 11455, PI_Y = 13633, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime3_4", PI_REGEN_POS = { PI_X = 11455, PI_Y = 13683, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime4_1", PI_REGEN_POS = { PI_X = 11505, PI_Y = 13533, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime4_2", PI_REGEN_POS = { PI_X = 11505, PI_Y = 13583, PI_DIR = 270 } },
{ PI_INDEX = "PzlSlime4_3", PI_REGEN_POS = { PI_X = 11505, PI_Y = 13633, PI_DIR = 270 } },
{ PI_INDEX = nil, PI_REGEN_POS = { PI_X = 11505, PI_Y = 13683, PI_DIR = 270 } },
},
-- 4 X 4 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
{ PI_INDEX = "PzlHoney1_1", PI_REGEN_POS = { PI_X = 11355, PI_Y = 13194, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney1_2", PI_REGEN_POS = { PI_X = 11355, PI_Y = 13244, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney1_3", PI_REGEN_POS = { PI_X = 11355, PI_Y = 13294, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney1_4", PI_REGEN_POS = { PI_X = 11355, PI_Y = 13344, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney2_1", PI_REGEN_POS = { PI_X = 11405, PI_Y = 13194, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney2_2", PI_REGEN_POS = { PI_X = 11405, PI_Y = 13244, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney2_3", PI_REGEN_POS = { PI_X = 11405, PI_Y = 13294, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney2_4", PI_REGEN_POS = { PI_X = 11405, PI_Y = 13344, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney3_1", PI_REGEN_POS = { PI_X = 11455, PI_Y = 13194, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney3_2", PI_REGEN_POS = { PI_X = 11455, PI_Y = 13244, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney3_3", PI_REGEN_POS = { PI_X = 11455, PI_Y = 13294, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney3_4", PI_REGEN_POS = { PI_X = 11455, PI_Y = 13344, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney4_1", PI_REGEN_POS = { PI_X = 11505, PI_Y = 13194, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney4_2", PI_REGEN_POS = { PI_X = 11505, PI_Y = 13244, PI_DIR = 270 } },
{ PI_INDEX = "PzlHoney4_3", PI_REGEN_POS = { PI_X = 11505, PI_Y = 13294, PI_DIR = 270 } },
{ PI_INDEX = nil, PI_REGEN_POS = { PI_X = 11505, PI_Y = 13344, PI_DIR = 270 } },
},
}
PG_TOPVIEW_DATA =
{
PTD_CENTER_POS = { PCP_X = 11430, PCP_Y = 13439 },
PTD_RANGE = 530,
PTD_DEGREE = 270,
}
-- <EFBFBD><EFBFBD>Ȳ<EFBFBD><EFBFBD> <EFBFBD>´<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>̾<EFBFBD><EFBFBD>α<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PG_CIRCUMSTANCE_DIALOG =
{
MONEY_LACK = { EFFECTMSG = nil, FACECUT = "Xiaoming", FILENAME = "Event", INDEX = "Xiaoming_05" },
GAME_ALREADY_PLAY = { EFFECTMSG = nil, FACECUT = nil, FILENAME = "Event", INDEX = "SystemMsg_01" },
GAME_WATING = { EFFECTMSG = nil, FACECUT = nil, FILENAME = "Event", INDEX = "SystemMsg_02" },
GAMEOVER_NO_CLICK = { EFFECTMSG = nil, FACECUT = nil, FILENAME = "Event", INDEX = "SystemMsg_03" },
}
PG_ANNOUNCE_DATA =
{
PLAY_TIME = "Pzl_Success_CostTime"
}
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ʿ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>
PG_ABSTATE_DATA =
{
PAD_USER_STUN = { INDEX = "StaAdlFStun", KEEPTIME = 9999999 },
PAD_FOMING_EFFECT = { INDEX = "StaPzlOccupy", KEEPTIME = 9999999 },
PAD_GAME_SELECT = { INDEX = "StaPzlHide", KEEPTIME = 1000 },
}
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PG_DOOR_BLOCK =
{
PDB_DOOR_INDEX = "GuildGate00",
PDB_BLOCK_INDEX = "Xiaoming",
PDB_REGEN_POSITION = { X = 0, Y = 0, DIR = 0}
}
PG_MOVABLE_CELL =
{
PMC_UP = 1,
PMC_DOWN = 2,
PMC_LEFT = 3,
PMC_RIGHT = 4,
}
PG_GAME_STATE =
{
PGS_WAIT = 1,
PGS_COUNT = 2,
PGS_PROGRESS = 3,
PGS_COMPLETE = 4,
PGS_FAIL = 5,
}
PG_PUZZLE_STATE =
{
PPS_WAIT = 1,
PPS_PROGRESS = 2,
PPS_COMPLETE = 3,
}
---------------------------------------------------------------------------------------------------------------------------------------
--***********************************************************************************************************************************--
-- --
-- <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> ]]--
--[[ ]]--
--[[------------------------------------------------------------------------------------------------]]--
--[[
PuzzleMemory =
{
PM_CurrentTime = <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ð<EFBFBD>
PM_EventMap = "<EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD><EFBFBD><EFBFBD>"
PM_NPCHandle = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>NPC <EFBFBD>ڵ<EFBFBD>
PM_State = PG_GAME_STATE["PGS_WAIT"]
PM_StepInfo = {
SI_Step = <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>δܰ<EFBFBD>
SI_NextStepTime = <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ð<EFBFBD>
},
PM_GameInfo = {
GI_GameMode = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
GI_CharHandle = <EFBFBD><EFBFBD> <EFBFBD>ڵ<EFBFBD>
GI_CharNumber = ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ѹ<EFBFBD>,
GI_StartTime = <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ð<EFBFBD>,
GI_GameEndTime = <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ð<EFBFBD>,
GI_NoClickTime = <EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ŭ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>Ǵ<EFBFBD> <EFBFBD>ð<EFBFBD>,
},
PG_PrevGamePlayer = {
PP_CharNumber = ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ѹ<EFBFBD>
PP_WaitingTime = <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ð<EFBFBD>
}
[<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ÿ<EFBFBD><EFBFBD>] = tPuzzleBoard( <EFBFBD>Ʒ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>̺<EFBFBD> ),
PM_PieceArray[PI_Handle] = CI_PieceInfo....
}
tPuzzleBoard =
{
PB_State = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD>Ϸ<EFBFBD>,
PB_EmptyCellID = CI_ID,
PB_MovableCell = {
PMC_UP = CI_ID,
PMC_DOWN = CI_ID,
PMC_LEFT = CI_ID,
PMC_RIGHT = CI_ID,
},
-- <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>
PB_BoardSize = {
MaxCell = ,
MaxWidth = ,
MaxHeight =
},
PB_CellArray = {
CellInfo = {
CI_ID
CI_PieceInfo =
{
PI_ID,
PI_Handle,
PI_GameType,
}
}
.......
}
PB_BaseBoard = {
BB_Handle = BaseBoard <EFBFBD>ڵ<EFBFBD>
}
PB_CellList[PI_Handle] = CellInfo
}
--]]
--[[------------------------------------------------------------------------------------------------]]--
--[[ ]]--
--[[ <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>
g_PuzzleMemory = { }
g_EventNPCHandle = { }
g_DieInfo = { }
function Xiaoming( Handle, MapIndex )
cExecCheck( "Xiaoming" )
if cIsObjectDead( Handle )
then
cAIScriptSet( Handle )
cNPCVanish( Handle )
PuzzleMemory[Handle] = nil
return ReturnAI["END"]
end
local PuzzleMemory
PuzzleMemory = g_PuzzleMemory[Handle]
if PuzzleMemory == nil
then
cAIScriptFunc( Handle, "NPCClick", "PG_MAIN_NPC_CLICK" )
cAIScriptFunc( Handle, "NPCMenu", "PG_NPCMENU_ACK" )
g_PuzzleMemory[Handle] = { }
PuzzleMemory = g_PuzzleMemory[Handle]
PuzzleMemory["PM_NPCHandle"] = Handle
PuzzleMemory["PM_DoorBlockHandle"] = PG_INVALID_VALUE
PuzzleMemory["PM_CurrentTime"] = cCurrentSecond()
PuzzleMemory["PM_EventMap"] = MapIndex
PuzzleMemory["PM_State"] = PG_GAME_STATE["PGS_WAIT"]
PuzzleMemory["PM_StepInfo"] = { }
PuzzleMemory["PM_GameInfo"] = { }
PuzzleMemory["PG_PrevGamePlayer"] = { }
PuzzleMemory["PM_PieceArray"] = { }
PuzzleMemory["PM_StepInfo"]["SI_Step"] = 1
PuzzleMemory["PM_StepInfo"]["SI_NextStepTime"] = PuzzleMemory["PM_CurrentTime"]
PuzzleMemory["PM_GameInfo"]["GI_GameMode"] = PG_INVALID_VALUE
PuzzleMemory["PM_GameInfo"]["GI_CharNumber"] = PG_INVALID_VALUE
PuzzleMemory["PM_GameInfo"]["GI_CharHandle"] = PG_INVALID_VALUE
PuzzleMemory["PM_GameInfo"]["GI_StartTime"] = PG_INVALID_VALUE
PuzzleMemory["PM_GameInfo"]["GI_GameEndTime"] = PG_INVALID_VALUE
PuzzleMemory["PM_GameInfo"]["GI_NoClickTime"] = PG_INVALID_VALUE
PuzzleMemory["PG_PrevGamePlayer"]["PP_CharNumber"] = PG_INVALID_VALUE
PuzzleMemory["PG_PrevGamePlayer"]["PP_WaitingTime"] = PG_INVALID_VALUE
PG_EVENT_OPEN( PuzzleMemory )
end
PuzzleMemory["PM_CurrentTime"] = cCurrentSecond()
PG_GAME_ROUTINE( PuzzleMemory )
end
function PG_EVENT_OPEN( PuzzleMemory )
cExecCheck( "PG_EVENT_OPEN" )
if PuzzleMemory == nil
then
return
end
--[[
PuzzleMemory["PM_DoorBlockHandle"] = cDoorBuild( PuzzleMemory["PM_EventMap"], PG_DOOR_BLOCK["PDB_DOOR_INDEX"],
PG_DOOR_BLOCK["PDB_REGEN_POSITION"]["X"], PG_DOOR_BLOCK["PDB_REGEN_POSITION"]["Y"], PG_DOOR_BLOCK["PDB_REGEN_POSITION"]["DIR"], 1000 )
if PuzzleMemory["PM_DoorBlockHandle"] ~= nil
then
cDoorAction( PuzzleMemory["PM_DoorBlockHandle"], PG_DOOR_BLOCK["PDB_BLOCK_INDEX"], "close" )
end
--]]
for i = 1, #PG_BASE_BOARD_DATA do
local PuzzleBoard = { }
local BaseBoard = { }
PuzzleBoard["PB_MovableCell"] = { }
PuzzleBoard["PB_BoardSize"] = { }
PuzzleBoard["PB_BaseBoard"] = { }
PuzzleBoard["PB_CellArray"] = { }
PuzzleBoard["PB_CellList"] = { }
PuzzleBoard["PB_MovableCell"][PG_MOVABLE_CELL["PMC_UP"]] = PG_INVALID_VALUE
PuzzleBoard["PB_MovableCell"][PG_MOVABLE_CELL["PMC_DOWN"]] = PG_INVALID_VALUE
PuzzleBoard["PB_MovableCell"][PG_MOVABLE_CELL["PMC_LEFT"]] = PG_INVALID_VALUE
PuzzleBoard["PB_MovableCell"][PG_MOVABLE_CELL["PMC_RIGHT"]] = PG_INVALID_VALUE
PuzzleBoard["PB_BoardSize"]["MaxWidth"] = PG_PUZZLE_SIZE[i]["PS_WIDTH"]
PuzzleBoard["PB_BoardSize"]["MaxHeight"] = PG_PUZZLE_SIZE[i]["PS_HEIGHT"]
PuzzleBoard["PB_BoardSize"]["MaxCell"] = PG_PUZZLE_SIZE[i]["PS_WIDTH"] * PG_PUZZLE_SIZE[i]["PS_HEIGHT"]
PuzzleBoard["PB_State"] = PG_PUZZLE_STATE["PPS_WAIT"]
PuzzleBoard["PB_EmptyCellID"] = PuzzleBoard["PB_BoardSize"]["MaxCell"]
PG_GET_MOVABLE_CELL( PuzzleBoard )
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
local BaseBoardLoc
BaseBoardLoc = PG_BASE_BOARD_DATA[i]["BB_REGEN_POS"]
PuzzleBoard["PB_BaseBoard"]["BB_Handle"] = cMobRegen_XY( PuzzleMemory["PM_EventMap"], PG_BASE_BOARD_DATA[i]["BB_INDEX"],
BaseBoardLoc["RP_X"], BaseBoardLoc["RP_Y"], BaseBoardLoc["RP_DIR"] )
if PuzzleBoard["PB_BaseBoard"]["BB_Handle"] ~= nil
then
cAIScriptSet ( PuzzleBoard["PB_BaseBoard"]["BB_Handle"], PuzzleMemory["PM_NPCHandle"] )
cAIScriptFunc ( PuzzleBoard["PB_BaseBoard"]["BB_Handle"], "Entrance", "PG_PIECE_ROUTINE" )
PuzzleMemory["PM_PieceArray"][PuzzleBoard["PB_BaseBoard"]["BB_Handle"]] = PuzzleBoard["PB_BaseBoard"]
g_PuzzleMemory[PuzzleBoard["PB_BaseBoard"]["BB_Handle"]] = PuzzleMemory
end
-- <EFBFBD>Ϸ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
local ComplPuzzleLoc
local PieceInfo = { }
local CellInfo = { }
ComplPuzzleLoc = PG_COMPLETION_PUZZLE_DATA[i]["CP_REGEN_POS"]
PieceInfo["PI_Handle"] = cMobRegen_XY( PuzzleMemory["PM_EventMap"], PG_COMPLETION_PUZZLE_DATA[i]["CP_INDEX"],
ComplPuzzleLoc["RP_X"], ComplPuzzleLoc["RP_Y"], ComplPuzzleLoc["RP_DIR"] )
if PieceInfo["PI_Handle"] ~= nil
then
cAIScriptSet ( PieceInfo["PI_Handle"], PuzzleMemory["PM_NPCHandle"] )
cAIScriptFunc ( PieceInfo["PI_Handle"], "Entrance", "PG_PIECE_ROUTINE" )
g_PuzzleMemory[PieceInfo["PI_Handle"]] = PuzzleMemory
PieceInfo["PI_ID"] = 1
PieceInfo["PI_GameType"] = i
CellInfo["CI_ID"] = 1
CellInfo["CI_PieceInfo"] = PieceInfo
PuzzleBoard["PB_CellArray"][1] = CellInfo
PuzzleBoard["PB_CellList"][PieceInfo["PI_Handle"]] = CellInfo
PuzzleMemory["PM_PieceArray"][PieceInfo["PI_Handle"]] = PieceInfo
end
PuzzleMemory[i] = PuzzleBoard
end
end
--[[------------------------------------------------------------------------------------------------]]--
--[[ ]]--
--[[ <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ƾ / <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ƾ ]]--
--[[ ]]--
--[[------------------------------------------------------------------------------------------------]]--
function PG_GAME_ROUTINE( PuzzleMemory )
cExecCheck( "PG_GAME_ROUTINE" )
if PuzzleMemory == nil
then
return
end
local PuzzleState
local GameInfo
local StepInfo
local PuzzleStep
local ProgressData
local ProgressStepData
PuzzleState = PuzzleMemory["PM_State"]
GameInfo = PuzzleMemory["PM_GameInfo"]
if GameInfo == nil
then
return
end
StepInfo = PuzzleMemory["PM_StepInfo"]
if StepInfo == nil
then
return
end
PuzzleStep = StepInfo["SI_Step"]
if PuzzleMemory["PM_CurrentTime"] < StepInfo["SI_NextStepTime"]
then
return
end
ProgressData = PG_PROGRESS_DATA[PuzzleState]
ProgressStepData = ProgressData["PPD_STEP_INFO"][PuzzleStep]
if ProgressStepData["PPD_EFFECTMSG"] ~= nil
then
cEffectMsg( GameInfo["GI_CharHandle"], ProgressStepData["PPD_EFFECTMSG"] )
end
if ProgressStepData["PPD_MOBCHAT"] ~= nil
then
cMobChat( PuzzleMemory["PM_NPCHandle"], ProgressStepData["PPD_MOBCHAT"]["FILENAME"], ProgressStepData["PPD_MOBCHAT"]["INDEX"] )
end
if ProgressStepData["PPD_FACECUT"] ~= nil
then
cMobDialog_Obj( GameInfo["GI_CharHandle"], ProgressStepData["PPD_FACECUT"]["FACECUT"], ProgressStepData["PPD_FACECUT"]["FILENAME"], ProgressStepData["PPD_FACECUT"]["INDEX"] )
end
ProgressStepData["PPD_FUNC"]( PuzzleMemory )
StepInfo["SI_Step"] = StepInfo["SI_Step"] + 1
if StepInfo["SI_Step"] > ProgressData["PPD_STEP_COUNT"]
then
StepInfo["SI_Step"] = 1
if ProgressData["PPD_STEP_ISLOOP"] == false
then
PuzzleMemory["PM_State"] = PuzzleMemory["PM_State"] + 1
if PuzzleMemory["PM_State"] > PG_GAME_STATE["PGS_COMPLETE"]
then
PuzzleMemory["PM_State"] = PG_GAME_STATE["PGS_WAIT"]
StepInfo["SI_Step"] = 1
end
ProgressData = PG_PROGRESS_DATA[PuzzleState]
ProgressStepData = ProgressData["PPD_STEP_INFO"][PuzzleStep]
end
end
StepInfo["SI_NextStepTime"] = PuzzleMemory["PM_CurrentTime"] + ProgressStepData["PPD_DELAY"]
end
function PG_DUMMY_FUNCTION( PuzzleMemory )
cExecCheck( "PG_DUMMY_FUNCTION" )
end
function PG_PIECE_ROUTINE( Handle, MapIndex )
cExecCheck( "PG_PIECE_ROUTINE" )
local PuzzleMemory
local PieceArray
PuzzleMemory = g_PuzzleMemory[Handle]
if PuzzleMemory == nil
then
cAIScriptSet( Handle )
cNPCVanish( Handle )
return ReturnAI["END"]
end
if cIsObjectDead( Handle )
then
if g_DieInfo[Handle] < PuzzleMemory["PM_CurrentTime"]
then
cAIScriptSet ( Handle )
cNPCVanish ( Handle )
g_PuzzleMemory[Handle] = nil
g_DieInfo[Handle] = nil
end
return ReturnAI["END"]
end
PieceArray = PuzzleMemory["PM_PieceArray"]
if PieceArray == nil
then
cAIScriptSet( Handle )
cNPCVanish( Handle )
g_PuzzleMemory[Handle] = nil
return ReturnAI["END"]
end
if PieceArray[Handle] == nil
then
cAIScriptSet( Handle )
cNPCVanish( Handle )
g_PuzzleMemory[Handle] = nil
return ReturnAI["END"]
end
if cIsObjectDead( PuzzleMemory["PM_NPCHandle"] )
then
cAIScriptSet( Handle )
cNPCVanish( Handle )
g_PuzzleMemory[Handle] = nil
return ReturnAI["END"]
end
return ReturnAI["END"]
end
function PG_COUNT_DELETE_BOARD( PuzzleMemory )
cExecCheck( "PG_COUNT_DELETE_BOARD" )
if PuzzleMemory == nil
then
return
end
if PuzzleMemory["PM_State"] ~= PG_GAME_STATE["PGS_COUNT"]
then
return
end
PuzzleState = PuzzleMemory["PM_State"]
if PuzzleState ~= PG_GAME_STATE["PGS_COUNT"]
then
return
end
local StepInfo
local PuzzleStep
local GameInfo
StepInfo = PuzzleMemory["PM_StepInfo"]
if StepInfo == nil
then
return
end
PuzzleStep = StepInfo["SI_Step"]
if PuzzleStep == PG_INVALID_VALUE
then
return
end
GameInfo = PuzzleMemory["PM_GameInfo"]
if GameInfo == nil
then
return
end
if GameInfo["GI_GameMode"] == PG_PUZZLE_MODE["PGM_ALL_PLAY"]
then
for i = 1, #PG_BASE_BOARD_DATA do
local PuzzleBoard
local BaseBoard
PuzzleBoard = PuzzleMemory[i]
if PuzzleBoard == nil
then
return
end
PG_DELETE_PUZZLEBOARD ( i, PuzzleMemory )
PG_CREATE_BASE_CELL ( i, PuzzleMemory )
PG_SUFFLE_PIECES ( PuzzleBoard )
PG_GET_MOVABLE_CELL ( PuzzleBoard )
BaseBoard = PuzzleBoard["PB_BaseBoard"]
if BaseBoard == nil
then
return
end
cSetAbstate( BaseBoard["BB_Handle"], PG_ABSTATE_DATA["PAD_GAME_SELECT"]["INDEX"], 1, PG_ABSTATE_DATA["PAD_GAME_SELECT"]["KEEPTIME"] )
end
else
local PuzzleBoard
local BaseBoard
PuzzleBoard = PuzzleMemory[GameInfo["GI_GameMode"]]
if PuzzleBoard == nil
then
return
end
PG_DELETE_PUZZLEBOARD ( GameInfo["GI_GameMode"], PuzzleMemory )
PG_CREATE_BASE_CELL ( GameInfo["GI_GameMode"], PuzzleMemory )
PG_SUFFLE_PIECES ( PuzzleBoard )
PG_GET_MOVABLE_CELL ( PuzzleBoard )
BaseBoard = PuzzleBoard["PB_BaseBoard"]
if BaseBoard == nil
then
return
end
cSetAbstate( BaseBoard["BB_Handle"], PG_ABSTATE_DATA["PAD_GAME_SELECT"]["INDEX"], 1, PG_ABSTATE_DATA["PAD_GAME_SELECT"]["KEEPTIME"] )
end
end
function PG_COUNT_EFFECT_BOARD( PuzzleMemory )
cExecCheck( "PG_COUNT_EFFECT_BOARD" )
if PuzzleMemory == nil
then
return
end
if PuzzleMemory["PM_State"] ~= PG_GAME_STATE["PGS_COUNT"]
then
return
end
PuzzleState = PuzzleMemory["PM_State"]
if PuzzleState ~= PG_GAME_STATE["PGS_COUNT"]
then
return
end
local StepInfo
local PuzzleStep
local GameInfo
StepInfo = PuzzleMemory["PM_StepInfo"]
if StepInfo == nil
then
return
end
PuzzleStep = StepInfo["SI_Step"]
if PuzzleStep == PG_INVALID_VALUE
then
return
end
GameInfo = PuzzleMemory["PM_GameInfo"]
if GameInfo == nil
then
return
end
if GameInfo["GI_GameMode"] == PG_PUZZLE_MODE["PGM_ALL_PLAY"]
then
for i = 1, #PG_BASE_BOARD_DATA do
local PuzzleBoard
local BaseBoard
PuzzleBoard = PuzzleMemory[i]
if PuzzleBoard == nil
then
return
end
BaseBoard = PuzzleBoard["PB_BaseBoard"]
if BaseBoard == nil
then
return
end
cSetAbstate( BaseBoard["BB_Handle"], PG_ABSTATE_DATA["PAD_GAME_SELECT"]["INDEX"], 1, PG_ABSTATE_DATA["PAD_GAME_SELECT"]["KEEPTIME"] )
end
else
local PuzzleBoard
local BaseBoard
PuzzleBoard = PuzzleMemory[GameInfo["GI_GameMode"]]
if PuzzleBoard == nil
then
return
end
BaseBoard = PuzzleBoard["PB_BaseBoard"]
if BaseBoard == nil
then
return
end
cSetAbstate( BaseBoard["BB_Handle"], PG_ABSTATE_DATA["PAD_GAME_SELECT"]["INDEX"], 1, PG_ABSTATE_DATA["PAD_GAME_SELECT"]["KEEPTIME"] )
end
end
function PG_COUNT_REGEN_PIECES( PuzzleMemory )
cExecCheck( "PG_COUNT_REGEN_PIECES" )
if PuzzleMemory == nil
then
return
end
if PuzzleMemory["PM_State"] ~= PG_GAME_STATE["PGS_COUNT"]
then
return
end
PuzzleState = PuzzleMemory["PM_State"]
if PuzzleState ~= PG_GAME_STATE["PGS_COUNT"]
then
return
end
local StepInfo
local PuzzleStep
local GameInfo
StepInfo = PuzzleMemory["PM_StepInfo"]
if StepInfo == nil
then
return
end
PuzzleStep = StepInfo["SI_Step"]
if PuzzleStep == PG_INVALID_VALUE
then
return
end
GameInfo = PuzzleMemory["PM_GameInfo"]
if GameInfo == nil
then
return
end
if GameInfo["GI_GameMode"] == PG_PUZZLE_MODE["PGM_ALL_PLAY"]
then
for i = 1, #PG_BASE_BOARD_DATA do
local PuzzleBoard
PuzzleBoard = PuzzleMemory[i]
if PuzzleBoard == nil
then
return
end
PG_REGEN_PIECES( i, PuzzleMemory )
end
else
local PuzzleBoard
PuzzleBoard = PuzzleMemory[GameInfo["GI_GameMode"]]
if PuzzleBoard == nil
then
return
end
PG_REGEN_PIECES( GameInfo["GI_GameMode"], PuzzleMemory )
end
end
function PG_COUNT_GAME_START( PuzzleMemory )
cExecCheck( "PG_COUNT_GAME_START" )
if PuzzleMemory == nil
then
return
end
if PuzzleMemory["PM_State"] ~= PG_GAME_STATE["PGS_COUNT"]
then
return
end
PuzzleState = PuzzleMemory["PM_State"]
if PuzzleState ~= PG_GAME_STATE["PGS_COUNT"]
then
return
end
local StepInfo
local PuzzleStep
local GameInfo
StepInfo = PuzzleMemory["PM_StepInfo"]
if StepInfo == nil
then
return
end
PuzzleStep = StepInfo["SI_Step"]
if PuzzleStep == PG_INVALID_VALUE
then
return
end
GameInfo = PuzzleMemory["PM_GameInfo"]
if GameInfo == nil
then
return
end
local GameData
GameData = PG_GAME_DATA[GameInfo["GI_GameMode"]]
if GameData == nil
then
return
end
GameInfo["GI_GameEndTime"] = PuzzleMemory["PM_CurrentTime"] + PG_GAME_DATA[GameInfo["GI_GameMode"]]["PGD_PLAYTIME"]
if GameInfo["GI_GameMode"] == PG_PUZZLE_MODE["PGM_ALL_PLAY"]
then
for i = 1, #PG_BASE_BOARD_DATA do
local PuzzleBoard
PuzzleBoard = PuzzleMemory[i]
if PuzzleBoard == nil
then
return
end
PuzzleBoard["PB_State"] = PG_PUZZLE_STATE["PPS_PROGRESS"]
end
else
local PuzzleBoard
PuzzleBoard = PuzzleMemory[GameInfo["GI_GameMode"]]
if PuzzleBoard == nil
then
return
end
PuzzleBoard["PB_State"] = PG_PUZZLE_STATE["PPS_PROGRESS"]
end
GameInfo["GI_StartTime"] = PuzzleMemory["PM_CurrentTime"]
GameInfo["GI_NoClickTime"] = PuzzleMemory["PM_CurrentTime"] + PG_NO_CLICK_TIME
cEffectTimer( GameInfo["GI_CharHandle"], 0, PG_GAME_DATA[GameInfo["GI_GameMode"]]["PGD_PLAYTIME"] )
return
end
function PG_PROGRESS_ISCOMPLETE( PuzzleMemory )
cExecCheck( "PG_PROGRESS_ISCOMPLETE" )
if PuzzleMemory == nil
then
return
end
if PuzzleMemory["PM_State"] ~= PG_GAME_STATE["PGS_PROGRESS"]
then
return
end
local GameInfo
local StepInfo
GameInfo = PuzzleMemory["PM_GameInfo"]
if GameInfo == nil
then
return
end
StepInfo = PuzzleMemory["PM_StepInfo"]
if StepInfo == nil
then
return
end
if GameInfo["GI_NoClickTime"] < PuzzleMemory["PM_CurrentTime"]
then
cSystemMessage_Obj( GameInfo["GI_CharHandle"], PG_CIRCUMSTANCE_DIALOG["GAMEOVER_NO_CLICK"]["FILENAME"], PG_CIRCUMSTANCE_DIALOG["GAMEOVER_NO_CLICK"]["INDEX"] )
PuzzleMemory["PM_State"] = PG_GAME_STATE["PGS_FAIL"]
return
end
if GameInfo["GI_GameEndTime"] < PuzzleMemory["PM_CurrentTime"]
then
PuzzleMemory["PM_State"] = PG_GAME_STATE["PGS_FAIL"]
return
end
if GameInfo["GI_GameMode"] == PG_PUZZLE_MODE["PGM_ALL_PLAY"]
then
for i = 1, #PG_BASE_BOARD_DATA do
local PuzzleBoard
PuzzleBoard = PuzzleMemory[i]
if PuzzleBoard == nil
then
return
end
if PuzzleBoard["PB_State"] ~= PG_PUZZLE_STATE["PPS_COMPLETE"]
then
return
end
end
else
local PuzzleBoard
PuzzleBoard = PuzzleMemory[GameInfo["GI_GameMode"]]
if PuzzleBoard == nil
then
return
end
if PuzzleBoard["PB_State"] ~= PG_PUZZLE_STATE["PPS_COMPLETE"]
then
return
end
end
PuzzleMemory["PM_State"] = PG_GAME_STATE["PGS_COMPLETE"]
StepInfo["SI_Step"] = 1
end
function PG_COMPLETE_INIT_GAME( PuzzleMemory )
cExecCheck( "PG_COMPLETE_INIT_GAME" )
if PuzzleMemory == nil
then
return
end
local GameInfo
local StepInfo
GameInfo = PuzzleMemory["PM_GameInfo"]
if GameInfo == nil
then
return
end
StepInfo = PuzzleMemory["PM_StepInfo"]
if StepInfo == nil
then
return
end
if PuzzleMemory["PG_PrevGamePlayer"] == nil
then
return
end
PuzzleMemory["PG_PrevGamePlayer"]["PP_CharNumber"] = GameInfo["GI_CharNumber"]
PuzzleMemory["PG_PrevGamePlayer"]["PP_WaitingTime"] = PuzzleMemory["PM_CurrentTime"] + PG_WATING_TIME
if GameInfo["GI_GameMode"] == PG_PUZZLE_MODE["PGM_ALL_PLAY"]
then
for i = 1, #PG_BASE_BOARD_DATA do
local PuzzleBoard
local BaseBoard
PuzzleBoard = PuzzleMemory[i]
if PuzzleBoard == nil
then
return
end
BaseBoard = PuzzleBoard["PB_BaseBoard"]
if BaseBoard == nil
then
return
end
PG_DELETE_PUZZLEBOARD ( i, PuzzleMemory )
PG_REGEN_COMPLETION ( i, PuzzleMemory )
end
else
local PuzzleBoard
local BaseBoard
PuzzleBoard = PuzzleMemory[GameInfo["GI_GameMode"]]
if PuzzleBoard == nil
then
return
end
BaseBoard = PuzzleBoard["PB_BaseBoard"]
if BaseBoard == nil
then
return
end
PG_DELETE_PUZZLEBOARD ( GameInfo["GI_GameMode"], PuzzleMemory )
PG_REGEN_COMPLETION ( GameInfo["GI_GameMode"], PuzzleMemory )
end
cTopView( GameInfo["GI_CharHandle"], 0, 0, 0, 0, 0 )
cHideOtherPlayer( GameInfo["GI_CharHandle"], 0 )
cResetAbstate( GameInfo["GI_CharHandle"], PG_ABSTATE_DATA["PAD_USER_STUN"]["INDEX"] )
cResetAbstate( PuzzleMemory["PM_NPCHandle"], PG_ABSTATE_DATA["PAD_FOMING_EFFECT"]["INDEX"] )
cEffectTimer( GameInfo["GI_CharHandle"], 1, 0 )
PuzzleMemory["PM_State"] = PG_GAME_STATE["PGS_WAIT"]
StepInfo["SI_Step"] = 1
StepInfo["SI_NextStepTime"] = PuzzleMemory["PM_CurrentTime"]
GameInfo["GI_GameMode"] = PG_INVALID_VALUE
GameInfo["GI_CharHandle"] = PG_INVALID_VALUE
GameInfo["GI_CharNumber"] = PG_INVALID_VALUE
GameInfo["GI_GameEndTime"] = PG_INVALID_VALUE
end
function PG_COMPLETE_SUCCESS_GAME( PuzzleMemory )
cExecCheck( "PG_COMPLETE_SUCCESS_GAME" )
if PuzzleMemory == nil
then
return
end
local GameInfo
local StepInfo
GameInfo = PuzzleMemory["PM_GameInfo"]
if GameInfo == nil
then
return
end
StepInfo = PuzzleMemory["PM_StepInfo"]
if StepInfo == nil
then
return
end
local RewardAbstateData
local RewardCharTitleData
local DialogData
local PlayTime
RewardAbstateData = PG_GAME_DATA[GameInfo["GI_GameMode"]]["PGD_REWARD_ABSTATE"]
RewardCharTitleData = PG_GAME_DATA[GameInfo["GI_GameMode"]]["PGD_REWARD_CHARTITLE"]
PlayTime = PuzzleMemory["PM_CurrentTime"] - GameInfo["GI_StartTime"]
PlayTime = math.floor( PlayTime )
cScriptMessage_Obj( GameInfo["GI_CharHandle"], PG_ANNOUNCE_DATA["PLAY_TIME"], PlayTime )
for i = 1, #RewardAbstateData do
cSetAbstate_Range( PuzzleMemory["PM_NPCHandle"], PG_REWARD_RANGE, ObjectType["Player"], RewardAbstateData[i]["PRA_INDEX"], 1, RewardAbstateData[i]["PRA_KEEPTIME"] )
end
cCharTitleAddValue( GameInfo["GI_CharHandle"], RewardCharTitleData["PRC_ID"], RewardCharTitleData["PRC_VALUE"] )
end
--[[------------------------------------------------------------------------------------------------]]--
--[[ ]]--
--[[ <EFBFBD><EFBFBD><EFBFBD><EFBFBD> / <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>Լ<EFBFBD> ]]--
--[[ ]]--
--[[------------------------------------------------------------------------------------------------]]--
function PG_REGEN_COMPLETION( nGameType, PuzzleMemory )
cExecCheck( "PG_REGEN_COMPLETION" )
if PuzzleMemory == nil
then
return
end
local PuzzleBoard
PuzzleBoard = PuzzleMemory[nGameType]
if PuzzleBoard == nil
then
return
end
if PuzzleMemory["PM_PieceArray"] == nil
then
PuzzleMemory["PM_PieceArray"] = { }
end
PuzzleBoard["PB_CellArray"] = { }
PuzzleBoard["PB_CellList"] = { }
-- <EFBFBD>Ϸ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
local ComplPuzzleLoc
local PieceInfo = { }
local CellInfo = { }
ComplPuzzleLoc = PG_COMPLETION_PUZZLE_DATA[nGameType]["CP_REGEN_POS"]
PieceInfo["PI_Handle"] = cMobRegen_XY( PuzzleMemory["PM_EventMap"], PG_COMPLETION_PUZZLE_DATA[nGameType]["CP_INDEX"],
ComplPuzzleLoc["RP_X"], ComplPuzzleLoc["RP_Y"], ComplPuzzleLoc["RP_DIR"] )
if PieceInfo["PI_Handle"] ~= nil
then
cAIScriptSet ( PieceInfo["PI_Handle"], PuzzleMemory["PM_NPCHandle"] )
cAIScriptFunc ( PieceInfo["PI_Handle"], "Entrance", "PG_PIECE_ROUTINE" )
g_PuzzleMemory[PieceInfo["PI_Handle"]] = PuzzleMemory
PieceInfo["PI_ID"] = 1
PieceInfo["PI_GameType"] = nGameType
CellInfo["CI_ID"] = 1
CellInfo["CI_PieceInfo"] = PieceInfo
PuzzleBoard["PB_CellArray"][1] = CellInfo
PuzzleBoard["PB_CellList"][PieceInfo["PI_Handle"]] = CellInfo
PuzzleMemory["PM_PieceArray"][PieceInfo["PI_Handle"]] = PieceInfo
end
PuzzleMemory[nGameType] = PuzzleBoard
end
function PG_CREATE_BASE_CELL( nGameType, PuzzleMemory )
cExecCheck( "PG_CREATE_BASE_CELL" )
if PuzzleMemory == nil
then
return
end
local PuzzleBoard
PuzzleBoard = PuzzleMemory[nGameType]
if PuzzleBoard == nil
then
return
end
PuzzleBoard["PB_EmptyCellID"] = PuzzleBoard["PB_BoardSize"]["MaxCell"]
PG_GET_MOVABLE_CELL( PuzzleBoard )
if PuzzleMemory["PM_PieceArray"] == nil
then
PuzzleMemory["PM_PieceArray"] = { }
end
PuzzleBoard["PB_CellArray"] = { }
PuzzleBoard["PB_CellList"] = { }
local PuzzleSize
local MaxCell
local PiecesData
PuzzleSize = PuzzleBoard["PB_BoardSize"]
if PuzzleSize == nil
then
return
end
MaxCell = PuzzleSize["MaxCell"]
PiecesData = PG_PIECE_INFO[nGameType]
for i = 1, MaxCell do
local PieceLoc
local PieceIndex
local PieceInfo = { }
local CellInfo = { }
-- <EFBFBD>󼿵<EFBFBD> Piece<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ش<EFBFBD>.
if i == MaxCell
then
PieceInfo["PI_Handle"] = PG_INVALID_VALUE
PieceInfo["PI_ID"] = i
PieceInfo["PI_GameType"] = nGameType
CellInfo["CI_ID"] = i
CellInfo["CI_PieceInfo"] = PieceInfo
PuzzleBoard["PB_CellArray"][i] = CellInfo
end
PieceInfo["PI_Handle"] = PG_INVALID_VALUE
PieceInfo["PI_ID"] = i
PieceInfo["PI_GameType"] = nGameType
CellInfo["CI_ID"] = i
CellInfo["CI_PieceInfo"] = PieceInfo
PuzzleMemory[nGameType]["PB_CellArray"][i] = CellInfo
end
PuzzleMemory[nGameType] = PuzzleBoard
end
function PG_REGEN_PIECES( nGameType, PuzzleMemory )
cExecCheck( "PG_REGEN_PIECES" )
if PuzzleMemory == nil
then
return
end
local PuzzleBoard
PuzzleBoard = PuzzleMemory[nGameType]
if PuzzleBoard == nil
then
return
end
PuzzleBoard["PB_CellList"] = { }
local PuzzleSize
local MaxCell
local PiecesData
local CellArray
PuzzleSize = PuzzleBoard["PB_BoardSize"]
if PuzzleSize == nil
then
return
end
MaxCell = PuzzleSize["MaxCell"]
PiecesData = PG_PIECE_INFO[nGameType]
CellArray = PuzzleBoard["PB_CellArray"]
if CellArray == nil
then
return
end
for i = 1, MaxCell do
local CellInfo
local PieceInfo
local PieceID
local PieceLoc
local PieceIndex
CellInfo = CellArray[i]
if CellInfo == nil
then
return
end
PieceInfo = CellInfo["CI_PieceInfo"]
if PieceInfo == nil
then
return
end
PieceID = PieceInfo["PI_ID"]
if PiecesData[PieceID]["PI_INDEX"] ~= nil
then
PieceLoc = PiecesData[i]["PI_REGEN_POS"]
PieceInfo["PI_Handle"] = cMobRegen_XY( PuzzleMemory["PM_EventMap"], PiecesData[PieceID]["PI_INDEX"],
PieceLoc["PI_X"], PieceLoc["PI_Y"], PieceLoc["PI_DIR"] )
if PieceInfo["PI_Handle"] ~= nil
then
cAIScriptSet ( PieceInfo["PI_Handle"], PuzzleMemory["PM_NPCHandle"] )
cAIScriptFunc ( PieceInfo["PI_Handle"], "Entrance", "PG_PIECE_ROUTINE" )
cAIScriptFunc ( PieceInfo["PI_Handle"], "NPCClick", "PG_CLICK_PIECE" )
g_PuzzleMemory[PieceInfo["PI_Handle"]] = PuzzleMemory
PuzzleBoard["PB_CellList"][PieceInfo["PI_Handle"]] = CellInfo
PuzzleMemory["PM_PieceArray"][PieceInfo["PI_Handle"]] = PieceInfo
end
end
end
end
function PG_DELETE_PUZZLEBOARD( nGameType, PuzzleMemory )
cExecCheck( "PG_DELETE_PUZZLEBOARD" )
if PuzzleMemory == nil
then
return
end
local PieceArray
local PuzzleBoard
local CellArray
local CellList
PieceArray = PuzzleMemory["PM_PieceArray"]
if PieceArray == nil
then
return
end
PuzzleBoard = PuzzleMemory[nGameType]
if PuzzleBoard == nil
then
return
end
CellArray = PuzzleBoard["PB_CellArray"]
if CellArray == nil
then
return
end
CellList = PuzzleBoard["PB_CellList"]
if CellList == nil
then
return
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ü <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for i = 1, #CellArray do
local CellInfo
local PieceInfo
local PieceHandle
CellInfo = CellArray[i]
if CellInfo == nil
then
return
end
PieceInfo = CellInfo["CI_PieceInfo"]
if PieceInfo == nil
then
return
end
PieceHandle = PieceInfo["PI_Handle"]
PuzzleMemory["PM_PieceArray"][PieceHandle] = nil
PuzzleMemory[nGameType]["PB_CellArray"][i]["CI_PieceInfo"] = nil
PuzzleMemory[nGameType]["PB_CellArray"][i] = nil
PuzzleMemory[nGameType]["PB_CellList"][PieceHandle] = nil
g_PuzzleMemory[PieceHandle] = nil
end
CellList = nil
CellArray = nil
end
--[[------------------------------------------------------------------------------------------------]]--
--[[ ]]--
--[[ <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>Լ<EFBFBD> ]]--
--[[ ]]--
--[[------------------------------------------------------------------------------------------------]]--
function PG_SUFFLE_PIECES( tPuzzleBoard )
cExecCheck( "PG_SUFFLE_PIECES" )
if tPuzzleBoard == nil
then
return
end
local CellArray
local BoardSize
local MaxPieceNumber
local PrevEmptyCellID
CellArray = tPuzzleBoard["PB_CellArray"]
if CellArray == nil
then
return
end
BoardSize = tPuzzleBoard["PB_BoardSize"]
MaxPieceNumber = BoardSize["MaxCell"] - 1
PrevEmptyCellID = MaxPieceNumber
for i = 1, PG_SUFFLE_COUNT do
local MovableCell
local RandomID
local SwapCellID
local EmptyCellID
local TempPieceInfo
MovableCell = tPuzzleBoard["PB_MovableCell"]
if MovableCell == 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><EFBFBD><EFBFBD>.
RandomID = cRandomInt( 1, 4 )
SwapCellID = MovableCell[RandomID]
EmptyCellID = tPuzzleBoard["PB_EmptyCellID"]
if ( SwapCellID ~= PG_INVALID_VALUE ) and ( PrevEmptyCellID ~= SwapCellID )
then
TempPieceInfo = CellArray[SwapCellID]["CI_PieceInfo"]
CellArray[SwapCellID]["CI_PieceInfo"] = CellArray[EmptyCellID]["CI_PieceInfo"]
CellArray[EmptyCellID]["CI_PieceInfo"] = TempPieceInfo
tPuzzleBoard["PB_EmptyCellID"] = SwapCellID
PG_GET_MOVABLE_CELL( tPuzzleBoard )
PrevEmptyCellID = EmptyCellID
end
end
end
function PG_GET_MOVABLE_CELL( tPuzzleBoard )
cExecCheck( "PG_GET_MOVABLE_CELL" )
if tPuzzleBoard == nil
then
return
end
local MovableCell
local EmptyCell
local MaxWidthSize
local MaxHeightSize
local MaxBorderSize
MovableCell = tPuzzleBoard["PB_MovableCell"]
if MovableCell == nil
then
return
end
EmptyCell = tPuzzleBoard["PB_EmptyCellID"]
MaxWidthSize = tPuzzleBoard["PB_BoardSize"]["MaxWidth"]
MaxHeightSize = tPuzzleBoard["PB_BoardSize"]["MaxHeight"]
MaxBorderSize = tPuzzleBoard["PB_BoardSize"]["MaxCell"]
if EmptyCell - MaxWidthSize < 1 then
MovableCell[PG_MOVABLE_CELL["PMC_UP"]] = PG_INVALID_VALUE
else
MovableCell[PG_MOVABLE_CELL["PMC_UP"]] = EmptyCell - MaxWidthSize
end
if EmptyCell + MaxWidthSize > MaxBorderSize then
MovableCell[PG_MOVABLE_CELL["PMC_DOWN"]] = PG_INVALID_VALUE
else
MovableCell[PG_MOVABLE_CELL["PMC_DOWN"]] = EmptyCell + MaxWidthSize
end
if EmptyCell % MaxWidthSize == 1 then
MovableCell[PG_MOVABLE_CELL["PMC_LEFT"]] = PG_INVALID_VALUE
else
MovableCell[PG_MOVABLE_CELL["PMC_LEFT"]] = EmptyCell - 1
end
if EmptyCell % MaxWidthSize == 0 then
MovableCell[PG_MOVABLE_CELL["PMC_RIGHT"]] = PG_INVALID_VALUE
else
MovableCell[PG_MOVABLE_CELL["PMC_RIGHT"]] = EmptyCell + 1
end
end
function PG_IS_COMPLETE_PUZZLE( tPuzzleBoard )
cExecCheck( "PG_IS_COMPLETE_PUZZLE" )
if tPuzzleBoard == nil
then
return false
end
local CellArray
local BorderSize
local CheckBoardSize
CellArray = tPuzzleBoard["PB_CellArray"]
if CellArray == nil
then
return
end
BorderSize = tPuzzleBoard["PB_BoardSize"]
if BorderSize == nil
then
return
end
CheckBoardSize = BorderSize["MaxCell"]-1
for i = 1, CheckBoardSize do
local CellInfo
local PieceInfo
CellInfo = CellArray[i]
if CellInfo == nil
then
return false
end
PieceInfo = CellInfo["CI_PieceInfo"]
if PieceInfo == nil
then
return false
end
if PieceInfo["PI_ID"] ~= i
then
return false
end
end
return true
end
function PG_PIECE_MOVE( PuzzleMemory, NPCGameType, NPCHandle )
cExecCheck( "PG_PIECE_MOVE" )
if PuzzleMemory == nil
then
return false
end
local tPuzzleBoard
tPuzzleBoard = PuzzleMemory[NPCGameType]
if tPuzzleBoard == nil
then
return false
end
local PieceArray
local CellList
local CellArray
local SelectedCell
local MovableCell
local GameInfo
PieceArray = PuzzleMemory["PM_PieceArray"]
if PieceArray == nil
then
return false
end
CellList = tPuzzleBoard["PB_CellList"]
if CellList == nil
then
return false
end
CellArray = tPuzzleBoard["PB_CellArray"]
if CellArray == nil
then
return false
end
SelectedCell = CellList[NPCHandle]
if SelectedCell == nil
then
return false
end
MovableCell = tPuzzleBoard["PB_MovableCell"]
if MovableCell == nil
then
return false
end
GameInfo = PuzzleMemory["PM_GameInfo"]
if GameInfo == nil
then
return false
end
for i = 1, #MovableCell do
if MovableCell[i] == SelectedCell["CI_ID"]
then
local SelcetedPieceHandle
local SelectedPieceID
local EmptyCellID
local EmptyCell
local TempPieceInfo
EmptyCellID = tPuzzleBoard["PB_EmptyCellID"]
EmptyCell = CellArray[EmptyCellID]
if EmptyCell == nil
then
return false
end
-- 1. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>.
tPuzzleBoard["PB_EmptyCellID"] = SelectedCell["CI_ID"]
-- 2. <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> Piece<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>.
SelcetedPieceHandle = SelectedCell["CI_PieceInfo"]["PI_Handle"]
SelectedPieceID = SelectedCell["CI_PieceInfo"]["PI_ID"]
CellList[SelcetedPieceHandle] = nil
PieceArray["SelcetedPieceHandle"] = nil
if g_DieInfo == nil
then
g_DieInfo = { }
end
g_DieInfo[SelcetedPieceHandle] = PuzzleMemory["PM_CurrentTime"] + PG_PIECE_VANISH_TIME
cKillObject( SelcetedPieceHandle, PG_INVALID_VALUE, GameInfo["GI_CharNumber"] )
-- 3. PieceInfo Swap
TempPieceInfo = EmptyCell["CI_PieceInfo"]
EmptyCell["CI_PieceInfo"] = SelectedCell["CI_PieceInfo"]
SelectedCell["CI_PieceInfo"] = TempPieceInfo
-- 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>.
local PieceData
local PieceIndex
local PieceLoc
local PieceInfo
PieceData = PG_PIECE_INFO[NPCGameType]
PieceIndex = PieceData[SelectedPieceID]["PI_INDEX"]
PieceLoc = PieceData[EmptyCellID]["PI_REGEN_POS"]
PieceInfo = EmptyCell["CI_PieceInfo"]
if PieceInfo == nil
then
return false
end
PieceInfo["PI_Handle"] = cMobRegen_XY( PuzzleMemory["PM_EventMap"], PieceIndex,
PieceLoc["PI_X"], PieceLoc["PI_Y"], PieceLoc["PI_DIR"] )
if PieceInfo["PI_Handle"] ~= nil
then
cAIScriptSet ( PieceInfo["PI_Handle"], PuzzleMemory["PM_NPCHandle"] )
cAIScriptFunc ( PieceInfo["PI_Handle"], "Entrance", "PG_PIECE_ROUTINE" )
cAIScriptFunc ( PieceInfo["PI_Handle"], "NPCClick", "PG_CLICK_PIECE" )
g_PuzzleMemory[PieceInfo["PI_Handle"]] = PuzzleMemory
CellList[PieceInfo["PI_Handle"]] = EmptyCell
PieceArray[PieceInfo["PI_Handle"]] = PieceInfo
end
return true
end
end
return false
end
--[[------------------------------------------------------------------------------------------------]]--
--[[ ]]--
--[[ NPC Ŭ<EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD> ]]--
--[[ ]]--
--[[------------------------------------------------------------------------------------------------]]--
--------------------------------------------------------------------------
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> NPC Ŭ<EFBFBD><EFBFBD> --
--------------------------------------------------------------------------
function PG_MAIN_NPC_CLICK( NPCHandle, PlyHandle, PlyRegNum )
cExecCheck( "PG_MAIN_NPC_CLICK" )
local PuzzleMemory
local GameState
PuzzleMemory = g_PuzzleMemory[NPCHandle]
if PuzzleMemory == nil
then
return
end
if PuzzleMemory["PG_PrevGamePlayer"] == nil
then
return
end
if ( PuzzleMemory["PG_PrevGamePlayer"]["PP_CharNumber"] == PlyRegNum ) and
( PuzzleMemory["PG_PrevGamePlayer"]["PP_WaitingTime"] > PuzzleMemory["PM_CurrentTime"] )
then
cSystemMessage_Obj( PlyHandle, PG_CIRCUMSTANCE_DIALOG["GAME_WATING"]["FILENAME"], PG_CIRCUMSTANCE_DIALOG["GAME_WATING"]["INDEX"] )
return
end
GameState = PuzzleMemory["PM_State"]
if GameState == PG_GAME_STATE["PGS_WAIT"]
then
cNPCMenuOpen( NPCHandle, PlyHandle )
else
cSystemMessage_Obj( PlyHandle, PG_CIRCUMSTANCE_DIALOG["GAME_ALREADY_PLAY"]["FILENAME"], PG_CIRCUMSTANCE_DIALOG["GAME_ALREADY_PLAY"]["INDEX"] )
end
return
end
function PG_NPCMENU_ACK( NPCHandle, PlyHandle, PlyRegNum, Value )
cExecCheck( "PG_NPCMENU_ACK" )
local PuzzleMemory
local GameState
PuzzleMemory = g_PuzzleMemory[NPCHandle]
if PuzzleMemory == nil
then
return
end
GameState = PuzzleMemory["PM_State"]
if GameState ~= PG_GAME_STATE["PGS_WAIT"]
then
return
end
local GameData
GameData = PG_GAME_DATA[Value]
if GameData == nil
then
return
end
-- 1. <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><EFBFBD>.
if cUseMoney( PlyHandle, GameData["PGD_COST"] ) == nil then
local DialogData
DialogData = PG_CIRCUMSTANCE_DIALOG["MONEY_LACK"]
cMobDialog_Obj( PlyHandle, DialogData["FACECUT"], DialogData["FILENAME"], DialogData["INDEX"] )
else
local StepInfo
local GameInfo
local BaseBoard
PuzzleMemory["PM_State"] = PG_GAME_STATE["PGS_COUNT"]
StepInfo = PuzzleMemory["PM_StepInfo"]
if StepInfo == nil
then
return
end
GameInfo = PuzzleMemory["PM_GameInfo"]
if GameInfo == nil
then
return
end
PuzzleMemory["PM_State"] = PG_GAME_STATE["PGS_COUNT"]
StepInfo["SI_Step"] = 1
StepInfo["SI_NextStepTime"] = PuzzleMemory["PM_CurrentTime"]
GameInfo["GI_GameMode"] = Value
GameInfo["GI_CharNumber"] = PlyRegNum
GameInfo["GI_CharHandle"] = PlyHandle
if Value == PG_PUZZLE_MODE["PGM_ALL_PLAY"]
then
for i = 1, #PG_BASE_BOARD_DATA do
local PuzzleBoard
local BaseBoard
PuzzleBoard = PuzzleMemory[i]
if PuzzleBoard == nil
then
return
end
BaseBoard = PuzzleBoard["PB_BaseBoard"]
if BaseBoard == nil
then
return
end
PG_DELETE_PUZZLEBOARD ( i, PuzzleMemory )
PG_REGEN_COMPLETION ( i, PuzzleMemory )
end
else
local PuzzleBoard
local BaseBoard
PuzzleBoard = PuzzleMemory[Value]
if PuzzleBoard == nil
then
return
end
BaseBoard = PuzzleBoard["PB_BaseBoard"]
if BaseBoard == nil
then
return
end
PG_DELETE_PUZZLEBOARD ( Value, PuzzleMemory )
PG_REGEN_COMPLETION ( Value, PuzzleMemory )
end
cSetAbstate( PuzzleMemory["PM_NPCHandle"], PG_ABSTATE_DATA["PAD_FOMING_EFFECT"]["INDEX"], 1, PG_ABSTATE_DATA["PAD_FOMING_EFFECT"]["KEEPTIME"] )
cSetAbstate( PlyHandle, PG_ABSTATE_DATA["PAD_USER_STUN"]["INDEX"], 1, PG_ABSTATE_DATA["PAD_USER_STUN"]["KEEPTIME"] )
cHideOtherPlayer( PlyHandle, 1 )
cTopView( PlyHandle, 1, PG_TOPVIEW_DATA["PTD_CENTER_POS"]["PCP_X"], PG_TOPVIEW_DATA["PTD_CENTER_POS"]["PCP_Y"], PG_TOPVIEW_DATA["PTD_RANGE"], PG_TOPVIEW_DATA["PTD_DEGREE"] )
end
end
--------------------------------------------------------------------------
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ŭ<EFBFBD><EFBFBD> --
--------------------------------------------------------------------------
function PG_CLICK_PIECE( NPCHandle, PlyHandle, PlyRegNum )
cExecCheck( "PG_CLICK_PIECE" )
local PuzzleMemory
local GameInfo
local PieceArray
local PieceInfo
local NPCGameType
local PuzzleBoard
PuzzleMemory = g_PuzzleMemory[NPCHandle]
if PuzzleMemory == nil
then
return
end
if PuzzleMemory["PM_State"] ~= PG_GAME_STATE["PGS_PROGRESS"]
then
return
end
GameInfo = PuzzleMemory["PM_GameInfo"]
if GameInfo == nil
then
return
end
if GameInfo["GI_CharNumber"] ~= PlyRegNum
then
return
end
if GameInfo["GI_CharHandle"] ~= PlyHandle
then
return
end
if GameInfo["GI_GameMode"] == PG_INVALID_VALUE
then
return
end
PieceArray = PuzzleMemory["PM_PieceArray"]
if PieceArray == nil
then
return
end
PieceInfo = PieceArray[NPCHandle]
if PieceInfo == nil
then
return
end
NPCGameType = PieceInfo["PI_GameType"]
if GameInfo["GI_GameMode"] ~= NPCGameType then
if GameInfo["GI_GameMode"] ~= PG_PUZZLE_MODE["PGM_ALL_PLAY"]
then
return
end
end
PuzzleBoard = PuzzleMemory[NPCGameType]
if PuzzleBoard == nil
then
return
end
if PuzzleBoard["PB_State"] ~= PG_PUZZLE_STATE["PPS_PROGRESS"]
then
return
end
GameInfo["GI_NoClickTime"] = PuzzleMemory["PM_CurrentTime"] + PG_NO_CLICK_TIME
-- <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>.
if PG_PIECE_MOVE( PuzzleMemory, NPCGameType, NPCHandle ) == true
then
PG_GET_MOVABLE_CELL( PuzzleBoard )
if PG_IS_COMPLETE_PUZZLE( PuzzleBoard ) == true
then
PuzzleBoard["PB_State"] = PG_PUZZLE_STATE["PPS_COMPLETE"]
end
end
end
---------------------------------------------------------------------------------------------------------------------------------------
--***********************************************************************************************************************************--
-- --
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> --
-- --
--***********************************************************************************************************************************--
---------------------------------------------------------------------------------------------------------------------------------------
PG_PROGRESS_DATA =
{
-- WAIT
{
PPD_STEP_ISLOOP = true, -- Ư<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȳ <EFBFBD>߻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>Ʒ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ݺ<EFBFBD>
PPD_STEP_COUNT = 3, -- <EFBFBD>Ʒ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŭ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD> <EFBFBD><EFBFBD>
PPD_STEP_INFO = -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
-- Step 1. NPC <EFBFBD><EFBFBD>ȭ 1
{
PPD_FUNC = PG_DUMMY_FUNCTION, -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ܿ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>Լ<EFBFBD>
PPD_EFFECTMSG = nil, -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <EFBFBD>޽<EFBFBD><EFBFBD><EFBFBD>
PPD_MOBCHAT = { FILENAME = "Event", INDEX= "Xiaoming_Chat01" }, -- <EFBFBD><EFBFBD>ê <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PPD_FACECUT = nil, -- <EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PPD_DELAY = 4, -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ð<EFBFBD>
},
-- Step 2. NPC <EFBFBD><EFBFBD>ȭ 2
{
PPD_FUNC = PG_DUMMY_FUNCTION,
PPD_EFFECTMSG = nil,
PPD_MOBCHAT = { FILENAME = "Event", INDEX= "Xiaoming_Chat02" },
PPD_FACECUT = nil,
PPD_DELAY = 4,
},
-- Step 3. NPC <EFBFBD><EFBFBD>ȭ 3
{
PPD_FUNC = PG_DUMMY_FUNCTION,
PPD_EFFECTMSG = nil,
PPD_MOBCHAT = { FILENAME = "Event", INDEX= "Xiaoming_Chat03" },
PPD_FACECUT = nil,
PPD_DELAY = 4,
},
}
},
-- COUNT
{
PPD_STEP_ISLOOP = false, -- <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>
PPD_STEP_COUNT = 6, -- <EFBFBD>Ʒ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŭ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD> <EFBFBD><EFBFBD>
PPD_STEP_INFO =
{
-- Step 1. ī<EFBFBD><EFBFBD>Ʈ <EFBFBD>ٿ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
PPD_FUNC = PG_DUMMY_FUNCTION,
PPD_EFFECTMSG = nil,
PPD_MOBCHAT = nil,
PPD_FACECUT = nil,
PPD_DELAY = 1,
},
-- Step 2. ī<EFBFBD><EFBFBD>Ʈ <EFBFBD>ٿ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
PPD_FUNC = PG_COUNT_EFFECT_BOARD,
PPD_EFFECTMSG = EFFECT_MSG_TYPE["EMT_COUNT_8_SEC"],
PPD_MOBCHAT = nil,
PPD_FACECUT = nil,
PPD_DELAY = 2,
},
-- Step 3. NPC <EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD><EFBFBD><EFBFBD>
{
PPD_FUNC = PG_DUMMY_FUNCTION,
PPD_EFFECTMSG = nil,
PPD_MOBCHAT = nil,
PPD_FACECUT = { FACECUT = "Xiaoming", FILENAME = "Event", INDEX = "Xiaoming_01" },
PPD_DELAY = 3,
},
-- Step 4. <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ü <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
PPD_FUNC = PG_COUNT_DELETE_BOARD,
PPD_EFFECTMSG = nil,
PPD_MOBCHAT = nil,
PPD_FACECUT = nil,
PPD_DELAY = 0,
},
-- Step 5. <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>
{
PPD_FUNC = PG_COUNT_REGEN_PIECES,
PPD_EFFECTMSG = nil,
PPD_MOBCHAT = nil,
PPD_FACECUT = { FACECUT = "Xiaoming", FILENAME ="Event", INDEX = "Xiaoming_02" },
PPD_DELAY = 3,
},
-- Step 6. <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ŸƮ
{
PPD_FUNC = PG_COUNT_GAME_START,
PPD_EFFECTMSG = EFFECT_MSG_TYPE["EMT_START"],
PPD_MOBCHAT = nil,
PPD_FACECUT = nil,
PPD_DELAY = 0,
},
}
},
--PROGRESS
{
PPD_STEP_ISLOOP = true,
PPD_STEP_COUNT = 1,
PPD_STEP_INFO =
{
-- Step 1. 1<EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ӿϷ<EFBFBD> <EFBFBD>ߴ<EFBFBD><EFBFBD><EFBFBD> Ȯ<EFBFBD><EFBFBD>
{
PPD_FUNC = PG_PROGRESS_ISCOMPLETE,
PPD_EFFECTMSG = nil,
PPD_MOBCHAT = nil,
PPD_FACECUT = nil,
PPD_DELAY = 1,
},
}
},
--COMPLETE
{
PPD_STEP_ISLOOP = false,
PPD_STEP_COUNT = 2,
PPD_STEP_INFO =
{
-- Step 1. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> / ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ÿ<EFBFBD><EFBFBD>Ʋ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
PPD_FUNC = PG_COMPLETE_SUCCESS_GAME,
PPD_EFFECTMSG = EFFECT_MSG_TYPE["EMT_SUCCESS"],
PPD_MOBCHAT = nil,
PPD_FACECUT = { FACECUT = "Xiaoming", FILENAME ="Event", INDEX = "Xiaoming_03" },
PPD_DELAY = 5,
},
-- Step 2. <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ʱ<EFBFBD>ȭ
{
PPD_FUNC = PG_COMPLETE_INIT_GAME,
PPD_EFFECTMSG = nil,
PPD_MOBCHAT = nil,
PPD_FACECUT = nil,
PPD_DELAY = 1,
},
}
},
--FAIL
{
PPD_STEP_ISLOOP = false,
PPD_STEP_COUNT = 2,
PPD_STEP_INFO =
{
-- Step 1. <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>н<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <EFBFBD>޽<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD><EFBFBD><EFBFBD>
{
PPD_FUNC = PG_DUMMY_FUNCTION,
PPD_EFFECTMSG = EFFECT_MSG_TYPE["EMT_FAIL"],
PPD_MOBCHAT = nil,
PPD_FACECUT = { FACECUT = "Xiaoming", FILENAME ="Event", INDEX = "Xiaoming_04" },
PPD_DELAY = 2,
},
-- Step 2. <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ʱ<EFBFBD>ȭ
{
PPD_FUNC = PG_COMPLETE_INIT_GAME,
PPD_EFFECTMSG = nil,
PPD_MOBCHAT = nil,
PPD_FACECUT = nil,
PPD_DELAY = 1,
},
}
},
}