添加配置表

This commit is contained in:
flswld
2022-11-30 00:00:20 +08:00
parent f70a890338
commit d7f3f3b866
33382 changed files with 8476601 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
local tempTrigger = {
{ config_id = 2330001, name = "Challenge_Enter_Region", event = EventType.EVENT_ENTER_REGION, source = "",
condition = "", action = "action_Challenge_Enter_Region", trigger_count = 0},
{ config_id = 2330002, name = "Challenge_LEAVE_REGION", event = EventType.EVENT_LEAVE_REGION, source = "",
condition = "", action = "action_Challenge_LEAVE_REGION", trigger_count = 0}
}
--------初始化----------
function LF_Initialize_Level()
for k,v in pairs(tempTrigger) do
table.insert(triggers, v)
table.insert(suites[1].triggers, v.name)
end
for k,v in pairs(regions) do
v.radius = 20
end
return 0
end
--------监听函数----------
function action_Challenge_Enter_Region(context, evt)
ScriptLib.SetPlayerEyePoint(context, evt.param1, evt.param1)
return 0
end
function action_Challenge_LEAVE_REGION(context, evt)
ScriptLib.ClearPlayerEyePoint(context, evt.param1)
return 0
end
LF_Initialize_Level()
--- ServerUploadTool Save to [/root/env/data/lua/common/V1_5] ---

View File

@@ -0,0 +1,570 @@
--[[local defs = {
group_id = xxx,
gadget_prison_list = {1,2,3,4},
gadget_guide = {1,2,3},
bait_list = {
[1] = {1,2,3},
[2] = {4,5,6},
[3] = {7,8,9},
},
duration = 240,
rampage_time = 40,
gadget_energy = 1,
}--]]
--[[local energy_info = {
[1] = { time = 80, points = {1,2,3,4,5,6}},
[2] = { time = 160, points = {1,2,3,4,5,6}}
}--]]
--初始化给的state
local HS_State = {
["Play"] = { name = "HideAndSeek_PlayerState_Play", value = 3 },
["Visible"] = { name = "HideAndSeek_PlayerState_Visible", value = 1 },
["OnMap"] = { name = "HideAndSeek_PlayerState_OnMap", value = 0 },
["Moveable"] = { name = "HideAndSeek_PlayerState_Moveable", value = 1 },
["Transfer"] = { name = "HideAndSeek_PlayerState_Transfer", value = 0 },
["TransferCache"] = { name = "HideAndSeek_PlayerState_TransferCache", value = 0},
["UltraMark"] = { name = "Is_In_UltraMark", value = 0 },
["GlobalSight"] = { name = "Is_In_GlobalSight", value = 0 },
["SuperPrison"] = { name = "Is_In_SuperPrison", value = 0 },
["Rampage"] = { name = "Is_In_Rampage", value = 0 },
["Dead"] = { name = "HideAndSeek_PlayerState_Dead", value = 0},
["Is_Detected"] = { name = "HideAndSeek_PlayerState_Is_Detected", value = 0},
}
local skill_info = {
["HideAndSeek_Skill_CatchPrey"] = { radius = 4 },
["HideAndSeek_Skill_Guide"] = { radius = 500 },
["HideAndSeek_Skill_Detect_F"] = { radius = 10 },
["HideAndSeek_Skill_UltraMark"] = { radius = 500, duration = 60 },
["HideAndSeek_Skill_GlobalSight"] = { radius = 500, duration = 20 },
["HideAndSeek_Skill_SuperPrison"] = { radius = 500, duration = 40 },
}
local hunter_win_by_EX = 30
local hunter_win_in_time = 120
local hunter_catch_by_guide = 10
local map_info = {
--一期
[1001003] = { name = "QingCe", list = {1,2,3} },
[1001001] = { name = "QingQuan", list = {4,5} },
[1001004] = { name = "WuWang", list = {4,8} },
[1001002] = { name = "JiuZhuang", list = {7,8} },
[1001005] = { name = "XueShan", list = {4,8} },
--二期地图
[1001006] = { name = "test_1", list = {1,2,3} },--轻策庄二期
[1001007] = { name = "test_2", list = {4,8} },
[1001008] = { name = "test_3", list = {4,8} },
[1001009] = { name = "test_4", list = {19,17,18,20} },--离岛
[1001010] = { name = "test_5", list = {4,8} },
[1001011] = { name = "test_6", list = {11,12,13} },--神里
[1001012] = { name = "test_7", list = {14,11,15} },--绯木
[1001013] = { name = "test_8", list = {16,17,18} },--九条
[1001014] = { name = "test_9", list = {4,8} },
[1001015] = { name = "test_10", list = {4,8} },
[1001015] = { name = "test_11", list = {4,21} },--初始林地
[1001016] = { name = "test_12", list = {4,8} },
[1001017] = { name = "test_13", list = {4,8} },
[1001018] = { name = "test_14", list = {4,8} },
[1001019] = { name = "test_15", list = {4,21,22} },--璃月遗迹
[1001020] = { name = "test_16", list = {4,8} },
[1001021] = { name = "test_17", list = {4,8} },
[1001026] = { name = "test_18", list = {7,8,23} },--酒庄
}
local Tri = {
[1]={ name = "gallery_stop", config_id = 8000001, event = EventType.EVENT_GALLERY_STOP, source = "", condition = "", action = "action_gallery_stop", trigger_count = 0},
[2]={ name = "challenge_success", config_id = 8000003, event = EventType.EVENT_CHALLENGE_SUCCESS, source = "", condition = "", action = "action_challenge_success", trigger_count = 0},
[3]={ name = "challenge_fail", config_id = 8000004, event = EventType.EVENT_CHALLENGE_FAIL, source = "", condition = "", action = "action_challenge_fail", trigger_count = 0},
[4]={ name = "variable_change", config_id = 8000005, event = EventType.EVENT_VARIABLE_CHANGE, source = "catch_sum", condition = "", action = "action_variable_change", trigger_count = 0, tag = "9012"},
[5]={ name = "time_axis_pass", config_id = 8000006, event = EventType.EVENT_TIME_AXIS_PASS, source = "", condition = "", action = "action_time_axis_pass", trigger_count = 0},
[6]={ name = "enter_region", config_id = 8000007, event = EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_enter_region", trigger_count = 0, forbid_guest = false},
[7]={ name = "GM_Debug", config_id = 8000008, event = EventType.EVENT_VARIABLE_CHANGE, source = "", condition = "", action = "action_GM_Debug", trigger_count = 0 },
[8]={ name = "multistage_end", config_id = 8000009, event = EventType.EVENT_SCENE_MULTISTAGE_PLAY_STAGE_END, source = "", condition = "", action = "action_multistage_end", trigger_count = 0 },
[9]={ name = "group_load", config_id = 8000010, event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
[10]={name = "avatar_die", config_id = 8000011, event = EventType.EVENT_AVATAR_DIE, source = "", condition = "", action = "action_avatar_die", trigger_count = 0 },
[11]={name = "player_quit", config_id = 8000012, event = EventType.EVENT_HIDE_AND_SEEK_PLAYER_QUIT, source = "", condition = "", action = "action_player_quit", trigger_count = 0 },
[12]={name = "leave_region", config_id = 8000013, event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_leave_region", trigger_count = 0, forbid_guest = false},
[13]={name = "group_will_unload", config_id = 8000014, event = EventType.EVENT_GROUP_WILL_UNLOAD, source = "", condition = "", action = "action_group_will_unload", trigger_count = 0 },
}
local Var = {
{ config_id=50000001,name = "catch_sum", value = 0, no_refresh = false},
{ config_id=50000002,name = "GM_stage", value = 0, no_refresh = false},
}
function Initialize_Base()
for i,v in ipairs(Tri) do
table.insert(triggers, v)
table.insert(suites[1].triggers, v.name)
end
for i,v in ipairs(Var) do
table.insert(variables, v)
end
end
---------------------------------------
function action_group_load(context, evt)
LF_Bake_Random_Scene(context)
return 0
end
function action_gallery_stop(context, evt)
ScriptLib.PrintContextLog(context, "## H&S_LOG : Gallery Stop")
if 1 == ScriptLib.GetGroupTempValue(context, "is_in_play", {}) then
LF_Stop_Hide_And_Seek(context, 3)
end
return 0
end
function action_multistage_end(context, evt)
ScriptLib.PrintContextLog(context, "## H&S_LOG : Multistage End : "..evt.param2.." | is_succ : "..evt.param3)
if evt.param3 == 0 then
--异常终结玩法
if 1 == ScriptLib.GetGroupTempValue(context, "is_in_play", {}) then
LF_Stop_Hide_And_Seek(context, 3)
end
return 0
end
if evt.param2 == 2 then
--LF_Bake_Random_Scene(context)
elseif evt.param2 == 3 then
ScriptLib.SetGroupTempValue(context, "in_escape", 1, {})
LF_Assign_Character_Card(context)
elseif evt.param2 == 4 then
ScriptLib.SetGroupTempValue(context, "in_escape", 0, {})
LF_Start_Hide_And_Seek(context)
elseif evt.param2 == 5 then
if 1 == ScriptLib.GetGroupTempValue(context, "is_in_play", {}) then
LF_Stop_Hide_And_Seek(context, 2)
end
end
return 0
end
function action_challenge_success(context, evt)
ScriptLib.PrintContextLog(context, "## HS_Log : challenge_success -> "..evt.param1)
if evt.source_name == "9012" then
if 1 == ScriptLib.GetGroupTempValue(context, "is_in_play", {}) then
LF_Stop_Hide_And_Seek(context, 1)
end
end
return 0
end
function action_challenge_fail(context, evt)
ScriptLib.PrintContextLog(context, "## HS_Log : challenge_fail -> "..evt.param1)
if evt.source_name == "9011" then
if 1 == ScriptLib.GetGroupTempValue(context, "is_in_play", {}) then
LF_Stop_Hide_And_Seek(context, 2)
end
end
return 0
end
function action_variable_change(context, evt)
if evt.param1 == evt.param2 + 1 then
---[[
if 1 == ScriptLib.GetGroupTempValue(context, "in_escape", {}) then
if evt.param1 == ScriptLib.GetGroupTempValue(context, "prey_sum", {}) then
ScriptLib.EndSceneMultiStagePlayStage(context, _index, "null", true)
end
end
--]]
return 0
else
return -1
end
end
function action_enter_region(context, evt)
if evt.param1 ~= defs.eye_point then
return -1
end
--开启视野锚点优化
ScriptLib.SetPlayerEyePointStream(context, evt.param1, evt.param1, false)
return 0
end
function action_leave_region(context, evt)
if evt.param1 ~= defs.eye_point then
return -1
end
--关闭视野锚点优化
ScriptLib.ClearPlayerEyePoint(context, evt.param1)
return 0
end
function action_group_will_unload(context, evt)
ScriptLib.RemoveEntityByConfigId(context, 0, EntityType.REGION, defs.eye_point)
return 0
end
function action_time_axis_pass(context, evt)
ScriptLib.PrintContextLog(context, "## H&S_LOG : time_axis "..evt.source_name.." -> "..evt.param1)
if evt.source_name == "rampage" then
HideAndSeek_Hunter_Rampage(context)
elseif evt.source_name == "energy" then
ScriptLib.KillEntityByConfigId(context, {config_id = defs.gadget_energy, entity_type = EntityType.GADGET})
--随机选择位置创建能量球
local p_list = energy_info[evt.param1].points
math.randomseed(ScriptLib.GetServerTime(context))
local ret = p_list[math.random(#p_list)]
local p_pos = {}
local p_rot = {}
for k,v in ipairs(points) do
if v.config_id == ret then
p_pos = v.pos
p_rot = v.rot
break
end
end
ScriptLib.CreateGadgetByConfigIdByPos(context, defs.gadget_energy, p_pos, p_rot)
local uid_list = ScriptLib.GetSceneUidList(context)
--通知全体掉能量球
ScriptLib.AssignPlayerUidOpNotify(context, {param_index = 12,param_list={},param_uid_list={},duration=3,target_uid_list=uid_list})
elseif evt.source_name == "hunter_win_by_EX" or evt.source_name == "hunter_win_in_time" or evt.source_name == "hunter_catch_by_guide" then
ScriptLib.SetGroupTempValue(context, evt.source_name, 0, {})
else
for i=1,3 do
local _uid = ScriptLib.GetGroupTempValue(context, "const_prey_"..i, {})
if evt.source_name == tostring(_uid) then
ScriptLib.AssignPlayerShowTemplateReminder(context, 138, {param_vec={},param_uid_vec={},uid_vec={_uid}})
LF_Set_Player_State_Value(context, _uid, HS_State.Dead.name, 1)
return 0
end
end
end
return 0
end
function action_avatar_die(context, evt)
local char = ScriptLib.GetGroupTempValue(context, HS_State.Play.name.."_"..context.uid, {})
ScriptLib.PrintContextLog(context, "## H&S_LOG : avatar_die "..context.uid.." | character = "..char)
if ScriptLib.GetGroupTempValue(context, "is_in_play", {}) == 0 then
ScriptLib.PrintContextLog(context, "## H&S_LOG : is_in_play = 0")
return -1
end
if char == 0 then
--hunter死亡判负
ScriptLib.StopChallenge(context, 9012, 0)
elseif char == 1 then
--prey死亡算被抓
LF_Set_Prey_Die(context, context.uid)
elseif char == 3 then
for i = 1,3 do
local prey = ScriptLib.GetGroupTempValue(context, "const_prey_"..i, {})
if prey == context.uid then
--prey提前死亡不参与游戏
LF_Set_Prey_Die(context, context.uid)
return 0
end
end
--hunter提前死亡直接结算prey胜利
local _index = ScriptLib.GetHideAndSeekPlayIndex(context)
ScriptLib.EndSceneMultiStagePlayStage(context, _index, "null", true)
LF_Stop_Hide_And_Seek(context, 2)
end
return 0
end
function action_player_quit(context, evt)
for j=1,3 do
if context.uid == ScriptLib.GetGroupTempValue(context, "prey_"..j, {}) then
ScriptLib.PrintContextLog(context, "## H&S_LOG : Running Player_Quit : "..context.uid)
--进行中玩家离场视为hunter抓住了一个
ScriptLib.ChangeGroupVariableValue(context, "catch_sum", 1)
return 0
end
end
ScriptLib.PrintContextLog(context, "## H&S_LOG : Free Player_Quit : "..context.uid)
return 0
end
function action_GM_Debug(context, evt)
ScriptLib.PrintContextLog(context, "## H&S_LOG : variable_change "..evt.source_name.." "..evt.param2.." -> "..evt.param1)
if evt.param1 == evt.param2 then
return -1
end
local uid_list = ScriptLib.GetSceneUidList(context)
for i,v in ipairs(uid_list) do
if evt.source_name == HS_State.OnMap.name.."_"..v then
LF_Notify_Player_Visible(context, v)
return -1
end
end
if evt.source_name == "catch_sum" then
return -1
end
if evt.source_name == "GM_stage" then
if evt.param1 == 1 then
LF_Bake_Random_Scene(context)
elseif evt.param1 == 2 then
LF_Assign_Character_Card(context)
elseif evt.param1 == 3 then
LF_Start_Hide_And_Seek(context)
end
end
return 0
end
---------------------------------------
function LF_Start_Hide_And_Seek(context)
ScriptLib.PrintContextLog(context, "## HS_Log : LF_Start_Hide_And_Seek")
local uid_list = ScriptLib.GetSceneUidList(context)
LF_Start_Comp_Challenge(context)
end
function LF_Stop_Hide_And_Seek(context, value)
ScriptLib.PrintContextLog(context, "## HS_Log : LF_Stop_Hide_And_Seek | value -> "..value)
ScriptLib.SetGroupTempValue(context, "is_in_play", 0, {})
ScriptLib.EndTimeAxis(context, "rampage")
ScriptLib.EndTimeAxis(context, "energy")
local hunter = ScriptLib.GetGroupTempValue(context, "hunter", {})
for i=1,3 do
local _uid = ScriptLib.GetGroupTempValue(context, "const_prey_"..i, {})
ScriptLib.EndTimeAxis(context, tostring(_uid))
end
local uid_list = ScriptLib.GetSceneUidList(context)
for i,v in ipairs(uid_list) do
LF_Init_Player_State(context, v)
end
ScriptLib.SetPlayerGroupVisionType(context, uid_list, {1})
for i,v in ipairs(defs.bait_list) do
for m,n in ipairs(v) do
ScriptLib.KillEntityByConfigId(context, {config_id = n, entity_type = EntityType.GADGET})
end
end
if value == 3 then
--人数不足导致异常处理
ScriptLib.StopChallenge(context, 9011, 0)
return -1
end
local _gallery = ScriptLib.GetGroupTempValue(context, "gallery_id", {})
-------
local catch_sum = ScriptLib.GetGroupVariableValue(context, "catch_sum")
--统计:抓捕总数
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_catch_sum", catch_sum)
--hunter胜利
if value == 1 then
--统计:清扫时刻
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_miss_none", 1)
--统计:迅捷攻势
if 1 == ScriptLib.GetGroupTempValue(context, "hunter_win_by_EX", {}) then
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_win_by_EX", 1)
end
--统计:终场倒计时
if 1 == ScriptLib.GetGroupTempValue(context, "hunter_win_in_time", {}) then
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_win_in_time", 1)
end
ScriptLib.UpdatePlayerGalleryScore(context, _gallery, {["update_type"]="updateGalleryResult", ["is_hunter_win"]=true})
--prey胜利
elseif value == 2 then
LF_Handle_Exhibition_Prey_Win(context)
ScriptLib.UpdatePlayerGalleryScore(context, _gallery, {["update_type"]="updateGalleryResult", ["is_hunter_win"]=false})
end
LF_Clear_Random_Scene(context)
end
function LF_Assign_Character_Card(context)
ScriptLib.PrintContextLog(context, "## HS_Log : LF_Assign_Character_Card")
local _index = ScriptLib.GetHideAndSeekPlayIndex(context)
local _gallery = ScriptLib.GetHideAndSeekPlayGalleryId(context, _index)
ScriptLib.SetGroupTempValue(context, "gallery_id", _gallery, {})
ScriptLib.SetGroupTempValue(context, "is_in_play", 1, {})
local uid_list = ScriptLib.GetSceneUidList(context)
ScriptLib.SetPlayerGroupVisionType(context, uid_list, {0})
local hunter = 0
local _index = ScriptLib.GetHideAndSeekPlayIndex(context)
hunter = ScriptLib.GetHideAndSeekHunter(context, _index)
ScriptLib.PrintContextLog(context, "## HS_Log : hunter_uid = "..hunter)
ScriptLib.SetGroupTempValue(context, "hunter", hunter, {})
local cnt = 1
for i,v in ipairs(uid_list) do
if v ~= hunter then
ScriptLib.SetGroupTempValue(context, "prey_"..cnt, v, {})
ScriptLib.SetGroupTempValue(context, "const_prey_"..cnt, v, {})
cnt = cnt + 1
end
end
--追加一次游侠统计,防止在这个阶段取不到值,考虑到不是很靠谱,四阶段重新计算一次
ScriptLib.SetGroupTempValue(context, "prey_sum", #uid_list-1, {})
--关闭牢笼
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, defs.gadget_prison_list[1], 0)
ScriptLib.PrintContextLog(context, "## H&S_LOG : player_sum = "..#uid_list)
for i,v in ipairs(uid_list) do
LF_Init_Player_Skill(context, v, i)
LF_Init_Player_State(context, v)
if v == hunter then
ScriptLib.AssignPlayerUidOpNotify(context, {param_index = 16,param_list={},param_uid_list={},duration=5,target_uid_list={v}})
else
ScriptLib.AssignPlayerUidOpNotify(context, {param_index = 17,param_list={},param_uid_list={},duration=5,target_uid_list={v}})
end
end
end
function LF_Init_Player_Skill(context, uid, u_ptr)
ScriptLib.PrintContextLog(context, "## H&S_LOG : LF_Init_Player_Skill : "..uid)
local _index = ScriptLib.GetHideAndSeekPlayIndex(context)
local _gallery = ScriptLib.GetHideAndSeekPlayGalleryId(context, _index)
local skill_list = ScriptLib.GetHideAndSeekPlayerSkillList(context, _index, uid)
for p,q in ipairs(skill_list) do
ScriptLib.AttachGalleryAbilityGroup(context, {uid}, _gallery, q)
end
end
function LF_Start_Comp_Challenge(context)
ScriptLib.PrintContextLog(context, "## HS_Log : LF_Start_Comp_Challenge")
ScriptLib.CreateFatherChallenge(context, 9011, 9011, defs.duration, {success=10,fail=10})
local uid_list = ScriptLib.GetSceneUidList(context)
local hunter = ScriptLib.GetGroupTempValue(context, "hunter", {})
ScriptLib.ForceRefreshAuthorityByConfigId(context, defs.gadget_prison_list[1], hunter)
--prey_sum这里统计就太晚了需要三阶段开始先统计一次
local prey_sum = 0
for i,v in ipairs(uid_list) do
if v == hunter then
LF_Set_Player_State_Value(context, v, HS_State.Play.name, 0)
else
local idx = 0
for j = 1,3 do
if v == ScriptLib.GetGroupTempValue(context, "prey_"..j, {}) then
idx = j
break
end
end
--只有非死亡状态的游侠才继续游戏
if ScriptLib.GetGroupTempValue(context, HS_State.Play.name.."_"..v, {}) == 3 then
LF_Set_Player_State_Value(context, v, HS_State.Play.name, 1)
ScriptLib.AttachChildChallenge(context, 9011, idx*math.pow(10,5)+9013,9013,{defs.group_id,10},{v},{success=1,fail=1})
prey_sum = prey_sum + 1
end
end
end
if prey_sum == 0 then
LF_Stop_Hide_And_Seek(context, 1)
end
--获取到正确的游侠数量
ScriptLib.SetGroupTempValue(context, "prey_sum", prey_sum, {})
ScriptLib.AttachChildChallenge(context, 9011, 9012, 9012, {0,3,9012,prey_sum}, {hunter},{success=10,fail=10})
--启动组合挑战
ScriptLib.StartFatherChallenge(context, 9011)
ScriptLib.InitTimeAxis(context, "rampage", {defs.duration - defs.rampage_time}, false)
--处理两个抓捕结算的初始化
ScriptLib.InitTimeAxis(context, "hunter_win_in_time", {hunter_win_in_time}, false)
ScriptLib.SetGroupTempValue(context, "hunter_win_in_time", 1, {})
--处理能量球计时
LF_Set_Energy(context)
--解除hunter限制
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, defs.gadget_prison_list[1], 201)
end
function LF_Set_Energy(context)
ScriptLib.PrintContextLog(context, "## HS_Log : LF_Set_Energy")
math.randomseed(ScriptLib.GetServerTime(context))
local energy_list = {}
for i,v in ipairs(energy_info) do
table.insert(energy_list, v.time + math.random(energy_info[i].step[1],energy_info[i].step[2]))
end
ScriptLib.InitTimeAxis(context, "energy", energy_list, false)
end
function LF_Bake_Random_Scene(context)
ScriptLib.PrintContextLog(context, "## HS_Log : LF_Bake_Random_Scene")
--根据ld需求进行调整
--suite 2按权重随机创建
if suites[2] ~= nil then
math.randomseed(ScriptLib.GetServerTime(context))
for i,v in ipairs(suites[2].gadgets) do
if math.random(100) > 50 then
ScriptLib.CreateGadget(context, {config_id = v})
end
end
end
--suite 3创建基本空气墙
if suites[3] ~= nil then
ScriptLib.AddExtraGroupSuite(context, 0, 3)
end
end
function LF_Clear_Random_Scene(context)
ScriptLib.PrintContextLog(context, "## HS_Log : LF_Clear_Random_Scene")
--根据需求清理数据
ScriptLib.EndTimeAxis(context, "hunter_win_by_EX")
ScriptLib.EndTimeAxis(context, "hunter_win_in_time")
ScriptLib.EndTimeAxis(context, "hunter_catch_by_guide")
ScriptLib.RemoveExtraGroupSuite(context, 0, 3)
ScriptLib.RemoveExtraGroupSuite(context, 0, 4)
--清理诱饵防止local的残留
ScriptLib.KillEntityByConfigId(context, {config_id = defs.gadget_energy, entity_type = EntityType.GADGET})
for i,v in ipairs(defs.bait_list) do
for m,n in ipairs(v) do
ScriptLib.KillEntityByConfigId(context, {config_id = n, entity_type = EntityType.GADGET})
end
end
for i,v in ipairs(defs.gadget_prison_list) do
ScriptLib.KillEntityByConfigId(context, {config_id = v, entity_type = EntityType.GADGET})
end
end
function LF_Init_Player_State(context, uid)
ScriptLib.PrintContextLog(context, "## H&S_LOG Init_Player_State : "..uid)
for m,n in pairs(HS_State) do
LF_Set_Player_State_Value(context, uid, n.name, n.value)
end
end
--用于集中处理hunter失败的结算
function LF_Handle_Exhibition_Prey_Win(context)
ScriptLib.PrintContextLog(context, "## H&S_LOG : LF_Handle_Exhibition_Prey_Win")
local hunter = ScriptLib.GetGroupTempValue(context, "hunter", {})
local prey_sum = ScriptLib.GetGroupTempValue(context, "prey_sum", {})
local catch_sum = ScriptLib.GetGroupVariableValue(context, "catch_sum")
--剩余人数结算
local prey_alive = prey_sum - catch_sum
if prey_alive == 1 then
--统计:猎手的惜败
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_miss_one", 1)
for i=1,3 do
local _prey = ScriptLib.GetGroupTempValue(context, "prey_"..i, {})
if _prey ~= 0 then
--统计:最后的火种
ScriptLib.AddExhibitionReplaceableData(context, _prey, "prey_alive_only", 1)
break
end
end
elseif prey_alive == 2 then
--统计:猎手的失误
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_miss_two", 1)
end
if catch_sum == 0 then
--统计:无从复命
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_miss_all", 1)
end
for i=1,3 do
local _prey = ScriptLib.GetGroupTempValue(context, "prey_"..i, {})
local _const = ScriptLib.GetGroupTempValue(context, "const_prey_"..i, {})
if _const ~= 0 then
--存活的prey
if _prey ~= 0 then
--统计:抗争到底
ScriptLib.AddExhibitionReplaceableData(context, _const, "prey_alive_win", 1)
--统计:全身而退
local guide_time = ScriptLib.GetGroupTempValue(context, "prey_win_by_guide", {})
ScriptLib.AddExhibitionReplaceableData(context, _const, "prey_win_by_guide", guide_time)
--统计:灯下取巧
local detect_time = ScriptLib.GetGroupTempValue(context, "prey_win_by_detect_".._prey, {})
ScriptLib.AddExhibitionReplaceableData(context, _prey, "prey_win_by_detect", detect_time)
--统计:无技能胜利,要反转统计一次
if 0 == ScriptLib.GetGroupTempValue(context, "prey_win_without_skill_".._const, {}) then
ScriptLib.AddExhibitionReplaceableData(context, _const, "prey_win_without_skill", 1)
end
elseif _prey == 0 then
--统计:默契之力
ScriptLib.AddExhibitionReplaceableData(context, _const, "prey_dead_win", 1)
end
end
end
end
---------------------------------------
Initialize_Base()

View File

@@ -0,0 +1,603 @@
local _radius = "radius"
------------------------------------------
--通用函数区
--获取球形范围内的u_list
function LF_Get_Uid_Around(context, radius)
local list = {}
local uid_list = ScriptLib.GetSceneUidList(context)
for i,v in ipairs(uid_list) do
if 1 == ScriptLib.GetGroupTempValue(context, HS_State.Play.name.."_"..v, {}) then
if radius >= LF_Get_Player_Distance_To_Player(context, context.uid, v) then
table.insert(list, v)
end
end
end
return list
end
--获取圆柱范围内的u_list
function LF_Get_Uid_Cylinder(context, radius)
local list = {}
local uid_list = ScriptLib.GetSceneUidList(context)
for i,v in ipairs(uid_list) do
if 1 == ScriptLib.GetGroupTempValue(context, HS_State.Play.name.."_"..v, {}) then
--if radius >= LF_Get_Player_Distance_To_Player(context, context.uid, v) then
if radius >= LF_Get_Player_Distance_To_Player_2D(context, context.uid, v) then
table.insert(list, v)
end
end
end
return list
end
function LF_Get_Baits_Around(context, radius)
local list = {}
for i,v in ipairs(defs.bait_list) do
for m,n in ipairs(v) do
if ScriptLib.CheckIsInGroup(context, 0, n) == true then
local eid = ScriptLib.GetEntityIdByConfigId(context, n)
if radius >= LF_Get_Player_Distance_To_Entity(context, context.uid, eid) then
table.insert(list, n)
end
end
end
end
return list
end
--判断3D距离
function LF_Get_Player_Distance_To_Player(context, uid_1, uid_2)
local eid_1 = ScriptLib.GetAvatarEntityIdByUid(context, uid_1)
local eid_2 = ScriptLib.GetAvatarEntityIdByUid(context, uid_2)
return LF_Get_Distance_By_EntityId(context, eid_1, eid_2)
end
--判断2D距离
function LF_Get_Player_Distance_To_Player_2D(context, uid_1, uid_2)
local eid_1 = ScriptLib.GetAvatarEntityIdByUid(context, uid_1)
local eid_2 = ScriptLib.GetAvatarEntityIdByUid(context, uid_2)
return LF_Get_Distance_By_EntityId_2D(context, eid_1, eid_2)
end
function LF_Get_Player_Distance_To_Entity(context, uid_1, eid_2)
local eid_1 = ScriptLib.GetAvatarEntityIdByUid(context, uid_1)
return LF_Get_Distance_By_EntityId(context, eid_1, eid_2)
end
function LF_Get_Distance_By_EntityId(context, eid_1, eid_2)
local pos_1 = ScriptLib.GetPosByEntityId(context, eid_1)
local pos_2 = ScriptLib.GetPosByEntityId(context, eid_2)
local X = pos_1.x - pos_2.x
local Y = pos_1.y - pos_2.y
local Z = pos_1.z - pos_2.z
return math.sqrt(X*X+Y*Y+Z*Z)
end
function LF_Get_Distance_By_EntityId_2D(context, eid_1, eid_2)
local pos_1 = ScriptLib.GetPosByEntityId(context, eid_1)
local pos_2 = ScriptLib.GetPosByEntityId(context, eid_2)
local X = pos_1.x - pos_2.x
local Z = pos_1.z - pos_2.z
return math.sqrt(X*X+Z*Z)
end
function LF_Get_Skill_Info(context, skill, info)
if skill_info[skill][info] ~= nil then
return skill_info[skill][info]
end
ScriptLib.PrintContextLog(context, "## H&S_WARNING : Invalid Skill_Info : skill -> "..skill.." | key -> "..info)
return 0
end
------------------------------------------
function HideAndSeek_Skill_Init(context)
local skill = "HideAndSeek_Skill_Init"
LF_Handle_Skill(context, skill, context.uid, 0)
return 0
end
--hunter技能响应
--抓捕
function HideAndSeek_Skill_CatchPrey(context)
local skill = "HideAndSeek_Skill_CatchPrey"
ScriptLib.PrintContextLog(context, "## catch_debug | skill = "..skill)
local radius = LF_Get_Skill_Info(context, skill, _radius)
ScriptLib.PrintContextLog(context, "## catch_debug | radius = "..radius)
--诱饵队列
local bait_list = LF_Get_Baits_Around(context, radius)
ScriptLib.PrintContextLog(context, "## catch_debug | #bait = "..#bait_list)
if #bait_list ~= 0 then
for i,v in ipairs(bait_list) do
LF_Handle_Skill(context, skill, 0, v)
end
--通知hunter被致盲
ScriptLib.AddTeamEntityGlobalFloatValue(context, {context.uid}, "HideAndSeek_Get_Blind", 1)
end
--玩家队列
local prey_list = LF_Get_Uid_Around(context, radius)
ScriptLib.PrintContextLog(context, "## catch_debug | #prey = "..#prey_list)
if #prey_list ~= 0 then
for i,v in ipairs(prey_list) do
LF_Handle_Skill(context, skill, v, 0)
end
end
return 0
end
--方向引导
function HideAndSeek_Skill_Guide(context)
local skill = "HideAndSeek_Skill_Guide"
LF_Handle_Skill(context, skill, context.uid, 0)
return 0
end
--方向引导
function FireDirection(context)
local skill = "FireDirection"
local hunter = ScriptLib.GetGroupTempValue(context, "hunter", {})
LF_Handle_Skill(context, skill, hunter, 0)
return 0
end
--为侦测到诱饵
function HideAndSeek_Skill_Detect_F(context)
local skill = "HideAndSeek_Skill_Detect_F"
local radius = LF_Get_Skill_Info(context, skill, _radius)
--玩家队列
--local prey_list = LF_Get_Uid_Around(context, radius)
local prey_list = LF_Get_Uid_Cylinder(context, radius)
if #prey_list > 0 then
LF_Handle_Skill(context, skill, context.uid, 1)
--统计:感应光环成功数
ScriptLib.AddExhibitionAccumulableData(context, context.uid, "hunter_detect_prey", #prey_list)
for i,v in ipairs(prey_list) do
--记录被探查的次数
LF_Change_Temp_Value(context, "prey_win_by_detect_"..v, 1)
LF_Set_Player_State_Value(context, v, HS_State.Is_Detected.name, 1)
end
else
LF_Handle_Skill(context, skill, context.uid, -1)
end
return 0
end
--无敌定位
function HideAndSeek_Skill_UltraMark(context)
local skill = "HideAndSeek_Skill_UltraMark"
local radius = LF_Get_Skill_Info(context, skill, _radius)
--玩家队列
local prey_list = LF_Get_Uid_Around(context, radius)
if #prey_list ~= 0 then
math.randomseed(ScriptLib.GetServerTime(context))
local ran = math.random(#prey_list)
LF_Handle_Skill(context, skill, prey_list[ran], 0)
LF_Notify_Skill_Info(context, skill, context.uid, prey_list[ran])
end
return 0
end
--无敌定位结束
function HideAndSeek_Out_UltraMark(context)
local skill = "HideAndSeek_Out_UltraMark"
LF_Handle_Skill(context, skill, context.uid, 0)
return 0
end
--全部出来
function HideAndSeek_Skill_GlobalSight(context)
local skill = "HideAndSeek_Skill_GlobalSight"
local radius = LF_Get_Skill_Info(context, skill, _radius)
local prey_list = LF_Get_Uid_Around(context, radius)
for i,v in ipairs(prey_list) do
LF_Handle_Skill(context, skill, v, 0)
end
LF_Notify_Skill_Info(context, skill, context.uid, 0)
return 0
end
--全不出来
function HideAndSeek_Out_GlobalSight(context)
local skill = "HideAndSeek_Out_GlobalSight"
LF_Handle_Skill(context, skill, context.uid, 0)
return 0
end
--超级锁定
function HideAndSeek_Skill_SuperPrison(context)
local skill = "HideAndSeek_Skill_SuperPrison"
local radius = LF_Get_Skill_Info(context, skill, _radius)
--玩家队列
local prey_list = LF_Get_Uid_Around(context, radius)
if #prey_list ~= 0 then
math.randomseed(ScriptLib.GetServerTime(context))
local ran = math.random(#prey_list)
LF_Handle_Skill(context, skill, prey_list[ran], 0)
LF_Notify_Skill_Info(context, skill, context.uid, prey_list[ran])
end
return 0
end
--锁定过期
function HideAndSeek_Out_SuperPrison(context)
local skill = "HideAndSeek_Out_SuperPrison"
LF_Handle_Skill(context, skill, context.uid, 0)
return 0
end
--猎人暴走
function HideAndSeek_Hunter_Rampage(context)
local skill = "HideAndSeek_Hunter_Rampage"
local hunter = ScriptLib.GetGroupTempValue(context, "hunter", {})
LF_Handle_Skill(context, skill, hunter, 0)
LF_Notify_Skill_Info(context, skill, hunter, 0)
return 0
end
--隐身
function HideAndSeek_Skill_SelfInvisible(context)
local skill = "HideAndSeek_Skill_SelfInvisible"
LF_Handle_Skill(context, skill, context.uid, 0)
--LF_Change_Temp_Value(context, "prey_win_without_skill_"..context.uid, 1)
return 0
end
--诱饵放置
function HideAndSeek_Skill_PlaceBait(context)
local skill = "HideAndSeek_Skill_PlaceBait"
LF_Handle_Skill(context, skill, context.uid, 0)
--LF_Change_Temp_Value(context, "prey_win_without_skill_"..context.uid, 1)
return 0
end
--伪装
function HideAndSeek_Skill_Transfer(context)
local skill = "HideAndSeek_Skill_Transfer"
LF_Handle_Skill(context, skill, context.uid, 0)
LF_Change_Temp_Value(context, "prey_win_without_skill_"..context.uid, 1)
return 0
end
--解除伪装
function HideAndSeek_Skill_Transfer_Quit(context)
local skill = "HideAndSeek_Skill_Transfer_Quit"
LF_Handle_Skill(context, skill, context.uid, 0)
return 0
end
--获取能量
function HideAndSeek_Skill_Get_Energy(context)
local skill = "HideAndSeek_Skill_Get_Energy"
--统计:眷顾之能
ScriptLib.AddExhibitionReplaceableData(context, context.uid, "player_get_energy", 1)
LF_Notify_Skill_Info(context, skill, context.uid, 0)
return 0
end
--疾跑
function HideAndSeek_Skill_Sprint(context)
local skill = "HideAndSeek_Skill_Sprint"
LF_Notify_Skill_Info(context, skill, context.uid, 0)
--LF_Change_Temp_Value(context, "prey_win_without_skill_"..context.uid, 1)
--统计:正义的加护
ScriptLib.AddExhibitionReplaceableData(context, context.uid, "extra_skill_user", 1)
return 0
end
--致盲
function HideAndSeek_Skill_Blind(context, config_id)
ScriptLib.PrintContextLog(context, "## H&S_LOG : skill_debug : blind cid = "..config_id)
for i,v in ipairs(defs.bait_list) do
for p,q in ipairs(v) do
if q == config_id then
local _prey = ScriptLib.GetGroupTempValue(context, "const_prey_"..i, {})
ScriptLib.AddExhibitionReplaceableData(context, _prey, "prey_cheat_hunter", 1)
ScriptLib.AddExhibitionAccumulableData(context, _prey, "prey_cheat_hunter", 1)
return 0
end
end
end
return -1
end
--退出被侦测状态(当被抓方被扫描后,进行移动时调用)
function HideAndSeek_Skill_Is_Detected_Quit(context)
local skill = "HideAndSeek_Skill_Is_Detected_Quit"
LF_Handle_Skill(context, skill, context.uid, 0)
return 0
end
function LF_Change_Temp_Value(context, key, delta)
local cnt = ScriptLib.GetGroupTempValue(context, key, {})
ScriptLib.SetGroupTempValue(context, key, cnt + delta, {})
end
-------------------------------------------
--技能分发管理器
function LF_Handle_Skill(context, skill, uid, cid)
ScriptLib.PrintContextLog(context, "## H&S_WARNING : skill -> "..skill.." | uid -> "..uid.." | cid -> "..cid)
if skill == "HideAndSeek_Skill_Init" then
--先判断玩家有没有注册成功
local reg = 0
for i=1,3 do
if uid == ScriptLib.GetGroupTempValue(context, "const_prey_"..i, {}) then
reg = 1
break
end
end
if uid == ScriptLib.GetGroupTempValue(context, "hunter", {}) then
--服务器可能在忽悠我还是要处理hunter进的晚没有初始化的情况处理完强制结束
LF_Init_Player_State(context, uid)
LF_Set_Player_State_Value(context, uid, HS_State.Play.name, 0)
ScriptLib.SetPlayerGroupVisionType(context, {uid}, {0})
return 0
end
if reg == 0 then
--处理未注册的玩家不可能是hunter
--初始化一次,然后更新阵营参数
LF_Init_Player_State(context, uid)
LF_Set_Player_State_Value(context, uid, HS_State.Play.name, 1)
ScriptLib.SetPlayerGroupVisionType(context, {uid}, {0})
else
--对已经在入场的玩家还原客户端状态
for k,v in pairs(HS_State) do
local _temp = ScriptLib.GetGroupTempValue(context, v.name.."_"..uid, {})
--重连直接清隐身保平安
if k ~= "Visible" then
LF_Set_Player_State_Value(context, uid, v.name, _temp)
else
LF_Set_Player_State_Value(context, uid, v.name, 1)
end
end
ScriptLib.SetPlayerGroupVisionType(context, {uid}, {0})
end
elseif skill == "HideAndSeek_Skill_CatchPrey" then
if uid ~= 0 then
LF_Set_Prey_Die(context, uid)
elseif uid == 0 and cid ~= 0 then
ScriptLib.KillEntityByConfigId(context, {config_id = cid, entity_type = EntityType.GADGET})
HideAndSeek_Skill_Blind(context, cid)
end
elseif skill == "HideAndSeek_Skill_Guide" then
ScriptLib.SetGroupTempValue(context, "guide_cnt", 0, {})
local uid_list = ScriptLib.GetSceneUidList(context)
for i,v in ipairs(uid_list) do
local _playValue = ScriptLib.GetGroupTempValue(context, HS_State.Play.name.."_"..v, {})
ScriptLib.PrintContextLog(context, "## H&S_LOG : skill_debug "..skill.." | uid = "..v.." | key = "..HS_State.Play.name.." | value = ".._playValue)
if 1 == _playValue then
--对存活的玩家执行action
for j=1,3 do
if v == ScriptLib.GetGroupTempValue(context, "prey_"..j, {}) then
ScriptLib.KillEntityByConfigId(context, {config_id=defs.gadget_guide[j], entity_type=EntityType.GADGET})
local eid = ScriptLib.GetAvatarEntityIdByUid(context, v)
local pos = ScriptLib.GetPosByEntityId(context, eid)
ScriptLib.PrintContextLog(context, "## H&S_LOG : skill_debug "..skill.." | prey_"..j.." = "..v.." | cid = "..defs.gadget_guide[j])
local ret = ScriptLib.CreateGadgetByConfigIdByPos(context, defs.gadget_guide[j], {x=pos.x,y=pos.y,z=pos.z}, {x=0,y=0,z=0})
ScriptLib.PrintContextLog(context, "## H&S_LOG : Create_Gadget_Guide_"..j.." -> "..ret)
end
end
end
end
elseif skill == "FireDirection" then
ScriptLib.ChangeGroupTempValue(context, "guide_cnt", 1, {})
local guide_cnt = ScriptLib.GetGroupTempValue(context, "guide_cnt", {})
local catch_sum = ScriptLib.GetGroupVariableValue(context, "catch_sum")
local prey_sum = ScriptLib.GetGroupTempValue(context, "prey_sum", {})
ScriptLib.PrintContextLog(context, "## H&S_LOG : skill_debug : guide_cnt = "..guide_cnt.." | catch_sum = "..catch_sum.." | prey_sum = "..prey_sum)
if guide_cnt == prey_sum - catch_sum then
--这个状态不用存档所以不执行lf_set_player_state
ScriptLib.AddTeamEntityGlobalFloatValue(context, {uid}, "FireDirection", 1)
--guide后抓人统计
ScriptLib.InitTimeAxis(context, "hunter_catch_by_guide", {hunter_catch_by_guide}, false)
ScriptLib.SetGroupTempValue(context, "hunter_catch_by_guide", 1, {})
LF_Change_Temp_Value(context, "prey_win_by_guide", 1)
end
elseif skill == "HideAndSeek_Skill_Detect_F" then
LF_Set_Player_State_Value(context, uid, "HideAndSeek_Skill_Detect", cid)
elseif skill == "HideAndSeek_Skill_UltraMark" then
ScriptLib.InitTimeAxis(context, "hunter_win_by_EX", {hunter_win_by_EX}, false)
ScriptLib.SetGroupTempValue(context, "hunter_win_by_EX", 1, {})
LF_Set_Player_State_Value(context, uid, HS_State.OnMap.name, 1)
LF_Set_Player_State_Value(context, uid, HS_State.Transfer.name, 0)
LF_Set_Player_State_Value(context, uid, HS_State.UltraMark.name, 1)
elseif skill == "HideAndSeek_Out_UltraMark" then
LF_Set_Player_State_Value(context, uid, HS_State.OnMap.name, 0)
LF_Set_Player_State_Value(context, uid, HS_State.UltraMark.name, 0)
elseif skill == "HideAndSeek_Skill_GlobalSight" then
ScriptLib.InitTimeAxis(context, "hunter_win_by_EX", {hunter_win_by_EX}, false)
ScriptLib.SetGroupTempValue(context, "hunter_win_by_EX", 1, {})
LF_Set_Player_State_Value(context, uid, HS_State.Transfer.name, 0)
LF_Set_Player_State_Value(context, uid, HS_State.OnMap.name, 1)
LF_Set_Player_State_Value(context, uid, HS_State.GlobalSight.name, 1)
elseif skill == "HideAndSeek_Out_GlobalSight" then
LF_Set_Player_State_Value(context, uid, HS_State.OnMap.name, 0)
LF_Set_Player_State_Value(context, uid, HS_State.GlobalSight.name, 0)
elseif skill == "HideAndSeek_Skill_SuperPrison" then
ScriptLib.InitTimeAxis(context, "hunter_win_by_EX", {hunter_win_by_EX}, false)
ScriptLib.SetGroupTempValue(context, "hunter_win_by_EX", 1, {})
LF_Set_Player_State_Value(context, uid, HS_State.Transfer.name, 0)
LF_Set_Player_State_Value(context, uid, HS_State.Moveable.name, 0)
LF_Set_Player_State_Value(context, uid, HS_State.SuperPrison.name, 1)
elseif skill == "HideAndSeek_Out_SuperPrison" then
LF_Set_Player_State_Value(context, uid, HS_State.Moveable.name, 1)
LF_Set_Player_State_Value(context, uid, HS_State.SuperPrison.name, 0)
elseif skill == "HideAndSeek_Hunter_Rampage" then
LF_Set_Player_State_Value(context, uid, HS_State.Rampage.name, 1)
elseif skill == "HideAndSeek_Skill_SelfInvisible" then
LF_Set_Player_State_Value(context, uid, HS_State.Transfer.name, 0)
LF_Set_Player_State_Value(context, uid, HS_State.Visible.name, 0)
elseif skill == "HideAndSeek_Skill_PlaceBait" then
local eid = ScriptLib.GetAvatarEntityIdByUid(context, uid)
local pos = ScriptLib.GetPosByEntityId(context, eid)
local pos_table = { x = pos.x, y = pos.y, z = pos.z + 0.1 }
local rot_table = { x = 0, y = 0, z = 0 }
ScriptLib.PrintContextLog(context, "## bait_debug | stage_1 ")
for i=1,3 do
local player = ScriptLib.GetGroupTempValue(context, "const_prey_"..i, {})
if player == 0 then
break
end
if player == uid then
ScriptLib.PrintContextLog(context, "## bait_debug | player = "..player)
if 2 ~= ScriptLib.GetGroupTempValue(context, HS_State.Play.name.."_"..player, {}) then
--这里要处理一个人的复数bait序列问题
local bait_ptr = 1
--重定位诱饵ptr,遍历比3-8译码效率高
for j = 1,#defs.bait_list[i] do
if ScriptLib.CheckIsInGroup(context, 0, defs.bait_list[i][j]) == false then
bait_ptr = j
break
end
end
local bait = defs.bait_list[i][bait_ptr]
ScriptLib.KillEntityByConfigId(context, {config_id=bait, entity_type=EntityType.GADGET})
local _value = ScriptLib.GetGroupTempValue(context, HS_State.TransferCache.name.."_"..player, {})
--如果玩家未变身,就用第一个transfer处理
if _value == 0 then
local _index = ScriptLib.GetHideAndSeekPlayIndex(context)
local _map = ScriptLib.GetHideAndSeekMap(context, _index)
_value = map_info[_map].list[1]
end
ScriptLib.PrintContextLog(context, "## H&S_LOG : bait_detail_info : player = "..player.." | ptr = "..bait_ptr.." | bait = "..bait.." value = ".._value)
local ret = ScriptLib.CreateGadgetByParamTable(context, {config_id = bait, pos = pos_table, rot = rot_table, sgv_key = {"SGV_HideAndSeek_Bait_Transfer"}, sgv_value = {_value}})
ScriptLib.PrintContextLog(context, "## H&S_LOG : bait_detail_ret : "..ret)
break
end
end
end
elseif skill == "HideAndSeek_Skill_Transfer" then
--根据地图翻译next
--默认地图变身配置
local list = {0,1,2,3}
local _index = ScriptLib.GetHideAndSeekPlayIndex(context)
local _map = 1
_map = ScriptLib.GetHideAndSeekMap(context, _index)
ScriptLib.PrintContextLog(context, "## HS_LOG : Get_Map_Info : ".._map)
for k,v in pairs(map_info) do
if k == _map then
list = v.list
break
end
end
local t = ScriptLib.GetGroupTempValue(context, HS_State.TransferCache.name.."_"..uid, {})
ScriptLib.PrintContextLog(context, "## H&S_LOG : Get_Player_Transform_Info : uid="..uid.." | value = "..t)
--先处理transfer初始值带来的问题
local t_next = 1
if t ~= 0 then
for i,v in ipairs(list) do
if t == v then
t_next = i + 1
if t_next > #list then
t_next = 1
end
end
end
end
LF_Set_Player_State_Value(context, uid, HS_State.Visible.name, 1)
LF_Set_Player_State_Value(context, uid, HS_State.Transfer.name, list[t_next])
LF_Set_Player_State_Value(context, uid, HS_State.TransferCache.name, list[t_next])
elseif skill == "HideAndSeek_Skill_Transfer_Quit" then
--取消变身保留cache
LF_Set_Player_State_Value(context, uid, HS_State.Transfer.name, 0)
elseif skill == "HideAndSeek_Skill_Is_Detected_Quit" then
LF_Set_Player_State_Value(context, uid, HS_State.Is_Detected.name, 0)
end
return 0
end
function LF_Set_Player_State_Value(context, uid, key, value)
--ScriptLib.PrintContextLog(context, "## H&S_LOG : Set_State_Value : uid = "..uid.." | key = "..key.." | value = "..value)
ScriptLib.SetGroupTempValue(context, key.."_"..uid, value, {})
ScriptLib.SetTeamEntityGlobalFloatValue(context, {uid}, key, value)
end
function LF_Notify_Player_Visible(context, uid)
ScriptLib.PrintContextLog(context, "## H&S_LOG : Modify_On_Map : uid = "..uid)
local list = {}
for i=1,3 do
if uid == ScriptLib.GetGroupTempValue(context, "const_prey_"..i, {}) then
if ScriptLib.GetGroupTempValue(context, HS_State.OnMap.name.."_"..uid, {}) == 1 then
table.insert(list, uid)
break
end
end
end
local _gallery = ScriptLib.GetGroupTempValue(context, "gallery_id", {})
ScriptLib.UpdatePlayerGalleryScore(context, _gallery, {["update_type"]="updateVisibleUidList", ["uid_list"] = list})
for i,v in ipairs(list) do
ScriptLib.PrintContextLog(context, "## OnMap_Debug : list["..i.."] = "..v)
end
end
function LF_Notify_Player_Die_Effect(context, uid)
ScriptLib.PrintContextLog(context, "## H&S_LOG : Prepare_Die_Effect : uid = "..uid)
ScriptLib.InitTimeAxis(context, tostring(uid), {3}, false)
end
function LF_Notify_Skill_Info(context, skill, uid_1, uid_2)
ScriptLib.PrintContextLog(context, "## H&S_LOG : LF_Notify_Skill_Info : skill -> "..skill)
local uid_list = ScriptLib.GetSceneUidList(context)
if skill == "HideAndSeek_Skill_UltraMark" then
ScriptLib.AssignPlayerShowTemplateReminder(context, 124, {param_vec={skill_info[skill].duration},param_uid_vec={uid_1,uid_2},uid_vec=uid_list})
elseif skill == "HideAndSeek_Skill_GlobalSight" then
ScriptLib.AssignPlayerShowTemplateReminder(context, 125, {param_vec={skill_info[skill].duration},param_uid_vec={uid_1},uid_vec=uid_list})
elseif skill == "HideAndSeek_Skill_SuperPrison" then
ScriptLib.AssignPlayerShowTemplateReminder(context, 126, {param_vec={skill_info[skill].duration},param_uid_vec={uid_1,uid_2},uid_vec=uid_list})
elseif skill == "HideAndSeek_Skill_CatchPrey" then
ScriptLib.AssignPlayerUidOpNotify(context, {param_index = 11,param_list={},param_uid_list={uid_1,uid_2},duration=3,target_uid_list=uid_list})
elseif skill == "HideAndSeek_Hunter_Rampage" then
ScriptLib.AssignPlayerUidOpNotify(context, {param_index = 13,param_list={},param_uid_list={uid_1},duration=3,target_uid_list=uid_list})
elseif skill == "HideAndSeek_Skill_Get_Energy" then
local notify_id = 15
if uid_1 == ScriptLib.GetGroupTempValue(context, "hunter", {}) then
notify_id = 14
end
ScriptLib.AssignPlayerUidOpNotify(context, {param_index = notify_id,param_list={},param_uid_list={uid_1},duration=3,target_uid_list=uid_list})
end
end
function LF_Set_Prey_Die(context, uid)
local hunter = ScriptLib.GetGroupTempValue(context, "hunter", {})
local _gallery = ScriptLib.GetGroupTempValue(context, "gallery_id", {})
ScriptLib.UpdatePlayerGalleryScore(context, _gallery, {["update_type"]="updateCaughtUid", ["caught_uid"]=uid})
LF_Set_Player_State_Value(context, uid, HS_State.Transfer.name, 0)
LF_Set_Player_State_Value(context, uid, HS_State.Visible.name, 1)
LF_Set_Player_State_Value(context, uid, HS_State.OnMap.name, 0)
LF_Set_Player_State_Value(context, uid, HS_State.Moveable.name, 1)
LF_Set_Player_State_Value(context, uid, HS_State.Play.name, 2)
local catch_sum = ScriptLib.GetGroupVariableValue(context, "catch_sum")
local prey_sum = ScriptLib.GetGroupTempValue(context, "prey_sum", {})
--处理prey死亡的exhibition统计
if 1 == ScriptLib.GetGroupTempValue(context, "hunter_catch_by_guide", {}) then
--统计:神秘预感后捕获
ScriptLib.AddExhibitionReplaceableData(context, hunter, "hunter_catch_by_guide", 1)
end
if catch_sum == 0 then
--统计:强行侦察
ScriptLib.AddExhibitionReplaceableData(context, uid, "prey_dead_first", 1)
end
if catch_sum == 1 then
--统计:阵脚大乱
ScriptLib.AddExhibitionReplaceableData(context, uid, "prey_dead_second", 1)
end
if catch_sum == prey_sum - 1 then
--统计:功败垂成
ScriptLib.AddExhibitionReplaceableData(context, uid, "prey_dead_final", 1)
end
--处理玩家死亡表现
if catch_sum < prey_sum - 1 then
LF_Notify_Skill_Info(context, "HideAndSeek_Skill_CatchPrey", hunter, uid)
LF_Notify_Player_Die_Effect(context, uid)
end
ScriptLib.ChangeGroupVariableValue(context, "catch_sum", 1)
--最后执行prey_清档比较安全
local idx = 0
for j = 1,3 do
if uid == ScriptLib.GetGroupTempValue(context, "prey_"..j, {}) then
idx = j
ScriptLib.SetGroupTempValue(context, "prey_"..j, 0, {})
break
end
end
ScriptLib.StopChallenge(context, idx*math.pow(10,5)+9013, 0)
end
-------------------------------------------

View File

@@ -0,0 +1,196 @@
--[[
local defs = {
timer_region = 1,
challenge_region = 2,
monster_hilichurl = 3,
exist_hour = {0,6},
}
--]]
local Tri = {
[1] = { name = "enter_region", config_id = 8000001, event = EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_enter_region", trigger_count = 0, forbid_guest = false },
[2] = { name = "leave_region", config_id = 8000002, event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_leave_region", trigger_count = 0, forbid_guest = false },
[3] = { name = "hilichurl_die", config_id = 8000003, event = EventType.EVENT_ANY_MONSTER_DIE, source = "", condition = "", action = "action_hilichurl_die", trigger_count = 0, tag = "950" },
[4] = { name = "time_axis_pass", config_id = 8000004, event = EventType.EVENT_TIME_AXIS_PASS, source = "Loop", condition = "", action = "action_time_axis_pass", trigger_count = 0 },
[5] = { name = "variable_change", config_id = 8000005, event = EventType.EVENT_VARIABLE_CHANGE, source = "hili_die", condition = "", action = "action_variable_change", trigger_count = 0 },
[6] = { name = "set_game_time", config_id = 8000006, event = EventType.EVENT_SET_GAME_TIME, source = "", condition = "", action = "action_set_game_time", trigger_count = 0 },
[7] = { name = "group_load", config_id = 8000007, event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
[8] = { name = "group_will_unload", config_id = 8000008, event = EventType.EVENT_GROUP_WILL_UNLOAD, source = "", condition = "", action = "action_group_will_unload", trigger_count = 0},
[9] = { name = "hp_change", config_id = 8000009, event = EventType.EVENT_SPECIFIC_MONSTER_HP_CHANGE, source = tostring(defs.monster_hilichurl), condition = "", action = "action_hp_change", trigger_count = 0 },
--[10]= { name = "var_print", config_id = 8000010, event = EventType.EVENT_VARIABLE_CHANGE, source = "", condition = "", action = "action_var_print", trigger_count = 0 }
}
local Var = {
[1] = { config_id=50000001,name = "hili_die", value = 0, no_refresh = false }
}
function Initialize()
for k,v in pairs(Tri) do
table.insert(triggers, v)
table.insert(suites[1].triggers, v.name)
end
table.insert(variables, Var[1])
end
---------------------------------
function action_enter_region(context, evt)
if evt.param1 == defs.challenge_region then
--做一个challenge唯一的保护
if ScriptLib.GetGroupTempValue(context, "in_challenge", {}) == 0 then
local ret = ScriptLib.ActiveChallenge(context, 234, 234, 1, 950, 1, 0)
ScriptLib.PrintContextLog(context, "## Hilichurl : hili challenge ret = "..ret)
ScriptLib.SetGroupTempValue(context, "in_challenge", 1, {})
end
elseif evt.param1 == defs.timer_region then
ScriptLib.InitTimeAxis(context, "Loop", {5}, true)
end
return 0
end
function action_leave_region(context, evt)
if evt.param1 == defs.challenge_region then
if ScriptLib.GetRegionEntityCount(context, { region_eid = evt.source_eid, entity_type = EntityType.AVATAR }) == 0 then
ScriptLib.SetGroupTempValue(context, "in_challenge", 0, {})
ScriptLib.StopChallenge(context, 234, 0)
end
elseif evt.param1 == defs.timer_region then
ScriptLib.EndTimeAxis(context, "Loop")
end
return 0
end
function action_hilichurl_die(context, evt)
if evt.param1 ~= defs.monster_hilichurl then
return -1
end
ScriptLib.PrintContextLog(context, "## Hilichurl : boss_die_type = "..evt.param2)
--仅大伟丘正常死亡才计数
if evt.param2 == 0 then
ScriptLib.SetGroupTempValue(context, "in_challenge", 0, {})
local ret = ScriptLib.ChangeGroupVariableValue(context, "hili_die", 1)
ScriptLib.PrintContextLog(context, "## Hilichurl : die_count_result = "..ret)
ScriptLib.RemoveExtraGroupSuite(context, 0, 2)
ScriptLib.RemoveExtraGroupSuite(context, 0, 3)
return 0
elseif evt.param2 == 2 then
--大伟丘逃跑的处理
ScriptLib.SetGroupTempValue(context, "Exist", 0, {})
ScriptLib.SetGroupTempValue(context, "in_challenge", 0, {})
ScriptLib.StopChallenge(context, 234, 0)
ScriptLib.RemoveExtraGroupSuite(context, 0, 2)
ScriptLib.RemoveExtraGroupSuite(context, 0, 3)
end
return -1
end
function action_time_axis_pass(context, evt)
local time = ScriptLib.GetGameHour(context)
ScriptLib.PrintContextLog(context, "## Hilichurl : game hour = "..time)
LF_Handle_Monster_Hilichurl(context)
return 0
end
--通过变量通知挑战是否完成
function action_variable_change(context, evt)
if evt.param1 == evt.param2 + 1 then
ScriptLib.FinishFindHilichurlLevel(context)
ScriptLib.EndTimeAxis(context, "Loop")
return 0
end
return -1
end
--调时间后立即做一次判定
function action_set_game_time(context, evt)
LF_Handle_Monster_Hilichurl(context)
return 0
end
function action_group_load(context, evt)
--使用unload做清理暂时不用load
return 0
end
function action_group_will_unload(context ,evt)
ScriptLib.RemoveEntityByConfigId(context, 0, EntityType.MONSTER, defs.monster_hilichurl)
ScriptLib.RemoveExtraGroupSuite(context, 0, 2)
ScriptLib.RemoveExtraGroupSuite(context, 0, 3)
ScriptLib.EndTimeAxis(context, "Loop")
return 0
end
function action_hp_change(context, evt)
if evt.param3 == 0 then
return -1
elseif evt.param3 <= 50 then
if ScriptLib.GetGroupTempValue(context, "hp_50", {}) == 1 then
return -1
end
ScriptLib.ShowReminder(context, 1110236)
ScriptLib.AddExtraGroupSuite(context, 0, 3)
ScriptLib.SetGroupTempValue(context, "hp_50", 1, {})
elseif evt.param3 <= 90 then
if ScriptLib.GetGroupTempValue(context, "hp_90", {}) == 1 then
return -1
end
ScriptLib.ShowReminder(context, 1110236)
ScriptLib.AddExtraGroupSuite(context, 0, 2)
ScriptLib.SetGroupTempValue(context, "hp_90", 1, {})
end
return 0
end
function action_var_print(context, evt)
ScriptLib.PrintContextLog(context, "## Hilichurl : var_change : "..evt.source_name.." "..evt.param2.." -> "..evt.param1)
return 0
end
----------------------------------------------
function LF_Handle_Monster_Hilichurl(context)
local time = ScriptLib.GetGameHour(context)
if defs.exist_hour[2] == 24 then
if time == 0 then
time = 24
end
end
--先校验时间符合区间
if time < defs.exist_hour[1] then
LF_Try_Remove_Hilichurl(context)
return -1
end
--需要处理超出时间是否强制脱战
if time >= defs.exist_hour[2] then
LF_Try_Remove_Hilichurl(context)
return -1
end
LF_Try_Summon_Hilichurl(context)
end
function LF_Try_Remove_Hilichurl(context)
ScriptLib.PrintContextLog(context, "## Hilichurl : Try_Remove_Hilichurl")
--如果怪不存在则简化处理
if 1 ~= ScriptLib.GetGroupTempValue(context, "Exist", {}) then
return 0
end
if 1 ~= ScriptLib.GetMonsterAbilityFloatValue(context, 0, defs.monster_hilichurl, "_IS_IN_BATTLE") then
local ret = ScriptLib.RemoveEntityByConfigId(context, 0, EntityType.MONSTER, defs.monster_hilichurl)
ScriptLib.PrintContextLog(context, "## Hilichurl : Remove Monster Result = "..ret)
ScriptLib.SetGroupTempValue(context, "Exist", 0, {})
end
end
function LF_Try_Summon_Hilichurl(context)
ScriptLib.PrintContextLog(context, "## Hilichurl : Try_Summon_Hilichurl")
if 1 == ScriptLib.GetGroupTempValue(context, "Exist", {}) then
return 0
end
ScriptLib.PrintContextLog(context, "## Hilichurl : Create Monster")
local ret = ScriptLib.CreateMonster(context, {config_id = defs.monster_hilichurl, delay_time = 0})
ScriptLib.PrintContextLog(context, "## Hilichurl : Create Monster Result = "..ret)
if ret == 0 then
ScriptLib.SetGroupTempValue(context, "Exist", 1, {})
ScriptLib.SetGroupTempValue(context, "hp_50", 0, {})
ScriptLib.SetGroupTempValue(context, "hp_90", 0, {})
end
end
----------------------------------------------
Initialize()