添加配置表

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
@@ -0,0 +1,159 @@
--[[======================================
|| filename: Activity_Hunt_Stage_1
|| owner: juntao.chen
|| description: 营地挑战玩法
|| LogName: Activity_Hunt_Stage_1
|| Protection: [Protection]
=======================================]]
--需求defs
--[[
local defs = {
gallery_id = 111,
region = 111
}
]]
--[[ 一阶段:
胆小型野猪:add_timid_cnt
野蛮型野猪:add_brutal_cnt
精英野猪:add_elite_cnt
二阶段:
monster_id
left_num
total_num ]]
local stage_2_group_id = 133002100
local temp_Variables = {--已自动添加config_id
{ name = "gm_Try_End", value = 0, no_refresh = false },
{ name = "gm_Try_Start", value = 0, no_refresh = false },
--一阶段
{ name = "add_timid_cnt", value = 0, no_refresh = false },
{ name = "add_brutal_cnt", value = 0, no_refresh = false },
{ name = "add_elite_cnt", value = 0, no_refresh = false },
--二阶段
{ name = "left_num", value = 0, no_refresh = false },
{ name = "total_num", value = 0, no_refresh = false },
{ name = "monster_id", value = 0, no_refresh = false },
{ name = "monster_id_sneak", value = 0, no_refresh = false },
{ name = "Stage_2_Monster_Count", value = 0, no_refresh = false },--仅策划用
--三阶段
{ name = "is_finish", value = 0, no_refresh = false },
{ name = "go_weak", value = 0, no_refresh = false },
}
local temp_Tirgger = {
{event = EventType.EVENT_VARIABLE_CHANGE, source = "", action = "action_EVENT_VARIABLE_CHANGE"},
{event = EventType.EVENT_GALLERY_START, source = "", action = "action_EVENT_GALLERY_START"},
{event = EventType.EVENT_GROUP_REFRESH, source = "", action = "action_EVENT_GROUP_REFRESH"},
{event = EventType.EVENT_GROUP_WILL_UNLOAD, source = "", action = "action_EVENT_GROUP_WILL_UNLOAD"},
{event = EventType.EVENT_LEAVE_REGION, source = "", action = "action_EVENT_LEAVE_REGION"},
{event = EventType.EVENT_GALLERY_STOP, source = "", action = "action_EVENT_GALLERY_STOP"},
}
function action_EVENT_GALLERY_STOP(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_1 action_EVENT_GALLERY_STOP:evt.param1="..evt.param1)
local _uidlist = ScriptLib.GetSceneUidList(context)
ScriptLib.SetPlayerGroupVisionType(context, _uidlist, {1})
return 0
end
function action_EVENT_LEAVE_REGION(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_1 action_EVENT_LEAVE_REGION:evt.param1="..evt.param1)
if ScriptLib.IsGalleryStart(context, defs.gallery_id) and evt.param1 == defs.region then
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_1 action_EVENT_LEAVE_REGION:StopGalleryByReason")
ScriptLib.StopGalleryByReason(context, defs.gallery_id, 5)
end
return 0
end
function action_EVENT_GROUP_WILL_UNLOAD(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_1 action_EVENT_GROUP_WILL_UNLOAD")
return 0
end
function action_EVENT_GROUP_REFRESH(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_1 action_EVENT_GROUP_REFRESH")
return 0
end
function action_EVENT_GALLERY_START(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_1 action_EVENT_GALLERY_START:2022_6_21_205629")
if base_info.group_id == stage_2_group_id then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{["total_num"] = defs.stage_2_goal})
ScriptLib.SetGroupVariableValue(context, "Stage_2_Monster_Count", 0)
local _uid = ScriptLib.GetSceneOwnerUid(context)
ScriptLib.SetTeamServerGlobalValue(context, _uid, "SGV_CUR_STAGE", 2)
else
local _uid = ScriptLib.GetSceneOwnerUid(context)
ScriptLib.SetTeamServerGlobalValue(context, _uid, "SGV_CUR_STAGE", 0)
end
return 0
end
function action_EVENT_VARIABLE_CHANGE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_1 action_EVENT_VARIABLE_CHANGE:evt.source_name = ".. evt.source_name.."| value = "..evt.param1)
--还是判一下name,避免发无用key到gallery上
if evt.source_name == "add_timid_cnt" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{[evt.source_name] = evt.param1})
end
if evt.source_name == "add_brutal_cnt" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{[evt.source_name] = evt.param1})
end
if evt.source_name == "add_elite_cnt" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{[evt.source_name] = evt.param1})
end
if evt.source_name == "left_num" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{[evt.source_name] = evt.param1})
end
if evt.source_name == "total_num" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{[evt.source_name] = evt.param1})
end
if evt.source_name == "monster_id" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{[evt.source_name] = evt.param1})
end
if evt.source_name == "monster_id_sneak" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{["monster_id"] = evt.param1,["sneak_count"] = 1})
end
if evt.source_name == "is_finish" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{[evt.source_name] = evt.param1})
end
if evt.source_name == "go_weak" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{[evt.source_name] = evt.param1})
end
--二阶段抓到动物后 判断是否完成
if evt.source_name == "Stage_2_Monster_Count" then
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_1 action_EVENT_VARIABLE_CHANGE1:defs.stage_2_goal="..defs.stage_2_goal)
if evt.param1 >= defs.stage_2_goal then
ScriptLib.StopGallery(context, 27002, false)
end
end
return 0
end
function LF_Try_Start(context)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_1 LF_Try_Start:")
return 0
end
function SLC_onStageReady(context)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 SLC_onStageReady:")
ScriptLib.SetGroupVariableValueByGroup(context,"start", 1,133002075)
return 0
end
--初始化
function Initialize()
--加触发器
if temp_Tirgger ~= nil then
for k,v in pairs(temp_Tirgger) do
v.name = v.action
v.config_id = 40000000 + k
v.trigger_count = 0
v.condition = ""
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
end
--加变量
if temp_Variables ~= nil then
for k,v in pairs(temp_Variables) do
v.config_id = 50000000 + k
table.insert(variables,v)
end
end
return 0
end
Initialize()
@@ -0,0 +1,342 @@
--[[======================================
|| filename: Activity_Hunt_Stage_2
|| owner: juntao.chen
|| description: 营地挑战玩法(布设group)
|| LogName: Activity_Hunt_Stage_2
|| Protection: [Protection]
=======================================]]
--需求defs
--[[
local defs = {
target_group = 111
}
]]
--[[ 一阶段:
胆小型野猪:add_timid_cnt
野蛮型野猪:add_brutal_cnt
精英野猪:add_elite_cnt
二阶段:
monster_id
left_num
total_num ]]
local stage_1_group_id = 133002075
local stage_2_group_id = {133002081,133002082,133002099}
local stage_3_group_id = 133002068
local monster_list = {
[28020310] = "add_timid_cnt",
[28020311] = "add_brutal_cnt",
[28020312] = "add_elite_cnt",
}
local score_list = {
[28020310] = 10,
[28020311] = 50,
[28020312] = 100,
}
local temp_Variables = {
{ config_id=50000009,name = "create_random_shield_orb", value = 0, no_refresh = false },
{ config_id=50000001,name = "create_monster_1", value = 0, no_refresh = false },
{ config_id=50000002,name = "create_monster_2", value = 0, no_refresh = false },
{ config_id=50000003,name = "create_monster_3", value = 0, no_refresh = false },
}
local temp_Tirgger = {
{event = EventType.EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE, source = "", action = "action_EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE"},
{event = EventType.EVENT_ENTER_REGION, source = "", action = "action_EVENT_ENTER_REGION"},
{event = EventType.EVENT_VARIABLE_CHANGE, source = "", action = "action2_EVENT_VARIABLE_CHANGE"},
{event = EventType.EVENT_GROUP_LOAD, source = "", action = "action_EVENT_GROUP_LOAD"},
{event = EventType.EVENT_TIME_AXIS_PASS, source = "Active_Trap", action = "action_EVENT_TIME_AXIS_PASS_Active_Trap"},
{event = EventType.EVENT_TIME_AXIS_PASS, source = "create_random_shield_orb", action = "action_EVENT_TIME_AXIS_PASS_create_random_shield_orb"},
{event = EventType.EVENT_ANY_MONSTER_DIE, source = "", action = "action_EVENT_ANY_MONSTER_DIE"},
}
function action_EVENT_TIME_AXIS_PASS_create_random_shield_orb(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_TIME_AXIS_PASS_create_random_shield_orb:")
local _cfgid = ScriptLib.GetGroupTempValue(context,"last_cfgid",{})
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_TIME_AXIS_PASS_create_random_shield_orb:_cfgid=".._cfgid)
ScriptLib.RemoveEntityByConfigId(context, base_info.group_id, EntityType.GADGET, 20000002)
ScriptLib.CreateGadget(context, { config_id = _cfgid })
return 0
end
--剩余怪物数量检测:用于二阶段线性解锁黄圈
function action_EVENT_ANY_MONSTER_DIE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_ANY_MONSTER_DIE:")
--非二阶段不跑该function
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_ANY_MONSTER_DIE:base_info.group_id="..base_info.group_id)
if stage_2_group_id == nil then
return 0
end
if #stage_2_group_id ~= 3 then
return 0
end
if base_info.group_id ~=stage_2_group_id[1] and base_info.group_id ~=stage_2_group_id[2] and base_info.group_id ~=stage_2_group_id[3] then
return 0
end
local _count = ScriptLib.GetGroupMonsterCount(context)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_ANY_MONSTER_DIE:_count=".._count)
--1解锁22解锁3
if _count == 2 and base_info.group_id == stage_2_group_id[1] then
ScriptLib.ActivateGroupLinkBundle(context, stage_2_group_id[2])
ScriptLib.AddExtraGroupSuite(context, stage_2_group_id[2], 2)
elseif _count == 2 and base_info.group_id == stage_2_group_id[2] then
ScriptLib.ActivateGroupLinkBundle(context, stage_2_group_id[3])
ScriptLib.AddExtraGroupSuite(context, stage_2_group_id[3], 2)
end
--如果最近踩过的黄圈是本group的圈,则更新左侧剩余数量
local _circle = ScriptLib.GetGroupTempValue(context, "Cur_Circle",{ group_id = defs.target_group})
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_ANY_MONSTER_DIE:_circle=".._circle)
if _circle == defs.circle_region then
--更新左侧面板
ScriptLib.SetGroupVariableValueByGroup(context, "left_num", _count, defs.target_group)
end
--如果数量为0,关闭黄圈
if _count == 0 then
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_ENTER_REGION:DeactivateGroupLinkBundle")
ScriptLib.DeactivateGroupLinkBundle(context,base_info.group_id)
end
return 0
end
--三阶段用 定时激活捕网机关
function action_EVENT_TIME_AXIS_PASS_Active_Trap(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_TIME_AXIS_PASS_Active_Trap:")
if evt.param1 == 1 then
ScriptLib.ShowReminder(context, 400174)
--随机挑选一个未激活的trap,记录config_id,生成倒三角箭头
local _list = {}
for k,v in pairs(gadgets) do
if v.gadget_id == 70800230 and ScriptLib.GetGadgetStateByConfigId(context,base_info.group_id,v.config_id) ~= 201 then
table.insert(_list,v.config_id)
end
end
if #_list > 0 then
local _t = math.random(#_list)
ScriptLib.SetGroupTempValue(context,"random_cfgid",_list[_t],{})
--找到待激活的机关,在他头顶创建一个倒三角
for k,v in pairs(gadgets) do
if v.config_id == _list[_t] then
ScriptLib.CreateGadgetByConfigIdByPos(context, 20000001,{x=v.pos.x, y=v.pos.y+2, z=v.pos.z}, v.rot)
end
end
end
elseif evt.param1 == 2 then
--根据_t生成gadget,移除倒三角
local _cfgid = ScriptLib.GetGroupTempValue(context,"random_cfgid",{})
ScriptLib.SetGadgetStateByConfigId(context,_cfgid,201)
ScriptLib.RemoveEntityByConfigId(context, base_info.group_id, EntityType.GADGET, 20000001)
end
return 0
end
--二阶段逻辑:更新当前区域剩余怪物显示
function action_EVENT_ENTER_REGION(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_ENTER_REGION:evt.param1="..evt.param1)
--是否二阶段
if base_info.group_id ~= stage_2_group_id[1] and base_info.group_id ~= stage_2_group_id[2] and base_info.group_id ~= stage_2_group_id[3] then
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_ENTER_REGION:是否二阶段")
return 0
end
--是否走进黄圈
if evt.param1 ~= defs.circle_region then
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_ENTER_REGION:是否走进黄圈")
return 0
end
--记录最新踩到的黄圈
ScriptLib.SetGroupTempValue(context,"Cur_Circle",evt.param1,{ group_id = defs.target_group})
--更新当前区域剩余怪物显示
local _count = ScriptLib.GetGroupMonsterCount(context)
ScriptLib.SetGroupVariableValueByGroup(context, "left_num", _count, defs.target_group)
return 0
end
function action_EVENT_GROUP_LOAD(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_GROUP_LOAD33:")
local _uid = ScriptLib.GetSceneOwnerUid(context)
--三个阶段分别弹图文教程
if base_info.group_id == stage_1_group_id then
ScriptLib.AssignPlayerShowTemplateReminder(context,194,{param_uid_vec={},param_vec={},uid_vec={_uid}})
end
if base_info.group_id == stage_2_group_id[1] then
ScriptLib.AssignPlayerShowTemplateReminder(context,195,{param_uid_vec={},param_vec={},uid_vec={_uid}})
--二阶段额外初始化下变量
ScriptLib.SetGroupTempValue(context,"catched",0,{})
end
if base_info.group_id == stage_3_group_id then
--三阶段帮忙激活下八方网
ScriptLib.AssignPlayerShowTemplateReminder(context,196,{param_uid_vec={},param_vec={},uid_vec={_uid}})
local _time = 20
if defs.Active_Trap_Time ~= nil then _time = defs.Active_Trap_Time end
ScriptLib.InitTimeAxis(context,"Active_Trap",{_time-5,_time},true)
end
return 0
end
function action2_EVENT_VARIABLE_CHANGE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action2_EVENT_VARIABLE_CHANGE:"..evt.source_name.."="..evt.param1)
if evt.source_name == "create_random_shield_orb" then
local _last_cfgid = ScriptLib.GetGroupTempValue(context,"last_cfgid",{})
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action2_EVENT_VARIABLE_CHANGE:_last_cfgid=" .. _last_cfgid)
local _list = {}
for k,v in pairs(gadgets) do
if v.gadget_id == 70800232 and v.config_id ~= _last_cfgid then
table.insert(_list,v.config_id)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action2_EVENT_VARIABLE_CHANGE:v.config_id=" .. v.config_id)
end
end
local _t = math.random(#_list)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action2_EVENT_VARIABLE_CHANGE:_t=" .. _t .. "| _list[_t] =" .. _list[_t] )
ScriptLib.SetGroupTempValue(context,"last_cfgid",_list[_t] , {})
ScriptLib.InitTimeAxis(context,"create_random_shield_orb",{5},false)
--找到待创建的护盾球,在他头顶创建一个倒三角
for k,v in pairs(gadgets) do
if v.config_id == _list[_t] then
ScriptLib.CreateGadgetByConfigIdByPos(context, 20000002,{x=v.pos.x, y=v.pos.y+1, z=v.pos.z}, v.rot)
end
end
end
if evt.source_name == "create_monster_1" then
LF_Create_Monster_By_Random_Point(context,28020310,evt.param1)
end
if evt.source_name == "create_monster_2" then
LF_Create_Monster_By_Random_Point(context,28020311,evt.param1)
end
if evt.source_name == "create_monster_3" then
LF_Create_Monster_By_Random_Point(context,28020312,evt.param1)
end
return 0
end
--只有一阶段才会走这个方式创建怪物
function LF_Create_Monster_By_Random_Point(context,m_id,num)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 LF_Create_Monster_By_Random_Point:")
local _alivelist = ScriptLib.GetGroupAliveMonsterList(context,base_info.group_id)
local _count = 0
local _list = {}
for k,v in pairs(monsters) do
if v.monster_id == m_id then
local _isalive = false
for i = 1 , #_alivelist do
if _alivelist[i] == v.config_id then
_isalive = true
break
end
end
if _isalive == false then
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 LF_Create_Monster_By_Random_Point:v.config_id="..v.config_id)
table.insert(_list,v.config_id)
else
_count = _count + 1
end
end
end
local _max = 0
if m_id == 28020310 then _max = defs.monster_max_1 end
if m_id == 28020311 then _max = defs.monster_max_2 end
if m_id == 28020312 then _max = defs.monster_max_3 end
--创建相应数量怪物且不超过max值
local _create_count = 0
if _count + num <= _max then
_create_count = num
else
_create_count = _max - _count
end
--开始创建
for i = 1 ,_create_count do
if #_list ~= 0 then
local _t = math.random(#_list)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 LF_Create_Monster_By_Random_Point:_list[_t]=".._list[_t])
--创建且给小猪、野林猪加初始sgv 设为0 (只有一阶段)其他阶段会默认1
if m_id == 28020310 or m_id == 28020311 then
ScriptLib.CreateMonsterWithGlobalValue(context, _list[_t], {["SGV_STAGE"] = 0})
else
ScriptLib.CreateMonster(context, {config_id = _list[_t], delay_time = 0})
end
--创建完移出待创建list
table.remove(_list,_t)
end
end
return 0
end
function action_EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE:"..evt.source_eid)
local _v = ScriptLib.GetGroupTempValue(context,"eid_"..evt.source_eid,{})
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE:_v=".._v)
if base_info.group_id == stage_1_group_id then
--一阶段
local _id = ScriptLib.GetMonsterIdByEntityId(context, evt.source_eid)
--一阶段 林野猪和雪猪,不看v直接算分(他们不会逃跑,死了肯定都是捕捉)
if _id == 28020311 or _id == 28020312 then
ScriptLib.SetGroupVariableValueByGroup(context, monster_list[_id], 1, defs.target_group)
elseif _id == 28020310 then--一阶段小猪
if _v ~= 0 then --非0都算捕捉
--根据一阶段怪物id发对应key
ScriptLib.SetGroupVariableValueByGroup(context, monster_list[_id], 1, defs.target_group)
end
end
elseif base_info.group_id == stage_3_group_id then
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE:base_info.group_id == stage_3_group_id")
--三阶段
ScriptLib.SetGroupVariableValueByGroup(context, "is_finish", 1, defs.target_group)
else
--二阶段
if _v ~= 0 then
--走到这里的怪都是抓到的,发monsterid
local _monster_id = ScriptLib.GetMonsterIdByEntityId(context, evt.source_eid)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 action_EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE:_monster_id=".._monster_id)
if _v == 1 then
ScriptLib.SetGroupVariableValueByGroup(context, "monster_id", _monster_id, defs.target_group)
elseif _v == 2 then
ScriptLib.SetGroupVariableValueByGroup(context, "monster_id_sneak", _monster_id, defs.target_group)
end
--发数量检测变量
ScriptLib.ChangeGroupVariableValueByGroup(context, "Stage_2_Monster_Count", 1, defs.target_group)
end
end
return 0
end
function SLC_BeCaptured(context)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 SLC_BeCaptured:")
if ScriptLib.GetGroupTempValue(context,"eid_"..context.source_entity_id,{}) == 0 then
ScriptLib.SetGroupTempValue(context,"eid_"..context.source_entity_id,1,{})
end
return 0
end
function SLC_HuntAnimal_Sneak(context)
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 SLC_HuntAnimal_Sneak:")
ScriptLib.SetGroupTempValue(context,"eid_"..context.source_entity_id,2,{})
return 0
end
function SLC_GoWeak(context)--三阶段雪猪王眩晕计数
ScriptLib.PrintContextLog(context,"## Activity_Hunt_Stage_2 SLC_GoWeak:")
if base_info.group_id ~= stage_3_group_id then
return 0
end
ScriptLib.SetGroupVariableValueByGroup(context, "go_weak", 1, defs.target_group)
return 0
end
--初始化
function Initialize()
--加触发器
if temp_Tirgger ~= nil then
for k,v in pairs(temp_Tirgger) do
v.name = v.action
v.config_id = 40000000 + k
v.trigger_count = 0
v.condition = ""
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
end
--加变量
if temp_Variables ~= nil then
for k,v in pairs(temp_Variables) do
table.insert(variables,v)
end
end
--指示物件倒三角
local _temp_gadget = {config_id = 20000001, gadget_id = 70710432, pos = { x = 1074.944, y = 286.500, z = -424.074 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1, area_id = 10 }
table.insert(gadgets,_temp_gadget)
local _temp_gadget = {config_id = 20000002, gadget_id = 70710432, pos = { x = 1074.944, y = 286.500, z = -424.074 }, rot = { x = 0.000, y = 0.000, z = 0.000 }, level = 1, area_id = 10 }
table.insert(gadgets,_temp_gadget)
return 0
end
Initialize()
@@ -0,0 +1,281 @@
--[[======================================
|| filename: Activity_RockBoardExplore
|| owner: juntao.chen
|| description: 石板探索活动
|| LogName: Activity_RockBoardExplore
|| Protection: [Protection]
=======================================]]
--需求defs
--[[
local defs = {
enter_region = 111,
leave_region = 111,
}
local stage_child_challenge_list = {}
]]
local challenge_list = {
["FindRock"] = 2010073,
["BeatMonster"] = 2010076,
["FindClue"] = 2010079,
["PuzzleProgress"] = 2010077,
}
local challenge_goal = {
["FindRock"] = defs.FindRock,
["BeatMonster"] = defs.BeatMonster,
["FindClue"] = defs.FindClue,
["PuzzleProgress"] = defs.PuzzleProgress,
}
local father_challenge_id = 2010078
local temp_Variables = {
--挑战触发器
{ config_id=50000001,name = "FindRock_Trigger", value = 0, no_refresh = false },
{ config_id=50000002,name = "BeatMonster_Trigger", value = 0, no_refresh = false },
{ config_id=50000003,name = "FindClue_Trigger", value = 0, no_refresh = false },
{ config_id=50000004,name = "PuzzleProgress_Trigger", value = 0, no_refresh = false },
--子挑战完成次数存档
{ config_id=50000005,name = "Child_Finished_Count", value = 0, no_refresh = true },
}
local temp_Tirgger = {
{event = EventType.EVENT_ENTER_REGION, source = "", action = "action_EVENT_ENTER_REGION"},
{event = EventType.EVENT_LEAVE_REGION, source = "", action = "action_EVENT_LEAVE_REGION"},
{event = EventType.EVENT_VARIABLE_CHANGE, source = "", action = "action_EVENT_VARIABLE_CHANGE"},
{event = EventType.EVENT_CHALLENGE_SUCCESS, source = "", action = "action_EVENT_CHALLENGE_SUCCESS"},
{event = EventType.EVENT_CHALLENGE_FAIL, source = "", action = "action_EVENT_CHALLENGE_FAIL"},
{event = EventType.EVENT_GROUP_LOAD, source = "", action = "action_EVENT_GROUP_LOAD"},
{event = EventType.EVENT_GROUP_WILL_UNLOAD, source = "", action = "action_EVENT_GROUP_WILL_UNLOAD"},
{event = EventType.EVENT_TIME_AXIS_PASS, source = "tick", action = "action_EVENT_TIME_AXIS_PASS_tick"},
{event = EventType.EVENT_TIME_AXIS_PASS, source = "challenge_timer", action = "action_EVENT_TIME_AXIS_PASS_challenge_timer"},
{event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", action = "action_EVENT_GADGET_STATE_CHANGE"},
--子挑战用trigger
{event = EventType.EVENT_VARIABLE_CHANGE, source = "FindRock_Trigger", action = "action_EVENT_VARIABLE_CHANGE_FindRock_Trigger",tag = "2010073"},
{event = EventType.EVENT_VARIABLE_CHANGE, source = "BeatMonster_Trigger", action = "action_EVENT_VARIABLE_CHANGE_BeatMonster_Trigger",tag = "2010076"},
{event = EventType.EVENT_VARIABLE_CHANGE, source = "FindClue_Trigger", action = "action_EVENT_VARIABLE_CHANGE_FindClue_Trigger",tag = "2010079"},
{event = EventType.EVENT_VARIABLE_CHANGE, source = "PuzzleProgress_Trigger", action = "action_EVENT_VARIABLE_CHANGE_PuzzleProgress_Trigger",tag = "2010077"},
}
function action_EVENT_GADGET_STATE_CHANGE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_GADGET_STATE_CHANGE:evt.param1="..evt.param1.."|evt.param3="..evt.param3)
local _gadgetid = ScriptLib.GetGadgetIdByEntityId(context, evt.source_eid)
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_GADGET_STATE_CHANGE:_gadgetid=".._gadgetid)
if 70330392 == _gadgetid then
if evt.param1 ~= 0 and evt.param3 == 0 then
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_GADGET_STATE_CHANGE:MarkGroupLuaAction")
local _trans = ScriptLib.GetChallengeTransaction(context, father_challenge_id)
ScriptLib.MarkGroupLuaAction(context, "ActivityDiscover_3",_trans,{})
end
end
return 0
end
function action_EVENT_VARIABLE_CHANGE_FindRock_Trigger(context,evt)
if ScriptLib.IsChallengeStartedByChallengeIndex(context,base_info.group_id,father_challenge_id) then
ScriptLib.StopChallenge(context, father_challenge_id, 1)
end
--父挑战完成
ScriptLib.FinishGroupLinkBundle(context, base_info.group_id)
ScriptLib.RemoveEntityByConfigId(context, 0, EntityType.REGION, defs.enter_region)
ScriptLib.RemoveEntityByConfigId(context, 0, EntityType.REGION, defs.leave_region)
--结束挑战时(成功),发埋点
--[[【3.1 backlog内】数据埋点 - 探索活动(TD)相关运营埋点】
https://www.tapd.cn/22963631/prong/stories/view/1122963631001540457 ]]
local _trans = evt.param_str1
local _param = {
["tool_used_times"] = ScriptLib.GetGroupTempValue(context,"count",{}),
["total_time"] = ScriptLib.GetGroupTempValue(context,"challenge_time",{}),
["result"] = 1,
}
LF_Debug_ShowTable(context,_param)
ScriptLib.MarkGroupLuaAction(context, "ActivityDiscover_2",_trans,_param)
--关小道具检测器
ScriptLib.EndTimeAxis(context, "tick")
local _hostuid = ScriptLib.GetSceneOwnerUid(context)
ScriptLib.RevokePlayerShowTemplateReminder(context, 199, {_hostuid})
--关挑战用时检测器
ScriptLib.EndTimeAxis(context, "challenge_timer")
return 0
end
function action_EVENT_VARIABLE_CHANGE_BeatMonster_Trigger(context,evt) return 0 end
function action_EVENT_VARIABLE_CHANGE_FindClue_Trigger(context,evt) return 0 end
function action_EVENT_VARIABLE_CHANGE_PuzzleProgress_Trigger(context,evt) return 0 end
function action_EVENT_CHALLENGE_FAIL(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_CHALLENGE_FAIL")
if evt.param1 ~= father_challenge_id then
return 0
end
--结束挑战时(失败),发埋点
--[[【3.1 backlog内】数据埋点 - 探索活动(TD)相关运营埋点】
https://www.tapd.cn/22963631/prong/stories/view/1122963631001540457 ]]
local _trans = evt.param_str1
local _c = ScriptLib.GetGroupTempValue(context,"count",{})
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_CHALLENGE_FAIL|_c=".._c)
local _param = {
["tool_used_times"] = _c,
["total_time"] = ScriptLib.GetGroupTempValue(context,"challenge_time",{}),
["result"] = 0,
}
LF_Debug_ShowTable(context,_param)
ScriptLib.MarkGroupLuaAction(context, "ActivityDiscover_2",_trans,_param)
--关小道具检测器
ScriptLib.EndTimeAxis(context,"tick")
local _hostuid = ScriptLib.GetSceneOwnerUid(context)
ScriptLib.RevokePlayerShowTemplateReminder(context, 199, {_hostuid})
return 0
end
--给挑战计时
function action_EVENT_TIME_AXIS_PASS_challenge_timer(context,evt)
ScriptLib.ChangeGroupTempValue(context,"challenge_time",1,{})
return 0
end
--接受ld变量,改挑战进度
function action_EVENT_VARIABLE_CHANGE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_VARIABLE_CHANGE:evt.source_name = ".. evt.source_name.."| value = "..evt.param1)
for k,v in pairs(challenge_list) do
if evt.source_name == k then
if evt.param1 == 0 then
local _uidlist = ScriptLib.GetSceneUidList(context)
if ScriptLib.IsChallengeStartedByChallengeIndex(context,base_info.group_id,father_challenge_id) then
ScriptLib.AttachChildChallenge(context,father_challenge_id,v,v,{3,v,challenge_goal[k],1,0},_uidlist,{success=1,fail=1})
end
end
if evt.param1 > 0 then
ScriptLib.SetGroupVariableValue(context,k.."_Trigger",1)
end
end
end
return 0
end
--完成父挑战后,关闭黄圈、关闭region(使小道具禁用)
function action_EVENT_CHALLENGE_SUCCESS(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_CHALLENGE_SUCCESS:evt.param1="..evt.param1)
if evt.param1 ~= father_challenge_id then
--子挑战完成
ScriptLib.ChangeGroupVariableValue(context,"Child_Finished_Count",1)
else
--父挑战完成
--此处不处理bundle完成,因为玩家有可能在没挂父挑战的情况下捡到石板
end
return 0
end
--reminder开关控制器,持续判断
function action_EVENT_TIME_AXIS_PASS_tick(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_TIME_AXIS_PASS_tick")
local _hostuid = ScriptLib.GetSceneOwnerUid(context)
local _isshow = ScriptLib.GetGroupTempValue(context,"isshow",{})
local _iswiget = ScriptLib.IsWidgetEquipped(context, _hostuid, 220064)
if _iswiget == -1 then
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_TIME_AXIS_PASS_tick:_iswiget=".._iswiget)
end
if _iswiget == false then
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_TIME_AXIS_PASS_tick:_iswiget == false")
if _isshow == 0 then
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_TIME_AXIS_PASS_tick:ShowTemplateReminder")
ScriptLib.AssignPlayerShowTemplateReminder(context,199,{param_uid_vec={},param_vec={},uid_vec={_hostuid}})
ScriptLib.SetGroupTempValue(context,"isshow",1,{})
end
else
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_TIME_AXIS_PASS_tick:_iswiget == true")
ScriptLib.RevokePlayerShowTemplateReminder(context, 199, {_hostuid})
if _isshow == 1 then ScriptLib.SetGroupTempValue(context,"isshow",0,{}) end
end
return 0
end
function action_EVENT_GROUP_LOAD(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_GROUP_LOAD:2")
return 0
end
function action_EVENT_ENTER_REGION(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_ENTER_REGION:evt.uid"..evt.uid)
--判断是否目标region
if evt.param1 ~= defs.enter_region then
return 0
end
--判断是否已开挑战
if ScriptLib.IsChallengeStartedByChallengeIndex(context,base_info.group_id,father_challenge_id) then
return 0
end
--开挑战,从存档进度开始
local _child_finished_count = ScriptLib.GetGroupVariableValue(context,"Child_Finished_Count")
ScriptLib.CreateFatherChallenge(context, father_challenge_id, father_challenge_id, 9999999, {success=defs.Total-_child_finished_count,fail=9999})
--打开小道具检测器
ScriptLib.InitTimeAxis(context,"tick",{2},true)
ScriptLib.SetGroupTempValue(context,"isshow",0,{})
--子挑战显示
local _uidlist = ScriptLib.GetSceneUidList(context)
for k,v in pairs(challenge_list) do
local _score = ScriptLib.GetGroupVariableValue(context,k)
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_ENTER_REGION:"..k .."=".. _score.."|v="..v)
if _score >= 0 then
if _score < challenge_goal[k] then
ScriptLib.AttachChildChallenge(context,father_challenge_id,v,v,{3,v,challenge_goal[k],1,_score},_uidlist,{success=1,fail=1})
end
end
end
ScriptLib.StartFatherChallenge(context, father_challenge_id)
--开始挑战时,发埋点
--[[【3.1 backlog内】数据埋点 - 探索活动(TD)相关运营埋点】
https://www.tapd.cn/22963631/prong/stories/view/1122963631001540457 ]]
local _trans = ScriptLib.GetChallengeTransaction(context, father_challenge_id)
ScriptLib.MarkGroupLuaAction(context, "ActivityDiscover_1",_trans,{})
--重置小道具使用次数计数
ScriptLib.SetGroupTempValue(context,"count",0,{})
--重置挑战计时
ScriptLib.SetGroupTempValue(context,"challenge_time",0,{})
ScriptLib.InitTimeAxis(context,"challenge_timer",{1},true)
return 0
end
function action_EVENT_LEAVE_REGION(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_LEAVE_REGION:")
if evt.param1 == defs.leave_region then
if ScriptLib.IsChallengeStartedByChallengeIndex(context,base_info.group_id,father_challenge_id) then
ScriptLib.StopChallenge(context, father_challenge_id, 0)
end
end
return 0
end
function action_EVENT_GROUP_WILL_UNLOAD(context,evt)--保底清除reminder
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore action_EVENT_GROUP_WILL_UNLOAD:")
local _hostuid = ScriptLib.GetSceneOwnerUid(context)
ScriptLib.RevokePlayerShowTemplateReminder(context, 199, {_hostuid})
ScriptLib.EndTimeAxis(context,"tick")
return 0
end
function LF_GetDistance(context,pos1,pos2)
local X = pos1.x - pos2.x
local Y = pos1.y - pos2.y
local Z = pos1.z - pos2.z
return math.sqrt(X*X+Y*Y+Z*Z)
end
function SLC_Use_Widget(context)
ScriptLib.PrintContextLog(context,"## Activity_RockBoardExplore SLC_Use_Widget:")
ScriptLib.ChangeGroupTempValue(context,"count",1,{})
return 0
end
function LF_Debug_ShowTable(context,tab)
for k,v in pairs(tab) do
ScriptLib.PrintContextLog(context,"## LF_Debug_ShowTable:"..k.." = "..v)
end
end
--初始化
function Initialize()
--加触发器
if temp_Tirgger ~= nil then
for k,v in pairs(temp_Tirgger) do
v.name = v.action
v.config_id = 40000000 + k
v.trigger_count = 0
v.condition = ""
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
end
--加变量
if temp_Variables ~= nil then
for k,v in pairs(temp_Variables) do
table.insert(variables,v)
end
end
return 0
end
Initialize()
@@ -0,0 +1,64 @@
--[[======================================
|| filename: Activity_VintagePresent
|| owner: juntao.chen
|| description: 找礼物玩法
|| LogName: Activity_VintagePresent
|| Protection: [Protection]
=======================================]]
--[[需求配置
--key为configid,值为礼物id
local present_list = {
[xxx] = 1,
}
]]
local chest_gadget_id = 70800272
local temp_Tirgger = {
{event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", action = "action_EVENT_GADGET_STATE_CHANGE"},
{event = EventType.EVENT_GROUP_LOAD, source = "", action = "action_EVENT_GROUP_LOAD"},
}
function action_EVENT_GROUP_LOAD(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_VintagePresent action_EVENT_GROUP_LOAD:")
return 0
end
function action_EVENT_GADGET_STATE_CHANGE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_VintagePresent action_EVENT_GADGET_STATE_CHANGE:")
local _gadgetid = ScriptLib.GetGadgetIdByEntityId(context, evt.source_eid)
if evt.param1 == 201 and _gadgetid == chest_gadget_id then
for k,v in pairs(present_list) do
if k == evt.param2 then
ScriptLib.PrintContextLog(context,"## Activity_VintagePresent action_EVENT_GADGET_STATE_CHANGE:v="..v)
local _ret = ScriptLib.VintageFinishGroupByPresentId(context,v)
if _ret ~= 0 then
ScriptLib.SetGadgetStateByConfigId(context, evt.param2, 0)
end
break
end
end
end
return 0
end
--初始化
function Initialize()
--加触发器
if temp_Tirgger ~= nil then
for k,v in pairs(temp_Tirgger) do
v.name = v.action
v.config_id = 40000000 + k
v.trigger_count = 0
v.condition = ""
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
end
--加变量
if temp_Variables ~= nil then
for k,v in pairs(temp_Variables) do
table.insert(variables,v)
end
end
return 0
end
Initialize()
@@ -0,0 +1,329 @@
--[[======================================
|| filename: Activity_WindMaze
|| owner: juntao.chen
|| description: 风场迷宫活动 基础建设,1物件逻辑响应 2 T技能公共cd实现 3 复活点
|| LogName: Activity_WindMaze
|| Protection: [Protection]
=======================================]]
--需求misc
--[[
local operator_list = {
[1] = {1,2},
}
]]
local Wind = {
Creater_Gadget_ID = 70800246
}
local temp_Tirgger_wind = {
{event = EventType.EVENT_GROUP_LOAD, source = "", action = "action2_EVENT_GROUP_LOAD"},
{event = EventType.EVENT_ENTER_REGION, source = "", action = "action2_EVENT_ENTER_REGION",forbid_guest =false},
{event = EventType.EVENT_TIME_AXIS_PASS, source = "Skill_CD", action = "action2_EVENT_TIME_AXIS_PASS_Skill_CD"},
{event = EventType.EVENT_TIME_AXIS_PASS, source = "operator_time_1", action = "action2_EVENT_TIME_AXIS_PASS_operator_time_1"},
{event = EventType.EVENT_TIME_AXIS_PASS, source = "operator_time_2", action = "action2_EVENT_TIME_AXIS_PASS_operator_time_2"},
{event = EventType.EVENT_GALLERY_STOP, source = "", action = "action2_EVENT_GALLERY_STOP"},
--
}
function action2_EVENT_GALLERY_STOP(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze action2_EVENT_GALLERY_STOP")
LF_Data_Handler(context,evt.param_str1)
return 0
end
function action2_EVENT_ENTER_REGION(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze action2_EVENT_ENTER_REGION")
if revivepoint_list ~= nil then
for k,v in pairs(revivepoint_list) do
if k == evt.param1 then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze action2_EVENT_ENTER_REGION:尝试设置复活点="..v)
if ScriptLib.IsGalleryStart(context,defs.gallery_id) then
ScriptLib.SetGalleryRevivePoint(context, defs.gallery_id, base_info.group_id, v)
else
ScriptLib.PrintContextLog(context,"## Activity_WindMaze action2_EVENT_ENTER_REGION:设置复活点失败,gallery未开启"..defs.gallery_id)
end
return 0
end
end
else
ScriptLib.PrintContextLog(context,"## Activity_WindMaze action2_EVENT_ENTER_REGION:没配复活点!!!=")
end
if transfer_list ~= nil then
for k,v in pairs(transfer_list) do
if k == evt.param1 then
for k2,v2 in pairs(points) do
if v2.config_id == v then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze action2_EVENT_ENTER_REGION:传送至复活点="..v)
ScriptLib.TransPlayerToPos(context, {uid_list={evt.uid}, pos=v2.pos, radius=0, rot=v2.rot})
end
end
end
end
else
ScriptLib.PrintContextLog(context,"## Activity_WindMaze action2_EVENT_ENTER_REGION:没配传送点!!!=")
end
return 0
end
function action2_EVENT_TIME_AXIS_PASS_operator_time_1(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze action2_EVENT_TIME_AXIS_PASS_operator_time_1")
for k,v in pairs(operator_list) do
local _k = ScriptLib.GetGroupTempValue(context,"operator_time_1_"..k,{})
if _k ~= 0 then
LF_Operate(context,k,"SGV_Switch_OnOff",1)
ScriptLib.SetEntityServerGlobalValueByConfigId(context, k, "SGV_Disable", 0)
--复原标记
ScriptLib.SetGroupTempValue(context,"operator_time_1_"..k,0,{})
end
end
return 0
end
function action2_EVENT_TIME_AXIS_PASS_operator_time_2(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze action2_EVENT_TIME_AXIS_PASS_operator_time_2")
for k,v in pairs(operator_list) do
local _k = ScriptLib.GetGroupTempValue(context,"operator_time_2_"..k,{})
if _k ~= 0 then
LF_Operate(context,k,"SGV_Switch_StrongWind",0)
ScriptLib.SetEntityServerGlobalValueByConfigId(context, k, "SGV_Disable", 0)
--复原标记
ScriptLib.SetGroupTempValue(context,"operator_time_2_"..k,0,{})
end
end
return 0
end
function LF_Operate(context,cfgid,sgv,value)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze LF_Operate:sgv="..sgv.."| cfgid="..cfgid.."|value="..value)
for i = 1 ,#operator_list[cfgid] do
for k,v in pairs(gadgets)do
if v.config_id == operator_list[cfgid][i] then
if Wind.Creater_Gadget_ID == ScriptLib.GetGadgetIdByEntityId(context,ScriptLib.GetEntityIdByConfigId(context, v.config_id)) then
--如果是吹风机,要判断是否解锁,否则不受影响
if 201 == ScriptLib.GetGadgetStateByConfigId(context, base_info.group_id, v.config_id) then
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v.config_id, sgv.."", value)
end
else
--普通气流
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v.config_id, sgv.."", value)
end
end
end
end
return 0
end
function action2_EVENT_TIME_AXIS_PASS_Skill_CD(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze action2_EVENT_TIME_AXIS_PASS_Skill_CD:")
ScriptLib.SetGroupTempValue(context,"Is_Skill_CD",0,{})
return 0
end
function action2_EVENT_GROUP_LOAD(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze action2_EVENT_GROUP_LOAD:")
ScriptLib.SetGroupTempValue(context,"Is_Skill_CD",0,{})
ScriptLib.SetGroupTempValue(context,"Skill_Switch",1,{})
--初始化数据支持变量
ScriptLib.SetGroupTempValue(context,"data_switch_on_times",0,{})
ScriptLib.SetGroupTempValue(context,"data_switch_off_times",0,{})
ScriptLib.SetGroupTempValue(context,"data_direct_times",0,{})
ScriptLib.SetGroupTempValue(context,"data_rotate_times",0,{})
ScriptLib.SetGroupTempValue(context,"data_operator_enhence_times",0,{})
ScriptLib.SetGroupTempValue(context,"data_operator_off_times",0,{})
ScriptLib.SetGroupTempValue(context,"data_Tbutton_times",0,{})
ScriptLib.SetGroupTempValue(context,"data_buff_times",0,{})
ScriptLib.SetGroupTempValue(context,"level_5_coin_sum",0,{})
return 0
end
function SLC_Operator_01(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Operator_01")
local _cfgid = ScriptLib.GetGadgetConfigId(context, {gadget_eid = context.source_entity_id})
local _k = ScriptLib.GetGroupTempValue(context,"operator_time_1_".._cfgid,{})
if _k ~= 0 then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Operator_01:重复交互,已拦截")
return 0
end
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Operator_01:".._cfgid)
ScriptLib.SetGroupTempValue(context,"operator_time_1_".._cfgid,1,{})
LF_Operate(context,_cfgid,"SGV_Switch_OnOff",0)
ScriptLib.SetEntityServerGlobalValueByConfigId(context, _cfgid, "SGV_Disable", 1)
ScriptLib.InitTimeAxis(context,"operator_time_1",{defs.operator_time_1},false)
ScriptLib.ChangeGroupTempValue(context,"data_operator_off_times",1,{})
return 0
end
function SLC_Operator_02(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Operator_02")
local _cfgid = ScriptLib.GetGadgetConfigId(context, {gadget_eid = context.source_entity_id})
local _k = ScriptLib.GetGroupTempValue(context,"operator_time_2_".._cfgid,{})
if _k ~= 0 then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Operator_02:重复交互,已拦截")
return 0
end
ScriptLib.SetGroupTempValue(context,"operator_time_2_".._cfgid,1,{})
LF_Operate(context,_cfgid,"SGV_Switch_StrongWind",1)
ScriptLib.SetEntityServerGlobalValueByConfigId(context, _cfgid, "SGV_Disable", 1)
ScriptLib.InitTimeAxis(context,"operator_time_2",{defs.operator_time_2},false)
ScriptLib.ChangeGroupTempValue(context,"data_operator_enhence_times",1,{})
return 0
end
function SLC_Creater_Switch_On_1(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Creater_Switch_On_1")
ScriptLib.SetEntityServerGlobalValueByEntityId(context, context.source_entity_id, "SGV_Switch_OnOff", 1)
ScriptLib.ChangeGroupTempValue(context,"data_switch_on_times",1,{})
return 0
end
function SLC_Creater_Switch_On_0(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Creater_Switch_On_0")
ScriptLib.SetEntityServerGlobalValueByEntityId(context, context.source_entity_id, "SGV_Switch_OnOff", 0)
ScriptLib.ChangeGroupTempValue(context,"data_switch_off_times",1,{})
return 0
end
function SLC_Creater_UpDown_0(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Creater_UpDown")
ScriptLib.SetEntityServerGlobalValueByEntityId(context, context.source_entity_id, "SGV_Switch_UpDown", 0)
ScriptLib.ChangeGroupTempValue(context,"data_direct_times",1,{})
return 0
end
function SLC_Creater_UpDown_1(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Creater_UpDown")
ScriptLib.SetEntityServerGlobalValueByEntityId(context, context.source_entity_id, "SGV_Switch_UpDown", 1)
ScriptLib.ChangeGroupTempValue(context,"data_direct_times",1,{})
return 0
end
function SLC_Creater_Dir_Clockwise(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Creater_Dir_Clockwise")
local _cfgid = ScriptLib.GetGadgetConfigId(context, { gadget_eid = context.target_entity_id })
local _dir = ScriptLib.GetGadgetAbilityFloatValue(context, base_info.group_id, _cfgid, "SGV_Switch_Dir")
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Creater_Dir_Clockwise:cfgid=".._cfgid.."|_dir=".._dir)
if _dir ==0 then
ScriptLib.SetEntityServerGlobalValueByEntityId(context, context.source_entity_id, "SGV_Switch_Dir", 1)
elseif _dir == 1 then
ScriptLib.SetEntityServerGlobalValueByEntityId(context, context.source_entity_id, "SGV_Switch_Dir", 2)
elseif _dir == 2 then
ScriptLib.SetEntityServerGlobalValueByEntityId(context, context.source_entity_id, "SGV_Switch_Dir", 3)
elseif _dir == 3 then
ScriptLib.SetEntityServerGlobalValueByEntityId(context, context.source_entity_id, "SGV_Switch_Dir", 0)
end
ScriptLib.ChangeGroupTempValue(context,"data_rotate_times",1,{})
return 0
end
function SLC_Creater_Dir_AntiClockwise(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Creater_Dir_AntiClockwise")
local _cfgid = ScriptLib.GetGadgetConfigId(context, { gadget_eid = context.target_entity_id })
local _dir = ScriptLib.GetGadgetAbilityFloatValue(context, base_info.group_id, _cfgid, "SGV_Switch_Dir")
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Creater_Dir_AntiClockwise:cfgid=".._cfgid.."|_dir=".._dir)
if _dir ==0 then
ScriptLib.SetEntityServerGlobalValueByEntityId(context, context.source_entity_id, "SGV_Switch_Dir", 3)
elseif _dir == 1 then
ScriptLib.SetEntityServerGlobalValueByEntityId(context, context.source_entity_id, "SGV_Switch_Dir", 0)
elseif _dir == 2 then
ScriptLib.SetEntityServerGlobalValueByEntityId(context, context.source_entity_id, "SGV_Switch_Dir", 1)
elseif _dir == 3 then
ScriptLib.SetEntityServerGlobalValueByEntityId(context, context.source_entity_id, "SGV_Switch_Dir", 2)
end
ScriptLib.ChangeGroupTempValue(context,"data_rotate_times",1,{})
return 0
end
function SLC_Creater_Dir_2(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Creater_Dir_2")
return 0
end
function SLC_Creater_Dir_3(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Creater_Dir_3")
return 0
end
function SLC_Creater_Dir_4(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Creater_Dir_4")
return 0
end
function SLC_Creater_Strong(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Creater_Strong")
return 0
end
function SLC_Creater_Normal(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Creater_Normal")
return 0
end
function SLC_Trigger_Skill(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze SLC_Trigger_Skill:")
local _cd = ScriptLib.GetGroupTempValue(context,"Is_Skill_CD",{})
if _cd == 0 then
ScriptLib.SetGroupTempValue(context,"Is_Skill_CD",1,{})
ScriptLib.InitTimeAxis(context, "Skill_CD", {5}, false)
local _uidlist = ScriptLib.GetSceneUidList(context)
ScriptLib.SetTeamEntityGlobalFloatValue(context, _uidlist, "_CD_Type", 1)
ScriptLib.ChangeGroupTempValue(context,"data_switch_on_times",1,{})
LF_Switch(context)
end
if _cd == 1 then
ScriptLib.SetTeamEntityGlobalFloatValue(context, {context.uid}, "_CD_Type", 2)
end
return 0
end
function LF_Switch(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze LF_Switch:")
local _off = ScriptLib.GetGroupTempValue(context,"Skill_Switch",{})
ScriptLib.PrintContextLog(context,"## Activity_WindMaze LF_Switch:_off=".._off)
if _off == 0 then
for k,v in pairs(gadgets) do
if v.gadget_id == Wind.Creater_Gadget_ID then
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v.config_id, "SGV_Switch_StrongWind", 1)
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v.config_id, "SGV_Switch_OnOff", 1)
end
end
ScriptLib.SetGroupTempValue(context,"Skill_Switch",1,{})
--reminder
ScriptLib.ShowReminder(context, 470210104)
elseif _off == 1 then
for k,v in pairs(gadgets) do
if v.gadget_id == Wind.Creater_Gadget_ID then
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v.config_id, "SGV_Switch_OnOff", 0)
end
end
ScriptLib.SetGroupTempValue(context,"Skill_Switch",0,{})
--reminder
ScriptLib.ShowReminder(context, 470210103)
end
ScriptLib.ChangeGroupTempValue(context,"data_Tbutton_times",1,{})
return 0
end
function LF_Data_Handler(context,trans)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze LF_Data_Handler:")
local _tab = {}
--操作吹风机:
_tab["switch_on_times"] = ScriptLib.GetGroupTempValue(context,"data_switch_on_times",{})
_tab["switch_off_times"] = ScriptLib.GetGroupTempValue(context,"data_switch_off_times",{})
_tab["direct_times"] = ScriptLib.GetGroupTempValue(context,"data_direct_times",{})
_tab["rotate_times"] = ScriptLib.GetGroupTempValue(context,"data_rotate_times",{})
--操作机关:
_tab["operator_enhence_times"] = ScriptLib.GetGroupTempValue(context,"data_operator_enhence_times",{})
_tab["operator_off_times"] = ScriptLib.GetGroupTempValue(context,"data_operator_off_times",{})
--T键使用:
_tab["Tbutton_times"] = ScriptLib.GetGroupTempValue(context,"data_Tbutton_times",{})
--buff获得个数
_tab["buff_times"] = ScriptLib.GetGroupTempValue(context,"data_buff_times",{})
--第五关金币获得个数
_tab["level_5_coin_sum"] = ScriptLib.GetGroupTempValue(context,"level_5_coin_sum",{})
for k,v in pairs(_tab) do
ScriptLib.PrintContextLog(context,"## Activity_WindMaze LF_Data_Handler:"..k.."="..v)
end
ScriptLib.MarkGroupLuaAction(context, "Activitywindfield_1",trans,_tab)
return 0
end
--初始化
function Initialize()
--加触发器
if temp_Tirgger_wind ~= nil then
for k,v in pairs(temp_Tirgger_wind) do
v.name = v.action
v.config_id = 40000020 + k
v.trigger_count = 0
v.condition = ""
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
end
--加变量
if temp_Variables_wind ~= nil then
for k,v in pairs(temp_Variables_wind) do
v.config_id = 50000020 + k
table.insert(variables,v)
end
end
return 0
end
Initialize()
@@ -0,0 +1,233 @@
--[[======================================
|| filename: Activity_WindMaze_Battle
|| owner: juntao.chen
|| description: 风场迷宫活动关卡流程控制
|| LogName: Activity_WindMaze_Battle
|| Protection: [Protection]
=======================================]]
--需求misc
--[[
local defs ={
gallery_id = 27004,
finish_region = 111,
}
]]
--测试结束
local Stage_Battle = {
Coin_Gadget_ID = 70800269,
Revive_Point = 1148
}
local temp_Variables = {
{ name = "coin", value = 0, no_refresh = false },
{ name = "killed_monster", value = 0, no_refresh = false },
{ name = "cur_stage", value = 0, no_refresh = false },
{ name = "end", value = 0, no_refresh = false },
}
local temp_Tirgger = {
{event = EventType.EVENT_VARIABLE_CHANGE, source = "", action = "action_EVENT_VARIABLE_CHANGE"},
{event = EventType.EVENT_ANY_GADGET_DIE, source = "", action = "action_EVENT_ANY_GADGET_DIE"},
{event = EventType.EVENT_GROUP_WILL_UNLOAD, source = "", action = "action_EVENT_GROUP_WILL_UNLOAD"},
{event = EventType.EVENT_ANY_MONSTER_DIE, source = "", action = "action_EVENT_ANY_MONSTER_DIE"},
{event = EventType.EVENT_GALLERY_STOP, source = "", action = "action_EVENT_GALLERY_STOP"},
{event = EventType.EVENT_DUNGEON_ALL_AVATAR_DIE, source = "", action = "action_EVENT_DUNGEON_ALL_AVATAR_DIE"},
{event = EventType.EVENT_DUNGEON_SETTLE, source = "", action = "action_EVENT_DUNGEON_SETTLE"},
{event = EventType.EVENT_ENTER_REGION, source = "", action = "action_EVENT_ENTER_REGION"},
--
}
--处理玩家进场清空陈列室替换值
function action_EVENT_ENTER_REGION(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle action_EVENT_ENTER_REGION" )
if evt.param1 == defs.ability_region then
if level_list[base_info.group_id] ~= nil then
return 0
end
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle action_EVENT_ENTER_REGION:清空陈列室替换值=".."Activity_WindField_"..level_list[base_info.group_id].."_Ball")
--金币
ScriptLib.ClearExhibitionReplaceableData(context, evt.uid, "Activity_WindField_5_Coin")
end
return 0
end
--处理地城关闭,如单人Esc退出
function action_EVENT_DUNGEON_SETTLE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle action_EVENT_DUNGEON_SETTLE" )
LF_Try_End(context,true)
return 0
end
--团灭检测器
function action_EVENT_DUNGEON_ALL_AVATAR_DIE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle action_EVENT_DUNGEON_ALL_AVATAR_DIE|evt.uid="..evt.uid)
local _uidlist = ScriptLib.GetSceneUidList(context)
for i = 1 ,#_uidlist do
if ScriptLib.IsPlayerAllAvatarDie(context,_uidlist[i]) == false then --任一活着则结束
return 0
end
end
ScriptLib.SetGroupVariableValue(context,"cur_stage",0)
return 0
end
function action_EVENT_GALLERY_STOP(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle action_EVENT_GALLERY_STOP |is_fail = "..evt.param2.." |reason = "..evt.param3 )
--[[ enum GalleryStopReason
{
GALLERY_STOP_NONE = 0;
GALLERY_STOP_TIMEUP = 1;
GALLERY_STOP_CLIENT_INTERRUPT = 2;
GALLERY_STOP_LUA_INTERRUPT_SUCCESS = 3;
GALLERY_STOP_LUA_INTERRUPT_FAIL = 4;
GALLERY_STOP_OWNER_LEAVE_SCENE = 5;
GALLERY_STOP_PLAY_INIT_FAILED = 6; // 玩法启动失败
GALLERY_STOP_OTHER_PLAYER_ENTER = 7;// 其他玩家进来
GALLERY_STOP_AVATAR_DIE = 8; // AVATAR阵亡
GALLERY_STOP_FINISHED = 9; // 完成gallery
GALLERY_STOP_FUNGUS_ALL_DIE = 10; // 3.2新增蕈兽团灭发起gallery stop
} ]]
if evt.param3 == 3 or evt.param3 == 9 then
ScriptLib.CauseDungeonSuccess(context)
else
ScriptLib.CauseDungeonFail(context)
end
return 0
end
function action_EVENT_ANY_MONSTER_DIE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle action_EVENT_ANY_MONSTER_DIE")
--watcher累计杀怪
local _uidlist = ScriptLib.GetSceneUidList(context)
for i = 1 , #_uidlist do
ScriptLib.AddExhibitionAccumulableDataAfterSuccess(context, _uidlist[i], "Activity_WindField_5_Monster", 1, {play_type=ExhibitionPlayType.Gallery,gallery_id=defs.gallery_id})
end
ScriptLib.ChangeGroupVariableValue(context,"killed_monster",1)
return 0
end
function action_EVENT_GROUP_WILL_UNLOAD(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle action_EVENT_GROUP_WILL_UNLOAD")
LF_Try_End(context,true)
return 0
end
function action_EVENT_ANY_GADGET_DIE(context,evt)--吃金币
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle action_EVENT_ANY_GADGET_DIE: evt.param1=" .. evt.param1)
--查询gadgetid
local _gadgetid = 0
for k,v in pairs(gadgets) do
if v.config_id == evt.param1 then
_gadgetid = v.gadget_id
break
end
end
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle action_EVENT_ANY_GADGET_DIE:_gadgetid = ".._gadgetid)
--金币
if _gadgetid == Stage_Battle.Coin_Gadget_ID then
ScriptLib.ChangeGroupVariableValue(context,"coin",1)
ScriptLib.ChangeGroupTempValue(context,"level_5_coin_sum",1,{})
--watcher单局吃金币
local _uidlist = ScriptLib.GetSceneUidList(context)
for i = 1 , #_uidlist do
ScriptLib.AddExhibitionReplaceableDataAfterSuccess(context, _uidlist[i], "Activity_WindField_5_Coin", 1, {play_type=ExhibitionPlayType.Gallery,gallery_id=defs.gallery_id})
end
end
return 0
end
function action_EVENT_VARIABLE_CHANGE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle action_EVENT_VARIABLE_CHANGE:"..evt.source_name.." = "..evt.param1)
if evt.source_name == "cur_stage" then
local _uidlist = ScriptLib.GetSceneUidList(context)
if evt.param1 == 1 then
--第一阶段先开gallery
ScriptLib.SetPlayerStartGallery(context,defs.gallery_id,_uidlist)
--设置复活点
ScriptLib.SetGalleryRevivePoint(context, defs.gallery_id, base_info.group_id, Stage_Battle.Revive_Point)
elseif evt.param1 == 6 then
--watcher完成
for i = 1 , #_uidlist do
ScriptLib.AddExhibitionReplaceableDataAfterSuccess(context, _uidlist[i], "Activity_WindField_5_LevelFinish", 1, {play_type=ExhibitionPlayType.Gallery,gallery_id=defs.gallery_id})
end
--最后完成
LF_Try_End(context,false)
elseif evt.param1 == 0 then
if ScriptLib.IsGalleryStart(context, defs.gallery_id) then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle action_EVENT_VARIABLE_CHANGE:StopGalleryByReason")
ScriptLib.StopGalleryByReason(context, defs.gallery_id, 8)
else
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle action_EVENT_VARIABLE_CHANGE:CauseDungeonFail")
ScriptLib.CauseDungeonFail(context)
end
return 0
else
--第二到四阶段,关旧的挑战
local _score = {
["is_start"] = false,
["is_success"] = false,
["challenge_time"] = 0,
["show_id"] = stage_challenge_id[evt.param1 - 1],
}
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,_score)
end
if evt.param1 ~= 6 then
--无论什么阶段,都开新的挑战
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle action_EVENT_VARIABLE_CHANGE:stage_challenge_id[evt.param1]="..stage_challenge_id[evt.param1])
local _score = {
["is_start"] = true,
["is_success"] = false,
["challenge_time"] = stage_challenge_time[evt.param1],
["show_id"] = stage_challenge_id[evt.param1],
}
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,_score)
end
ScriptLib.SetGroupVariableValue(context,"killed_monster",0)
ScriptLib.SetGroupVariableValue(context,"coin",0)
elseif evt.source_name == "killed_monster" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{[evt.source_name] = evt.param1})
elseif evt.source_name == "coin" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{[evt.source_name] = evt.param1})
--二阶段吃金币奖励buff
if ScriptLib.GetGroupVariableValue(context,"cur_stage") == 2 and evt.param1 == defs.stage2_coin_goal then
local _uidlist = ScriptLib.GetSceneUidList(context)
for i = 1 , #_uidlist do
--ScriptLib.AttachGalleryTeamAbilityGroup(context, {_uidlist[i]}, defs.gallery_id, 0)
ScriptLib.SetTeamServerGlobalValue(context, _uidlist[i], "SGV_WindField_Buff_1", 1)
end
ScriptLib.ChangeGroupTempValue(context,"data_buff_times",1,{})
end
--三阶段吃金币奖励buff
if ScriptLib.GetGroupVariableValue(context,"cur_stage") == 4 and evt.param1 == defs.stage4_coin_goal then
local _uidlist = ScriptLib.GetSceneUidList(context)
for i = 1 , #_uidlist do
--ScriptLib.AttachGalleryTeamAbilityGroup(context, {_uidlist[i]}, defs.gallery_id, 0)
ScriptLib.SetTeamServerGlobalValue(context, _uidlist[i], "SGV_WindField_Buff_2", 1)
end
ScriptLib.ChangeGroupTempValue(context,"data_buff_times",1,{})
end
elseif evt.source_name == "end" then
ScriptLib.StopGallery(context, defs.gallery_id, true)
end
return 0
end
function LF_Try_End(context,is_fail)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Battle LF_Try_End:")
ScriptLib.StopGallery(context, defs.gallery_id, is_fail)
return 0
end
--初始化
function Initialize()
--加触发器
if temp_Tirgger ~= nil then
for k,v in pairs(temp_Tirgger) do
v.name = v.action
v.config_id = 40000000 + k
v.trigger_count = 0
v.condition = ""
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
end
--加变量
if temp_Variables ~= nil then
for k,v in pairs(temp_Variables) do
v.config_id = 50000000 + k
table.insert(variables,v)
end
end
return 0
end
Initialize()
@@ -0,0 +1,504 @@
--[[======================================
|| filename: Activity_WindMaze_Normal
|| owner: juntao.chen
|| description: 风场迷宫活动关卡流程控制
|| LogName: Activity_WindMaze_Normal
|| Protection: [Protection]
=======================================]]
--需求misc
--[[
local defs ={
gallery_id = 27004,
finish_region = 111,
challenge_id = 2,
ball_challenge_id = 1,
}
]]
--测试结束
local Stage_Normal = {
BigOrb_Gadget_ID = 70800281,
SmallOrb_Gadget_ID = 70800268,
Coin_Gadget_ID = 70800269,
Ball_Challenge_Time = 15,
}
local level_list = {
[247021001] = 1,
[247022002] = 2,
[247023001] = 3,
[247024001] = 4,
}
local temp_Variables = {
{ name = "gm_Try_Start", value = 0, no_refresh = false },
{ name = "gm_Try_End", value = 0, no_refresh = false },
{ name = "element_ball", value = 0, no_refresh = false },
{ name = "coin", value = 0, no_refresh = false },
{ name = "killed_monster", value = 0, no_refresh = false },
{ name = "rotate1", value = 0, no_refresh = false },
{ name = "rotate2", value = 0, no_refresh = false },
{ name = "gm_Try_Start_Ball", value = 0, no_refresh = false },
{ name = "gm_Try_Finish_Ball", value = 0, no_refresh = false },
{ name = "Ball_Challenge_Finish", value = 0, no_refresh = false },
}
local temp_Tirgger = {
{event = EventType.EVENT_GROUP_LOAD, source = "", action = "action_EVENT_GROUP_LOAD"},
{event = EventType.EVENT_VARIABLE_CHANGE, source = "", action = "action_EVENT_VARIABLE_CHANGE"},
{event = EventType.EVENT_ENTER_REGION, source = "", action = "action_EVENT_ENTER_REGION", forbid_guest = false },
{event = EventType.EVENT_ANY_GADGET_DIE, source = "", action = "action_EVENT_ANY_GADGET_DIE"},
{event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", action = "action_EVENT_GADGET_STATE_CHANGE"},
{event = EventType.EVENT_TIME_AXIS_PASS, source = "Ball_Challenge", action = "action_EVENT_TIME_AXIS_PASS_Ball_Challenge"},
{event = EventType.EVENT_GROUP_WILL_UNLOAD, source = "", action = "action_EVENT_GROUP_WILL_UNLOAD"},
{event = EventType.EVENT_ANY_MONSTER_DIE, source = "", action = "action_EVENT_ANY_MONSTER_DIE"},
{event = EventType.EVENT_GALLERY_STOP, source = "", action = "action_EVENT_GALLERY_STOP"},
{event = EventType.EVENT_GALLERY_PLAYER_LEAVE_SCENE, source = "", action = "action_EVENT_GALLERY_PLAYER_LEAVE_SCENE"},
{event = EventType.EVENT_DUNGEON_SETTLE, source = "", action = "action_EVENT_DUNGEON_SETTLE"},
{event = EventType.EVENT_DUNGEON_ALL_AVATAR_DIE, source = "", action = "action_EVENT_DUNGEON_ALL_AVATAR_DIE"},
--
}
--团灭检测器
function action_EVENT_DUNGEON_ALL_AVATAR_DIE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_DUNGEON_ALL_AVATAR_DIE" )
local _uidlist = ScriptLib.GetSceneUidList(context)
if _uidlist == nil then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_DUNGEON_ALL_AVATAR_DIE:_uidlist == nil")
return 0
end
for i = 1 ,#_uidlist do
if ScriptLib.IsPlayerAllAvatarDie(context,_uidlist[i]) == false then --任一活着则结束
return 0
end
end
ScriptLib.StopGalleryByReason(context, defs.gallery_id, 8)
return 0
end
--处理地城关闭,如单人Esc退出
function action_EVENT_DUNGEON_SETTLE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_DUNGEON_SETTLE" )
LF_Try_End(context,true)
return 0
end
--处理联机时其中一人离开的情况
function action_EVENT_GALLERY_PLAYER_LEAVE_SCENE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_GALLERY_PLAYER_LEAVE_SCENE" )
local _region_eid = ScriptLib.GetGroupTempValue(context,"region_eid",{})
LF_Check_Finish(context,false)
return 0
end
function action_EVENT_GALLERY_STOP(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_GALLERY_STOP |is_fail = "..evt.param2.." |reason = "..evt.param3 )
--[[ enum GalleryStopReason
{
GALLERY_STOP_NONE = 0;
GALLERY_STOP_TIMEUP = 1;
GALLERY_STOP_CLIENT_INTERRUPT = 2;
GALLERY_STOP_LUA_INTERRUPT_SUCCESS = 3;
GALLERY_STOP_LUA_INTERRUPT_FAIL = 4;
GALLERY_STOP_OWNER_LEAVE_SCENE = 5;
GALLERY_STOP_PLAY_INIT_FAILED = 6; // 玩法启动失败
GALLERY_STOP_OTHER_PLAYER_ENTER = 7;// 其他玩家进来
GALLERY_STOP_AVATAR_DIE = 8; // AVATAR阵亡
GALLERY_STOP_FINISHED = 9; // 完成gallery
GALLERY_STOP_FUNGUS_ALL_DIE = 10; // 3.2新增蕈兽团灭发起gallery stop
} ]]
if evt.param3 == 3 or evt.param3 == 9 then
ScriptLib.CauseDungeonSuccess(context)
else
ScriptLib.CauseDungeonFail(context)
end
return 0
end
function action_EVENT_ANY_MONSTER_DIE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_ANY_MONSTER_DIE")
ScriptLib.ChangeGroupVariableValue(context,"killed_monster",1)
return 0
end
function action_EVENT_GROUP_WILL_UNLOAD(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_GROUP_WILL_UNLOAD")
LF_Try_End(context,true)
return 0
end
function action_EVENT_TIME_AXIS_PASS_Ball_Challenge(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_TIME_AXIS_PASS_Ball_Challenge: evt.param1=" .. evt.param1)
--重置各组吃球
LF_Try_FailBall(context)
--重置标记
ScriptLib.SetGroupTempValue(context,"Ball_Cfgid",0,{})
return 0
end
function action_EVENT_GADGET_STATE_CHANGE(context,evt)--吃大球
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_GADGET_STATE_CHANGE: evt.param1=" .. evt.param1)
--查询gadget_id
local _gadgetid = 0
for k,v in pairs(gadgets) do
if v.config_id == evt.param2 then
_gadgetid = v.gadget_id
break
end
end
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_GADGET_STATE_CHANGE: _gadgetid=" .. _gadgetid)
if _gadgetid == Stage_Normal.BigOrb_Gadget_ID and evt.param1 == 201 then
--如果大球切了
if ScriptLib.GetGroupTempValue(context,"Ball_Cfgid",{}) ==0 then
--且没有正在进行的吃球挑战
LF_Try_StartBall(context,evt.param2)
end
end
return 0
end
function action_EVENT_ANY_GADGET_DIE(context,evt)--吃金币、吃小球
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_ANY_GADGET_DIE: evt.param1=" .. evt.param1)
--查询gadgetid
local _gadgetid = 0
for k,v in pairs(gadgets) do
if v.config_id == evt.param1 then
_gadgetid = v.gadget_id
break
end
end
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_ANY_GADGET_DIE:_gadgetid = ".._gadgetid)
--金币
if _gadgetid == Stage_Normal.Coin_Gadget_ID then
ScriptLib.ChangeGroupVariableValue(context,"coin",1)
--watcher单局收集金币数量
local _uidlist = ScriptLib.GetSceneUidList(context)
if _uidlist == nil then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_ANY_GADGET_DIE:_uidlist == nil")
return 0
end
if level_list == nil then
return 0
end
if level_list[base_info.group_id] == nil then
return 0
end
for i = 1 , #_uidlist do
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_ANY_GADGET_DIE:level_list[base_info.group_id] = "..level_list[base_info.group_id])
ScriptLib.AddExhibitionReplaceableDataAfterSuccess(context, _uidlist[i], "Activity_WindField_"..level_list[base_info.group_id].."_Coin", 1, {play_type=ExhibitionPlayType.Gallery,gallery_id=defs.gallery_id})
end
end
--小球
if _gadgetid == Stage_Normal.SmallOrb_Gadget_ID then
ScriptLib.ChangeGroupTempValue(context,"ball_count",-1,{})
ScriptLib.ChangeGroupTempValue(context,"temp_ball_current_count",1,{})
--update到服务器
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{["ball_current_count"] = ScriptLib.GetGroupTempValue(context,"temp_ball_current_count",{})})
end
return 0
end
function action_EVENT_ENTER_REGION(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_ENTER_REGION:p1="..evt.param1.."|defs.finish_region="..defs.finish_region)
if evt.param1 == defs.finish_region then
ScriptLib.SetGroupTempValue(context,"region_eid",evt.source_eid,{})
LF_Check_Finish(context,true)
end
if evt.param1 == defs.ability_region then
if level_list == nil then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_ENTER_REGION:level_list == nil")
return 0
end
if level_list[base_info.group_id] == nil then
return 0
end
if level_list[base_info.group_id] == 4 then
--ScriptLib.AttachGalleryTeamAbilityGroup(context, {evt.uid}, defs.gallery_id, 0)
end
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_ENTER_REGION:清空陈列室替换值=".."Activity_WindField_"..level_list[base_info.group_id].."_Ball")
--清空陈列室替换值
--球
ScriptLib.ClearExhibitionReplaceableData(context, evt.uid, "Activity_WindField_"..level_list[base_info.group_id].."_Ball")
--金币
ScriptLib.ClearExhibitionReplaceableData(context, evt.uid, "Activity_WindField_"..level_list[base_info.group_id].."_Coin")
end
return 0
end
function LF_Check_Finish(context,is_enter_region)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Check_Finish:")
--[[ --Step1 检查吃够球了没【砍了】
local _maxcount = 0
for k,v in pairs(gadgets) do
if v.gadget_id == Stage_Normal.BigOrb_Gadget_ID then
_maxcount = _maxcount + 1
end
end
local _ball = ScriptLib.GetGroupVariableValue(context,"element_ball")
if _ball < _maxcount then
--没吃够球,弹reminderreturn
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Check_Finish:没吃够球,弹reminderreturn")
ScriptLib.ShowReminder(context,470210101)
return 0
end ]]
--Step2 检查都进region了没
--2.1 取活着的玩家_alive_uidlist
local _eid = ScriptLib.GetEntityIdByConfigId(context, defs.finish_region)
local _count = ScriptLib.GetRegionEntityCount(context, { region_eid =_eid, entity_type = EntityType.AVATAR })
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Check_Finish:_count".._count)
local _alive_uidlist = {}
local _uidlist = ScriptLib.GetSceneUidList(context)
if _uidlist == nil then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Check_Finish:_uidlist == nil")
return 0
end
for i = 1 , #_uidlist do
if ScriptLib.IsPlayerAllAvatarDie(context, _uidlist[i]) == false then
table.insert(_alive_uidlist,_uidlist[i])
end
end
--2.2 判断活着的玩家都到达
if _count == 0 then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Check_Finish:终点位置没人")
--终点没人,return
return 0
end
if _count ~= #_alive_uidlist then
--还有人没到达终点,return
if is_enter_region == true then
--如果这次检测是由enter_region引起,则提示玩家
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Check_Finish:需要全部人到达终点,弹reminderreturn")
ScriptLib.ShowReminder(context,470210102)
end
return 0
end
--完成watcher[要先于gallerystop执行
--watcher完成
--local _uidlist = ScriptLib.GetSceneUidList(context)--上面有了
if level_list == nil then
return 0
end
if level_list[base_info.group_id] == nil then
return 0
end
for i = 1 , #_uidlist do
ScriptLib.AddExhibitionReplaceableDataAfterSuccess(context, _uidlist[i], "Activity_WindField_"..level_list[base_info.group_id].."_LevelFinish", 1, {play_type=ExhibitionPlayType.Gallery,gallery_id=defs.gallery_id})
end
--完成
LF_Try_End(context,false)
return 0
end
function action_EVENT_VARIABLE_CHANGE(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_VARIABLE_CHANGE:"..evt.source_name.." = "..evt.param1)
--gm
if evt.source_name == "gm_Try_Start" and evt.param1 ~= 0 then
LF_Try_Start(context,evt.param1)
elseif evt.source_name == "gm_Try_End" and evt.param1 ~= 0 then
LF_Try_End(context,true)
elseif evt.source_name == "gm_Try_Start_Ball" then
LF_Try_StartBall(context,ball_id)
elseif evt.source_name == "gm_Try_Finish_Ball" then
LF_Try_FinishBall(context)
--gm结束
--正式:
elseif evt.source_name == "ball_count" then
if evt.param1 == 0 then
LF_Try_FinishBall(context)
end
elseif evt.source_name == "element_ball" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{[evt.source_name] = evt.param1})
elseif evt.source_name == "killed_monster" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{[evt.source_name] = evt.param1})
elseif evt.source_name == "coin" then
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,{[evt.source_name] = evt.param1})
end
return 0
end
function action_EVENT_GROUP_LOAD(context,evt)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal action_EVENT_GROUP_LOAD:")
ScriptLib.SetGroupVariableValue(context,"element_ball",0)
ScriptLib.SetGroupVariableValue(context,"coin",0)
LF_Try_Start(context,2)
return 0
end
function LF_Try_End(context,is_fail)
if is_fail then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Try_End:true")
else
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Try_End:false")
end
ScriptLib.StopGallery(context, defs.gallery_id, is_fail)
return 0
end
function LF_Try_StartBall(context,ball_id)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Try_StartBall")
local _get_config_suc = false
--对大小球suite的操作
for k,v in pairs(windball_list) do
if k == ball_id then --找到对应配置
_get_config_suc = true
if suites[v] == nil then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Try_StartBall:suites[v] == nil")
return 0
end
--创建小球们
ScriptLib.AddExtraGroupSuite(context,base_info.group_id,v)
--记录有多少个小球(用于本次挑战计数,吃一个-1,直到0)
ScriptLib.SetGroupTempValue(context,"ball_count",#suites[v].gadgets,{})
--组织数据tableupdate到服务器
local _uidlist = ScriptLib.GetSceneUidList(context)
if _uidlist == nil then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Try_StartBall:_uidlist == nil")
return 0
end
local _time = defs.ball_challenge_time
if _time == nil then
_time = Stage_Normal.Ball_Challenge_Time
ScriptLib.PrintGroupWarning(context,"## Activity_WindMaze_Normal LF_Try_StartBall:没配吃球挑战时间,设为20秒")
else
end
local _score = {
["is_start"] = true,
["is_success"] = false,
["challenge_time"] = _time,
["show_id"] = defs.ball_challenge_id,
["ball_max_count"] = #suites[v].gadgets,
["ball_current_count"] = 0,
}
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,_score)
--temp变量归零(用来每次吃球给服务器发"ball_current_count"
ScriptLib.SetGroupTempValue(context,"temp_ball_current_count",0,{})
--记录当前处于哪组捡球小挑战。(完成的时候根据这个判断完成了哪组)
ScriptLib.SetGroupTempValue(context,"Ball_Cfgid",ball_id,{})
--计时
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Try_StartBall:_time=".._time)
ScriptLib.InitTimeAxis(context,"Ball_Challenge",{_time},false)
else
--其他的大球暂时隐藏
ScriptLib.SetGadgetStateByConfigId(context,k,201)
end
end
if _get_config_suc == false then ScriptLib.PrintGroupWarning(context,"## Activity_WindMaze_Normal LF_Try_StartBall:找不到吃球配置,大球configid:"..ball_id) end
return 0
end
function LF_Try_FailBall(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Try_FailBall")
--结束捡球挑战
local _score = {
["is_start"] = false,
["is_success"] = false,
["challenge_time"] = 0,
["show_id"] = defs.ball_challenge_id,
}
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,_score)
--切回原挑战
local _score = {
["is_start"] = true,
["is_success"] = false,
["challenge_time"] = 180,
["show_id"] = defs.challenge_id,
}
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,_score)
local _cfgid = ScriptLib.GetGroupTempValue(context,"Ball_Cfgid",{})
for k,v in pairs(windball_list) do
if k == _cfgid then
ScriptLib.RemoveExtraGroupSuite(context, base_info.group_id, v)
ScriptLib.SetGadgetStateByConfigId(context,k,0)
else
--未完成的大球重新显示
if ScriptLib.GetGroupTempValue(context,"BigOrb_Is_Fisnish_"..k,{}) ~=1 then
ScriptLib.SetGadgetStateByConfigId(context,k,0)
end
end
end
--重置标记
ScriptLib.SetGroupTempValue(context,"Ball_Cfgid",0,{})
return 0
end
function LF_Try_FinishBall(context)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Try_FinishBall")
--结束捡球挑战
local _score = {
["is_start"] = false,
["is_success"] = true,
["challenge_time"] = 0,
["show_id"] = defs.ball_challenge_id,
}
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,_score)
--切回原挑战
local _score = {
["is_start"] = true,
["is_success"] = false,
["challenge_time"] = 180,
["show_id"] = defs.challenge_id,
}
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,_score)
--给大球计数+1
ScriptLib.ChangeGroupVariableValue(context,"element_ball",1)
--记录该组吃球已完成
local _cfgid = ScriptLib.GetGroupTempValue(context,"Ball_Cfgid",{})
ScriptLib.SetGroupTempValue(context,"BigOrb_Is_Fisnish_".._cfgid,1,{})
--重置其他大球
for k,v in pairs(windball_list) do
if ScriptLib.GetGroupTempValue(context,"BigOrb_Is_Fisnish_"..k,{}) ~= 1 then
ScriptLib.SetGadgetStateByConfigId(context,k,0)
end
end
--重置标记
ScriptLib.SetGroupTempValue(context,"Ball_Cfgid",0,{})
--停掉计时器
ScriptLib.EndTimeAxis(context,"Ball_Challenge")
--通知LD完成,值为大球的id
ScriptLib.SetGroupVariableValue(context,"Ball_Challenge_Finish",_cfgid)
--watcher单局收集风元素球数量
local _uidlist = ScriptLib.GetSceneUidList(context)
if _uidlist == nil then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Try_StartBall:_uidlist == nil")
return 0
end
if level_list == nil then
return 0
end
if level_list[base_info.group_id] == nil then
return 0
end
for i = 1 , #_uidlist do
ScriptLib.AddExhibitionReplaceableDataAfterSuccess(context, _uidlist[i], "Activity_WindField_"..level_list[base_info.group_id].."_Ball", 1, {play_type=ExhibitionPlayType.Gallery,gallery_id=defs.gallery_id})
end
return 0
end
function LF_Try_Start(context,show_id)
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Try_Start: is_start = true")
local uidlist = ScriptLib.GetSceneUidList(context)
if uidlist == nil then
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Try_StartBall:uidlist == nil")
return 0
end
ScriptLib.PrintContextLog(context,"## Activity_WindMaze_Normal LF_Try_Start: #uidlist = "..#uidlist)
ScriptLib.SetPlayerStartGallery(context,defs.gallery_id,uidlist)
local _score = {
["is_start"] = true,
["is_success"] = false,
["challenge_time"] = 180,
["show_id"] = defs.challenge_id,
}
ScriptLib.UpdatePlayerGalleryScore(context,defs.gallery_id,_score)
return 0
end
--初始化
function Initialize()
--加触发器
if temp_Tirgger ~= nil then
for k,v in pairs(temp_Tirgger) do
v.name = v.action
v.config_id = 40000000 + k
v.trigger_count = 0
v.condition = ""
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
end
--加变量
if temp_Variables ~= nil then
for k,v in pairs(temp_Variables) do
v.config_id = 50000000 + k
table.insert(variables,v)
end
end
return 0
end
Initialize()
@@ -0,0 +1,186 @@
--[[======================================
|| filename: CampChallenge
|| owner: juntao.chen
|| description: 营地挑战玩法
|| LogName: CampChallenge
|| Protection: [Protection]
=======================================]]
--需求defs
--[[
local defs = {
challenge_id = 111,
enter_region = 1,
leave_region = 1,
trigger_time = 1
}
]]
local buff_id_list = {
[2010060] = 1,
[2010061] = 3,
[2010062] = 2,
[2010063] = 3,
[2010064] = 1,
}
local temp_Variables = {
{ config_id=50000001,name = "SET_TRIGGER", value = 0, no_refresh = true },
}
local temp_Tirgger = {
{event = EventType.EVENT_ENTER_REGION, source = "", action = "action_EVENT_ENTER_REGION",forbid_guest = false},
{event = EventType.EVENT_LEAVE_REGION, source = "", action = "action_EVENT_LEAVE_REGION",forbid_guest = false},
{event = EventType.EVENT_VARIABLE_CHANGE, source = "SET_TRIGGER", action = "EVENT_VARIABLE_CHANGE_SET_TRIGGER",tag = "111"},
{event = EventType.EVENT_CHALLENGE_SUCCESS, source = "", action = "action_EVENT_CHALLENGE_SUCCESS"},
{event = EventType.EVENT_CHALLENGE_FAIL, source = "", action = "action_EVENT_CHALLENGE_FAIL"},
{event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", action = "action_EVENT_GADGET_STATE_CHANGE"},
--{event = EventType.EVENT_MONSTER_BATTLE, source = "", action = "action_EVENT_MONSTER_BATTLE"}, --不需要了
}
--[[ function action_EVENT_MONSTER_BATTLE(context,evt)
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_MONSTER_BATTLE ")
return 0
end
]]
--风种子被拾取,传日志
function action_EVENT_GADGET_STATE_CHANGE(context,evt)
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_GADGET_STATE_CHANGE ")
if evt.param1 ~= 201 then return 0 end
if ScriptLib.GetGadgetIdByEntityId(context,evt.source_eid) ~= 70800251 then return 0 end
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_GADGET_STATE_CHANGE 风种子被拾取")
--【【3.1 backlog内】数据埋点 - 蒙德佳酿节(TD)相关运营埋点】
--https://www.tapd.cn/22963631/prong/stories/view/1122963631001540454
local _trans = ScriptLib.GetChallengeTransaction(context, defs.challenge_id)
ScriptLib.MarkGroupLuaAction(context, "Vintage_Camp_4",_trans,{})
return 0
end
--挑战失败,传日志
function action_EVENT_CHALLENGE_FAIL(context,evt)
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_CHALLENGE_FAIL ")
--【【3.1 backlog内】数据埋点 - 蒙德佳酿节(TD)相关运营埋点】
--https://www.tapd.cn/22963631/prong/stories/view/1122963631001540454
ScriptLib.MarkGroupLuaAction(context, "Vintage_Camp_3",evt.param_str1,{})
--失败后删掉额外suite
ScriptLib.RefreshGroup(context,{group_id = base_info.group_id, suite = init_config.suite})
return 0
end
--挑战成功,关grouplink、传日志
function action_EVENT_CHALLENGE_SUCCESS(context,evt)
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_CHALLENGE_SUCCESS ")
--移除ability region(该操作会导致被移除的region触发leave_region,顺便会恢复visionType)
ScriptLib.RemoveEntityByConfigId(context, 0, EntityType.REGION, defs.leave_region)
ScriptLib.RemoveEntityByConfigId(context, 0, EntityType.REGION, defs.enter_region)
--bundle完成
ScriptLib.FinishGroupLinkBundle(context, base_info.group_id)
return 0
end
--挑战进度变化,传日志
function EVENT_VARIABLE_CHANGE_SET_TRIGGER(context,evt)
ScriptLib.PrintContextLog(context, "## CampChallenge : EVENT_VARIABLE_CHANGE_SET_TRIGGER ")
--【【3.1 backlog内】数据埋点 - 蒙德佳酿节(TD)相关运营埋点】
--https://www.tapd.cn/22963631/prong/stories/view/1122963631001540454
local _trans = ScriptLib.GetChallengeTransaction(context, defs.challenge_id)
ScriptLib.MarkGroupLuaAction(context, "Vintage_Camp_2",_trans,{["cur_progress"] = evt.param1,["total_progress"]= defs.trigger_time})
return 0
end
--主客机进区域设置visiontype;主机进区域开挑战、恢复suite内容、传日志
function action_EVENT_ENTER_REGION(context,evt)
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_ENTER_REGION:evt.param1 = "..evt.param1.."uid = "..evt.uid)
if evt.param1 ~= defs.enter_region then
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_ENTER_REGION:".." evt.param1 ~= defs.enter_region")
return 0
end
-- 主客机都设置visionType
ScriptLib.SetPlayerGroupVisionType(context, {evt.uid}, {0})
if evt.uid ~= ScriptLib.GetSceneOwnerUid(context) then --剩余操作只对主机执行
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_ENTER_REGION:".."evt.uid ~= ScriptLib.GetSceneOwnerUid(context) ")
return 0
end
if ScriptLib.IsChallengeStartedByChallengeIndex(context,base_info.group_id,defs.challenge_id) == true then
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_ENTER_REGION:".." ScriptLib.IsChallengeStartedByChallengeIndex(context,base_info.group_id,defs.challenge_id) == true ")
return 0
end
local _cur_count = ScriptLib.GetGroupVariableValue(context,"SET_TRIGGER")
if _cur_count >= defs.trigger_time then
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_ENTER_REGION:".."_cur_count >= defs.trigger_time")
ScriptLib.FinishGroupLinkBundle(context, base_info.group_id)--保底再次finish一下
return 0 --进度已完成,不开挑战
end
--开挑战
ScriptLib.StartChallenge(context, defs.challenge_id, defs.challenge_id, {3, 111, defs.trigger_time, 1, _cur_count})
--【【3.1 backlog内】数据埋点 - 蒙德佳酿节(TD)相关运营埋点】
--https://www.tapd.cn/22963631/prong/stories/view/1122963631001540454
local _trans = ScriptLib.GetChallengeTransaction(context, defs.challenge_id)
ScriptLib.MarkGroupLuaAction(context, "Vintage_Camp_1",_trans,{})
--恢复suite内容
if Phase == nil then
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_ENTER_REGION LD注意:没有配置Phase")
return 0
end
local _p = ScriptLib.GetGroupVariableValue(context,"STAGE")
if _p ==0 then
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_ENTER_REGION LD注意:没有找到Variable:STAGE")
return 0
end
if Phase[_p] == nil then
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_ENTER_REGION LD注意:没有找到STAGE=".._p.."对应的suite配置")
return 0
end
for i = 1 , #Phase[_p] do
ScriptLib.AddExtraGroupSuite(context, base_info.group_id, Phase[_p][i])
end
return 0
end
--主客机出区域恢复visiontype 主机出区域挑战失败、group重置
function action_EVENT_LEAVE_REGION(context,evt)
ScriptLib.PrintContextLog(context, "## CampChallenge : action_EVENT_LEAVE_REGION evt.param1="..evt.param1 .. "|defs.leave_region = "..defs.leave_region)
if evt.param1 ~= defs.leave_region then return 0 end
--主客机离开恢复visionType
ScriptLib.SetPlayerGroupVisionType(context, {evt.uid}, {1})
if evt.uid ~= ScriptLib.GetSceneOwnerUid(context) then
return 0
end
--主机离开关挑战
if ScriptLib.IsChallengeStartedByChallengeIndex(context,base_info.group_id,defs.challenge_id) == true then
ScriptLib.StopChallenge(context, defs.challenge_id, 0)
end
return 0
end
--初始化
function Initialize()
--加触发器
if temp_Tirgger ~= nil then
for k,v in pairs(temp_Tirgger) do
v.name = v.action
v.config_id = 40000000 + k
v.trigger_count = 0
v.condition = ""
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
end
--加变量
if temp_Variables ~= nil then
for k,v in pairs(temp_Variables) do
table.insert(variables,v)
end
end
return 0
end
Initialize()
@@ -0,0 +1,482 @@
---
--- Generated by Luanalysis
--- Created by binghong.shen_187191.
--- DateTime: 2022/5/18 17:01
--[[======================================
|| filename: ChiWangShooter
|| owner: binghong.shen
|| description: 赤王陵 射线机关
|| LogName: ChiWangShooter
|| Protection: [Protection]
=======================================]]
--[[
var:
curMoveIndex
--点阵id
defs.pointarray_ID = 110100048
--点阵个数
defs.pointArrayNum=4
--添加的按钮id
defs.optionID=24
--发射器id
defs.shooterGadgetID=13001
--发射激光的点
defs.shootPoints={1,2}
--停留点List
defs.stopPoints = {1,2,4}
--停留点对应底座
defs.shooterBaseList={
[1]=12001,
[2]=12002,
[4]=12003,
}
--短暂停留的点
defs.shortStayPointList={2}
--短暂停留的时间
defs.stayTime={3}
--最终射线机关停留点位
defs.finalShooterPoint = 1
--额外可能在的suite
defs.extraAddSuite = 1
--]]
---
---
local extrTriggers = {
initialtrigger = {
{ config_id = 80000001, name = "OnWorkOptionSelect", event= EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_OnWorkOptionSelect", trigger_count = 0},
{ config_id = 80000002, name = "OnPlatformReach", event= EventType.EVENT_PLATFORM_ARRIVAL, source = "", condition = "", action = "action_OnPlatformReach", trigger_count = 0},
{ config_id = 80000003, name = "time_axis_pass", event = EventType.EVENT_TIME_AXIS_PASS, source = "", condition = "", action = "action_time_axis_pass", trigger_count = 0},
{ config_id = 80000004, name = "OnGroupLoad", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_OnGroupLoad", trigger_count = 0},
{ config_id = 80000005, name = "OnVariableChange", event = EventType.EVENT_VARIABLE_CHANGE, source = "", condition = "", action = "action_OnVariableChange", trigger_count = 0},
}
}
function action_OnVariableChange(context, evt)
--玩法完成
if evt.source_name == "isFinished" and evt.param1 == 1 then
local curMoveIndex = ScriptLib.GetGroupVariableValue(context, "curMoveIndex")
ScriptLib.SetGroupVariableValue(context, "curMoveIndex", defs.finalShooterPoint or curMoveIndex)
ScriptLib.EndTimeAxis(context, "short_stay_timer")
ScriptLib.EndTimeAxis(context, "real_move_timer")
RefreshAll(context)
return 0
end
return 0
end
function action_OnGroupLoad(context, evt)
--点阵不存档所以直接把机关扔过去
local entityID=ScriptLib.GetEntityIdByConfigId(context, defs.shooterGadgetID)
if (entityID ~= 0) then
ScriptLib.RemoveEntityByConfigId(context, 0, EntityType.GADGET, defs.shooterGadgetID)
local curMoveIndex = ScriptLib.GetGroupVariableValue(context, "curMoveIndex")
local _ret, pos, rot = ScriptLib.GetPlatformArrayInfoByPointId(context, defs.pointarray_ID, curMoveIndex)
ScriptLib.CreateGadgetByConfigIdByPos(context, defs.shooterGadgetID, { x = pos.x, y = pos.y, z = pos.z }, { x = rot.x, y = rot.y, z = rot.z })
end
RefreshAll(context)
return 0
end
--刷新所有物件到正确的状态
function RefreshAll(context)
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : RefreshAll start")
local curMoveIndex = ScriptLib.GetGroupVariableValue(context, "curMoveIndex")
local isFinished = ScriptLib.GetGroupVariableValue(context, "isFinished")
if(isFinished~=nil and isFinished == 1)then
ScriptLib.SetGroupVariableValue(context, "curMoveIndex", defs.finalShooterPoint or curMoveIndex)
curMoveIndex = ScriptLib.GetGroupVariableValue(context, "curMoveIndex")
end
--更新发射器
local hasAuthority = CheckAuthority(context)
local CanShoot = CheckShootPoint(context,curMoveIndex)
if CanShoot then
ScriptLib.SetGadgetStateByConfigId(context, defs.shooterGadgetID, 201)
else
if(hasAuthority)then
ScriptLib.SetGadgetStateByConfigId(context, defs.shooterGadgetID, 0)
else
ScriptLib.SetGadgetStateByConfigId(context, defs.shooterGadgetID, 202)
end
end
ScriptLib.SetPlatformPointArray(context, defs.shooterGadgetID, defs.pointarray_ID, {curMoveIndex}, { route_type = 0,record_mode=1 })
--更新所有底座
for _,ShooterBaseID in pairs(defs.shooterBaseList)do
local baseState = ScriptLib.GetGadgetStateByConfigId(context, 0, ShooterBaseID)
if(baseState ~= 901)then
RefreshShooterBase(context, ShooterBaseID)
end
end
end
--刷新底座状态
function RefreshShooterBase(context, ShooterBaseID)
local hasAuthority = CheckAuthority(context)
local curMoveIndex = ScriptLib.GetGroupVariableValue(context, "curMoveIndex")
local curStayBaseID = GetShooterBaseIDByMoveIndex(curMoveIndex)
local isCurShootBase = (curStayBaseID==ShooterBaseID)
local isShootPoint = CheckShootPointByBaseID(context,ShooterBaseID,curMoveIndex)
local isShortStay = CheckIsShortStayByBaseID(ShooterBaseID,curMoveIndex)
local isFinished = ScriptLib.GetGroupVariableValue(context, "isFinished") or 0
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : InitShooterBase"
.." ShooterBaseID "..tostring(ShooterBaseID)
.." isCurShootBase "..tostring(isCurShootBase)
.." isShootPoint "..tostring(isShootPoint)
.." isShortStay "..tostring(isShortStay)
.." hasAuthority "..tostring(hasAuthority)
)
if(hasAuthority==false)then
ScriptLib.SetGadgetStateByConfigId(context, ShooterBaseID, 202)
else
if(not isCurShootBase)then
ScriptLib.SetGadgetStateByConfigId(context, ShooterBaseID, 0)
else
if (isShootPoint and not isShortStay) then
if isFinished == 1 then
ScriptLib.SetGadgetStateByConfigId(context, ShooterBaseID, 203)
else
ScriptLib.SetGadgetStateByConfigId(context, ShooterBaseID, 204)
end
elseif(isShootPoint and isShortStay) then
ScriptLib.SetGadgetStateByConfigId(context, ShooterBaseID, 203)
if isFinished == 0 then
ScriptLib.InitTimeAxis(context, "short_stay_timer", defs.stayTime, false)
end
elseif(not isShootPoint and isShortStay) then
ScriptLib.SetGadgetStateByConfigId(context, ShooterBaseID, 0)
if isFinished == 0 then
ScriptLib.InitTimeAxis(context, "short_stay_timer", defs.stayTime, false)
end
elseif(not isShootPoint and not isShortStay) then
if isFinished == 1 then
ScriptLib.SetGadgetStateByConfigId(context, ShooterBaseID, 0)
else
ScriptLib.SetGadgetStateByConfigId(context, ShooterBaseID, 201)
end
end
end
end
end
-- 按下按钮后启动射线机关移动
function action_OnWorkOptionSelect(context, evt)
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : action_OnWorkOptionSelect start ")
local optionID = evt.param2
if(optionID==defs.optionID)then
TriggerMove(context)
end
return 0
end
-- 射线机关移动
function TriggerMove(context)
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : TriggerMove start ")
local isFinished = ScriptLib.GetGroupVariableValue(context, "isFinished")
if(isFinished~=nil and isFinished == 1)then
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : TriggerMove end play is finish ")
return 0
end
local nextPath = GetNextPath(context)
local pathLength = #nextPath
if(pathLength~=0)then
local nextMovePoint = nextPath[pathLength]
local toMoveBaseID = GetShooterBaseIDByMoveIndex(nextMovePoint)
local toMoveBaseState = ScriptLib.GetGadgetStateByConfigId(context, 0, toMoveBaseID)
if(toMoveBaseState==901)then
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : TriggerMove end next base is lock")
ScriptLib.ShowReminder(context, 400191)
return
end
else
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : TriggerMove error path find fail")
return
end
ScriptLib.InitTimeAxis(context, "real_move_timer", {0.2}, false)
local curMoveIndex = ScriptLib.GetGroupVariableValue(context, "curMoveIndex")
local curShooterBaseID = GetShooterBaseIDByMoveIndex(curMoveIndex)
--设置发射器为0,设置对应底座为0startplatform
ScriptLib.SetGadgetStateByConfigId(context,defs.shooterGadgetID,0)
if(curShooterBaseID~=nil)then
ScriptLib.SetGadgetStateByConfigId(context,curShooterBaseID,0)
end
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : TriggerMove end "
.." moveGadget "..defs.shooterGadgetID
.." pointArrayID "..defs.pointarray_ID
)
end
function RealMove(context)
local isFinished = ScriptLib.GetGroupVariableValue(context, "isFinished")
if(isFinished~=nil and isFinished == 1)then
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : TriggerMove end play is finish ")
return 0
end
local nextPath = GetNextPath(context)
local pathLength = #nextPath
if(pathLength~=0)then
ScriptLib.SetPlatformPointArray(context, defs.shooterGadgetID, defs.pointarray_ID, nextPath, { route_type = 0,record_mode=1 })
end
end
-- 计算射线机关的移动路径
function GetNextPath(context)
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : GetNextPath start ")
local path = {}
local curMoveIndex = ScriptLib.GetGroupVariableValue(context,"curMoveIndex")
local pointArrayLength = defs.pointArrayNum
for k,v in ipairs(defs.stopPoints)do
if(curMoveIndex==v)then
local isLastPoint = (k==#defs.stopPoints)
if(not isLastPoint)then
for i = curMoveIndex+1,defs.stopPoints[k+1]do
table.insert(path,i)
end
else
if(curMoveIndex ~= pointArrayLength)then
for i = curMoveIndex+1,pointArrayLength do
table.insert(path,i)
end
end
for i = 1,defs.stopPoints[1] do
table.insert(path,i)
end
end
break
end
end
if(#path==0)then
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : Path Not Found. curMoveIndex "..curMoveIndex
.." pointArrayLength "..pointArrayLength
)
end
local debugPathInfo = ""
for k,v in ipairs(path)do
debugPathInfo = debugPathInfo.." "..tostring(v)
end
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : GetNextPath is "..debugPathInfo)
return path
end
-- 射线机关到达点位后执行对应逻辑
function action_OnPlatformReach(context, evt)
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : chiwang action_OnPlatformReach start")
local config_id = evt.param1
local hasAuthority = CheckAuthority(context)
if(config_id == defs.shooterGadgetID)then
--isFinished
local isFinished = ScriptLib.GetGroupVariableValue(context, "isFinished")
if(isFinished~=nil and isFinished == 1)then
return 0
end
local pointID = evt.param3
local CanShoot = CheckShootPoint(context,pointID)
local ShooterBaseID = GetShooterBaseIDByMoveIndex(pointID)
local isShortStay = CheckIsShortStay(pointID)
local baseState = ScriptLib.GetGadgetStateByConfigId(context, 0, ShooterBaseID)
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : chiwang platform reach update"
.." ShooterBaseID "..tostring(ShooterBaseID)
.." CanShoot "..tostring(CanShoot)
.." isShortStay "..tostring(isShortStay)
.." hasAuthority "..tostring(hasAuthority)
)
--设置底座状态
if(baseState ~= 901)then
if(hasAuthority==false)then
ScriptLib.SetGadgetStateByConfigId(context, ShooterBaseID, 202)
else
if(ShooterBaseID)then
if (CanShoot and isShortStay) then
ScriptLib.SetGadgetStateByConfigId(context, ShooterBaseID, 203)
elseif(CanShoot and not isShortStay) then
ScriptLib.SetGadgetStateByConfigId(context, ShooterBaseID, 204)
elseif(not CanShoot and isShortStay) then
ScriptLib.SetGadgetStateByConfigId(context, ShooterBaseID, 0)
elseif(not CanShoot and not isShortStay) then
ScriptLib.SetGadgetStateByConfigId(context, ShooterBaseID, 201)
end
else
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : BasePointNotFit please check stopPoint and basePoint config")
return -1
end
end
end
--设置发射器状态
if CanShoot then
ScriptLib.SetGadgetStateByConfigId(context, defs.shooterGadgetID, 201)
else
if(hasAuthority)then
ScriptLib.SetGadgetStateByConfigId(context, defs.shooterGadgetID, 0)
else
ScriptLib.SetGadgetStateByConfigId(context, defs.shooterGadgetID, 202)
end
end
--设置短暂停留计时器
if isShortStay then
ScriptLib.InitTimeAxis(context, "short_stay_timer", defs.stayTime, false)
end
--记录当前移动点位
if defs.shooterBaseList[pointID]~=nil then
ScriptLib.SetGroupVariableValue(context, "curMoveIndex", pointID)
end
end
return 0
end
--自动移动计时器触发
function action_time_axis_pass(context, evt)
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : action_time_axis_pass start")
if evt.source_name == "short_stay_timer" then
TriggerMove(context)
end
if evt.source_name == "real_move_timer" then
RealMove(context)
end
return 0
end
function GetShooterBaseIDByMoveIndex(moveIndex)
return defs.shooterBaseList[moveIndex]
end
--判断当前移动点是否发射射线
function CheckShootPoint(context,pointID)
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : CheckShootPoint "..pointID)
for _,v in pairs(defs.shootPoints)do
if v == pointID then
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : CheckShootPoint success")
return true
end
end
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : CheckShootPoint fail")
return false
end
--判断基座是否发射射线
function CheckShootPointByBaseID(context,shooterBaseID,curMoveIndex)
for pointID, baseId in pairs(defs.shooterBaseList)do
if(curMoveIndex == pointID and baseId == shooterBaseID)then
local canShoot = CheckShootPoint(context,pointID)
if canShoot then
return true
end
end
end
return false
end
--判断移动点是否是短暂停留
function CheckIsShortStay(pointID)
for _,v in pairs(defs.shortStayPointList)do
if v == pointID then
return true
end
end
return false
end
--判断基座是否是短暂停留
function CheckIsShortStayByBaseID(shooterBaseID,curMoveIndex)
for pointID, baseId in pairs(defs.shooterBaseList)do
if(curMoveIndex == pointID and baseId == shooterBaseID)then
local canShoot = CheckIsShortStay(pointID)
if canShoot then
return true
end
end
end
return false
end
--判断是否权限足够
function CheckAuthority(context)
local level = ScriptLib.GetChainLevel(context, ScriptLib.GetSceneOwnerUid(context), 100004)
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : chiwang shooter get level "..tostring(level))
if(level>=2)then
return true
end
return false
end
-- 更新物件上的按钮
function SLC_UpdateInteractBtn( context, value )
local gadgetID = ScriptLib.GetGadgetConfigId(context, {gadget_eid = context.source_entity_id})
--isFinished
local isFinished = ScriptLib.GetGroupVariableValue(context, "isFinished")
if(isFinished~=nil and isFinished == 1)then
ScriptLib.SetWorktopOptionsByGroupId(context, base_info.group_id, gadgetID, {})
return 0
end
if value == 0 then
ScriptLib.SetWorktopOptionsByGroupId(context, base_info.group_id, gadgetID, {})
end
if value == 1 then
ScriptLib.PrintContextLog(context, "@@ ChiWangShooter : UpdateInteractBtn "
.." gadgetID "..tostring(gadgetID)
.." optionID "..tostring(defs.optionID)
)
ScriptLib.SetWorktopOptionsByGroupId(context, base_info.group_id, gadgetID, {defs.optionID})
end
return 0
end
--监听chainLevel,刷新所有物件
function SLC_OnChainLevelUpgrade( context, value )
RefreshAll(context)
return 0
end
function LF_Initialize_Group()
for _,v in pairs(extrTriggers.initialtrigger) do
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
if defs.extraAddSuite ~= nil then
table.insert(suites[defs.extraAddSuite].triggers, v.name)
end
end
table.insert(variables,{ config_id=50000001,name = "isFinished", value = 0 })
return 0
end
LF_Initialize_Group()
@@ -0,0 +1,48 @@
----[[======================================
--|| filename: DesertRoseFlower_Quest
--|| owner: binghong.shen
--|| description: 沙漠蔷薇
--|| LogName: DesertRoseFlower_Quest
--|| Protection: [Protection]
--=======================================]]
--
----[[
--defs.flowerGadgetID
--defs.waterQuest_Event
--defs.ActivateQuest1_Event
--defs.ActivateQuest2_Event
----]]
--local extrTriggers = {
-- initialtrigger = {
-- { config_id = 80000001, name = "OnGroupLoad", event= EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_GroupLoad", trigger_count = 0},
-- }
--}
--
--function RefreshGroup(context, evt)
--
-- local Finished = ScriptLib.GetGroupVariableValue(context, "Finished")
-- if(Finished==1)then
-- ScriptLib.SetGadgetStateByConfigId(context,defs.flowerGadgetID,302)
-- return 0
-- end
--
-- return 0
--end
--
--function action_GroupLoad(context, evt)
-- RefreshGroup(context, evt)
-- return 0
--end
--
--
--function LF_Initialize_Group()
-- for _,v in pairs(extrTriggers.initialtrigger) do
-- table.insert(triggers, v)
-- table.insert(suites[init_config.suite].triggers, v.name)
-- end
-- table.insert(variables,{ config_id=50000001,name = "Finished", value = 0 })
--
-- return 0
--end
--
--LF_Initialize_Group()
@@ -0,0 +1,217 @@
---
--- Generated by Luanalysis
--- Created by binghong.shen_187191.
--- DateTime: 2022/5/31 11:52
--[[======================================
|| filename: DesertRotObelisk_Auto
|| owner: binghong.shen
|| description: 赤王庙 自动旋转方尖碑
|| LogName: DesertRotObelisk_Auto
|| Protection: [Protection]
=======================================]]
--[[
--点阵id
defs.pointarray_ID = 110100049
--旋转CD
defs.RotateTime = 5
--方尖碑configID和初始旋转
defs.gadget_1
defs.gadget_2
defs.gadget_3
defs.rotation_1
defs.rotation_2
defs.rotation_3
--重力压板对应的控制的方尖碑(后来改为了开关控制)
defs.boardControlList={
[12001]={12002,12003},
}
--]]
---
local obeliskList={
{config_id=defs.gadget_1,rotation=defs.rotation_1},
{config_id=defs.gadget_2,rotation=defs.rotation_2},
{config_id=defs.gadget_3,rotation=defs.rotation_3},
}
local extraTriggers={
{ config_id = 8000001, name = "Group_Load", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_GroupLoad", trigger_count = 0 },
{ config_id = 8000002, name = "Platform_Arrive", event = EventType.EVENT_PLATFORM_ARRIVAL, source = "", condition = "", action = "action_PlatformArrive", trigger_count = 0 },
{ config_id = 8000003, name = "OnRotateAxis", event = EventType.EVENT_TIME_AXIS_PASS, source = "", condition = "", action = "action_TimeAxisPass", trigger_count = 0 },
{ config_id = 8000004, name = "OnGadgetStateChange", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_GadgetStateChange", trigger_count = 0 },
}
function template(context, evt)
return 0
end
function action_GroupLoad(context, evt)
ScriptLib.PrintContextLog(context, "@@ DesertRotObelisk_Auto : action_GroupLoad start ")
if ScriptLib.GetGroupVariableValue(context,"success")~=0 then
for _,v in pairs(obeliskList)do
if v.config_id ~= 0 then
ScriptLib.SetGadgetStateByConfigId(context, v.config_id, 203)
end
end
return 0
end
--还原成初始状态
for _,v in pairs(obeliskList)do
if(v.rotation==0)then
ScriptLib.SetGadgetStateByConfigId(context, v.config_id, 201)
end
if(v.rotation==120)then
ScriptLib.SetPlatformPointArray(context, v.config_id, defs.pointarray_ID, { 1 }, { route_type = 0,turn_mode=true })
ScriptLib.SetGadgetStateByConfigId(context, v.config_id, 202)
end
if(v.rotation==240)then
ScriptLib.SetPlatformPointArray(context, v.config_id, defs.pointarray_ID, { 2 }, { route_type = 0,turn_mode=true })
ScriptLib.SetGadgetStateByConfigId(context, v.config_id, 202)
end
ScriptLib.SetGroupVariableValue(context, v.config_id.."rotation", v.rotation)
ScriptLib.SetGroupVariableValue(context, v.config_id.."isLock", 1)
end
--开启计时器
ScriptLib.InitTimeAxis(context, "RotateTimeAxis", {defs.RotateTime}, true)
ScriptLib.PrintContextLog(context, "@@ DesertRotObelisk_Auto : action_GroupLoad end ")
return 0
end
function action_GadgetStateChange(context,evt)
ScriptLib.PrintContextLog(context, "@@ DesertRotObelisk_Auto : action_GadgetStateChange start ")
local config_id = evt.param2
local state = evt.param1
local isBoard = false
for boardId,_ in pairs(defs.boardControlList)do
if boardId == config_id then
isBoard = true
break
end
end
if(isBoard)then
local lockObeliskTable = {}
for boardId,controlList in pairs(defs.boardControlList)do
local boardState = ScriptLib.GetGadgetStateByConfigId(context, 0, boardId)
if (boardState == 0 or boardState == 202) then
for _,v in pairs(controlList)do
table.insert(lockObeliskTable,v)
end
end
end
for _,v in pairs(obeliskList)do
local isLock = false
for _,lockObelisk in pairs(lockObeliskTable)do
if(v.config_id==lockObelisk)then
isLock = true
end
end
if isLock then
ScriptLib.SetGroupVariableValue(context, v.config_id.."isLock", 1)
else
ScriptLib.SetGroupVariableValue(context, v.config_id.."isLock", 0)
end
end
end
ScriptLib.PrintContextLog(context, "@@ DesertRotObelisk_Auto : action_GadgetStateChange end ")
return 0
end
function action_TimeAxisPass(context,evt)
ScriptLib.PrintContextLog(context, "@@ DesertRotObelisk_Auto : action_TimeAxisPass start ")
if evt.source_name == "RotateTimeAxis" then
for _,v in pairs(obeliskList)do
local isLock = ScriptLib.GetGroupVariableValue(context, v.config_id.."isLock")
if(isLock==0)then
RotateGadget(context,v.config_id)
end
end
end
ScriptLib.PrintContextLog(context, "@@ DesertRotObelisk_Auto : action_TimeAxisPass end ")
return 0
end
function RotateGadget(context,config_id)
ScriptLib.SetGadgetStateByConfigId(context, config_id, 202)
ScriptLib.SetPlatformPointArray(context, config_id, defs.pointarray_ID, { 1 }, { route_type = 0,turn_mode=true })
local curRot = ScriptLib.GetGroupVariableValue(context, config_id.."rotation")
ScriptLib.SetGroupVariableValue(context, config_id.."rotation", (curRot+120)%360)
end
function action_PlatformArrive(context, evt)
ScriptLib.PrintContextLog(context, "@@ DesertRotObelisk_Auto : action_PlatformArrive start ")
local config_id = evt.param1
local curRot = ScriptLib.GetGroupVariableValue(context, config_id.."rotation")
if curRot == nil then
return 0
end
if(curRot==0)then
ScriptLib.SetGadgetStateByConfigId(context, config_id, 201)
else
ScriptLib.SetGadgetStateByConfigId(context, config_id, 0)
end
if(CheckIsSuccess(context))then
ScriptLib.SetGroupVariableValue(context, "success", 1)
ScriptLib.EndTimeAxis(context, "RotateTimeAxis")
for _,v in pairs(obeliskList)do
if v.config_id ~= 0 then
ScriptLib.SetGadgetStateByConfigId(context, v.config_id, 203)
end
end
ScriptLib.PrintContextLog(context, "@@ DesertRotObelisk_Auto : success ")
end
ScriptLib.PrintContextLog(context, "@@ DesertRotObelisk_Auto : action_PlatformArrive end ")
return 0
end
function CheckIsSuccess(context)
for _,v in pairs(obeliskList)do
if(ScriptLib.GetGadgetStateByConfigId(context, 0, v.config_id)~=201)then
return false
end
end
return true
end
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
table.insert(variables,{ config_id=40000001,name = "success", value = 0, no_refresh = true})
for i=1,#obeliskList do
if obeliskList[i].config_id ~= 0 then
table.insert(variables,{ config_id=60000000+obeliskList[i].config_id,name = obeliskList[i].config_id.."rotation", value = obeliskList[i].rotation})
table.insert(variables,{ config_id=70000000+obeliskList[i].config_id,name = obeliskList[i].config_id.."isLock", value = 0})
end
end
end
LF_Initialize_Group(triggers, suites)
@@ -0,0 +1,182 @@
---
--- Generated by Luanalysis
--- Created by binghong.shen_187191.
--- DateTime: 2022/5/31 15:48
---
--[[======================================
|| filename: DesertRotObelisk_Select
|| owner: binghong.shen
|| description: 赤王庙 手动旋转方尖碑
|| LogName: RotObelisk
|| Protection: [Protection]
=======================================]]
--[[
-- 显示的按钮id
defs.option_id = 24
--点阵id
defs.pointarray_ID = 110100049
--方尖碑configID
defs.gadget_1
defs.gadget_2
defs.gadget_3
--方尖碑初始旋转角
defs.rotation_1
defs.rotation_2
defs.rotation_3
--方尖碑旋转影响的configID表
defs.gadget_connect1={}
defs.gadget_connect2={}
defs.gadget_connect3={}
--]]
---
local obeliskList={
{config_id=defs.gadget_1,rotation=defs.rotation_1},
{config_id=defs.gadget_2,rotation=defs.rotation_2},
{config_id=defs.gadget_3,rotation=defs.rotation_3},
}
local connectRelation={
[defs.gadget_1]=defs.gadget_connect1,
[defs.gadget_2]=defs.gadget_connect2,
[defs.gadget_3]=defs.gadget_connect3,
}
local extraTriggers={
{ config_id = 8000001, name = "Group_Load", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_GroupLoad", trigger_count = 0 },
{ config_id = 8000002, name = "Platform_Arrive", event = EventType.EVENT_PLATFORM_ARRIVAL, source = "", condition = "", action = "action_PlatformArrive", trigger_count = 0 },
{ config_id = 8000003, name = "On_Option_Select", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_OptionSelect", trigger_count = 0 },
}
function action_GroupLoad(context, evt)
ScriptLib.PrintContextLog(context, "@@ LUA_Log : RotObelisk action_GroupLoad start ")
if ScriptLib.GetGroupVariableValue(context,"success")~=0 then
for _,v in pairs(obeliskList)do
if v.config_id ~= 0 then
ScriptLib.SetGadgetStateByConfigId(context, v.config_id, 203)
end
end
return 0
end
--还原成初始状态
for _,v in pairs(obeliskList)do
if(v.rotation==0)then
ScriptLib.SetGadgetStateByConfigId(context, v.config_id, 201)
end
if(v.rotation==120)then
ScriptLib.SetPlatformPointArray(context, v.config_id, defs.pointarray_ID, { 1 }, { route_type = 0,turn_mode=true })
ScriptLib.SetGadgetStateByConfigId(context, v.config_id, 202)
end
if(v.rotation==240)then
ScriptLib.SetPlatformPointArray(context, v.config_id, defs.pointarray_ID, { 2 }, { route_type = 0,turn_mode=true })
ScriptLib.SetGadgetStateByConfigId(context, v.config_id, 202)
end
ScriptLib.SetGroupVariableValue(context, v.config_id.."rotation", v.rotation)
ScriptLib.PrintContextLog(context, "@@ LUA_Log : RotObelisk init configID "..v.config_id.." rotation "..v.rotation)
end
if(CheckIsAllStatic(context))then
for _,v in pairs(obeliskList)do
ScriptLib.SetWorktopOptionsByGroupId(context,base_info.group_id , v.config_id, {defs.option_id})
end
end
ScriptLib.PrintContextLog(context, "@@ LUA_Log : RotObelisk action_GroupLoad end ")
return 0
end
function action_OptionSelect(context, evt)
ScriptLib.PrintContextLog(context, "@@ LUA_Log : RotObelisk action_OptionSelect start ")
if evt.param2 ~= defs.option_id then
return 0
end
local config_id = evt.param1
for _,v in pairs(obeliskList)do
ScriptLib.SetWorktopOptionsByGroupId(context,base_info.group_id , v.config_id, {})
end
RotateGadget(context,config_id)
for _,v in pairs(connectRelation[config_id])do
RotateGadget(context,v)
end
ScriptLib.PrintContextLog(context, "@@ LUA_Log : RotObelisk action_OptionSelect end ")
return 0
end
function RotateGadget(context,config_id)
ScriptLib.SetGadgetStateByConfigId(context, config_id, 202)
ScriptLib.SetPlatformPointArray(context, config_id, defs.pointarray_ID, { 1 }, { route_type = 0,turn_mode=true })
local curRot = ScriptLib.GetGroupVariableValue(context, config_id.."rotation")
ScriptLib.SetGroupVariableValue(context, config_id.."rotation", (curRot+120)%360)
end
function action_PlatformArrive(context, evt)
ScriptLib.PrintContextLog(context, "@@ LUA_Log : RotObelisk action_PlatformArrive start ")
local config_id = evt.param1
local curRot = ScriptLib.GetGroupVariableValue(context, config_id.."rotation")
if(curRot==0)then
ScriptLib.SetGadgetStateByConfigId(context, config_id, 201)
else
ScriptLib.SetGadgetStateByConfigId(context, config_id, 0)
end
if(CheckIsAllStatic(context))then
for _,v in pairs(obeliskList)do
ScriptLib.SetWorktopOptionsByGroupId(context,base_info.group_id , v.config_id, {defs.option_id})
end
ScriptLib.PrintContextLog(context, "@@ LUA_Log : RotObelisk_Select action_PlatformArrive add btn ")
end
if(CheckIsSuccess(context))then
ScriptLib.SetGroupVariableValue(context, "success", 1)
for _,v in pairs(obeliskList)do
ScriptLib.SetWorktopOptionsByGroupId(context,base_info.group_id , v.config_id, {})
ScriptLib.SetGadgetStateByConfigId(context, v.config_id, 203)
end
ScriptLib.PrintContextLog(context, "@@ LUA_Log : RotObelisk_Select success ")
end
ScriptLib.PrintContextLog(context, "@@ LUA_Log : RotObelisk_Select action_PlatformArrive end ")
return 0
end
function CheckIsAllStatic(context)
for _,v in pairs(obeliskList)do
if(ScriptLib.GetGadgetStateByConfigId(context, 0, v.config_id)==202)then
return false
end
end
return true
end
function CheckIsSuccess(context)
for _,v in pairs(obeliskList)do
if(ScriptLib.GetGadgetStateByConfigId(context, 0, v.config_id)~=201)then
return false
end
end
return true
end
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
table.insert(variables,{ config_id=40000001,name = "success", value = 0, no_refresh = true})
for i=1,#obeliskList do
if obeliskList[i].config_id ~= 0 then
table.insert(variables,{ config_id=60000000+obeliskList[i].config_id,name = obeliskList[i].config_id.."rotation", value = obeliskList[i].rotation})
end
end
end
LF_Initialize_Group(triggers, suites)
@@ -0,0 +1,282 @@
--ServerUploadTool Save to [/root/env/data/lua/common/V3_1]
--[[
=====================================================================================================================
|| Filename || Desert_HourGlass
|| RelVersion || 3.1
|| Owner || xudong.sun
|| Description || 3.1版本沙漏计时玩法
|| LogName || ## Desert_HourGlass_LOG
|| Protection || 按下按键时自动检查当前是否可以开启挑战
=====================================================================================================================
local HourGlass_ConfigIDList = {}
local glassNum = 4
--8.25新增 防止多个挑战叠加
local forceStopGroup = {}
=======================================================================================]]
local glassNum = #HourGlass_ConfigIDList
local extrTriggers = {
initialtrigger = {
["Enter_Region"] = { config_id = 80000001, name = "Enter_Region", event= EventType.EVENT_ENTER_REGION, source = "1", condition = "", action = "action_player_in_region", trigger_count = 0, tag = "999" },
["challenge_Success"] = { config_id = 80000002, name = "challenge_Success", event= EventType.EVENT_CHALLENGE_SUCCESS, source = "", condition = "", action = "action_challengeSuccess", trigger_count = 0 },
["challenge_Fail"] = { config_id = 80000003, name = "challenge_Fail", event= EventType.EVENT_CHALLENGE_FAIL, source = "", condition = "", action = "action_challengeFail", trigger_count = 0 },
["Group_Load"] = { config_id = 80000004, name = "Group_Load", event= EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_GroupLoad", trigger_count = 0 },
["Group_UnLoad"] = { config_id = 80000005, name = "Group_UnLoad", event= EventType.EVENT_GROUP_WILL_UNLOAD, source = "", condition = "", action = "actiong_group_unload", trigger_count = 0 },
}
}
function action_player_in_region( context, evt )
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : Player In EndRegion")
return 0
end
function action_GroupLoad( context, evt )
--清空挑战开始标记位
ScriptLib.SetGroupVariableValue(context, "HourGlass_InChallenge", 0)
ScriptLib.SetGroupVariableValue(context, "HourGlass_InTime", 0)
if ScriptLib.GetGroupVariableValue(context, "HourGlass_Success")==1 then
--挑战完成,将所有沙漏置为完成态
for i,v in ipairs(HourGlass_ConfigIDList) do
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 203)
end
else
--挑战未完成,将所有非特殊状态的沙漏复位
for i,v in ipairs(HourGlass_ConfigIDList) do
if ScriptLib.GetGadgetStateByConfigId(context, 0, v) ~= 204 and ScriptLib.GetGadgetStateByConfigId(context, 0, v) ~= 901 then
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : 初始化 configID:"..v)
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 0)
end
end
end
return 0
end
function action_challengeSuccess( context, evt )
if evt.source_name == "1" then
--设置沙漏状态
for i,v in ipairs(HourGlass_ConfigIDList) do
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v, "SGV_HourGlass_Active", 0)
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 203)
end
ScriptLib.SetGroupVariableValue(context, "HourGlass_Success", 1)
--设置挑战开启标志
ScriptLib.SetGroupVariableValue(context, "HourGlass_InChallenge", 0)
end
return 0
end
function action_challengeFail( context, evt )
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : 触发挑战失败,id = "..evt.source_name)
if evt.source_name == "1" then
--设置沙漏状态
for i,v in ipairs(HourGlass_ConfigIDList) do
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v, "SGV_HourGlass_Active", 0)
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 0)
end
--设置挑战开启标志
ScriptLib.SetGroupVariableValue(context, "HourGlass_InChallenge", 0)
elseif evt.param1==2010067 then
ScriptLib.StopChallenge(context, tonumber(evt.source_name), 1)
ScriptLib.AttachChildChallenge(context, 1, tonumber(evt.source_name), 2010068, { 10, 30, 10},{},{success = 0,fail = 0})
ScriptLib.SetEntityServerGlobalValueByConfigId(context, ScriptLib.GetGroupTempValue(context, "childChallenge"..tonumber(evt.source_name),{}), "SGV_HourGlass_Active", 0)
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, ScriptLib.GetGroupTempValue(context, "childChallenge"..tonumber(evt.source_name),{}), 201)
ScriptLib.SetGroupTempValue(context, "childChallenge"..tonumber(evt.source_name), 0,{})
for i=2,glassNum+1 do
if ScriptLib.GetGroupTempValue(context, "childChallenge"..i,{})~=0 then
return 0
end
end
ScriptLib.StopChallenge(context, 1, 0)
end
return 0
end
function actiong_group_unload( context, evt )
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : 触发unload")
ScriptLib.StopChallenge(context, 1, 0)
return 0
end
function SLC_HourGlass_SetSGV( context, value )
if ScriptLib.GetGroupVariableValue(context, "HourGlass_Success")==1 then
return 0
end
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : ServerLuaCall SetSGV")
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : target_eid = "..context.target_entity_id)
local configID = ScriptLib.GetGadgetConfigId(context, { gadget_eid = context.target_entity_id })
--客户端按下按键,纯计时版
if value == 3 then
--检查是否有建筑师版
for i,v in ipairs(HourGlass_ConfigIDList) do
local entityID = ScriptLib.GetEntityIdByConfigId(context, v)
if ScriptLib.GetGadgetIdByEntityId(context, entityID) == 70330310 and ScriptLib.GetGadgetStateByConfigId(context, 0, v) == 204 then
ScriptLib.ShowReminderByUid(context, {context.owner_uid}, 33010076)
return 0
end
end
--设置沙漏状态
ScriptLib.SetEntityServerGlobalValueByConfigId(context, configID, "SGV_HourGlass_Active", 1)
ScriptLib.SetGroupVariableValue(context, "HourGlass_InTime", 1)
end
--纯计时版的停止逻辑
if value == 0 then
ScriptLib.SetEntityServerGlobalValueByConfigId(context, configID, "SGV_HourGlass_Active", 0)
ScriptLib.SetGroupVariableValue(context, "HourGlass_InTime", 0)
end
--客户端按下按键,寻找沙漏玩法
if value == 1 or value == 2 then
--设置沙漏开始计时
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : configID = "..configID)
--检查是否有建筑师版
for i,v in ipairs(HourGlass_ConfigIDList) do
local entityID = ScriptLib.GetEntityIdByConfigId(context, v)
if ScriptLib.GetGadgetIdByEntityId(context, entityID) == 70330310 and ScriptLib.GetGadgetStateByConfigId(context, 0, v) == 204 then
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : configID "..v.." 失败")
ScriptLib.ShowReminderByUid(context, {context.owner_uid}, 33010076)
return 0
else
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : configID "..v.." 通过")
end
end
--设置挑战开始
if ScriptLib.GetGroupVariableValue(context, "HourGlass_InChallenge") == 0 then
--8.25新增 防止多个挑战叠加
--旧挑战设置失败
if forceStopGroup~=nil and #forceStopGroup>0 then
for i,v in ipairs(forceStopGroup) do
ScriptLib.ExecuteGroupLua(context, v, "SLC_ForceStopChallenge", {})
end
end
--ScriptLib.StartChallenge(context, 1, ChallengeID, ChallengeParam)
ScriptLib.CreateFatherChallenge(context, 1, 2010066, 300, {success = 10, fail = 5})
ScriptLib.AttachChildChallenge(context, 1, 2, 2010067, { base_info.group_id, 100, value*30 ,5},{},{success = 0,fail = 0})
for i=3,glassNum+1 do
ScriptLib.AttachChildChallenge(context, 1, i, 2010068, { 10, value*30, 10},{},{success = 0,fail = 0})
end
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : 挑战关联完成")
--记录挑战tempvalu
ScriptLib.SetGroupTempValue(context, "childChallenge2", configID,{})
for i=3,glassNum+1 do
ScriptLib.SetGroupTempValue(context, "childChallenge"..i, 0,{})
end
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : Tempvalue记录完成")
--设置沙漏状态
for i,v in ipairs(HourGlass_ConfigIDList) do
if v~= configID then
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 201)
else
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, 202)
end
end
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : 沙漏状态设置完成")
ScriptLib.StartFatherChallenge(context,1)
--设置挑战开启标志
ScriptLib.SetGroupVariableValue(context, "HourGlass_InChallenge", 1)
else
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : 开关一次挑战")
for i=2,glassNum+1 do
if ScriptLib.GetGroupTempValue(context, "childChallenge"..i,{}) == 0 then
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, configID, 202)
ScriptLib.StopChallenge(context, i, 1)
ScriptLib.AttachChildChallenge(context, 1, i, 2010067, { base_info.group_id, 100, value*30 ,5},{},{success = 0,fail = 0})
ScriptLib.SetGroupTempValue(context, "childChallenge"..i, configID,{})
break
end
end
end
ScriptLib.SetEntityServerGlobalValueByConfigId(context, configID, "SGV_HourGlass_Active", 1)
--检查当前沙漏是否都已经开始计时
for i,v in ipairs(HourGlass_ConfigIDList) do
if ScriptLib.GetGadgetAbilityFloatValue(context, base_info.group_id, v, "SGV_HourGlass_Active")~= 1 then
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : configID "..v.." is not active")
return 0
end
end
ScriptLib.PrintContextLog(context, "## Desert_HourGlass_LOG : 挑战成功")
ScriptLib.StopChallenge(context, 1, 1)
end
return 0
end
--8.25新增 防止多个挑战叠加
function SLC_ForceStopChallenge(context, prev_context)
ScriptLib.StopChallenge(context, 1, 0)
return 0
end
function LF_Initialize_Group()
for k,v in pairs(extrTriggers.initialtrigger) do
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
table.insert(variables,{ config_id=50000001, name = "HourGlass_Success", value = 0, no_refresh = true})
table.insert(variables,{ config_id=50000002, name = "HourGlass_InTime", value = 0, no_refresh = true})
table.insert(variables,{ config_id=50000003, name = "HourGlass_InChallenge", value = 0, no_refresh = true})
return 0
end
LF_Initialize_Group()
@@ -0,0 +1,176 @@
---
--- Generated by Luanalysis
--- Created by binghong.shen_187191.
--- DateTime: 2022/6/7 14:36
---
--[[======================================
|| filename: DeshretElevator
|| owner: binghong.shen
|| description: 赤王庙电梯
|| LogName: DeshretElevator
|| Protection: [Protection]
=======================================]]
--[[
defs.elevatorOptionID
defs.gadget_elevatorID
defs.finalMovePoints
--]]
---
local extrTriggers = {
initialtrigger = {
{ config_id = 80000001, name = "OnWorkOptionSelect", event= EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_OnWorkOptionSelect", trigger_count = 0},
{ config_id = 80000002, name = "OnPlatformReach", event= EventType.EVENT_PLATFORM_ARRIVAL, source = "", condition = "", action = "action_OnPlatformReach", trigger_count = 0},
{ config_id = 80000004, name = "OnGroupLoad", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_OnGroupLoad", trigger_count = 0},
}
}
function action_OnGroupLoad(context, evt)
ScriptLib.PrintContextLog(context, "@@ DeshretElevator : elevator action_OnGroupLoad")
local curMovePoint = ScriptLib.GetGroupVariableValue(context, "CurMovePoint")
local pointArrayID = ScriptLib.GetGroupVariableValue(context, "pointarray_ID")
ScriptLib.SetPlatformPointArray(context, defs.gadget_elevatorID, pointArrayID, {curMovePoint}, { route_type = 0,record_mode=1 })
local isBlockMoveMode = ScriptLib.GetGroupVariableValue(context, "IsBlockMoveMode")
if isBlockMoveMode == 1 then
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_elevatorID, 203)
else
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_elevatorID, 201)
end
return 0
end
function action_OnWorkOptionSelect(context, evt)
ScriptLib.PrintContextLog(context, "@@ DeshretElevator : elevator action_OnWorkOptionSelect")
local optionID = evt.param2
if(optionID == defs.elevatorOptionID)then
local curMovePoint = ScriptLib.GetGroupVariableValue(context, "CurMovePoint")
local movePoint1 = ScriptLib.GetGroupVariableValue(context, "MovePoint1")
local movePoint2 = ScriptLib.GetGroupVariableValue(context, "MovePoint2")
local toMovePoint = 0
if(movePoint1==curMovePoint)then
toMovePoint = movePoint2
else
toMovePoint = movePoint1
end
TryMoveElevatorToPoint(context,toMovePoint)
end
return 0
end
function SetElevator(context,PointArray,Point)
ScriptLib.SetGroupVariableValue(context, "pointarray_ID",PointArray)
ScriptLib.SetGroupVariableValue(context, "IsFinalMove",0)
ScriptLib.SetGroupVariableValue(context, "CurMovePoint",Point)
ScriptLib.SetGroupVariableValue(context, "MovePoint1",1)
ScriptLib.SetGroupVariableValue(context, "MovePoint2",2)
ScriptLib.StopPlatform(context, defs.gadget_elevatorID)
ScriptLib.SetPlatformPointArray(context, defs.gadget_elevatorID, PointArray, {Point}, { route_type = 0,record_mode=1 })
local isBlockMoveMode = ScriptLib.GetGroupVariableValue(context, "IsBlockMoveMode")
if isBlockMoveMode == 1 then
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_elevatorID, 203)
else
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_elevatorID, 201)
end
return 0
end
function SetElevator_finalMove(context,PointArray,StartPoint)
ScriptLib.SetGroupVariableValue(context, "pointarray_ID",PointArray)
ScriptLib.SetGroupVariableValue(context, "IsFinalMove",1)
ScriptLib.SetGroupVariableValue(context, "CurMovePoint",StartPoint)
ScriptLib.SetGroupVariableValue(context, "MovePoint1",defs.finalMovePoints[1])
ScriptLib.SetGroupVariableValue(context, "MovePoint2",defs.finalMovePoints[#defs.finalMovePoints])
ScriptLib.StopPlatform(context, defs.gadget_elevatorID)
ScriptLib.SetPlatformPointArray(context, defs.gadget_elevatorID, PointArray, {StartPoint}, { route_type = 0,record_mode=1 })
local isBlockMoveMode = ScriptLib.GetGroupVariableValue(context, "IsBlockMoveMode")
if isBlockMoveMode == 1 then
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_elevatorID, 203)
else
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_elevatorID, 201)
end
return 0
end
function TryMoveElevatorToPoint(context,Point)
ScriptLib.PrintContextLog(context, "@@ DeshretElevator : elevator TryMoveElevatorToPoint "..Point)
local curMovePoint = ScriptLib.GetGroupVariableValue(context, "CurMovePoint")
if(curMovePoint==Point)then
ScriptLib.ShowReminder(context, 400191)
return 0
end
local pointArrayID = ScriptLib.GetGroupVariableValue(context, "pointarray_ID")
ScriptLib.PrintContextLog(context, "@@ DeshretElevator : elevator pointArrayID "..pointArrayID)
--先停再移动
ScriptLib.StopPlatform(context, defs.gadget_elevatorID)
local IsFinalMove = ScriptLib.GetGroupVariableValue(context, "IsFinalMove")
if IsFinalMove == 1 then
local movePoints = {}
if(defs.finalMovePoints[1]==Point)then
for i = #defs.finalMovePoints,1,-1 do
table.insert(movePoints,defs.finalMovePoints[i])
end
else
movePoints = defs.finalMovePoints
end
ScriptLib.SetPlatformPointArray(context, defs.gadget_elevatorID, pointArrayID, movePoints, { route_type = 0,record_mode=1 })
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_elevatorID, 203)
else
ScriptLib.SetPlatformPointArray(context, defs.gadget_elevatorID, pointArrayID, {Point}, { route_type = 0,record_mode=1 })
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_elevatorID, 201)
end
ScriptLib.SetGroupVariableValue(context, "CurMovePoint",Point)
return 0
end
function action_OnPlatformReach(context, evt)
ScriptLib.PrintContextLog(context, "@@ DeshretElevator : elevator action_OnPlatformReach")
local config_id = evt.param1
local reachPoint = evt.param3
local curMovePoint = ScriptLib.GetGroupVariableValue(context, "CurMovePoint")
if(config_id == defs.gadget_elevatorID and reachPoint == curMovePoint)then
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_elevatorID, 0)
end
return 0
end
function SLC_DeshretElevatorUpdate(context, value)
ScriptLib.PrintContextLog(context, "@@ DeshretElevator : elevator SLC_DeshretElevatorUpdate")
local gadgetID = ScriptLib.GetGadgetConfigId(context, {gadget_eid = context.source_entity_id})
if(value == 0)then
ScriptLib.SetWorktopOptionsByGroupId(context, base_info.group_id, gadgetID, {defs.elevatorOptionID})
else
ScriptLib.SetWorktopOptionsByGroupId(context, base_info.group_id, gadgetID, {})
end
return 0
end
function LF_Initialize_Group()
for _,v in pairs(extrTriggers.initialtrigger) do
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
--table.insert(variables,{ config_id=50000001,name = "CurMovePoint", value = 1 })
--table.insert(variables,{ config_id=50000002,name = "pointarray_ID", value = 1 })
--table.insert(variables,{ config_id=50000003,name = "MovePoint1", value = 1 })
--table.insert(variables,{ config_id=50000004,name = "MovePoint2", value = 2 })
--table.insert(variables,{ config_id=50000005,name = "IsBlockMoveMode", value = 0 })
--table.insert(variables,{ config_id=50000005,name = "IsFinalMove", value = 0 })
return 0
end
LF_Initialize_Group()
@@ -0,0 +1,77 @@
--ServerUploadTool Save to [/root/env/data/lua/common/V3_1]
--[[
=====================================================================================================================
|| Filename || Engineer_Laser
|| RelVersion || 3.1
|| Owner || xudong.sun
|| Description || 3.1建筑师射线
|| LogName || ## Engineer_Laser_LOG
|| Protection ||
=====================================================================================================================
local engineerLaserConfigID = 0
local turnOption = 0
local correctState = 0
=======================================================================================]]
local nextState ={
[0]= 201,
[201]= 202,
[202]= 0,
}
local extrTriggers = {
initialtrigger = {
["Gadget_Create"] = { config_id = 80000002, name = "Gadget_Create", event= EventType.EVENT_GADGET_CREATE, source = "", condition = "", action = "action_gadget_create", trigger_count = 0},
["State_Change"] = { config_id = 80000003, name = "State_Change", event= EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_state_change", trigger_count = 0},
}
}
function action_state_change( context, evt )
if evt.param1 == correctState and evt.param2 == engineerLaserConfigID then
ScriptLib.SetEntityServerGlobalValueByConfigId(context, engineerLaserConfigID, "SGV_HAS_LASER", 1)
elseif evt.param1 ~= correctState and evt.param2 == engineerLaserConfigID then
ScriptLib.SetEntityServerGlobalValueByConfigId(context, engineerLaserConfigID, "SGV_HAS_LASER", 0)
end
return 0
end
function action_gadget_create( context, evt )
if evt.param1 == engineerLaserConfigID then
if ScriptLib.GetGadgetStateByConfigId(context, 0, engineerLaserConfigID) == correctState then
ScriptLib.SetEntityServerGlobalValueByConfigId(context, engineerLaserConfigID, "SGV_HAS_LASER", 1)
else
ScriptLib.SetEntityServerGlobalValueByConfigId(context, engineerLaserConfigID, "SGV_HAS_LASER", 0)
end
end
return 0
end
function SLC_EngineerMark( context )
local eid = context.source_entity_id
ScriptLib.MarkGroupLuaAction(context, "getengineer", "", {group_id = base_info.group_id ,config_id = ScriptLib.GetGadgetConfigId(context, { gadget_eid = eid }) })
return 0
end
function LF_Initialize_Group()
for k,v in pairs(extrTriggers.initialtrigger) do
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
return 0
end
LF_Initialize_Group()
@@ -0,0 +1,8 @@
function SLC_EngineerMark( context )
local eid = context.source_entity_id
ScriptLib.MarkGroupLuaAction(context, "getengineer", "", {group_id = base_info.group_id ,config_id = ScriptLib.GetGadgetConfigId(context, { gadget_eid = eid }) })
return 0
end
@@ -0,0 +1,498 @@
--2.5换人挑战玩法
--ServerUploadTool Save to [/root/env/data/lua/common/V2_5]
--miscs配置内容
--[[
击杀数量,每击杀一定数量的怪物,换一个刷怪池子,到最后一个池子时无限刷怪
没有精英怪
一关内最多5个池子,难度会逐渐提升,一关定时4分钟,
普通玩家可能只能刷到池子3,能拿到所有奖励,头部玩家能刷到池子5,后面的2个池子就是用于给头部玩家进行
--fever进度升级节点
local fever_progress_table = {
0,40,120,270,570,800
}
--各等级fever的下降速率
local fever_attenuation = {
-1,-1,-2,-2,-3
}
--地城对应的天气配置
local DungeonWeather = {
10039,10040,10041,10042
}
--怪物潮
local monster_tide = {
[1] = {2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2048,2049,2050,2051},
[2] = {2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2052,2053,2054,2055},
[3] = {2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2056,2057,2058,2059},
[4] = {2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2056,2057,2058,2059},
[5] = {2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2056,2057,2058,2059},
}
local defs = {
group_id = 235801002,
worktop_id = 123, --操作台对应的操作数
air_wall = 2005, --场内空气墙对应的ConfigID
minion_fever = 5, --普通怪物死亡增加的热度值
game_time = 360, --挑战时间
min_monster_count = 5, --场上最少怪物数量
max_monster_count = 5, --场上最多怪物数量
environment_suite = 4, --环境灯光所在的Suite
noswitch_punishment_interval = 30, --不换人开始有惩罚的最小时间间隔
num_killed_per_tide = {20, 20, 20, 20, 0} --每组怪物潮对应需要的杀怪数量
}
--配置一个region,覆盖场内的战斗空间,用来在玩家进入时创建空气墙
]]
local local_defs = {
worktop_option = 30110,
progress_key = 1,
team_global_value = "FEVER_LEVEL",
team_noswitch_pubishment = "NOSWITCH_PUNISHMENT",
team_has_switch = "HAS_SWITCHED_TEAM",
burn_effect_level = 2,
environment_change_level = 1,
base_upgrade_reminder = 358010102,
team_noswitch_pubishment_reminder = 144,
punish_inAdvance_reminder = 201
}
local time_axis = {
--扣分时间轴,每秒掉一定的分数
fever_axis = {1},
noswitch_punishment_axis = {defs.noswitch_punishment_interval},
noswitch_punishment_inAdvance_axis = {defs.noswitch_punishment_interval-(defs.punish_inAdvance_reminder_time or 3)}
}
local Tri = {
[1] = { name = "group_load", config_id = 8000001, event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0},
[2] = { name = "select_option", config_id = 8000002, event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_select_option", trigger_count = 0},
[3] = { name = "time_axis_pass", config_id = 8000003, event = EventType.EVENT_TIME_AXIS_PASS, source = "", condition = "", action = "action_time_axis_pass", trigger_count = 0},
[4] = { name = "gallery_progress_pass", config_id = 8000004, event = EventType.EVENT_GALLERY_PROGRESS_PASS, source = "", condition = "", action = "action_gallery_progress_pass", trigger_count = 0},
[5] = { name = "monster_tide_die", config_id = 8000005, event = EventType.EVENT_MONSTER_TIDE_DIE, source = "", condition = "", action = "action_monster_tide_die", trigger_count = 0},
[6] = { name = "monster_die_before_leave_scene", config_id = 8000006, event = EventType.EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE, source = "", condition = "", action = "action_monster_die_before_leave_scene", trigger_count = 0},
[7] = { name = "gallery_stop", config_id = 8000007, event = EventType.EVENT_GALLERY_STOP, source = "", condition = "", action = "action_gallery_stop", trigger_count = 0},
[8] = { name = "sumo_switch_team", config_id = 8000008, event = EventType.EVENT_SUMO_SWITCH_TEAM_EVENT, source = "", condition = "", action = "action_sumo_switch_team", trigger_count = 0},
[9] = { name = "dungeon_all_avatar_die", config_id = 8000009, event = EventType.EVENT_DUNGEON_ALL_AVATAR_DIE, source = "", condition = "", action = "action_dungeon_all_avatar_die", trigger_count = 0},
[10] = { name = "dungeon_settle", config_id = 8000010, event = EventType.EVENT_DUNGEON_SETTLE, source = "", condition = "", action = "action_dungeon_settle", trigger_count = 0},
[11] = { name = "enter_start_region", config_id = 8000011, event = EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_enter_start_region", trigger_count = 0},
}
function Initialize()
for k,v in pairs(Tri) do
table.insert(triggers, v)
table.insert(suites[1].triggers, v.name)
end
for config_id,infos in pairs(monsters) do
table.insert(infos.affix, 9009)
end
table.insert(variables,{ config_id=50000001,name = "current_monster_tide", value = 0})
table.insert(variables,{ config_id=50000002,name = "current_elite", value = 1})
table.insert(variables,{ config_id=50000003,name = "fever_ratio", value = 1})
--用于记录当前是否开启不换队惩罚,用于客户端断线重连时恢复状态
table.insert(variables,{ config_id=50000004,name = "is_noswitch_punishment", value = 0})
--用于记录当前怪物潮中的击杀数量,当击杀数量达到配置数量时,加载下一波怪物潮
table.insert(variables,{ config_id=50000005,name = "num_current_minion_killed", value = 0})
--用于记录是否已经创建空气墙,防止玩家卡在空气墙外
table.insert(variables,{ config_id=50000006,name = "is_air_wall_created", value = 0})
--用于记录当前怪物潮是否处于切换状态
table.insert(variables,{ config_id=50000007,name = "is_tide_being_switched", value = 0})
end
------------------------------------------------------------------
--group load后,加载操作台选项
function action_group_load(context,evt)
ScriptLib.SetWorktopOptionsByGroupId(context, defs.group_id, defs.worktop_id, {local_defs.worktop_option})
--开场就直接加载氛围物件,不要等玩家开启挑战
--加载环境氛围物件
ScriptLib.AddExtraGroupSuite(context,defs.group_id, defs.environment_suite)
return 0
end
--按下操作台按键,启动玩法
function action_select_option(context,evt)
--如果空气墙没有提前创建,那么不会处理开始事件
if 1~= ScriptLib.GetGroupVariableValue(context,"is_air_wall_created") then
return -1
end
ScriptLib.DelWorktopOptionByGroupId(context, defs.group_id, defs.worktop_id, local_defs.worktop_option)
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, defs.worktop_id, GadgetState.GearStop)
LF_Start_Play(context)
return 0
end
--时间轴tick事件,根据tick的时间轴不同处理不同逻辑
function action_time_axis_pass(context,evt)
--纯数量刷怪,不再走刷怪Tick
--fever条tick,扣分
if (evt.source_name == "FEVER_AXIS") then
LF_Update_Fever(context,LF_Get_Fever_Subnum(context))
end
--提前显示一下需要换队
if (evt.source_name == "NOSWITCH_PUNISHMENT_INADVANCE_AXIS") then
ScriptLib.ShowTemplateReminder(context, local_defs.punish_inAdvance_reminder, {defs.punish_inAdvance_reminder_time or 3})
end
--不换队tick,如果长时间不换队则将设置惩罚gv
if (evt.source_name == "NOSWITCH_PUNISHMENT_AXIS") then
ScriptLib.ShowTemplateReminder(context, local_defs.team_noswitch_pubishment_reminder, {0})
ScriptLib.SetGroupVariableValue(context,"is_noswitch_punishment",1)
LF_Set_Team_Global_Value(context,local_defs.team_noswitch_pubishment,1)
end
return 0
end
--fever升级时,给team挂global value,并激活场景氛围物件
function action_gallery_progress_pass(context,evt)
local fever_level = evt.param1
ScriptLib.PrintContextLog(context,"FS: Fever uprade to level "..fever_level)
ScriptLib.ShowReminder(context, local_defs.base_upgrade_reminder+fever_level)
LF_Set_Team_Global_Value(context,local_defs.team_global_value,fever_level)
LF_Activate_Environment_Gadget(context,fever_level)
return 0
end
function action_gallery_stop(context,evt)
LF_Stop_Play(context)
return 0
end
--当前的怪物潮刷完的时候,重置当前的怪物潮或者刷下一波怪物潮
function action_monster_tide_die(context,evt)
-- ScriptLib.PrintContextLog(context,"FS: Tide Clear"..evt.param1)
-- local is_being_switched = ScriptLib.GetGroupVariableValue(context,"is_tide_being_switched")
-- ScriptLib.PrintContextLog(context,"FS: Tide Switch"..is_being_switched)
local current_monster_tide = LF_Get_Current_Monster_Tide(context)
local current_tide_list = monster_tide[current_monster_tide]
-- ScriptLib.PrintContextLog(context,"FS: Tide Max"..(#current_tide_list))
--不在刷够怪物切换怪物潮的过程中
--如果当前怪物潮已经被杀完了
if evt.param1 >= #current_tide_list then
if defs.num_killed_per_tide[current_monster_tide] == 0 then
LF_Refresh_Monster_Tide(context,"Current")
else
LF_Refresh_Monster_Tide(context,"Next")
end
end
return 0
end
--有怪死亡时,计分,并更新fever条,怪物死亡只处理积分
function action_monster_die_before_leave_scene(context,evt)
local monster_eid = evt.source_eid
local monster_cid = evt.param1
local fever_ratio = ScriptLib.GetGroupVariableValue(context,"fever_ratio")
local monster_fever = monsters[monster_cid].kill_score
LF_Update_Fever(context,monster_fever*fever_ratio)
LF_Update_Score(context,monster_eid)
return 0
end
function LF_Refresh_Monster_Tide(context, refresh_mode)
local current_monster_tide_index = LF_Get_Current_Monster_Tide(context)
-- ScriptLib.KillMonsterTide(context, defs.group_id, LF_Get_Current_Tide_Num(context))
-- ScriptLib.SetGroupVariableValue(context,"is_tide_being_switched",1)
if refresh_mode == "Current" then
LF_Set_Current_Monster_Tide(context, current_monster_tide_index)
LF_Create_Monster_Tide(context,current_monster_tide_index)
ScriptLib.PrintContextLog(context,"FS: Tide Clear Refresh Current")
end
if refresh_mode == "Next" then
LF_Set_Current_Monster_Tide(context, current_monster_tide_index + 1)
LF_Create_Monster_Tide(context,current_monster_tide_index + 1)
ScriptLib.PrintContextLog(context,"FS: Tide Clear Refresh Next")
end
-- LF_Set_Current_Tide_Minion_Killed(context,0)
-- ScriptLib.SetGroupVariableValue(context,"is_tide_being_switched",0)
end
--玩家换队时触发,启动一个一定时间的时间轴,时间轴tick时修改global value给玩家挂debuff
function action_sumo_switch_team(context,evt)
--刚刚换队,先清掉team上的换队惩罚global value,并开始计时,如果tick时没有换队,则挂上惩罚标记gv
LF_Set_Team_Global_Value(context,local_defs.team_noswitch_pubishment,0)
ScriptLib.EndTimeAxis(context,"NOSWITCH_PUNISHMENT_AXIS")
ScriptLib.InitTimeAxis(context,"NOSWITCH_PUNISHMENT_AXIS",time_axis.noswitch_punishment_axis,false)
--清理换队提示
ScriptLib.EndTimeAxis(context,"NOSWITCH_PUNISHMENT_INADVANCE_AXIS")
ScriptLib.InitTimeAxis(context,"NOSWITCH_PUNISHMENT_INADVANCE_AXIS",time_axis.noswitch_punishment_inAdvance_axis,false)
--换队增加热情值
LF_Update_Fever(context,defs.switch_team_fever)
--换队的时候给服务端发送消息,让客户端显示惩罚倒计时UI
local uid_list = ScriptLib.GetSceneUidList(context)
if uid_list and nil~=uid_list[1]then
ScriptLib.UpdatePlayerGalleryScore(context, defs.gallery_id, {["uid"] = uid_list[1], ["noswitch_time"] = defs.noswitch_punishment_interval})
end
--清除当前显示的换队惩罚的reminder
local uid_list = ScriptLib.GetSceneUidList(context)
local ret = ScriptLib.RevokePlayerShowTemplateReminder(context, local_defs.team_noswitch_pubishment_reminder, {})
ScriptLib.RevokePlayerShowTemplateReminder(context, local_defs.punish_inAdvance_reminder, {})
ScriptLib.PrintContextLog(context,"FS: Clear reminder result"..ret)
--换队的时候修改team的gv,重新刷一下新的avatar身上的加成效果
LF_Set_Team_Global_Value(context,local_defs.team_has_switch,1)
ScriptLib.SetGroupVariableValue(context,"is_noswitch_punishment",0)
return 0
end
--玩家进入区域直接创建空气墙,防止卡延迟出圈
function action_enter_start_region(context,evt)
--加载空气墙
ScriptLib.CreateGadget(context,{config_id = defs.air_wall})
ScriptLib.SetGroupVariableValue(context,"is_air_wall_created",1)
return 0
end
--团灭触发,直接结束玩法
function action_dungeon_all_avatar_die(context,evt)
LF_Stop_Play(context)
return 0
end
function action_dungeon_settle(context,evt)
LF_Stop_Play(context)
return 0
end
------------------------------------------------------------------
--辅助方法---------------------------------------------------------
------------------------------------------------------------------
--关卡相关方法-----------------------------------------------------
--启动玩法方法,初始化各种东西
function LF_Start_Play(context)
ScriptLib.StartGallery(context, defs.gallery_id)
ScriptLib.InitGalleryProgressScore(context, "fever", defs.gallery_id, fever_progress_table, GalleryProgressScoreUIType.GALLERY_PROGRESS_SCORE_UI_TYPE_SUMO_STAGE, GalleryProgressScoreType.GALLERY_PROGRESS_SCORE_NO_DEGRADE)
ScriptLib.InitTimeAxis(context,"FEVER_AXIS",time_axis.fever_axis,true)
LF_Set_Current_Tide_Num(context,0)
LF_Set_Current_Monster_Tide(context,1)
LF_Create_Monster_Tide(context,1)
--启动玩法时给第一队挂一下gv,防止一开始就受到惩罚;并开启时间轴开始计时
LF_Set_Team_Global_Value(context,local_defs.team_noswitch_pubishment,0)
ScriptLib.InitTimeAxis(context,"NOSWITCH_PUNISHMENT_AXIS",time_axis.noswitch_punishment_axis,false)
ScriptLib.InitTimeAxis(context,"NOSWITCH_PUNISHMENT_INADVANCE_AXIS",time_axis.noswitch_punishment_inAdvance_axis,false)
--玩法开始的时候给服务端发送消息,让客户端显示惩罚倒计时UI
local uid_list = ScriptLib.GetSceneUidList(context)
if uid_list and nil~=uid_list[1]then
ScriptLib.UpdatePlayerGalleryScore(context, defs.gallery_id, {["uid"] = uid_list[1], ["noswitch_time"] = defs.noswitch_punishment_interval})
end
end
--终止玩法方法,关掉各种东西
function LF_Stop_Play(context)
local current_monster_tide = LF_Get_Current_Monster_Tide(context)
--清理一下空气墙,防止其他问题
ScriptLib.RemoveEntityByConfigId(context, defs.group_id, EntityType.GADGET, defs.air_wall)
--玩法结束,清理掉当前的怪物潮
ScriptLib.KillMonsterTide(context, defs.group_id, current_monster_tide)
ScriptLib.StopGallery(context, defs.gallery_id,true)
ScriptLib.EndTimeAxis(context,"FEVER_AXIS")
--关闭一下地城,以正确触发重新挑战
ScriptLib.CauseDungeonFail(context)
end
--启动一波指定ID的怪物潮,需要传入该波怪物潮的ID(具体配置在miscs中定义)
function LF_Create_Monster_Tide(context,monster_tide_index)
ScriptLib.PrintContextLog(context,"FS: Creating monster tide ["..monster_tide_index.."]")
local monster_config_id_list = monster_tide[monster_tide_index]
--增加怪物潮的计数,下一次开启时index会+1,防止索引到同一波怪物潮
local tide_num = LF_Get_Current_Tide_Num(context)
LF_Set_Current_Tide_Num(context,tide_num+1)
local current_monster_tide = LF_Get_Current_Monster_Tide(context)
ScriptLib.AutoMonsterTide(context, tide_num+1, defs.group_id, monster_config_id_list, #monster_config_id_list, tide_suite_config[current_monster_tide].min, tide_suite_config[current_monster_tide].max)
end
--刷新指定
--通用类方法-------------------------------------------------------
--切换场上的场景氛围物件状态
function LF_Activate_Environment_Gadget(context,fever_level)
ScriptLib.PrintContextLog(context,"FS: Activate environment gadgets! Fever Level_"..fever_level)
--根据当前的fever等级,改变天气
if (fever_level>local_defs.environment_change_level) then
ScriptLib.PrintContextLog(context,"FS: Changing environment weather!")
local ret = ScriptLib.SetWeatherAreaState(context, DungeonWeather[fever_level],1)
ScriptLib.PrintContextLog(context,"FS: The result of starting weather ".. DungeonWeather[fever_level].."is "..ret)
local ret = ScriptLib.EnterWeatherArea(context, DungeonWeather[fever_level])
ScriptLib.PrintContextLog(context,"FS: The result of changing weather".. DungeonWeather[fever_level].."is "..ret)
end
--切换场上所有的物件的状态
for i = 1, #suites[defs.environment_suite].gadgets do
local config_id = suites[defs.environment_suite].gadgets[i]
local gadget_id = LF_Get_Gadget_Id_By_Config_Id(context,config_id)
--大小火盆
if (gadget_id == 70350306 or gadget_id == 70350307) then
if (fever_level<local_defs.burn_effect_level) then
--点燃小火
--ScriptLib.PrintContextLog(context,"FS: Burn little fire!")
local ret = ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, config_id, 101)
end
if (fever_level<#fever_progress_table-2 and fever_level>=local_defs.burn_effect_level) then
--喷大火,5秒后转回小火
--ScriptLib.PrintContextLog(context,"FS: Burn middle fire!")
local ret = ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, config_id, 201)
end
if (fever_level >= #fever_progress_table-2) then
--持续喷大火
--ScriptLib.PrintContextLog(context,"FS: Burn super fire!")
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, config_id, 202)
end
end
--挂灯
if (gadget_id == 70350308) then
if (fever_level>=local_defs.burn_effect_level) then
--点燃小火
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, config_id, 201)
end
end
--场景氛围
if (gadget_id == 70350309) then
--转到对应的gadgetStatedefault-0、phase1-201、phase2-202、phase3-203、phase4-204
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, config_id, 200+fever_level)
end
end
end
--给team挂global value,角色处理各种特殊效果
function LF_Set_Team_Global_Value(context,gv_name,value)
--ScriptLib.PrintContextLog(context,"FS: Sending global values to team!")
local uid_list = ScriptLib.GetSceneUidList(context)
ScriptLib.SetTeamEntityGlobalFloatValue(context, uid_list, gv_name, value)
end
-----CRUD类方法----------------------------------------------------
--更新fever条,fever_delta为fever条改变值
function LF_Update_Fever(context,fever_delta)
-- ScriptLib.PrintContextLog(context,"FS: Update Fever!")
ScriptLib.AddGalleryProgressScore(context, "fever", defs.gallery_id, fever_delta)
end
--更新积分,需要传入目标monster的entity id
function LF_Update_Score(context,monster_eid)
-- ScriptLib.PrintContextLog(context,"FS: Update Score!")
local uid_list = ScriptLib.GetSceneUidList(context)
local monster_id = ScriptLib.GetMonsterIdByEntityId(context,monster_eid)
if uid_list and nil~=uid_list[1]then
ScriptLib.UpdatePlayerGalleryScore(context, defs.gallery_id, {["uid"] = uid_list[1], ["monster_id"] = monster_id})
end
end
--返回当前等级下的积分衰减速率
function LF_Get_Fever_Subnum(context)
local fever = ScriptLib.GetGalleryProgressScore(context, "fever", defs.gallery_id)
for i = 1, #fever_progress_table-1 do
local lower_bound = fever_progress_table[i]
local higher_bound = fever_progress_table[i+1]
if fever>=lower_bound and fever<higher_bound then
return fever_attenuation[i]
end
end
return -1
end
--设置当前怪物潮的波次数(注意不等于怪物潮的index)。每次创建怪物潮会使波次数+1,方便索引新的怪物潮
function LF_Set_Current_Tide_Num(context,value)
ScriptLib.SetGroupTempValue(context, "MinionTide", value, {})
end
--获取当前怪物潮的波次数(注意不等于怪物潮的index)。每次创建怪物潮会使波次数+1,方便索引新的怪物潮
function LF_Get_Current_Tide_Num(context)
return ScriptLib.GetGroupTempValue(context, "MinionTide", {})
end
--设置当前怪物潮波次的index
function LF_Set_Current_Monster_Tide(context,index)
ScriptLib.SetGroupVariableValue(context,"current_monster_tide",index)
end
--获取当前怪物潮波次的index
function LF_Get_Current_Monster_Tide(context)
local monster_tide = ScriptLib.GetGroupVariableValue(context,"current_monster_tide")
return monster_tide
end
--2.5新增
--获取当前怪物潮的击杀数量
function LF_Get_Current_Tide_Minion_Killed(context)
local num_minion_killed = ScriptLib.GetGroupVariableValue(context,"num_current_minion_killed")
return num_minion_killed
end
--增加当前怪物潮的击杀数量
function LF_Add_Current_Tide_Minion_Killed(context, num)
ScriptLib.ChangeGroupVariableValue(context,"num_current_minion_killed",num)
end
--设置当前怪物潮的击杀数量
function LF_Set_Current_Tide_Minion_Killed(context, num)
ScriptLib.SetGroupVariableValue(context,"num_current_minion_killed", num)
end
--根据gadget的config_id查询gadget_id
function LF_Get_Gadget_Id_By_Config_Id(context, config_id)
return gadgets[config_id].gadget_id
end
------------------------------------------------------------------
--server lua call-------------------------------------------------
function SLC_Update_Fever_Ratio(context,new_fever_ratio)
ScriptLib.PrintContextLog(context,"FS: SERVER_LUA_CALL: Changing fever ratio to: "..new_fever_ratio)
ScriptLib.SetGroupVariableValue(context,"fever_ratio",new_fever_ratio)
return 0
end
--向客户端下发当前的惩罚状态和fever值,用于客户端重连时请求
function SLC_Refresh_Team_State(context)
ScriptLib.PrintContextLog(context,"FS: SERVER_LUA_CALL: Request for refresh punishment state: ")
local is_noswitch_punishment = ScriptLib.GetGroupVariableValue(context,"is_noswitch_punishment")
LF_Set_Team_Global_Value(context,"NOSWITCH_PUNISHMENT",is_noswitch_punishment)
local fever = ScriptLib.GetGalleryProgressScore(context, "fever", defs.gallery_id)
LF_Set_Team_Global_Value(context,"fever",fever)
return 0
end
------------------------------------------------------------------
Initialize()
@@ -0,0 +1,693 @@
--ServerUploadTool Save to [/root/env/data/lua/common/V2_5]
----fever进度升级节点
--local fever_progress_table = {
-- 0,50,100,200,300,500
--}
----各等级fever的下降速率
--local fever_attenuation = {
-- -1,-2,-3,-4,-5
--}
--
--local monster_tide = {
-- [1] = {2001,2002,2003,2004,2005,2006,2007},
-- [2] = {2008,2009,2010,2011,2012,2013,2014}
--}
--
--local elite = {
-- 2015,2016,2017,2018,2019,2020,2021
--}
--local elite = {
-- [1] = {2001},
-- [2] = {2011,2012},
-- [3] = {2038,2039},
-- [4] = {2040}
--}
--
--local elite_born_points = {
-- 3001,3002,3003,3004,3005,3006,3007
--}
--defs.punish_inAdvance_reminder_time = 3
------
--local defs = {
-- group_id = 235801002,
-- worktop_id = 123,
-- minion_fever = 5,
-- game_time = 360,
-- minion_interval = 120,
-- elite_interval = 30,
-- elite_fever = 50,
-- min_monster_count = 5,
-- max_monster_count = 5,
-- environment_suite = 4,
--}
local local_defs = {
worktop_option = 30110,
progress_key = 1,
team_global_value = "FEVER_LEVEL",
team_noswitch_pubishment = "NOSWITCH_PUNISHMENT",
team_has_switch = "HAS_SWITCHED_TEAM",
burn_effect_level = 2,
environment_change_level = 1,
base_upgrade_reminder = 358010102,
team_noswitch_pubishment_reminder = 144,
punish_inAdvance_reminder = 201
}
local time_axis = {
--小怪潮替换时间轴,每次触发时替换小怪潮
minion_tide_axis = {defs.minion_tide_interval},
--精英怪潮替换时间轴,每次触发时替换精英怪潮
elite_tide_axis = {defs.elite_tide_interval},
--精英怪时间轴,每次触发时刷新一只精英怪
elite_axis = {defs.elite_interval},
--扣分时间轴,每秒掉一定的分数
fever_axis = {1},
noswitch_punishment_axis = {defs.noswitch_punishment_interval},
noswitch_punishment_inAdvance_axis = {defs.noswitch_punishment_interval-(defs.punish_inAdvance_reminder_time or 3)}
}
local Tri = {
[1] = { name = "group_load", config_id = 8000001, event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0},
[2] = { name = "select_option", config_id = 8000002, event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_select_option", trigger_count = 0},
[3] = { name = "time_axis_pass", config_id = 8000003, event = EventType.EVENT_TIME_AXIS_PASS, source = "", condition = "", action = "action_time_axis_pass", trigger_count = 0},
[4] = { name = "gallery_progress_pass", config_id = 8000004, event = EventType.EVENT_GALLERY_PROGRESS_PASS, source = "", condition = "", action = "action_gallery_progress_pass", trigger_count = 0},
[5] = { name = "monster_tide_die", config_id = 8000005, event = EventType.EVENT_MONSTER_TIDE_DIE, source = "", condition = "", action = "action_monster_tide_die", trigger_count = 0},
[6] = { name = "monster_die_before_leave_scene", config_id = 8000006, event = EventType.EVENT_MONSTER_DIE_BEFORE_LEAVE_SCENE, source = "", condition = "", action = "action_monster_die_before_leave_scene", trigger_count = 0},
[7] = { name = "gallery_stop", config_id = 8000007, event = EventType.EVENT_GALLERY_STOP, source = "", condition = "", action = "action_gallery_stop", trigger_count = 0},
[8] = { name = "sumo_switch_team", config_id = 8000008, event = EventType.EVENT_SUMO_SWITCH_TEAM_EVENT, source = "", condition = "", action = "action_sumo_switch_team", trigger_count = 0},
[9] = { name = "dungeon_all_avatar_die", config_id = 8000009, event = EventType.EVENT_DUNGEON_ALL_AVATAR_DIE, source = "", condition = "", action = "action_dungeon_all_avatar_die", trigger_count = 0},
[10] = { name = "dungeon_settle", config_id = 8000010, event = EventType.EVENT_DUNGEON_SETTLE, source = "", condition = "", action = "action_dungeon_settle", trigger_count = 0},
[11] = { name = "enter_start_region", config_id = 8000011, event = EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_enter_start_region", trigger_count = 0},
-- [12] = { name = "monster_create", config_id = 8000012, event = EventType.EVENT_ANY_MONSTER_LIVE, source = "", condition = "", action = "action_monster_create", trigger_count = 0},
[13] = { name = "monster_tide_over", config_id = 8000013, event = EventType.EVENT_MONSTER_TIDE_OVER, source = "", condition = "", action = "action_monster_tide_over", trigger_count = 0},
}
function Initialize()
for k,v in pairs(Tri) do
table.insert(triggers, v)
table.insert(suites[1].triggers, v.name)
end
for config_id,infos in pairs(monsters) do
table.insert(infos.affix, 9009)
end
table.insert(variables,{ config_id=50000001,name = "current_monster_tide", value = 0})
table.insert(variables,{ config_id=50000002,name = "current_elite", value = 1})
table.insert(variables,{ config_id=50000003,name = "fever_ratio", value = 1})
--用于记录当前是否开启不换队惩罚,用于客户端断线重连时恢复状态
table.insert(variables,{ config_id=50000004,name = "is_noswitch_punishment", value = 0})
--用于记录当前精英是否在场,精英在场时,怪物潮不做刷新
table.insert(variables,{ config_id=50000005,name = "is_elite_on_ground", value = 0})
--用于记录当前怪物潮是否结束,当精英死亡时判断当前怪物潮是否处于结束状态,如果是,则直接加载下一波怪物潮
table.insert(variables,{ config_id=50000006,name = "is_current_minion_tide_end", value = 0})
--用于记录是否已经创建空气墙,防止玩家卡在空气墙外
table.insert(variables,{ config_id=50000007,name = "is_air_wall_created", value = 0})
--用于记录场上的怪物总数,当需要切怪物潮时,需要先判断场上已经没有怪物了
table.insert(variables,{ config_id=50000008,name = "monster_count", value = 0})
--用于标记需要监听场上怪物死亡直到怪物数量为0
table.insert(variables,{ config_id=50000009,name = "last_end_tide", value = 0})
table.insert(variables,{ config_id=50000010,name = "refresh_end_tide", value = 0})
end
------------------------------------------------------------------
--group load后,加载操作台选项
function action_group_load(context,evt)
ScriptLib.SetWorktopOptionsByGroupId(context, defs.group_id, defs.worktop_id, {local_defs.worktop_option})
--开场就直接加载氛围物件,不要等玩家开启挑战
--加载环境氛围物件
ScriptLib.AddExtraGroupSuite(context,defs.group_id,defs.environment_suite)
return 0
end
--按下操作台按键,启动玩法
function action_select_option(context,evt)
--如果空气墙没有提前创建,那么不会处理开始事件
if 1~= ScriptLib.GetGroupVariableValue(context,"is_air_wall_created") then
return -1
end
ScriptLib.DelWorktopOptionByGroupId(context, defs.group_id, defs.worktop_id, local_defs.worktop_option)
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, defs.worktop_id, GadgetState.GearStop)
LF_Start_Play(context)
return 0
end
--时间轴tick事件,根据tick的时间轴不同处理不同逻辑
function action_time_axis_pass(context,evt)
--小怪时间轴tick,将小怪潮的index指向下一位(修改group variable
if (evt.source_name == "MINION_TIDE_AXIS") then
ScriptLib.PrintContextLog(context,"FS: MINION_TIDE_AXIS tick!")
LF_Refresh_Currtent_Monster_Tide(context)
end
--精英波次时间轴tick,将精英怪的index指向下一位
if (evt.source_name == "ELITE_TIDE_AXIS") then
ScriptLib.PrintContextLog(context,"FS: ELITE_TIDE_AXIS tick!")
local current_elite_index = LF_Get_Current_Elite_Index(context)
LF_Set_Current_Elite_Index(context,current_elite_index+1)
end
--精英时间轴tick,刷新下一只精英
if (evt.source_name == "ELITE_AXIS") then
ScriptLib.PrintContextLog(context,"FS: ELITE_AXIS tick!")
local current_elite_index = LF_Get_Current_Elite_Index(context)
LF_Create_Elite_Monster(context,current_elite_index)
--性能优化:刷出精英怪时,暂停怪物潮
ScriptLib.PrintContextLog(context,"FS: elite created. Stop monster tide ["..LF_Get_Current_Tide_Num(context).."]")
ScriptLib.PauseAutoMonsterTide(context, defs.group_id, LF_Get_Current_Tide_Num(context))
end
--fever条tick,扣分
if (evt.source_name == "FEVER_AXIS") then
LF_Update_Fever(context,LF_Get_Fever_Subnum(context))
end
--提前显示一下需要换队
if (evt.source_name == "NOSWITCH_PUNISHMENT_INADVANCE_AXIS") then
ScriptLib.ShowTemplateReminder(context, local_defs.punish_inAdvance_reminder, {defs.punish_inAdvance_reminder_time or 3})
end
--不换队tick,如果长时间不换队则将设置惩罚gv
if (evt.source_name == "NOSWITCH_PUNISHMENT_AXIS") then
--ScriptLib.PrintContextLog(context,"FS: Showing reminder "..local_defs.team_noswitch_pubishment_reminder)
ScriptLib.ShowTemplateReminder(context, local_defs.team_noswitch_pubishment_reminder, {0})
--ScriptLib.ShowReminder(context, local_defs.team_noswitch_pubishment_reminder)
ScriptLib.SetGroupVariableValue(context,"is_noswitch_punishment",1)
LF_Set_Team_Global_Value(context,local_defs.team_noswitch_pubishment,1)
end
return 0
end
--fever升级时,给team挂global value,并激活场景氛围物件
function action_gallery_progress_pass(context,evt)
local fever_level = evt.param1
ScriptLib.PrintContextLog(context,"FS: Fever uprade to level "..fever_level)
ScriptLib.ShowReminder(context, local_defs.base_upgrade_reminder+fever_level)
LF_Set_Team_Global_Value(context,local_defs.team_global_value,fever_level)
LF_Activate_Environment_Gadget(context,fever_level)
return 0
end
function action_gallery_stop(context,evt)
LF_Stop_Play(context)
return 0
end
--当前的怪物潮刷完的时候,重置当前的怪物潮,这里只处理怪物潮的怪物
function action_monster_tide_die(context,evt)
local current_monster_tide = LF_Get_Current_Monster_Tide(context)
local tide_index = tonumber(evt.source_name)
local refresh_end_tide = ScriptLib.GetGroupVariableValue(context,"refresh_end_tide")
if tide_index == refresh_end_tide then
local elite_num = ScriptLib.GetGroupVariableValue(context,"is_elite_on_ground")
local monster_count = ScriptLib.GetGroupMonsterCount(context)
ScriptLib.PrintContextLog(context,"FS:[TIDE_DIE] 死亡的怪物来源于刷新时手动结束的怪物潮,剩余总怪物数量"..monster_count.."精英怪"..elite_num)
if monster_count == elite_num and elite_num ~= 0 then
ScriptLib.PrintContextLog(context,"FS:[TIDE_DIE] 场上仅剩精英怪,标记需要在精英怪死亡时创建新的怪物潮")
ScriptLib.SetGroupVariableValue(context,"is_current_minion_tide_end",1)
end
if monster_count == 0 then
ScriptLib.PrintContextLog(context,"FS:[TIDE_DIE] 场上没有怪物了,直接创建")
LF_Create_Monster_Tide(context,current_monster_tide)
ScriptLib.SetGroupVariableValue(context,"is_current_minion_tide_end",0)
end
return 0
end
--如果当前怪物潮已经被杀完了,且精英怪不在场
if (evt.param1 >= #monster_tide[current_monster_tide]) then
--标记非手动结束的怪物潮里的怪已经刷完了
ScriptLib.SetGroupVariableValue(context,"is_current_minion_tide_end",1)
local is_elite_on_ground = ScriptLib.GetGroupVariableValue(context,"is_elite_on_ground")
ScriptLib.PrintContextLog(context,"FS:[TIDE_DIE] 怪物潮"..tide_index.."所有怪物清空")
if (is_elite_on_ground == 0) then
--精英不在场,才能开一个新的怪物潮
ScriptLib.PrintContextLog(context,"FS: [TIDE_DIE] 场上没有精英怪,获取当前对应波次,创建怪物潮")
LF_Create_Monster_Tide(context,current_monster_tide)
ScriptLib.SetGroupVariableValue(context,"is_current_minion_tide_end",0)
end
end
return 0
end
--记录当前结束的MonsterTideIndex
function action_monster_tide_over(context, evt)
local end_index = tonumber(evt.source_name)
if end_index ~= nil then
ScriptLib.SetGroupVariableValue(context,"last_end_tide", end_index)
ScriptLib.PrintContextLog(context,"FS:[DEBUG][TIDE_OVER] 当前怪物潮结束,波次"..end_index)
end
return 0
end
--有怪死亡时,计分,并更新fever条,这里只处理怪物计分和精英怪阻塞
function action_monster_die_before_leave_scene(context,evt)
local monster_eid = evt.source_eid
local monster_cid = evt.param1
local is_elite = LF_Is_Elite(context,monster_cid)
local fever_ratio = ScriptLib.GetGroupVariableValue(context,"fever_ratio")
local monster_fever = monsters[monster_cid].kill_score
LF_Update_Fever(context,monster_fever*fever_ratio)
LF_Update_Score(context,monster_eid)
--死的是精英怪,看看之前有没有阻塞
if is_elite then
--精英死亡时,检测该组刷新的精英怪数量,如果全部死亡就重新开始计时
local elite_num = ScriptLib.GetGroupVariableValue(context,"is_elite_on_ground")
if elite_num > 1 then
--场上还有别的精英怪
ScriptLib.SetGroupVariableValue(context,"is_elite_on_ground",elite_num-1)
else
ScriptLib.SetGroupVariableValue(context,"is_elite_on_ground",0)
ScriptLib.EndTimeAxis(context,"ELITE_AXIS")
ScriptLib.InitTimeAxis(context,"ELITE_AXIS",time_axis.elite_axis,false)
if ScriptLib.GetGroupVariableValue(context,"is_current_minion_tide_end") == 0 then
if not LF_Is_Current_Index_End(context) then
ScriptLib.PrintContextLog(context,"FS:[DEBUG][MonDie] 精英怪死亡,当前怪物潮没有触发OVER,继续刷新,波次"..LF_Get_Current_Tide_Num(context))
ScriptLib.ContinueAutoMonster(context, defs.group_id, LF_Get_Current_Tide_Num(context))
else
if 0 == ScriptLib.GetGroupMonsterCount(context) then
ScriptLib.PrintContextLog(context,"FS:[DEBUG] [MonDie]精英怪死亡,当前怪物潮已经触发OVER且场上没有Monster,重新创建怪物潮")
local current_monster_tide = LF_Get_Current_Monster_Tide(context)
LF_Create_Monster_Tide(context,current_monster_tide)
ScriptLib.SetGroupVariableValue(context,"is_current_minion_tide_end",0)
end
end
else
--当前怪物潮已经结束了,因为场上有精英怪被卡住了。精英死亡时,手动开启新的怪物潮
if 0 == ScriptLib.GetGroupMonsterCount(context) then
ScriptLib.PrintContextLog(context,"FS:[DEBUG][MonDie] 精英怪死亡且场上没有怪物,波次"..LF_Get_Current_Tide_Num(context))
local current_monster_tide = LF_Get_Current_Monster_Tide(context)
LF_Create_Monster_Tide(context,current_monster_tide)
ScriptLib.SetGroupVariableValue(context,"is_current_minion_tide_end",0)
end
end
end
end
return 0
end
--玩家换队时触发,启动一个一定时间的时间轴,时间轴tick时修改global value给玩家挂debuff
function action_sumo_switch_team(context,evt)
--刚刚换队,先清掉team上的换队惩罚global value,并开始计时,如果tick时没有换队,则挂上惩罚标记gv
LF_Set_Team_Global_Value(context,local_defs.team_noswitch_pubishment,0)
ScriptLib.EndTimeAxis(context,"NOSWITCH_PUNISHMENT_AXIS")
ScriptLib.InitTimeAxis(context,"NOSWITCH_PUNISHMENT_AXIS",time_axis.noswitch_punishment_axis,false)
--清理换队提示
ScriptLib.EndTimeAxis(context,"NOSWITCH_PUNISHMENT_INADVANCE_AXIS")
ScriptLib.InitTimeAxis(context,"NOSWITCH_PUNISHMENT_INADVANCE_AXIS",time_axis.noswitch_punishment_inAdvance_axis,false)
--换队增加热情值
LF_Update_Fever(context,defs.switch_team_fever)
--换队的时候给服务端发送消息,让客户端显示惩罚倒计时UI
local uid_list = ScriptLib.GetSceneUidList(context)
if uid_list and nil~=uid_list[1]then
ScriptLib.UpdatePlayerGalleryScore(context, defs.gallery_id, {["uid"] = uid_list[1], ["noswitch_time"] = defs.noswitch_punishment_interval})
end
--清除当前显示的换队惩罚的reminder
local uid_list = ScriptLib.GetSceneUidList(context)
local ret = ScriptLib.RevokePlayerShowTemplateReminder(context, local_defs.team_noswitch_pubishment_reminder, {})
ScriptLib.RevokePlayerShowTemplateReminder(context, local_defs.punish_inAdvance_reminder, {})
ScriptLib.PrintContextLog(context,"FS: Clear reminder result"..ret)
--换队的时候修改team的gv,重新刷一下新的avatar身上的加成效果
--ScriptLib.PrintContextLog(context,"FS: team has changed, team_has_change = 1")
LF_Set_Team_Global_Value(context,local_defs.team_has_switch,1)
ScriptLib.SetGroupVariableValue(context,"is_noswitch_punishment",0)
return 0
end
--玩家进入区域直接创建空气墙,防止卡延迟出圈
function action_enter_start_region(context,evt)
--加载空气墙
ScriptLib.CreateGadget(context,{config_id = defs.air_wall})
ScriptLib.SetGroupVariableValue(context,"is_air_wall_created",1)
return 0
end
--团灭触发,直接结束玩法
function action_dungeon_all_avatar_die(context,evt)
LF_Stop_Play(context)
return 0
end
function action_dungeon_settle(context,evt)
LF_Stop_Play(context)
return 0
end
------------------------------------------------------------------
--辅助方法---------------------------------------------------------
------------------------------------------------------------------
--关卡相关方法-----------------------------------------------------
--启动玩法方法,初始化各种东西
function LF_Start_Play(context)
ScriptLib.StartGallery(context, defs.gallery_id)
ScriptLib.InitGalleryProgressScore(context, "fever", defs.gallery_id, fever_progress_table, GalleryProgressScoreUIType.GALLERY_PROGRESS_SCORE_UI_TYPE_SUMO_STAGE, GalleryProgressScoreType.GALLERY_PROGRESS_SCORE_NO_DEGRADE)
ScriptLib.InitTimeAxis(context,"FEVER_AXIS",time_axis.fever_axis,true)
ScriptLib.InitTimeAxis(context,"MINION_TIDE_AXIS",time_axis.minion_tide_axis,true)
ScriptLib.InitTimeAxis(context,"ELITE_TIDE_AXIS",time_axis.elite_tide_axis,true)
ScriptLib.InitTimeAxis(context,"ELITE_AXIS",time_axis.elite_axis,false)
LF_Set_Current_Tide_Num(context,0)
LF_Set_Current_Monster_Tide(context,1)
LF_Set_Current_Elite_Index(context,1)
LF_Create_Monster_Tide(context,1)
--启动玩法时给第一队挂一下gv,防止一开始就受到惩罚;并开启时间轴开始计时
LF_Set_Team_Global_Value(context,local_defs.team_noswitch_pubishment,0)
ScriptLib.InitTimeAxis(context,"NOSWITCH_PUNISHMENT_AXIS",time_axis.noswitch_punishment_axis,false)
ScriptLib.InitTimeAxis(context,"NOSWITCH_PUNISHMENT_INADVANCE_AXIS",time_axis.noswitch_punishment_inAdvance_axis,false)
--玩法开始的时候给服务端发送消息,让客户端显示惩罚倒计时UI
local uid_list = ScriptLib.GetSceneUidList(context)
if uid_list and nil~=uid_list[1]then
ScriptLib.UpdatePlayerGalleryScore(context, defs.gallery_id, {["uid"] = uid_list[1], ["noswitch_time"] = defs.noswitch_punishment_interval})
end
--加载空气墙
ScriptLib.CreateGadget(context,{config_id = defs.air_wall})
end
--终止玩法方法,关掉各种东西
function LF_Stop_Play(context)
local current_monster_tide = LF_Get_Current_Monster_Tide(context)
--清理一下空气墙,防止其他问题
ScriptLib.RemoveEntityByConfigId(context, defs.group_id, EntityType.GADGET, defs.air_wall)
--玩法结束,清理掉当前的怪物潮
if not LF_Is_Current_Index_End(context) then
ScriptLib.KillMonsterTide(context, defs.group_id, current_monster_tide)
end
ScriptLib.StopGallery(context, defs.gallery_id,true)
ScriptLib.EndTimeAxis(context,"FEVER_AXIS")
ScriptLib.EndTimeAxis(context,"MINION_TIDE_AXIS")
ScriptLib.EndTimeAxis(context,"ELITE_AXIS")
ScriptLib.EndTimeAxis(context,"ELITE_TIDE_AXIS")
--关闭一下地城,以正确触发重新挑战
ScriptLib.CauseDungeonFail(context)
end
--启动一波指定ID的怪物潮,需要传入该波怪物潮的ID(具体配置在miscs中定义)
function LF_Create_Monster_Tide(context,monster_tide_index)
local monster_config_id_list = monster_tide[monster_tide_index]
--增加怪物潮的计数,下一次开启时index会+1,防止索引到同一波怪物潮
local tide_num = LF_Get_Current_Tide_Num(context)
LF_Set_Current_Tide_Num(context,tide_num+1)
ScriptLib.PrintContextLog(context,"FS: [DEBUG][CREATE] 创建怪物潮,怪物波次 ["..monster_tide_index.."]".."怪物潮INDEX"..(tide_num+1))
local current_monster_tide = LF_Get_Current_Monster_Tide(context)
ScriptLib.AutoMonsterTide(context, tide_num+1, defs.group_id, monster_config_id_list, #monster_config_id_list, tide_suite_config[current_monster_tide].min, tide_suite_config[current_monster_tide].max)
end
--停止目前的怪物潮,下次刷新新配置的怪物潮
function LF_Refresh_Currtent_Monster_Tide(context)
ScriptLib.PrintContextLog(context,"FS:[DEBUG] [REFRESH]时间轴刷新怪物潮,标记当前怪物潮结束")
local current_monster_tide = LF_Get_Current_Monster_Tide(context)
--标记当前怪物潮结束,如果怪物潮没有结束则手动结束
local tide_index = LF_Get_Current_Tide_Num(context)
ScriptLib.SetGroupVariableValue(context,"refresh_end_tide",tide_index)
if not LF_Is_Current_Index_End(context) then
ScriptLib.PrintContextLog(context,"FS:[DEBUG] [REFRESH]手动结束当前怪物潮")
ScriptLib.EndMonsterTide(context, defs.group_id, tide_index, 1)
end
-- ScriptLib.SetGroupVariableValue(context,"is_current_minion_tide_end",1)
LF_Set_Current_Monster_Tide(context,current_monster_tide+1)
--如果场上没有怪就直接创建
if 0 == ScriptLib.GetGroupMonsterCount(context) then
LF_Create_Monster_Tide(context,current_monster_tide+1)
ScriptLib.SetGroupVariableValue(context,"is_current_minion_tide_end",0)
ScriptLib.PrintContextLog(context,"FS:[DEBUG] [REFRESH]更新怪物潮,刷新怪物,并且标记这一波怪没有结束")
end
end
--在随机的位置,刷新指定序列的精英怪
function LF_Create_Elite_Monster(context,elite_index)
local elite_list = elite[elite_index]
ScriptLib.PrintContextLog(context,"FS: Creating elite nums_"..#elite_list)
--生成一个点的序列表,每次随机的时候把结果踢出
local point_index = {}
local choices = {}
for i=1,#elite_born_points do
table.insert(point_index,i)
end
for i=1,#elite_list do
local randomNum = math.random(1,#point_index)
table.insert(choices, point_index[randomNum])
table.remove(point_index, randomNum)
end
for i=1,#elite_list do
for k,v in pairs(points) do
if elite_born_points[choices[i]] == v.config_id then
ScriptLib.PrintContextLog(context,"FS: Creating elite ["..elite_list[i].."] at point "..v.pos.x..","..v.pos.y..","..v.pos.z)
ScriptLib.CreateMonsterByConfigIdByPos(context, elite_list[i], v.pos, v.rot)
end
end
end
ScriptLib.SetGroupVariableValue(context,"is_elite_on_ground",#elite_list)
end
--从1~max间随机nums个
function LF_Random_Choice(max, nums)
local choices = {}
local list = {}
for i=1,nums do
local randomNum = math.random(1,#list)
table.insert(choices, list[randomNum])
table.remove(list, randomNum)
end
return choices
end
function LF_Is_Current_Index_End(context)
if LF_Get_Current_Tide_Num(context) > ScriptLib.GetGroupVariableValue(context,"last_end_tide") then
ScriptLib.PrintContextLog(context,"FS:[DEBUG] [JUDGE]判断当前怪物潮没有结束")
return false
end
ScriptLib.PrintContextLog(context,"FS:[DEBUG] [JUDGE] 判断当前怪物潮已经结束")
return true
end
--通用类方法-------------------------------------------------------
--切换场上的场景氛围物件状态
function LF_Activate_Environment_Gadget(context,fever_level)
ScriptLib.PrintContextLog(context,"FS: Activate environment gadgets!")
--根据当前的fever等级,改变天气
if (fever_level>local_defs.environment_change_level) then
ScriptLib.PrintContextLog(context,"FS: Changing environment weather!")
local ret = ScriptLib.SetWeatherAreaState(context, DungeonWeather[fever_level],1)
--ScriptLib.PrintContextLog(context,"FS: The result of starting weather ".. DungeonWeather[fever_level].."is "..ret)
local ret = ScriptLib.EnterWeatherArea(context, DungeonWeather[fever_level])
--ScriptLib.PrintContextLog(context,"FS: The result of changing weather".. DungeonWeather[fever_level].."is "..ret)
end
--切换场上所有的物件的状态
for i = 1, #suites[defs.environment_suite].gadgets do
local config_id = suites[defs.environment_suite].gadgets[i]
local gadget_id = LF_Get_Gadget_Id_By_Config_Id(context,config_id)
--大小火盆
if (gadget_id == 70350306 or gadget_id == 70350307) then
if (fever_level<local_defs.burn_effect_level) then
--点燃小火
--ScriptLib.PrintContextLog(context,"FS: Burn little fire!")
local ret = ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, config_id, 101)
end
if (fever_level<#fever_progress_table-2 and fever_level>=local_defs.burn_effect_level) then
--喷大火,5秒后转回小火
--ScriptLib.PrintContextLog(context,"FS: Burn middle fire!")
local ret = ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, config_id, 201)
end
if (fever_level >= #fever_progress_table-2) then
--持续喷大火
--ScriptLib.PrintContextLog(context,"FS: Burn super fire!")
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, config_id, 202)
end
end
--挂灯
if (gadget_id == 70350308) then
if (fever_level>=local_defs.burn_effect_level) then
--点燃小火
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, config_id, 201)
end
end
--场景氛围
if (gadget_id == 70350309) then
--转到对应的gadgetStatedefault-0、phase1-201、phase2-202、phase3-203、phase4-204
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_id, config_id, 200+fever_level)
end
end
end
--给team挂global value,角色处理各种特殊效果
function LF_Set_Team_Global_Value(context,gv_name,value)
--ScriptLib.PrintContextLog(context,"FS: Sending global values to team!")
local uid_list = ScriptLib.GetSceneUidList(context)
ScriptLib.SetTeamEntityGlobalFloatValue(context, uid_list, gv_name, value)
end
-----CRUD类方法----------------------------------------------------
--更新fever条,fever_delta为fever条改变值
function LF_Update_Fever(context,fever_delta)
ScriptLib.AddGalleryProgressScore(context, "fever", defs.gallery_id, fever_delta)
end
--更新积分,需要传入目标monster的entity id
function LF_Update_Score(context,monster_eid)
local uid_list = ScriptLib.GetSceneUidList(context)
local monster_id = ScriptLib.GetMonsterIdByEntityId(context,monster_eid)
if uid_list and nil~=uid_list[1]then
ScriptLib.UpdatePlayerGalleryScore(context, defs.gallery_id, {["uid"] = uid_list[1], ["monster_id"] = monster_id})
end
end
--返回当前等级下的积分衰减速率
function LF_Get_Fever_Subnum(context)
local fever = ScriptLib.GetGalleryProgressScore(context, "fever", defs.gallery_id)
for i = 1, #fever_progress_table-1 do
local lower_bound = fever_progress_table[i]
local higher_bound = fever_progress_table[i+1]
if fever>=lower_bound and fever<higher_bound then
return fever_attenuation[i]
end
end
return -1
end
--增加场上的怪物总数
function LF_Add_MonsterCount(context, num)
-- local monster_count = ScriptLib.GetGroupVariableValue(context,"monster_count")
-- ScriptLib.SetGroupVariableValue(context,"monster_count", monster_count+num)
ScriptLib.ChangeGroupVariableValue(context,"monster_count",num)
end
function LF_Get_MonsterCount(context)
local monster_count = ScriptLib.GetGroupVariableValue(context,"monster_count")
return monster_count
end
--设置当前怪物潮的波次数(注意不等于怪物潮的index)。每次创建怪物潮会使波次数+1,方便索引新的怪物潮
function LF_Set_Current_Tide_Num(context,value)
ScriptLib.SetGroupTempValue(context, "MinionTide", value, {})
end
--获取当前怪物潮的波次数(注意不等于怪物潮的index)。每次创建怪物潮会使波次数+1,方便索引新的怪物潮
function LF_Get_Current_Tide_Num(context)
return ScriptLib.GetGroupTempValue(context, "MinionTide", {})
end
--设置当前大怪的进度index
function LF_Set_Current_Elite_Index(context,index)
ScriptLib.SetGroupVariableValue(context,"current_elite",index)
end
--获取当前大怪的进度index
function LF_Get_Current_Elite_Index(context)
local elite_index = ScriptLib.GetGroupVariableValue(context,"current_elite")
return elite_index
end
--设置当前怪物潮波次的index
function LF_Set_Current_Monster_Tide(context,index)
ScriptLib.SetGroupVariableValue(context,"current_monster_tide",index)
end
--获取当前怪物潮波次的index
function LF_Get_Current_Monster_Tide(context)
local monster_tide = ScriptLib.GetGroupVariableValue(context,"current_monster_tide")
return monster_tide
end
--根据config id 返回一个点位
function LF_Get_Point(context,point_cid)
for i = 1,#points do
if (points[i].config_id == point_cid) then
return points[i]
end
end
return -1
end
--根据gadget的config_id查询gadget_id
function LF_Get_Gadget_Id_By_Config_Id(context, config_id)
return gadgets[config_id].gadget_id
end
--返回一个指定configid的怪物是否是大怪
function LF_Is_Elite(context,monster_cid)
for i=1,#elite do
for k,cfg_id in pairs(elite[i]) do
if monster_cid == cfg_id then
return true
end
end
end
return false
end
------------------------------------------------------------------
--server lua call-------------------------------------------------
function SLC_Update_Fever_Ratio(context,new_fever_ratio)
ScriptLib.PrintContextLog(context,"FS: SERVER_LUA_CALL: Changing fever ratio to: "..new_fever_ratio)
ScriptLib.SetGroupVariableValue(context,"fever_ratio",new_fever_ratio)
return 0
end
--向客户端下发当前的惩罚状态和fever值,用于客户端重连时请求
function SLC_Refresh_Team_State(context)
ScriptLib.PrintContextLog(context,"FS: SERVER_LUA_CALL: Request for refresh punishment state: ")
local is_noswitch_punishment = ScriptLib.GetGroupVariableValue(context,"is_noswitch_punishment")
LF_Set_Team_Global_Value(context,"NOSWITCH_PUNISHMENT",is_noswitch_punishment)
local fever = ScriptLib.GetGalleryProgressScore(context, "fever", defs.gallery_id)
LF_Set_Team_Global_Value(context,"fever",fever)
return 0
end
------------------------------------------------------------------
Initialize()
@@ -0,0 +1,320 @@
--ServerUploadTool Save to [/root/env/data/lua/common/V3_1]
--[[
=====================================================================================================================
|| Filename || HamsterGambing
|| RelVersion || 3.1
|| Owner || xudong.sun
|| Description || 3.1日常打地鼠
|| LogName || ## HamsterGambing_LOG
|| Protection ||
=====================================================================================================================
local pointStateList = {configid, 0, 0, configid, 0, configid} //点位和configID之间的关系,该点位有坑,就填对应的configID;该点位无坑,填0
local challengeOptionConfigID = 0 //挑战开启的configID
local challengeOptionID = 0 //挑战开启按键的ID
local holeConfigID = {1,2,3} //坑的configID list
local checkOptionID = 1 //移动完之后,玩家靠近坑位会显示的按键ID
local arrayID = {1,2} //点阵ID
local randomVez = {min = 1, max = 5} //每轮触发的交换最大次数和最小次数
local successCount = 2 //需要成功的次数
=======================================================================================]]
local extrTriggers = {
initialtrigger = {
["Group_Load"] = { config_id = 80000001, name = "Group_Load", event= EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0},
["Option_Down"] = { config_id = 80000002, name = "Option_Down", event= EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_option_down", trigger_count = 0},
["Reach_Point"] = { config_id = 80000003, name = "Reach_Point", event= EventType.EVENT_PLATFORM_ARRIVAL, source = "", condition = "", action = "action_reach_point", trigger_count = 0},
--["Move_Interval"] = { config_id = 80000004, name = "Move_Interval", event= EventType.EVENT_TIME_AXIS_PASS, source = "move_interval", condition = "", action = "action_move_interval", trigger_count = 0},
}
}
local HamsterEnum = {
Inmove = 0,
WaitMove = 1,
MoveSuccess = 2,
}
function action_group_load( context, evt )
--初始化点位记录
-- ScriptLib.SetGroupTempValue(context, "hamsterNum", 0,{})
ScriptLib.SetGroupTempValue(context, "reachPointNum", 0,{})
ScriptLib.SetGroupVariableValue(context, "hamster_success_num", 0)
for i=1,#pointStateList do
ScriptLib.SetGroupTempValue(context, "arraypoint"..i, pointStateList[i],{})
-- if pointStateList[i] ~= 0 then
-- ScriptLib.ChangeGroupTempValue(context, "hamsterNum", 1,{})
-- end
end
--固定一个第一轮不动的鼹鼠坑
local tempList = {}
for i,v in ipairs(holeConfigID) do
local entityID = ScriptLib.GetEntityIdByConfigId(context, v)
if ScriptLib.GetGadgetIdByEntityId(context, entityID) ~= 70330295 then
table.insert(tempList,v)
end
end
if unmovenum >= #holeConfigID then
ScriptLib.PrintGroupWarning(context,"## HamsterGambing action_group_load: 不可移动的洞,数量多于洞的总数")
return 0
end
for i=1,unmovenum do
local randomIndex = math.random(1, #tempList)
ScriptLib.SetGroupTempValue(context, "unmoveableconfigid"..i, tempList[randomIndex],{})
table.remove(tempList, randomIndex)
end
--初始化挑战按键
ScriptLib.SetWorktopOptionsByGroupId(context, 0, challengeOptionConfigID, {challengeOptionID})
return 0
end
function action_option_down( context, evt )
if evt.param2 == challengeOptionID then
LF_SetHamster( context, HamsterEnum.WaitMove)
--删除挑战按键
ScriptLib.DelWorktopOption(context, challengeOptionID)
elseif evt.param2 == checkOptionID then
ScriptLib.PrintContextLog(context, "## HamsterGambing : GadgetID = "..ScriptLib.GetGadgetIdByEntityId(context, evt.source_eid))
--删除查看按键
for i,v in ipairs(holeConfigID) do
ScriptLib.DelWorktopOptionByGroupId(context, 0, v, checkOptionID)
end
--确认是否完成
if ScriptLib.GetGadgetIdByEntityId(context, evt.source_eid) == 70330295 then
--找到鼹鼠,成功次数+1
ScriptLib.ChangeGroupVariableValue(context, "hamster_success_num", 1)
--8.5新增:向当前configID发送消息,播一个成功特效
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, evt.param1, 203)
if ScriptLib.GetGroupVariableValue(context, "hamster_success_num")>= successCount then
--完成挑战
LF_SetHamster( context, HamsterEnum.MoveSuccess)
ScriptLib.PrintContextLog(context, "## HamsterGambing : 挑战成功!")
return 0
end
else
--向当前configID发送消息,播一个失败特效
ScriptLib.SetGroupGadgetStateByConfigId(context, 0, evt.param1, 202)
end
LF_SetHamster( context, HamsterEnum.WaitMove)
end
return 0
end
function action_reach_point( context, evt )
ScriptLib.ChangeGroupTempValue(context, "reachPointNum", 1,{})
local moveRound = #holeConfigID
if ScriptLib.GetGroupVariableValue(context, "hamster_success_num") == 0 then
moveRound = moveRound - unmovenum
end
if ScriptLib.GetGroupTempValue(context, "reachPointNum", {})>= moveRound then
ScriptLib.SetGroupTempValue(context, "reachPointNum", 0,{})
ScriptLib.ChangeGroupTempValue(context, "moveVez", -1,{})
if ScriptLib.GetGroupTempValue(context, "moveVez",{}) == 0 then
--移动次数用完,显示按键
LF_SetModel( context, holeConfigID, 1)
for i,v in ipairs(holeConfigID) do
ScriptLib.SetWorktopOptionsByGroupId(context, 0, v, {checkOptionID})
end
return 0
end
--继续移动
LF_MoveHamster( context )
end
return 0
end
function SLC_StartHamsterMove( context )
LF_SetHamster( context, HamsterEnum.Inmove)
--开启下一轮
ScriptLib.SetGroupTempValue(context, "moveVez", math.random(randomVez.min, randomVez.max),{})
ScriptLib.PrintContextLog(context, "## HamsterGambing : 本轮需要移动次数: "..ScriptLib.GetGroupTempValue(context, "moveVez", {}))
--移动鼹鼠
LF_MoveHamster( context )
return 0
end
-- function action_move_interval( context, evt )
-- ScriptLib.ChangeGroupTempValue(context, "moveVez", -1,{})
-- ScriptLib.PrintContextLog(context, "## HamsterGambing : 移动次数还剩: "..ScriptLib.GetGroupTempValue(context, "moveVez",{}))
-- if ScriptLib.GetGroupTempValue(context, "moveVez",{}) <= 0 then
-- --移动次数用完,显示按键
-- LF_SetModel( context, 1)
-- ScriptLib.PrintContextLog(context, "## HamsterGambing : 停止移动")
-- for i,v in ipairs(holeConfigID) do
-- ScriptLib.SetWorktopOptionsByGroupId(context, 0, v, {checkOptionID})
-- end
-- ScriptLib.EndTimeAxis(context, "move_interval")
-- return 0
-- end
-- --继续移动
-- LF_MoveHamster( context )
-- return 0
-- end
function LF_SetHamster( context, value)
for i,v in ipairs(holeConfigID) do
local entityID = ScriptLib.GetEntityIdByConfigId(context, v)
if ScriptLib.GetGadgetIdByEntityId(context, entityID) == 70330295 then
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v, "SGV_HAMSTER_WAITMOVE", value)
end
end
return 0
end
function LF_SetModel( context, configIdList, value)
for i,v in ipairs(configIdList) do
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v, "SGV_HAMSTER_MODEL", value)
end
return 0
end
function LF_MoveHamster( context )
ScriptLib.PrintContextLog(context, "## HamsterGambing : 开始移动")
--删除观察按键
for i,v in ipairs(holeConfigID) do
ScriptLib.DelWorktopOption(context, checkOptionID)
end
--获取空点位
local Point = LF_GetPointState(context)
--如果还没成功过,降低难度
if ScriptLib.GetGroupVariableValue(context, "hamster_success_num") == 0 then
for i=1,unmovenum do
local tempID = ScriptLib.GetGroupTempValue(context, "unmoveableconfigid"..i,{})
for i,v in ipairs(Point.hamsterPoint) do
if ScriptLib.GetGroupTempValue(context, "arraypoint"..v, {}) == tempID then
table.remove(Point.hamsterPoint, i)
break
end
end
end
end
--point转化为ConfigID
local configIdList = {}
for i,v in ipairs(Point.hamsterPoint) do
table.insert(configIdList, ScriptLib.GetGroupTempValue(context, "arraypoint"..v, {}) )
end
LF_SetModel( context, configIdList, 0)
for i,v in ipairs(Point.hamsterPoint) do
local moveConfigID = ScriptLib.GetGroupTempValue(context, "arraypoint"..v, {})
--找出一个要去的点
local tempPoint = LF_GetPointState(context)
tempIndex = math.random(1, #tempPoint.blankPoint)
local blankPoint = tempPoint.blankPoint[tempIndex]
--动起来
ScriptLib.PrintContextLog(context, "## HamsterGambing : 本次移动,"..moveConfigID..""..v.." 移动到 "..blankPoint)
if arrayID[ScriptLib.GetGroupVariableValue(context, "hamster_success_num")+1] == nil then
ScriptLib.PrintGroupWarning(context,"## HamsterGambing LF_MoveHamster: arraypoint数量不足")
return 0
end
ScriptLib.SetPlatformPointArray(context, moveConfigID, arrayID[ScriptLib.GetGroupVariableValue(context, "hamster_success_num")+1], {v,blankPoint}, {route_type = 0})
--更新点位(风险点,移动平台还未到达就更新了位置关系,可能会不匹配;但是因为load之后会初始化,似乎也不会有大问题)
ScriptLib.SetGroupTempValue(context, "arraypoint"..v, 0,{})
ScriptLib.SetGroupTempValue(context, "arraypoint"..blankPoint, moveConfigID,{})
end
return 0
end
--查空point
function LF_GetPointState( context)
local Point = {
blankPoint = {},
hamsterPoint = {},
}
for i=1,#pointStateList do
--ScriptLib.PrintContextLog(context, "## HamsterGambing : #pointStateList = "..#pointStateList.." i = "..i)
if ScriptLib.GetGroupTempValue(context, "arraypoint"..i, {}) == 0 then
table.insert(Point.blankPoint, i)
else
table.insert(Point.hamsterPoint, i)
end
end
return Point
end
function LF_Initialize_Group()
for k,v in pairs(extrTriggers.initialtrigger) do
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
table.insert(variables,{ config_id= 50000001, name = "hamster_success_num", value = 0, no_refresh = true})
return 0
end
LF_Initialize_Group()
@@ -0,0 +1,13 @@
function SLC_Reminder_Done( context)
ScriptLib.SetGroupVariableValue(context, "open_the_door", 1)
return 0
end
function LF_Initialize_OpenDoor_Group()
table.insert(variables,{ config_id= 50000001, name = "open_the_door", value = 0, no_refresh = true})
return 0
end
LF_Initialize_OpenDoor_Group()
@@ -0,0 +1,67 @@
--ServerUploadTool Save to [/root/env/data/lua/common/V3_1]
--[[
=====================================================================================================================
|| Filename || OutOfBattle
|| RelVersion || 3.1
|| Owner || xudong.sun
|| Description || 3.1脱战任务玩法
|| LogName || ## OutOfBattle_LOG
|| Protection ||
=====================================================================================================================
local levelUpOption = 0
local chainId = 0
lcoal maxLevel = 5
local notifyGroupList = {}
=======================================================================================]]
local extrTriggers = {
initialtrigger = {
["LeaveRegion"] = { config_id = 80000001, name = "LeaveRegion", event= EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_leave_region", trigger_count = 0},
["GroupUnLoad"] = { config_id = 80000002, name = "GroupUnLoad", event= EventType.EVENT_GROUP_WILL_UNLOAD, source = "", condition = "", action = "action_group_unload", trigger_count = 0},
}
}
function SLC_OutOfBattle( context )
ScriptLib.AddQuestProgress(context, ""..questID)
ScriptLib.SetTeamServerGlobalValue(context, ScriptLib.GetSceneOwnerUid(context), "SGV_CAN_CLEAR_THREAT", 1)
return 0
end
function SLC_ResetSGV( context )
ScriptLib.SetTeamServerGlobalValue(context, ScriptLib.GetSceneOwnerUid(context), "SGV_CAN_CLEAR_THREAT", 0)
return 0
end
function action_leave_region( context, evt )
ScriptLib.SetTeamServerGlobalValue(context, ScriptLib.GetSceneOwnerUid(context), "SGV_CAN_CLEAR_THREAT", 0)
return 0
end
function action_group_unload( context, evt )
ScriptLib.SetTeamServerGlobalValue(context, ScriptLib.GetSceneOwnerUid(context), "SGV_CAN_CLEAR_THREAT", 0)
return 0
end
function LF_Initialize_Group()
for k,v in pairs(extrTriggers.initialtrigger) do
table.insert(triggers, v)
for i=1,#suites do
table.insert(suites[i].triggers, v.name)
end
end
return 0
end
LF_Initialize_Group()
@@ -0,0 +1,258 @@
--ServerUploadTool Save to [/root/env/data/lua/common/V3_1]
--[[
=====================================================================================================================
|| Filename || PermissionOperator
|| RelVersion || 3.1
|| Owner || xudong.sun
|| Description || 3.1权限操作台
|| LogName || ## PermissionOperator_LOG
|| Protection || 在操作台创建时判断玩家权限是否足够开启
=====================================================================================================================
local optionID = {}
local optionID_2 = 0
=======================================================================================]]
local SGV_Delta={
[100004] = 103,
[100006] = 101,
[100007] = 102,
[100008] = 100,
}
local FailOption = 495
local SGV_KEY = "SGV_PERMISSION_COMMONLEVEL"
local SGV_GLOW = "SGV_PERMISSION_GLOW"
local SGV_SWIPE = "SGV_PERMISSION_SWIPE"
local extrTriggers = {
initialtrigger = {
["Group_Load"] = { config_id = 80000001, name = "Group_Load", event= EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0},
["Select_Option"] = { config_id = 80000002, name = "Select_Option", event= EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_select_option", trigger_count = 0},
["State_Change"] = { config_id = 80000003, name = "State_Change", event= EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_state_change", trigger_count = 0},
["Switch_Timer"] = { config_id = 80000004, name = "Switch_Timer", event= EventType.EVENT_TIME_AXIS_PASS, source = "switchbutton_timer", condition = "", action = "action_switch_button", trigger_count = 0},
["Chain_Level_Change"] = { config_id = 80000005, name = "Chain_Level_Change", event= EventType.EVENT_GADGET_CHAIN_LEVEL_CHANGE, source = "", condition = "", action = "action_chain_level_change", trigger_count = 0},
}
}
function action_state_change( context, evt)
local entityID = ScriptLib.GetEntityIdByConfigId(context, evt.param2)
if ScriptLib.GetGadgetIdByEntityId(context, entityID) == 70330283 and evt.param3 == 202 then
ScriptLib.PrintContextLog(context, "## PermissionOperator_LOG : 权限操作台状态切换")
LF_StOperatorState( context )
end
--补充逻辑: 当两个操作台同步时,通过切状态删除另一个操作台的按键
if ScriptLib.GetGadgetIdByEntityId(context, entityID) == 70330283 and evt.param1 == 203 then
ScriptLib.PrintContextLog(context, "## PermissionOperator_LOG : 删除自己的按键")
if #optionID<1 or optionID[1]==nil then
ScriptLib.PrintGroupWarning(context,"## PermissionOperator_LOG action_state_change: LD没有设置optionid的misc")
return 0
end
ScriptLib.DelWorktopOptionByGroupId(context, 0, evt.param2, optionID[1])
end
return 0
end
function action_chain_level_change( context, evt )
ScriptLib.PrintContextLog(context, "## PermissionOperator_LOG : 权限等级变化")
LF_StOperatorState( context )
return 0
end
function action_select_option( context, evt)
-- 8.4新增需求:权限不足也提供按键,但是按下后会提供一个reminder提醒玩家权限不足
if evt.param2 == FailOption then
ScriptLib.ShowReminderByUid(context, {ScriptLib.GetSceneOwnerUid(context)}, 33100001)
return 0
end
if #optionID==2 then
if evt.param2 == optionID[1] then
ScriptLib.DelWorktopOptionByGroupId(context, 0, evt.param1, optionID[1])
ScriptLib.SetGroupVariableValue(context, "Variable_OptionID", 2)
ScriptLib.InitTimeAxis(context, "switchbutton_timer", {2}, false)
ScriptLib.SetEntityServerGlobalValueByConfigId(context, evt.param1, "SGV_PERMISSION_SWIPE", 1)
else
ScriptLib.DelWorktopOptionByGroupId(context, 0, evt.param1, optionID[2])
ScriptLib.SetGroupVariableValue(context, "Variable_OptionID", 1)
ScriptLib.InitTimeAxis(context, "switchbutton_timer", {2}, false)
ScriptLib.SetEntityServerGlobalValueByConfigId(context, evt.param1, "SGV_PERMISSION_SWIPE", 2)
end
elseif #optionID==1 then
if evt.param2 == optionID[1] then
ScriptLib.DelWorktopOptionByGroupId(context, 0, evt.param1, optionID[1])
--8.11 BUG修复:防止玩法完成后重复设置按键
ScriptLib.SetGroupVariableValue(context, "Variable_OptionID", 2)
end
else
ScriptLib.PrintGroupWarning(context,"## PermissionOperator action_select_option: 小兄弟,你的table是不是填错惹")
end
return 0
end
function action_switch_button( context, evt )
for i,v in ipairs(gadgets) do
if v.gadget_id == 70330283 then
ScriptLib.SetWorktopOptionsByGroupId(context, 0, v.config_id, {optionID[ScriptLib.GetGroupVariableValue(context, "Variable_OptionID")]})
end
end
return 0
end
function action_group_load( context, evt )
ScriptLib.PrintContextLog(context, "## PermissionOperator_LOG : 权限操作台创建")
LF_StOperatorState( context )
return 0
end
function LF_RestOperatorState(context, prev_context)
ScriptLib.PrintContextLog(context, "## PermissionOperator_LOG : 重置权限操作台")
LF_StOperatorState( context )
return 0
end
function LF_StOperatorState( context )
for i,v in ipairs(gadgets) do
if v.gadget_id == 70330283 then
--获取需要的权限类型和等级
local _permissiontype = 0
local _permissionlevel = 0
if v.server_global_value_config.SGV_CHAINTYPE ~= nil then
_permissiontype = v.server_global_value_config.SGV_CHAINTYPE
else
ScriptLib.PrintGroupWarning(context,"## PermissionOperator action_gadget_create: 没有获取到升级链类型")
end
if v.server_global_value_config.SGV_CHAINLEVEL ~= nil then
_permissionlevel = v.server_global_value_config.SGV_CHAINLEVEL
else
_permissionlevel = 1
end
ScriptLib.PrintContextLog(context, "## PermissionOperator_LOG : 需要等级".._permissionlevel)
local _curlevel = ScriptLib.GetChainLevel(context, ScriptLib.GetSceneOwnerUid(context), _permissiontype)
ScriptLib.PrintContextLog(context, "## PermissionOperator_LOG : 自身等级:".._curlevel)
if ScriptLib.GetGadgetStateByConfigId(context, 0, v.config_id)==202 then
ScriptLib.PrintContextLog(context, "## PermissionOperator_LOG : 状态202,空表现")
--设置锁定
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v.config_id, "SGV_PERMISSION_GLOW", 0)
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v.config_id, "SGV_PERMISSION_COMMONLEVEL", 0)
ScriptLib.DelWorktopOptionByGroupId(context, 0, v.config_id, optionID[ScriptLib.GetGroupVariableValue(context, "Variable_OptionID")])
elseif _curlevel< _permissionlevel then
ScriptLib.PrintContextLog(context, "## PermissionOperator_LOG : 设置失败表现")
--设置失败表现
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v.config_id, "SGV_PERMISSION_GLOW", -1)
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v.config_id, "SGV_PERMISSION_COMMONLEVEL", SGV_Delta[_permissiontype]+_permissionlevel+100)
--8.4新增需求:权限不足也提供按键,但是按下后会提供一个reminder提醒玩家权限不足
ScriptLib.SetWorktopOptionsByGroupId(context, 0, v.config_id, {FailOption})
else
ScriptLib.PrintContextLog(context, "## PermissionOperator_LOG : 设置成功表现")
--设置成功表现
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v.config_id, "SGV_PERMISSION_GLOW", 1)
ScriptLib.SetEntityServerGlobalValueByConfigId(context, v.config_id, "SGV_PERMISSION_COMMONLEVEL", SGV_Delta[_permissiontype]+_curlevel)
--8.11 BUG修复:防止玩法完成后重复设置按键
if #optionID == 1 then
if ScriptLib.GetGroupVariableValue(context, "Variable_OptionID") == 1 then
ScriptLib.PrintContextLog(context, "## PermissionOperator_LOG : 设置单次按键")
if optionID[ScriptLib.GetGroupVariableValue(context, "Variable_OptionID")] == nil then
ScriptLib.PrintGroupWarning(context,"## PermissionOperator LF_StOperatorState: OPTIONID获取失败")
return 0
end
ScriptLib.SetWorktopOptionsByGroupId(context, 0, v.config_id, {optionID[ScriptLib.GetGroupVariableValue(context, "Variable_OptionID")]})
end
else
ScriptLib.PrintContextLog(context, "## PermissionOperator_LOG : 设置多次按键")
if optionID[ScriptLib.GetGroupVariableValue(context, "Variable_OptionID")] == nil then
ScriptLib.PrintGroupWarning(context,"## PermissionOperator LF_StOperatorState: OPTIONID获取失败")
return 0
end
ScriptLib.SetWorktopOptionsByGroupId(context, 0, v.config_id, {optionID[ScriptLib.GetGroupVariableValue(context, "Variable_OptionID")]})
end
end
--8.8 更新:支持复数个权限操作台
--break
end
end
return 0
end
function LF_Initialize_Group()
for k,v in pairs(extrTriggers.initialtrigger) do
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
--给任务版,从suite里切出来的加个特判
if isQuest ~= nil then
table.insert(suites[1].triggers, v.name)
end
end
table.insert(variables,{ config_id=50000001, name = "Variable_OptionID", value = 1, no_refresh = true})
return 0
end
LF_Initialize_Group()
@@ -0,0 +1,9 @@
function SLC_Reset_Boss(context)
ScriptLib.PrintContextLog(context,"ResetBoss: 触发脱战,重新生成BOSS")
ScriptLib.RemoveEntityByConfigId(context, 0, EntityType.MONSTER, BossConfigID)
--再重新创建出来
ScriptLib.CreateMonster(context, { config_id = BossConfigID, delay_time = 0 })
return 0
end
@@ -0,0 +1,103 @@
--ServerUploadTool Save to [/root/env/data/lua/common/V3_1]
--[[
=====================================================================================================================
|| Filename || RotateDungeon
|| RelVersion || 3.1
|| Owner || xudong.sun
|| Description || 3.1旋转地城
|| LogName || ## RotateDungeon_LOG
|| Protection || 每次进地城的角度初始化,在leveltagdata中配置
=====================================================================================================================
local Option_to_Rotation = {
[操作台ConfigID]={
[OptionID] = { levelTag = "qingtian", arrayPoint = 1 },
[OptionID] = { levelTag = "qingtian", arrayPoint = 2 },
},
[操作台ConfigID]={
[OptionID] = { levelTag = "qingtian", arrayPoint = 1 },
[OptionID] = { levelTag = "qingtian", arrayPoint = 2 },
},
[操作台ConfigID]={
[OptionID] = { levelTag = "qingtian", arrayPoint = 1 },
[OptionID] = { levelTag = "qingtian", arrayPoint = 2 },
[OptionID] = { levelTag = "qingtian", arrayPoint = 3 },
},
}
local AxisList = {
[操作台configID] = 轴ConfigID,
[操作台configID] = 轴ConfigID,
[操作台configID] = 轴ConfigID,
}
local ArrayID = {
[操作台ConfigID] = 1
}
=======================================================================================]]
local extrTriggers = {
initialtrigger = {
["Option_Down"] = { config_id = 80000001, name = "Option_Down", event= EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_option_down", trigger_count = 0},
--["Group_load"] = { config_id = 80000002, name = "Group_load", event= EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0},
}
}
-- function action_group_load(context, evt)
-- -- for k,v in pairs(Option_to_Rotation) do
-- -- ScriptLib.ChangeToTargetLevelTag(context, _nextRotate.levelTag)
-- -- end
-- return 0
-- end
function action_option_down( context, evt )
ScriptLib.PrintContextLog(context, "## RotateDungeon_LOG : 触发Event")
if AxisList[evt.param1] == nil or Option_to_Rotation[evt.param1] == nil then
ScriptLib.PrintContextLog(context, "## RotateDungeon_LOG : 判定未通过")
return 0
end
--获取轴的configID
local _axisConfigID = AxisList[evt.param1]
--获取当前需要调整的旋转角度
local _nextRotate = Option_to_Rotation[evt.param1][evt.param2]
if _nextRotate == nil or _axisConfigID == nil then
ScriptLib.PrintContextLog(context, "## RotateDungeon_LOG : 判定未通过 2 ")
ScriptLib.PrintGroupWarning(context,"## RotateDungeon action_option_down: 获取到的轴物件为空或者下一个旋转点为空")
return 0
end
ScriptLib.PrintContextLog(context, "## RotateDungeon_LOG : 将configID ".._axisConfigID.." 移动到array "..ArrayID[evt.param1].." 的point ".._nextRotate.arrayPoint)
--设置轴旋转
ScriptLib.SetPlatformPointArray(context, _axisConfigID, ArrayID[evt.param1], {_nextRotate.arrayPoint}, {route_type = 0})
--设置LevelTag
ScriptLib.ChangeToTargetLevelTag(context, _nextRotate.levelTag)
return 0
end
function LF_Initialize_Group()
for k,v in pairs(extrTriggers.initialtrigger) do
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
return 0
end
LF_Initialize_Group()
@@ -0,0 +1,78 @@
-- --ServerUploadTool Save to [/root/env/data/lua/common/V3_1]
-- --[[
-- =====================================================================================================================
-- || Filename || RotateStair
-- || RelVersion || 3.1
-- || Owner || xudong.sun
-- || Description || 3.1旋转台阶
-- || LogName || ## RotateStair_LOG
-- || Protection ||
-- =====================================================================================================================
-- local stairConfigID = 0
-- local turnOption = 0
-- local cystalConfigID = 0
-- local operator_stair = {
-- [gadgetstate] = {stairconfigID, stairconfigID},
-- [gadgetstate] = {stairconfigID, stairconfigID},
-- }
-- =======================================================================================]]
-- local extrTriggers = {
-- initialtrigger = {
-- ["Option_Down"] = { config_id = 80000001, name = "Option_Down", event= EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_option_down", trigger_count = 0},
-- ["Group_Load"] = { config_id = 80000002, name = "Group_Load", event= EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0},
-- ["Time_Axis"] = { config_id = 80000003, name = "Time_Axis", event= EventType.EVENT_TIME_AXIS_PASS, source = "DelaySetOption", condition = "", action = "action_time_axis", trigger_count = 0},
-- }
-- }
-- function action_group_load( context, evt )
-- ScriptLib.SetWorktopOptionsByGroupId(context, 0, cystalConfigID, {turnOption})
-- return 0
-- end
-- function action_option_down( context, evt )
-- if evt.param2 == turnOption then
-- for i,v in ipairs(operator_stair[ScriptLib.GetGadgetStateByConfigId(context, 0, evt.param1)]) do
-- local curState = ScriptLib.GetGadgetStateByConfigId(context, 0, v)
-- local nextState = curState - 1
-- if nextState < 201 then
-- nextState = 204
-- end
-- ScriptLib.SetGroupGadgetStateByConfigId(context, 0, v, nextState)
-- end
-- ScriptLib.DelWorktopOption(context, turnOption)
-- ScriptLib.InitTimeAxis(context, "DelaySetOption", {1}, false)
-- ScriptLib.SetEntityServerGlobalValueByConfigId(context, evt.param1, "SGV_SET_LIGHT", 1)
-- end
-- return 0
-- end
-- function action_time_axis( context, evt)
-- ScriptLib.SetWorktopOptionsByGroupId(context, 0, cystalConfigID, {turnOption})
-- ScriptLib.SetEntityServerGlobalValueByConfigId(context, cystalConfigID, "SGV_SET_LIGHT", 0)
-- return 0
-- end
-- function LF_Initialize_Group()
-- for k,v in pairs(extrTriggers.initialtrigger) do
-- table.insert(triggers, v)
-- table.insert(suites[init_config.suite].triggers, v.name)
-- end
-- return 0
-- end
-- LF_Initialize_Group()
@@ -0,0 +1,147 @@
--ServerUploadTool Save to [/root/env/data/lua/common/V3_1]
--[[
=====================================================================================================================
|| Filename || SetChainLevel
|| RelVersion || 3.1
|| Owner || xudong.sun
|| Description || 3.1脏器瓮升级
|| LogName || ## SetChainLevel_LOG
|| Protection ||
=====================================================================================================================
local levelUpOption = 0
local chainId = 0
lcoal maxLevel = 5
local notifyGroupList = {}
local needCS = true
local CS_ID = 1
local regionID = 0
=======================================================================================]]
local extrTriggers = {
initialtrigger = {
["Varibale_Change"] = { config_id = 80000001, name = "Varibale_Change", event= EventType.EVENT_VARIABLE_CHANGE, source = "Variable_Setchain", condition = "", action = "action_variable_change", trigger_count = 0},
["Enter_Region"] = { config_id = 80000002, name = "Enter_Region", event= EventType.EVENT_ENTER_REGION, source = "", condition = "", action = "action_enter_region", trigger_count = 0},
}
}
local chainList = {100004,100006,100007,100008}
local normalQuestID = {7305246, 7305442, 7322101, 7322201, 7308305}
local sp_1_QuestID = 7305437
local sp_2_QuestID = 7308301
function action_variable_change( context, evt )
if evt.param1 ~= 1 or evt.param2 == 1 then
return 0
end
local perLevel = {}
local afterLevel = {}
for i,v in ipairs(chainList) do
ScriptLib.PrintContextLog(context, "## SetChainLevel_LOG : 升级前等级: "..ScriptLib.GetChainLevel(context, ScriptLib.GetSceneOwnerUid(context), v))
table.insert(perLevel,ScriptLib.GetChainLevel(context, ScriptLib.GetSceneOwnerUid(context), v))
end
local targetLevel = maxLevel
local tempLevel = ScriptLib.GetChainLevel(context, ScriptLib.GetSceneOwnerUid(context), chainId)
if tempLevel < maxLevel then
targetLevel = tempLevel + 1
end
ScriptLib.SetChainLevel(context, chainId, targetLevel, true)
if notifyGroupList ~= nil and #notifyGroupList > 0 then
for i,v in ipairs(notifyGroupList) do
ScriptLib.ExecuteGroupLua(context, v, "LF_RestOperatorState", {})
end
end
if CS_ID == nil then
return 0
end
for i,v in ipairs(chainList) do
ScriptLib.PrintContextLog(context, "## SetChainLevel_LOG : 升级后等级: "..ScriptLib.GetChainLevel(context, ScriptLib.GetSceneOwnerUid(context), v))
table.insert(afterLevel,ScriptLib.GetChainLevel(context, ScriptLib.GetSceneOwnerUid(context), v))
end
if #perLevel<4 or #afterLevel<4 then
ScriptLib.PrintGroupWarning(context,"## SetChainLevel_LOG action_variable_change: 升级前后的等级有获取失败")
return 0
end
ScriptLib.PrintContextLog(context, "## SetChainLevel_LOG : 下发CS "..CS_ID.."param { "..perLevel[1].." "..perLevel[2].." "..perLevel[3].." "..perLevel[4].." "..afterLevel[1].." "..afterLevel[2].." "..afterLevel[3].." "..afterLevel[4].." }")
--触发升级CS表现
ScriptLib.PlayCutSceneWithParam(context, CS_ID, 0, {{perLevel[1],perLevel[2],perLevel[3],perLevel[4],afterLevel[1],afterLevel[2],afterLevel[3],afterLevel[4]}})
return 0
end
function action_enter_region( context, evt )
if evt.param1 ~= regionID then
return 0
end
local avatar_eid = ScriptLib.GetAvatarEntityIdByUid(context, ScriptLib.GetSceneOwnerUid(context))
--普通等级保底
local tempLevel = 0
for i,v in ipairs(normalQuestID) do
if ScriptLib.GetQuestState(context, avatar_eid, v) == QuestState.FINISHED then
tempLevel = tempLevel + 1
end
end
if ScriptLib.GetChainLevel(context, ScriptLib.GetSceneOwnerUid(context), 100004) < tempLevel then
--触发保底
ScriptLib.SetChainLevel(context, 100004, tempLevel, true)
ScriptLib.PrintGroupWarning(context,"## SetChainLevel_LOG action_enter_region: 触发赤王普通权限保底了,快查查怎么回事")
ScriptLib.PrintContextLog(context, "## SetChainLevel_LOG : 触发赤王普通权限保底")
end
--特殊等级1保底
if ScriptLib.GetQuestState(context, avatar_eid, sp_1_QuestID) == QuestState.FINISHED and ScriptLib.GetChainLevel(context, ScriptLib.GetSceneOwnerUid(context), 100006) == 0 then
--触发保底
ScriptLib.SetChainLevel(context, 100006, 1, true)
ScriptLib.PrintGroupWarning(context,"## SetChainLevel_LOG action_enter_region: 触发赤王特殊权限1保底了,快查查怎么回事")
ScriptLib.PrintContextLog(context, "## SetChainLevel_LOG : 触发赤王特殊权限1保底")
end
--特殊等级2保底
if ScriptLib.GetQuestState(context, avatar_eid, sp_2_QuestID) == QuestState.FINISHED and ScriptLib.GetChainLevel(context, ScriptLib.GetSceneOwnerUid(context), 100007) == 0 then
--触发保底
ScriptLib.SetChainLevel(context, 100007, 1, true)
ScriptLib.PrintGroupWarning(context,"## SetChainLevel_LOG action_enter_region: 触发赤王特殊权限2保底了,快查查怎么回事")
ScriptLib.PrintContextLog(context, "## SetChainLevel_LOG : 触发赤王特殊权限2保底")
end
return 0
end
function LF_Initialize_Group()
for k,v in pairs(extrTriggers.initialtrigger) do
table.insert(triggers, v)
table.insert(suites[init_config.suite].triggers, v.name)
end
table.insert(variables,{ config_id=50000001, name = "Variable_Setchain", value = 0, no_refresh = true})
return 0
end
LF_Initialize_Group()
@@ -0,0 +1,56 @@
--- local markList = {}
local markTriggers = {
initialtrigger = {
["StateChange"] = { config_id = 90000001, name = "StateChange", event= EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_state_change_transportmark", trigger_count = 0},
}
}
function action_state_change_transportmark(context, evt)
ScriptLib.PrintContextLog(context, "## MarkAction : StateChange")
local markState = 0
for i,v in ipairs(markList) do
if evt.param2 == v then
if evt.param1 == 0 then
markState = 1
elseif evt.param3 == 0 then
markState = 2
else
break
end
ScriptLib.MarkGroupLuaAction(context, "transparentstate", "", {group_id = base_info.group_id ,
config_id = evt.param2,
gadget_id = ScriptLib.GetGadgetIdByEntityId(context, ScriptLib.GetEntityIdByConfigId(context, evt.param2)),
state = markState })
break
end
end
return 0
end
function LF_Initialize_MarkGroup()
for k,v in pairs(markTriggers.initialtrigger) do
table.insert(triggers, v)
for i,n in ipairs(suites) do
table.insert(n.triggers, v.name)
end
end
return 0
end
LF_Initialize_MarkGroup()