mirror of
https://gitlab.com/YuukiPS/GC-Resources.git
synced 2025-04-28 09:05:26 +00:00
Add Gadget Lua
This commit is contained in:
parent
e484e4cdd5
commit
23a9ebf73d
34
Resources/Scripts/Gadget/AirflowAgent.lua
Normal file
34
Resources/Scripts/Gadget/AirflowAgent.lua
Normal file
@ -0,0 +1,34 @@
|
||||
local default_time = 6
|
||||
local Action01_time = 2
|
||||
local Action02_time = 8
|
||||
|
||||
function OnTimer(context, now)
|
||||
ScriptLib.PrintLog("time = "..now)
|
||||
local arguments = ScriptLib.GetGadgetArguments(context)
|
||||
local length = #arguments
|
||||
local state_begin_time = ScriptLib.GetGadgetStateBeginTime(context)
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
|
||||
-- 获取机关当前状态
|
||||
if state == GadgetState.Default then
|
||||
if length > 0 and arguments[1] > 2 then
|
||||
default_time = arguments[1] - 2
|
||||
end
|
||||
if now >= state_begin_time + default_time then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
elseif state == GadgetState.Action01 then
|
||||
if now >= state_begin_time + Action01_time then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
elseif state == GadgetState.Action02 then
|
||||
if length > 1 and arguments[2] > 0 then
|
||||
Action02_time = arguments[2]
|
||||
end
|
||||
if now >= state_begin_time + Action02_time then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
12
Resources/Scripts/Gadget/AllElemController.lua
Normal file
12
Resources/Scripts/Gadget/AllElemController.lua
Normal file
@ -0,0 +1,12 @@
|
||||
-- 机关被攻击
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
if is_host == true then
|
||||
-- 获取机关当前状态
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if state == GadgetState.Default then
|
||||
--if ElementType.None == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
--end
|
||||
end
|
||||
end
|
||||
end
|
13
Resources/Scripts/Gadget/AncientOre.lua
Normal file
13
Resources/Scripts/Gadget/AncientOre.lua
Normal file
@ -0,0 +1,13 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
local this_config = ScriptLib.GetContextGadgetConfigId(context)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
--ScriptLib.PrintLog("GadgetState Get Change!!!!!!!")
|
||||
ScriptLib.SetGadgetState(context, param1)
|
||||
if param1==0 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_config, false)
|
||||
end
|
||||
if param1==201 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_config, true)
|
||||
end
|
||||
return 0
|
||||
end
|
4
Resources/Scripts/Gadget/BadmintonBall.lua
Normal file
4
Resources/Scripts/Gadget/BadmintonBall.lua
Normal file
@ -0,0 +1,4 @@
|
||||
-- abilityRequest
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
26
Resources/Scripts/Gadget/BalloonTree.lua
Normal file
26
Resources/Scripts/Gadget/BalloonTree.lua
Normal file
@ -0,0 +1,26 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
end
|
23
Resources/Scripts/Gadget/BigAster.lua
Normal file
23
Resources/Scripts/Gadget/BigAster.lua
Normal file
@ -0,0 +1,23 @@
|
||||
local defs = {
|
||||
player_energy = "AVATAR_ASTER_SCORE"
|
||||
}
|
||||
|
||||
--接收来自abilityAction的消息,启动玩法进度更新逻辑
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
--玩家提交param2->1
|
||||
if param2 == 1 then
|
||||
--获取玩家当前能量
|
||||
local uid = ScriptLib.GetUidByTeamEntityId(context, param3)
|
||||
local energy = ScriptLib.GetTeamAbilityFloatValue(context, uid, defs.player_energy)
|
||||
--将当前能量写入uid_value
|
||||
local old_energy = ScriptLib.GetGadgetPlayUidValue(context, 0, 0, uid, defs.player_energy)
|
||||
ScriptLib.PrintLog("## uid:"..uid.." | energy:"..energy.." | old_energy:"..old_energy)
|
||||
--ScriptLib.SetGadgetPlayUidValue(context, 0, 0, uid, defs.player_energy, old_energy + energy)
|
||||
--通知ability可以清掉自己的能量计数
|
||||
ScriptLib.GadgetPlayUidOp(context, 0, 0, {uid}, 1, "clear_energy", {})
|
||||
--增加玩法总进度
|
||||
ScriptLib.AddScenePlayBattleProgress(context, 133001413, energy)
|
||||
return 0
|
||||
end
|
||||
return -1
|
||||
end
|
10
Resources/Scripts/Gadget/CelestiaSplinter.lua
Normal file
10
Resources/Scripts/Gadget/CelestiaSplinter.lua
Normal file
@ -0,0 +1,10 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
local group_id=ScriptLib.GetContextGroupId(context)
|
||||
if group_id ~= nil and group_id ~= -1 then
|
||||
if param1==0 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, group_id, ScriptLib.GetContextGadgetConfigId(context), false)
|
||||
elseif param1==1 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, group_id, ScriptLib.GetContextGadgetConfigId(context), true)
|
||||
end
|
||||
end
|
||||
end
|
6
Resources/Scripts/Gadget/Chest_Drop_Interact.lua
Normal file
6
Resources/Scripts/Gadget/Chest_Drop_Interact.lua
Normal file
@ -0,0 +1,6 @@
|
||||
-- abilityRequest
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
|
||||
|
14
Resources/Scripts/Gadget/Chest_Interact.lua
Normal file
14
Resources/Scripts/Gadget/Chest_Interact.lua
Normal file
@ -0,0 +1,14 @@
|
||||
-- abilityRequest
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
-- 获取机关当前状态
|
||||
if param1 == 0 then
|
||||
--[[local this_config = ScriptLib.GetGadgetConfigId(context, {gadget_eid = source_entity_id})
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, this_group, this_config, GadgetState.Default)]]
|
||||
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
end
|
||||
|
||||
|
37
Resources/Scripts/Gadget/Chest_Interact_Test.lua
Normal file
37
Resources/Scripts/Gadget/Chest_Interact_Test.lua
Normal file
@ -0,0 +1,37 @@
|
||||
-- abilityRequest
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
local this_target = ScriptLib.GetContextGadgetConfigId(context)
|
||||
--ScriptLib.PrintLog("##config="..this_target)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
--ScriptLib.PrintLog("##config="..this_group)
|
||||
-- 获取机关当前状态
|
||||
if param1 == 0 then
|
||||
--[[local this_config = ScriptLib.GetGadgetConfigId(context, {gadget_eid = source_entity_id})
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, this_group, this_config, GadgetState.Default)]]
|
||||
if this_target == 7 then
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, this_group, 9, GadgetState.chestOpened)
|
||||
end
|
||||
|
||||
if this_target == 9 then
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, this_group, 10, GadgetState.chestOpened)
|
||||
end
|
||||
|
||||
if this_target == 10 then
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, this_group, 11, GadgetState.chestOpened)
|
||||
end
|
||||
|
||||
if this_target == 11 then
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, this_group, 7, GadgetState.chestOpened)
|
||||
end
|
||||
|
||||
ScriptLib.ChangeGroupVariableValue(context,"count",1)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
18
Resources/Scripts/Gadget/ChiWangBarrierGenerator.lua
Normal file
18
Resources/Scripts/Gadget/ChiWangBarrierGenerator.lua
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
--- Generated by Luanalysis
|
||||
--- Created by binghong.shen_187191.
|
||||
--- DateTime: 2022/5/26 14:00
|
||||
---
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
local this_target = ScriptLib.GetContextGadgetConfigId(context)
|
||||
--ScriptLib.PrintLog("##config="..this_target)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
|
||||
--if (param1 == 201) then
|
||||
-- ScriptLib.SetWorktopOptionsByGroupId(context, this_group, this_target, {437})
|
||||
--else
|
||||
-- ScriptLib.SetWorktopOptionsByGroupId(context, this_group, this_target, {})
|
||||
--end
|
||||
|
||||
end
|
6
Resources/Scripts/Gadget/Clue_Source.lua
Normal file
6
Resources/Scripts/Gadget/Clue_Source.lua
Normal file
@ -0,0 +1,6 @@
|
||||
-- abilityRequest
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
ScriptLib.PrintLog("##param1="..param1)
|
||||
-- 获取机关当前状态
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
9
Resources/Scripts/Gadget/CompassTrigger.lua
Normal file
9
Resources/Scripts/Gadget/CompassTrigger.lua
Normal file
@ -0,0 +1,9 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 1 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
240
Resources/Scripts/Gadget/Crucible.lua
Normal file
240
Resources/Scripts/Gadget/Crucible.lua
Normal file
@ -0,0 +1,240 @@
|
||||
--玩家吃球的数据包
|
||||
local protocol = {
|
||||
[1] = { name = "small_grume", value = 0 },
|
||||
[2] = { name = "big_grume", value = 0 },
|
||||
[3] = { name = "in_burst", value = 0 },
|
||||
[4] = { name = "score", value = 0 },
|
||||
[5] = { name = "elem_type", value = 0 }
|
||||
}
|
||||
|
||||
--玩法基础定义,有可能会配在group里
|
||||
local base = {
|
||||
inferior = 300, --小球分数
|
||||
superior = 1000, --大球分数
|
||||
hit_punish = 1, --受击扣分
|
||||
burst_multi = 2, --加成倍率
|
||||
burst_time = 60
|
||||
}
|
||||
|
||||
--元素类型字典
|
||||
local elemType = {
|
||||
[1] = "Water",
|
||||
[2] = "Fire",
|
||||
[3] = "Electric",
|
||||
[4] = "Ice",
|
||||
[5] = "Wind",
|
||||
[6] = "Rock",
|
||||
[7] = "Grass"
|
||||
}
|
||||
|
||||
local ElementType = {
|
||||
["None"] = 0,
|
||||
["Fire"] = 1,
|
||||
["Water"] = 2,
|
||||
["Grass"] = 3,
|
||||
["Electric"] = 4,
|
||||
["Ice"] = 5,
|
||||
["Frozen"] = 6,
|
||||
["Wind"] = 7,
|
||||
["Rock"] = 8,
|
||||
["Antifire"] = 9
|
||||
}
|
||||
|
||||
--globalValue的字典
|
||||
local submit = {
|
||||
[1] = { key = "_Crucible_Grume_Player_Sum_Inferior", value = 0 }, --该玩家本次提交小凝块的数量
|
||||
[2] = { key = "_Crucible_Grume_Player_Sum_Superior", value = 0 }, --该玩家本次提交大凝块的数量
|
||||
[3] = { key = "_Crucible_Grume_Player_In_Burst", value = 0 } --该玩家是否处于加成状态
|
||||
}
|
||||
|
||||
--跟ability通信的编码
|
||||
local notify = {
|
||||
submit_grume = 10086,
|
||||
select_user_str = "random_user"
|
||||
}
|
||||
|
||||
function LF_Log(str, value)
|
||||
ScriptLib.PrintLog("## "..str.." = "..value)
|
||||
return 0
|
||||
end
|
||||
|
||||
function OnPlayStageChange(context, old_stage, cur_stage, final_stage)
|
||||
if cur_stage > old_stage and cur_stage ~= final_stage then
|
||||
--stage变化的识别符标为1
|
||||
local elem = LF_Calculate_ElemWeight(context)
|
||||
ScriptLib.GadgetLuaNotifyGroup(context, elem, old_stage, cur_stage)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
--接收来自abilityAction的消息,启动玩法进度更新逻辑
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
--玩家提交param2->1
|
||||
if param2 == 1 and param1 ~= 5001 then
|
||||
local uid = ScriptLib.GetUidByTeamEntityId(context, param3)
|
||||
return LF_Update_Player_Submit_Grume(context, uid)
|
||||
end
|
||||
--[[ --本体受击param->9
|
||||
elseif param2 == 9 then
|
||||
--上传炉子受击信息
|
||||
return LF_Update_Crucible_BeHit(context)--]]
|
||||
|
||||
--[[--元素凝块异常param->100+
|
||||
elseif param2 >= 100 then
|
||||
local uid = ScriptLib.GetTeamUidByEntityId(context, entity_id)
|
||||
--解析复杂param
|
||||
return LF_Update_Player_Lose_Grume(context, uid, param2)
|
||||
end
|
||||
ScriptLib.PrintLog("## undefined param2="..param2)--]]
|
||||
|
||||
--说明是groupLua过来的消息,param1为点名请求,param2为点名元素
|
||||
if param1 == 5001 then
|
||||
local uid_list = ScriptLib.GetSceneUidList(context)
|
||||
local random_user = {}
|
||||
if #uid_list <= 2 then
|
||||
random_user = uid_list
|
||||
elseif #uid_list > 2 then
|
||||
--local now = ScriptLib.GetServerTime(context)
|
||||
local seed = math.randomseed(tostring(ScriptLib.GetServerTime(context)):reverse():sub(1,5))
|
||||
for i=1,2 do
|
||||
local r = math.random(1,#uid_list)
|
||||
random_user[i] = uid_list[r]
|
||||
table.remove(uid_list, r)
|
||||
end
|
||||
end
|
||||
local dict_elem = 0
|
||||
for k,v in pairs(ElementType) do
|
||||
if k == elemType[param2] then
|
||||
dict_elem = v
|
||||
end
|
||||
end
|
||||
local cur_time = ScriptLib.GetServerTime(context)
|
||||
--点名改到怪物死光了触发
|
||||
ScriptLib.GadgetPlayUidOp(context, 0, 0, random_user, param2, notify.select_user_str, {dict_elem, cur_time, base.burst_time})
|
||||
--随后通知group创建对应计bonus时器
|
||||
ScriptLib.GadgetLuaNotifyGroup(context, 100, param2, 0)
|
||||
LF_Log("notify_op_elem", param2)
|
||||
return 0
|
||||
end
|
||||
return -1
|
||||
end
|
||||
|
||||
--[[--计算炉子受击扣分信息
|
||||
function LF_Update_Crucible_BeHit(context)
|
||||
local process_lost = 0
|
||||
|
||||
local cur_process = ScriptLib.GetGadgetPlayProgress(context, 0, 0)
|
||||
local min_process = ScriptLib.GetGadgetPlayStageBeginProgress(context, 0, 0)
|
||||
|
||||
if min_process <= cur_process - base.hit_punish then
|
||||
process_lost = base.hit_punish * -1
|
||||
else process_lost = min_process - cur_process
|
||||
end
|
||||
|
||||
LF_Log("score_lose", process_lost)
|
||||
ScriptLib.AddGadgetPlayProgress(context, 0, 0, process_lost)
|
||||
return 0
|
||||
end--]]
|
||||
|
||||
--根据uid信息更新获取globalValue
|
||||
function LF_Update_Player_Submit_Grume(context, uid)
|
||||
for i=1,#submit do
|
||||
submit[i].value = ScriptLib.GetTeamAbilityFloatValue(context, uid, submit[i].key)
|
||||
end
|
||||
|
||||
--user_crucible_protocal
|
||||
local user_crucible = LF_Get_Uid_Submit_Info(context, uid)
|
||||
|
||||
--计算本次提交的分数
|
||||
user_crucible[4].value = user_crucible[1].value*base.inferior*(1+user_crucible[3].value*(base.burst_multi-1))
|
||||
user_crucible[4].value = user_crucible[4].value + user_crucible[2].value*base.superior*(1+user_crucible[3].value*(base.burst_multi-1))
|
||||
|
||||
LF_Log("add_progress", user_crucible[4].value)
|
||||
--获取本次提交的元素
|
||||
local x = ScriptLib.GetTeamAbilityFloatValue(context, uid, "_Team_Real_Grume_ElemType")
|
||||
for k,v in pairs(elemType) do
|
||||
if k == x then
|
||||
local _score = ScriptLib.GetGadgetPlayUidValue(context, 0, 0, uid, v)
|
||||
--[[if 0 == _score then
|
||||
ScriptLib.SetGadgetPlayUidValue(context, 0, 0, uid, v, 0)
|
||||
end--]]
|
||||
LF_Log(uid.."_submit_elem", v)
|
||||
LF_Log(uid.."_old_score", _score)
|
||||
LF_Log(uid.."_add_score", user_crucible[4].value)
|
||||
_score = _score + user_crucible[4].value
|
||||
LF_Log(uid.."_new_score", _score)
|
||||
ScriptLib.SetGadgetPlayUidValue(context, 0, 0, uid, v, _score )
|
||||
--额外增加对应元素交球总数统计
|
||||
local ball_count = ScriptLib.GetGadgetPlayUidValue(context, 0, 0, uid, v.."_ball")
|
||||
ScriptLib.SetGadgetPlayUidValue(context, 0, 0, uid, v.."_ball", user_crucible[1].value + user_crucible[2].value + ball_count)
|
||||
break
|
||||
end
|
||||
end
|
||||
ScriptLib.AddGadgetPlayProgress(context, 0, 0, user_crucible[4].value)
|
||||
--user_crucible[5].value = elemType[x]
|
||||
|
||||
--[[local final_packet = {
|
||||
[1]=user_crucible[1].value,
|
||||
[2]=user_crucible[2].value,
|
||||
[3]=user_crucible[3].value,
|
||||
[4]=user_crucible[4].value,
|
||||
[5]=user_crucible[5].value
|
||||
}--]]
|
||||
return 0
|
||||
end
|
||||
|
||||
--获取玩家信息数组
|
||||
function LF_Get_Uid_Submit_Info(context, uid)
|
||||
local result = protocol
|
||||
for i=1,3 do
|
||||
LF_Get_Gadget_Uid_Variable(context, uid, result, i)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
--从gadget变量中获取差值,并更新
|
||||
function LF_Get_Gadget_Uid_Variable(context, uid, array, t)
|
||||
local Uid_Value = ScriptLib.GetGadgetPlayUidValue(context, 0, 0, uid, array[t].name)
|
||||
if Uid_Value == 0 then
|
||||
ScriptLib.SetGadgetPlayUidValue(context, 0, 0, uid, array[t].name, 0)
|
||||
end
|
||||
array[t].value = submit[t].value - Uid_Value
|
||||
ScriptLib.SetGadgetPlayUidValue(context, 0, 0, uid, array[t].name, submit[t].value)
|
||||
return 0
|
||||
end
|
||||
|
||||
--[[--解析复杂param
|
||||
function LF_Update_Player_Lose_Grume(context, uid, value)
|
||||
local struct = {}
|
||||
struct.location = math.floor(value%1000/100)
|
||||
struct.size = math.floor(value%100/10)
|
||||
struct.reason = math.floor(value%10)
|
||||
if struct.location > 3 or struct.size > 2 or struct.reason > 3 then
|
||||
return -1
|
||||
end
|
||||
--##将玩家丢球数据上传至c++
|
||||
--ScriptLib.UploadCrucibleAbnormalPacket(context, uid, struct)
|
||||
return 0
|
||||
end--]]
|
||||
|
||||
function LF_Calculate_ElemWeight(context)
|
||||
local sum = 0
|
||||
for i=1,7 do
|
||||
local var_value = ScriptLib.GetGroupVariableValue(context, elemType[i])
|
||||
if var_value < 0 or var_value == nil then
|
||||
LF_Log("group_var_illegal", i)
|
||||
break
|
||||
end
|
||||
sum = sum + var_value
|
||||
end
|
||||
local r_s = math.random(1,sum)
|
||||
for i=1,7 do
|
||||
local var_value = ScriptLib.GetGroupVariableValue(context, elemType[i])
|
||||
if r_s > var_value then
|
||||
r_s = r_s - var_value
|
||||
else
|
||||
return i
|
||||
end
|
||||
end
|
||||
return -1
|
||||
end
|
13
Resources/Scripts/Gadget/DarkPlant.lua
Normal file
13
Resources/Scripts/Gadget/DarkPlant.lua
Normal file
@ -0,0 +1,13 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
local this_flower = ScriptLib.GetContextGadgetConfigId(context)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_flower, false)
|
||||
elseif param1 ==1 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_flower, true)
|
||||
elseif param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, param1)
|
||||
end
|
||||
end
|
3
Resources/Scripts/Gadget/DatePalm.lua
Normal file
3
Resources/Scripts/Gadget/DatePalm.lua
Normal file
@ -0,0 +1,3 @@
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
ScriptLib.SetGadgetState(context, 1)
|
||||
end
|
16
Resources/Scripts/Gadget/DesertRoseSeed.lua
Normal file
16
Resources/Scripts/Gadget/DesertRoseSeed.lua
Normal file
@ -0,0 +1,16 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
--ScriptLib.PrintLog("##param1="..param1)
|
||||
-- 获取机关当前状态
|
||||
local this_config = ScriptLib.GetContextGadgetConfigId(context)
|
||||
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_config, false)
|
||||
end
|
||||
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_config, true)
|
||||
end
|
||||
end
|
12
Resources/Scripts/Gadget/DreamFlower.lua
Normal file
12
Resources/Scripts/Gadget/DreamFlower.lua
Normal file
@ -0,0 +1,12 @@
|
||||
-- ServerUploadTool Save to [/root/env/data/lua/gadget]
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
local this_gadget = ScriptLib.GetContextGadgetConfigId(context)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_gadget, true)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_gadget, false)
|
||||
end
|
||||
end
|
23
Resources/Scripts/Gadget/ElecCannon.lua
Normal file
23
Resources/Scripts/Gadget/ElecCannon.lua
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
local stateChain={
|
||||
{0101,0102,0103,0104,0105,0106,0107,0108,0109},
|
||||
{0201,0202,0203,0204,0205,0206,0207,0208,0209},
|
||||
{0301,0302,0303,0304,0305,0306,0307,0308,0309},
|
||||
{0401,0402,0403,0404,0,0406,0407,0408,0409},
|
||||
{0501,0502,0503,0504,0505,0506,0507,0508,0509},
|
||||
}
|
||||
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
local gadgetState=ScriptLib.GetGadgetStateByConfigId(context, ScriptLib.GetContextGroupId(context),ScriptLib.GetContextGadgetConfigId(context))
|
||||
for i=1,#stateChain do
|
||||
for j=1,#stateChain[i] do
|
||||
if gadgetState==stateChain[i][j] then
|
||||
if i+param1>0 and i+param1<=#stateChain and j+param2>0 and j+param2 <=#stateChain[i] then
|
||||
ScriptLib.SetGadgetState(context, stateChain[i+param1][j+param2])
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
28
Resources/Scripts/Gadget/ElecController.lua
Normal file
28
Resources/Scripts/Gadget/ElecController.lua
Normal file
@ -0,0 +1,28 @@
|
||||
-- 机关初始化配置
|
||||
-- 初始状态
|
||||
local state_ = GadgetState.GearStart
|
||||
-- 启动元素
|
||||
local start_elem_type_ = ElementType.Electric
|
||||
-- 停止元素
|
||||
local stop_elem_type_ = ElementType.None
|
||||
|
||||
|
||||
-- 机关被攻击
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
if is_host == true then
|
||||
-- 获取机关当前状态
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if state == GadgetState.Default or state == GadgetState.GearAction1 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
||||
if state == GadgetState.Action01 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
12
Resources/Scripts/Gadget/ElectricPile.lua
Normal file
12
Resources/Scripts/Gadget/ElectricPile.lua
Normal file
@ -0,0 +1,12 @@
|
||||
-- abilityRequest
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
--ScriptLib.PrintLog("##param1="..param1)
|
||||
-- 获取机关当前状态
|
||||
local this_config = ScriptLib.GetContextGadgetConfigId(context)
|
||||
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, this_group, 33, GadgetState.GearStart )
|
||||
end
|
||||
|
||||
|
183
Resources/Scripts/Gadget/ElemForce_Base.lua
Normal file
183
Resources/Scripts/Gadget/ElemForce_Base.lua
Normal file
@ -0,0 +1,183 @@
|
||||
--玩家吃球的数据包
|
||||
local protocol = {
|
||||
[1] = { name = "small_grume", value = 0 },
|
||||
[2] = { name = "big_grume", value = 0 },
|
||||
[3] = { name = "in_burst", value = 0 },
|
||||
[4] = { name = "score", value = 0 },
|
||||
[5] = { name = "elem_type", value = 0 }
|
||||
}
|
||||
|
||||
--玩法基础定义,有可能会配在group里
|
||||
local base = {
|
||||
inferior = 200, --小球分数
|
||||
superior = 500, --大球分数
|
||||
hit_punish = 1000, --受击扣分
|
||||
burst_multi = 2 --加成倍率
|
||||
}
|
||||
|
||||
--元素类型字典
|
||||
local elemType = {
|
||||
[1] = "Fire",
|
||||
[2] = "Water",
|
||||
[3] = "Electric",
|
||||
[4] = "Ice",
|
||||
[5] = "Wind",
|
||||
[6] = "Rock",
|
||||
[7] = "Grass"
|
||||
}
|
||||
|
||||
--globalValue的字典
|
||||
local submit = {
|
||||
[1] = { key = "_Crucible_Grume_Player_Sum_Inferior", value = 0 }, --该玩家本次提交小凝块的数量
|
||||
[2] = { key = "_Crucible_Grume_Player_Sum_Superior", value = 0 }, --该玩家本次提交大凝块的数量
|
||||
[3] = { key = "_Crucible_Grume_Player_In_Burst", value = 0 } --该玩家是否处于加成状态
|
||||
}
|
||||
|
||||
--跟ability通信的编码
|
||||
local notify = {
|
||||
submit_grume = 10086,
|
||||
select_user_str = "random_user",
|
||||
select_user_value = 10
|
||||
}
|
||||
|
||||
function OnPlayStageChange(context, old_stage, cur_stage, final_stage)
|
||||
if cur_stage > old_stage and cur_stage ~= final_stage then
|
||||
local uid_list = ScriptLib.GetSceneUidList(context)
|
||||
local random_user = {}
|
||||
if #uid_list <= 2 then
|
||||
random_user = uid_list
|
||||
else
|
||||
local seed = math.randomseed(tostring(os.time()):reverse():sub(1,5))
|
||||
for i=1,2 do
|
||||
local r = math.random(1,#uid_list)
|
||||
random_user[i] = uid_list[r]
|
||||
table.remove(uid_list, r)
|
||||
end
|
||||
|
||||
local elem = LF_Calculate_ElemWeight(context)
|
||||
ScriptLib.GadgetPlayUidOp(context, 0, 0, random_user, notify.select_user_value, elem)
|
||||
--stage变化的识别符标为1
|
||||
ScriptLib.GadgetLuaNotifyGroup(context, elem, old_stage, cur_stage)
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
--接收来自abilityAction的消息,启动玩法进度更新逻辑
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
--玩家提交param2->1
|
||||
if param2 == 1 then
|
||||
local uid = ScriptLib.GetUidByTeamEntityId(context, param3)
|
||||
return LF_Update_Player_Submit_Grume(context, uid)
|
||||
|
||||
--本体受击param->9
|
||||
elseif param2 == 9 then
|
||||
--上传炉子受击信息
|
||||
return LF_Update_Crucible_BeHit(context)
|
||||
|
||||
--元素凝块异常param->100+
|
||||
elseif param2 >= 100 then
|
||||
local uid = ScriptLib.GetTeamUidByEntityId(context, entity_id)
|
||||
--解析复杂param
|
||||
return LF_Update_Player_Lose_Grume(context, uid, param2)
|
||||
end
|
||||
return -1
|
||||
end
|
||||
|
||||
--计算炉子受击扣分信息
|
||||
function LF_Update_Crucible_BeHit(context)
|
||||
local process_lost = 0
|
||||
|
||||
local cur_process = ScriptLib.GetGadgetPlayProgress(context, 0, 0)
|
||||
local min_process = ScriptLib.GetGadgetPlayStageBeginProgress(context, 0, 0)
|
||||
|
||||
if min_process <= cur_process - base.hit_punish then
|
||||
process_lost = base.hit_punish
|
||||
else process_lost = min_process - cur_process
|
||||
end
|
||||
|
||||
ScriptLib.AddGadgetPlayProgress(context, 0, 0, process_lost)
|
||||
return 0
|
||||
end
|
||||
|
||||
--根据uid信息更新获取globalValue
|
||||
function LF_Update_Player_Submit_Grume(context, uid)
|
||||
for i=1,#submit do
|
||||
submit[i].value = ScriptLib.GetTeamAbilityFloatValue(context, uid, submit[i].key)
|
||||
end
|
||||
|
||||
--user_crucible_protocal
|
||||
local user_crucible = LF_Get_Uid_Submit_Info(context, uid)
|
||||
|
||||
--计算本次提交的分数
|
||||
user_crucible[4].value = user_crucible[1].value*base.inferior*(1+user_crucible[3].value*base.burst_multi)
|
||||
user_crucible[4].value = user_crucible[4].value + user_crucible[2].value*base.superior*(1+user_crucible[3].value*base.burst_multi)
|
||||
|
||||
--获取本次提交的元素
|
||||
local x = ScriptLib.GetTeamAbilityFloatValue(context, uid, "_Team_Real_Grume_ElemType")
|
||||
user_crucible[5].value = elemType[x]
|
||||
|
||||
local final_packet = {
|
||||
[1]=user_crucible[1].value,
|
||||
[2]=user_crucible[2].value,
|
||||
[3]=user_crucible[3].value,
|
||||
[4]=user_crucible[4].value,
|
||||
[5]=user_crucible[5].value
|
||||
}
|
||||
--##将玩家获取分数消息更新至c++
|
||||
--ScriptLib.UploadCrucibleSubmitPacket(context, uid, final_packet)
|
||||
|
||||
ScriptLib.AddGadgetPlayProgress(context, 0, 0, user_crucible[4].value)
|
||||
return 0
|
||||
end
|
||||
|
||||
--获取玩家信息数组
|
||||
function LF_Get_Uid_Submit_Info(context, uid)
|
||||
local result = protocol
|
||||
for i=1,#result do
|
||||
LF_Get_Gadget_Uid_Variable(context, uid, result, i)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
--从gadget变量中获取差值,并更新
|
||||
function LF_Get_Gadget_Uid_Variable(context, uid, array, t)
|
||||
array[t].value = submit[t].value - ScriptLib.GetGadgetPlayUidValue(context, 0, 0, uid, array[t].name)
|
||||
ScriptLib.SetGadgetPlayUidValue(context, 0, 0, uid, array[t].name, submit[t].value)
|
||||
return
|
||||
end
|
||||
|
||||
--解析复杂param
|
||||
function LF_Update_Player_Lose_Grume(context, uid, value)
|
||||
local struct = {}
|
||||
struct.location = math.floor(value%1000/100)
|
||||
struct.size = math.floor(value%100/10)
|
||||
struct.reason = math.floor(value%10)
|
||||
if struct.location > 3 or struct.size > 2 or struct.reason > 3 then
|
||||
return -1
|
||||
end
|
||||
--##将玩家丢球数据上传至c++
|
||||
--ScriptLib.UploadCrucibleAbnormalPacket(context, uid, struct)
|
||||
return 0
|
||||
end
|
||||
|
||||
function LF_Calculate_ElemWeight(context)
|
||||
local sum = 0
|
||||
for i=1,7 do
|
||||
local var_value = ScriptLib.GetGroupVariableValue(context, elemType[i])
|
||||
if var_value < 0 then
|
||||
break
|
||||
end
|
||||
sum = sum + var_value
|
||||
end
|
||||
local r_s = math.random(1,sum)
|
||||
for i=1,7 do
|
||||
local var_value = ScriptLib.GetGroupVariableValue(context, elemType[i])
|
||||
if r_s > var_value then
|
||||
r_s = r_s - var_value
|
||||
else
|
||||
return i
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
12
Resources/Scripts/Gadget/ElementFlora.lua
Normal file
12
Resources/Scripts/Gadget/ElementFlora.lua
Normal file
@ -0,0 +1,12 @@
|
||||
-- abilityRequest
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
--ScriptLib.PrintLog("##param1="..param1)
|
||||
-- 获取机关当前状态
|
||||
local this_config = ScriptLib.GetContextGadgetConfigId(context)
|
||||
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_config, true)
|
||||
end
|
||||
|
||||
|
17
Resources/Scripts/Gadget/ElementFlora02.lua
Normal file
17
Resources/Scripts/Gadget/ElementFlora02.lua
Normal file
@ -0,0 +1,17 @@
|
||||
-- abilityRequest
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
--ScriptLib.PrintLog("##param1="..param1)
|
||||
-- 获取机关当前状态
|
||||
local this_config = ScriptLib.GetContextGadgetConfigId(context)
|
||||
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
|
||||
local gather_config_ids = ScriptLib.GetGatherConfigIdList(context)
|
||||
|
||||
if param1 == 1 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, gather_config_ids[1], true)
|
||||
end
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, gather_config_ids[2], true)
|
||||
end
|
||||
end
|
10
Resources/Scripts/Gadget/ElementForce.lua
Normal file
10
Resources/Scripts/Gadget/ElementForce.lua
Normal file
@ -0,0 +1,10 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
-- 获取机关当前状态
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
elseif param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
||||
|
||||
|
23
Resources/Scripts/Gadget/ElementRock.lua
Normal file
23
Resources/Scripts/Gadget/ElementRock.lua
Normal file
@ -0,0 +1,23 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
--ScriptLib.PrintLog("##param1="..param1)
|
||||
-- 获取机关当前状态
|
||||
local this_config = ScriptLib.GetContextGadgetConfigId(context)
|
||||
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_config, false)
|
||||
end
|
||||
if param1 == 1 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_config, true)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
end
|
23
Resources/Scripts/Gadget/ElementRune.lua
Normal file
23
Resources/Scripts/Gadget/ElementRune.lua
Normal file
@ -0,0 +1,23 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
end
|
28
Resources/Scripts/Gadget/FireController.lua
Normal file
28
Resources/Scripts/Gadget/FireController.lua
Normal file
@ -0,0 +1,28 @@
|
||||
-- 机关初始化配置
|
||||
-- 初始状态
|
||||
local state_ = GadgetState.GearStart
|
||||
-- 启动元素
|
||||
local start_elem_type_ = ElementType.Fire
|
||||
-- 停止元素
|
||||
local stop_elem_type_ = ElementType.None
|
||||
|
||||
|
||||
-- 机关被攻击
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
if is_host == true then
|
||||
-- 获取机关当前状态
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if state == GadgetState.Default or state == GadgetState.GearAction1 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
||||
if state == GadgetState.Action01 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
16
Resources/Scripts/Gadget/Fire_Source.lua
Normal file
16
Resources/Scripts/Gadget/Fire_Source.lua
Normal file
@ -0,0 +1,16 @@
|
||||
-- abilityRequest
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
--ScriptLib.PrintLog("##param1="..param1)
|
||||
-- 获取机关当前状态
|
||||
if param1 == 0 then
|
||||
--[[local this_config = ScriptLib.GetGadgetConfigId(context, {gadget_eid = source_entity_id})
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, this_group, this_config, GadgetState.Default)]]
|
||||
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
elseif param1 == 1 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
||||
|
||||
|
30
Resources/Scripts/Gadget/GadgetMarkAction.lua
Normal file
30
Resources/Scripts/Gadget/GadgetMarkAction.lua
Normal file
@ -0,0 +1,30 @@
|
||||
--[[======================================
|
||||
|| filename: GadgetMarkAction
|
||||
|| owner: zijun.ma
|
||||
|| description: 3.0开始应用的通用物件MarkAction
|
||||
|| LogName: TD_GadgetMarkAction
|
||||
|| Protection: [Protection]
|
||||
=======================================]]
|
||||
--[[
|
||||
-- 功能需求 --
|
||||
由Gadget发起的MarkLuaAction,希望使用者不修改便可以使用
|
||||
param1:统一约束为GadgetID,用于方便运营识别(会出现多个GadgetID用一套)
|
||||
param2:区分用,类似区分序号
|
||||
--]]
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == nil then
|
||||
return 0
|
||||
end
|
||||
|
||||
local groupID = ScriptLib.GetContextGroupId(context)
|
||||
local configID = ScriptLib.GetContextGadgetConfigId(context)
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
|
||||
if param2 == nil then
|
||||
ScriptLib.MarkGroupLuaAction(context, "Gadget_".. param1, "", {["group_id"]=groupID,["config_id"]=configID,["state_id"]=state})
|
||||
else
|
||||
ScriptLib.MarkGroupLuaAction(context, "Gadget_".. param1, "", {["group_id"]=groupID,["config_id"]=configID,["state_id"]=state,["special"] = param2})
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
8
Resources/Scripts/Gadget/Gather_ElectricRock01.lua
Normal file
8
Resources/Scripts/Gadget/Gather_ElectricRock01.lua
Normal file
@ -0,0 +1,8 @@
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
if element_type == ElementType.Electric then
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "ElectricRock_Destroy"})
|
||||
local this_rock = ScriptLib.GetContextGadgetConfigId(context)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
ScriptLib.KillEntityByConfigId(context, { group_id = this_group, config_id = this_rock })
|
||||
end
|
||||
end
|
10
Resources/Scripts/Gadget/Gather_ElectricRock03.lua
Normal file
10
Resources/Scripts/Gadget/Gather_ElectricRock03.lua
Normal file
@ -0,0 +1,10 @@
|
||||
-- abilityRequest
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
--ScriptLib.PrintLog("##param1="..param1)
|
||||
-- 获取机关当前状态
|
||||
local this_config = ScriptLib.GetContextGadgetConfigId(context)
|
||||
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_config, true)
|
||||
end
|
19
Resources/Scripts/Gadget/Gather_FireFlower01.lua
Normal file
19
Resources/Scripts/Gadget/Gather_FireFlower01.lua
Normal file
@ -0,0 +1,19 @@
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
--ScriptLib.PrintLog("##BeHurt")
|
||||
local this_flower = ScriptLib.GetContextGadgetConfigId(context)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
|
||||
if element_type == ElementType.Fire then
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if state == GadgetState.Default then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_flower, true)
|
||||
elseif state ~= GadgetState.Action02 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
elseif state == GadgetState.Action03 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
|
||||
--ScriptLib.KillEntityByConfigId(context, { group_id = this_group, config_id = this_flower })
|
||||
end
|
||||
end
|
18
Resources/Scripts/Gadget/Gather_FireFlower02.lua
Normal file
18
Resources/Scripts/Gadget/Gather_FireFlower02.lua
Normal file
@ -0,0 +1,18 @@
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
--ScriptLib.PrintLog("##BeHurt")
|
||||
local this_flower = ScriptLib.GetContextGadgetConfigId(context)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
|
||||
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if state == GadgetState.Default then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
elseif state == GadgetState.Action01 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
elseif state == GadgetState.Action02 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
|
||||
--ScriptLib.KillEntityByConfigId(context, { group_id = this_group, config_id = this_flower })
|
||||
|
||||
end
|
9
Resources/Scripts/Gadget/Gather_KapokFlower.lua
Normal file
9
Resources/Scripts/Gadget/Gather_KapokFlower.lua
Normal file
@ -0,0 +1,9 @@
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if element_type == ElementType.Water then
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "Water_Bloom"})
|
||||
local this_flower = ScriptLib.GetContextGadgetConfigId(context)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
ScriptLib.KillEntityByConfigId(context, { group_id = this_group, config_id = this_flower })
|
||||
end
|
||||
end
|
8
Resources/Scripts/Gadget/Gear_MovingTarget.lua
Normal file
8
Resources/Scripts/Gadget/Gear_MovingTarget.lua
Normal file
@ -0,0 +1,8 @@
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
local this_target = ScriptLib.GetContextGadgetConfigId(context)
|
||||
--ScriptLib.PrintLog("##config="..this_target)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
--ScriptLib.PrintLog("##config="..this_group)
|
||||
ScriptLib.KillEntityByConfigId(context, { group_id = this_group, config_id = this_target })
|
||||
end
|
8
Resources/Scripts/Gadget/Ginseng.lua
Normal file
8
Resources/Scripts/Gadget/Ginseng.lua
Normal file
@ -0,0 +1,8 @@
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
local this_target = ScriptLib.GetContextGadgetConfigId(context)
|
||||
--ScriptLib.PrintLog("##config="..this_target)
|
||||
--local this_group = ScriptLib.GetContextGroupId(context)
|
||||
--ScriptLib.PrintLog("##config="..this_group)
|
||||
ScriptLib.SetGadgetStateByConfigId(context, this_target, GadgetState.GatherDrop)
|
||||
ScriptLib.PrintLog("OnHit Trigger")
|
||||
end
|
5
Resources/Scripts/Gadget/GinsengOnTree.lua
Normal file
5
Resources/Scripts/Gadget/GinsengOnTree.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
|
||||
end
|
21
Resources/Scripts/Gadget/GinsengTree.lua
Normal file
21
Resources/Scripts/Gadget/GinsengTree.lua
Normal file
@ -0,0 +1,21 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
local gather_config_ids = ScriptLib.GetGatherConfigIdList(context)
|
||||
local length = #gather_config_ids
|
||||
ScriptLib.PrintLog("gather_config_ids length: " ..length)
|
||||
if length > 0 then
|
||||
if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, gather_config_ids[1], GadgetState.GearStart) then
|
||||
ScriptLib.PrintLog("Drop config_id:" .. gather_config_ids[1] .." failed")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
local gather_config_ids = ScriptLib.GetGatherConfigIdList(context)
|
||||
local length = #gather_config_ids
|
||||
ScriptLib.PrintLog("gather_config_ids length: " ..length)
|
||||
if length > 0 then
|
||||
if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, gather_config_ids[1], GadgetState.GearStart) then
|
||||
ScriptLib.PrintLog("Drop config_id:" .. gather_config_ids[1] .." failed")
|
||||
end
|
||||
end
|
||||
end
|
8
Resources/Scripts/Gadget/GlazedLily.lua
Normal file
8
Resources/Scripts/Gadget/GlazedLily.lua
Normal file
@ -0,0 +1,8 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
26
Resources/Scripts/Gadget/GrassController.lua
Normal file
26
Resources/Scripts/Gadget/GrassController.lua
Normal file
@ -0,0 +1,26 @@
|
||||
-- 机关初始化配置
|
||||
-- 初始状态
|
||||
local state_ = GadgetState.GearStart
|
||||
-- 启动元素
|
||||
local start_elem_type_ = ElementType.Grass
|
||||
-- 停止元素
|
||||
local stop_elem_type_ = ElementType.None
|
||||
|
||||
|
||||
-- 机关被攻击
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
if is_host == true then
|
||||
-- 获取机关当前状态
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if state == GadgetState.Default or state == GadgetState.GearAction1 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
||||
if state == GadgetState.Action01 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
28
Resources/Scripts/Gadget/IceController.lua
Normal file
28
Resources/Scripts/Gadget/IceController.lua
Normal file
@ -0,0 +1,28 @@
|
||||
-- 机关初始化配置
|
||||
-- 初始状态
|
||||
local state_ = GadgetState.GearStart
|
||||
-- 启动元素
|
||||
local start_elem_type_ = ElementType.Ice
|
||||
-- 停止元素
|
||||
local stop_elem_type_ = ElementType.None
|
||||
|
||||
|
||||
-- 机关被攻击
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
if is_host == true then
|
||||
-- 获取机关当前状态
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if state == GadgetState.Default or state == GadgetState.GearAction1 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
||||
if state == GadgetState.Action01 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
59
Resources/Scripts/Gadget/IceControllerActive.lua
Normal file
59
Resources/Scripts/Gadget/IceControllerActive.lua
Normal file
@ -0,0 +1,59 @@
|
||||
-- 机关初始化配置
|
||||
-- 初始状态
|
||||
local state_ = GadgetState.GearStart
|
||||
-- 启动元素
|
||||
local start_elem_type_ = ElementType.Ice
|
||||
-- 停止元素
|
||||
local stop_elem_type_ = ElementType.None
|
||||
|
||||
|
||||
-- 机关被攻击
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
if is_host == true then
|
||||
-- 获取机关当前状态
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if state == GadgetState.Default or state == GadgetState.GearAction1 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
||||
if state == GadgetState.Action01 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
--ScriptLib.PrintLog("GadgetState Get Change!!!!!!!")
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
if param1 == 903 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
if param1 == 106 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.ChestRock)
|
||||
end
|
||||
end
|
||||
|
7
Resources/Scripts/Gadget/ImmortalFire.lua
Normal file
7
Resources/Scripts/Gadget/ImmortalFire.lua
Normal file
@ -0,0 +1,7 @@
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
-- 获取机关当前状态
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if element_type == ElementType.Fire and state == GadgetState.Default then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
15
Resources/Scripts/Gadget/KazuhaServeItem_Gadget.lua
Normal file
15
Resources/Scripts/Gadget/KazuhaServeItem_Gadget.lua
Normal file
@ -0,0 +1,15 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
local ret = ScriptLib.SetGadgetState(context, param1)
|
||||
if 0 ~= ret then
|
||||
return 0
|
||||
end
|
||||
|
||||
local group_id = ScriptLib.GetContextGroupId(context)
|
||||
|
||||
if 220142013 == group_id or 220142012 == group_id then
|
||||
ScriptLib.ExecuteGroupLua(context, group_id, "EX_Device_Gadget_State_Change", {param1})
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
8
Resources/Scripts/Gadget/LaserSwitch.lua
Normal file
8
Resources/Scripts/Gadget/LaserSwitch.lua
Normal file
@ -0,0 +1,8 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 1 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
3
Resources/Scripts/Gadget/LimitRing.lua
Normal file
3
Resources/Scripts/Gadget/LimitRing.lua
Normal file
@ -0,0 +1,3 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
10
Resources/Scripts/Gadget/LitChargePoint.lua
Normal file
10
Resources/Scripts/Gadget/LitChargePoint.lua
Normal file
@ -0,0 +1,10 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1~=nil then
|
||||
--ScriptLib.PrintLog("GadgetState Get Change!!!!!!!")
|
||||
ScriptLib.SetGadgetState(context, param1)
|
||||
end
|
||||
if param2~=nil then
|
||||
ScriptLib.MarkGroupLuaAction(context, "LitChargePoint_1", "", {["config_id"]=ScriptLib.GetContextGadgetConfigId(context),["gadget_id"]=70290353})
|
||||
end
|
||||
return 0
|
||||
end
|
3
Resources/Scripts/Gadget/MichiaeMatsuri_Ore.lua
Normal file
3
Resources/Scripts/Gadget/MichiaeMatsuri_Ore.lua
Normal file
@ -0,0 +1,3 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "MichiaeMatsuri_Ore"})
|
||||
end
|
15
Resources/Scripts/Gadget/MimosaTrigger.lua
Normal file
15
Resources/Scripts/Gadget/MimosaTrigger.lua
Normal file
@ -0,0 +1,15 @@
|
||||
-- abilityRequest
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
--ScriptLib.PrintLog("##param1="..param1)
|
||||
-- 获取机关当前状态
|
||||
local this_config = ScriptLib.GetContextGadgetConfigId(context)
|
||||
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
|
||||
if param1 == 1 then
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, this_group, this_config, GadgetState.Default )
|
||||
end
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGroupGadgetStateByConfigId(context, this_group, this_config, GadgetState.GearStart )
|
||||
end
|
||||
end
|
39
Resources/Scripts/Gadget/MoleDestination.lua
Normal file
39
Resources/Scripts/Gadget/MoleDestination.lua
Normal file
@ -0,0 +1,39 @@
|
||||
local _delay = 10
|
||||
|
||||
-- ¶¨Ê±Æ÷»Øµ÷
|
||||
function OnTimer(context, now)
|
||||
-- »ñÈ¡»ú¹Øµ±Ç°×´Ì¬
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if state ~= GadgetState.GearAction1 then
|
||||
-- »ñÈ¡µ±Ç°×´Ì¬µÄ¿ªÊ¼Ê±¼ä
|
||||
local state_begin_time = ScriptLib.GetGadgetStateBeginTime(context)
|
||||
if now >= state_begin_time + _delay then
|
||||
-- Èç¹ûÆô¶¯Ê±¼ä³¬¹ýÆô¶¯³ÖÐøÊ±¼ä£¬Ôòת»»ÎªDefault״̬
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
end
|
5
Resources/Scripts/Gadget/Mole_DigHole.lua
Normal file
5
Resources/Scripts/Gadget/Mole_DigHole.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
|
||||
end
|
10
Resources/Scripts/Gadget/MonsterCreater.lua
Normal file
10
Resources/Scripts/Gadget/MonsterCreater.lua
Normal file
@ -0,0 +1,10 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
local arguments = ScriptLib.GetGadgetArguments(context)
|
||||
local length = #arguments
|
||||
if length == 2 then
|
||||
ScriptLib.CreateMonster(context, { config_id = arguments[1], delay_time = arguments[2] })
|
||||
end
|
||||
if length ==1 then
|
||||
ScriptLib.CreateMonster(context, { config_id = arguments[1], delay_time = 2 })
|
||||
end
|
||||
end
|
13
Resources/Scripts/Gadget/MoonLotus.lua
Normal file
13
Resources/Scripts/Gadget/MoonLotus.lua
Normal file
@ -0,0 +1,13 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
local this_gadget = ScriptLib.GetContextGadgetConfigId(context)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_gadget, false)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_gadget, true)
|
||||
end
|
||||
end
|
22
Resources/Scripts/Gadget/MoveingStone.lua
Normal file
22
Resources/Scripts/Gadget/MoveingStone.lua
Normal file
@ -0,0 +1,22 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
local this_target = ScriptLib.GetContextGadgetConfigId(context)
|
||||
--ScriptLib.PrintLog("##config="..this_target)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
--ScriptLib.PrintLog("##config="..this_group)
|
||||
if param1 == 0 then
|
||||
ScriptLib.StopPlatform(context, this_target)
|
||||
end
|
||||
|
||||
if param1 == 1 then
|
||||
ScriptLib.StartPlatform(context, this_target)
|
||||
end
|
||||
|
||||
if param1 == 2 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
|
||||
if param1 == 3 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
|
||||
end
|
12
Resources/Scripts/Gadget/OceanidRegionChecker.lua
Normal file
12
Resources/Scripts/Gadget/OceanidRegionChecker.lua
Normal file
@ -0,0 +1,12 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 201 then
|
||||
local eid = ScriptLib.GetGroupVariableValue(context, "REGION_EID")
|
||||
if ScriptLib.GetRegionEntityCount(context, { region_eid = eid, entity_type = EntityType.AVATAR }) == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
elseif param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
else
|
||||
ScriptLib.SetGadgetState(context, param1)
|
||||
end
|
||||
end
|
18
Resources/Scripts/Gadget/Oceanid_Platform.lua
Normal file
18
Resources/Scripts/Gadget/Oceanid_Platform.lua
Normal file
@ -0,0 +1,18 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 1 then
|
||||
if 901 == ScriptLib.GetGadgetState(context) then
|
||||
ScriptLib.SetGadgetState(context, 0)
|
||||
else
|
||||
local s = ScriptLib.GetGadgetState(context)
|
||||
ScriptLib.PrintContextLog(context, "error_state="..s)
|
||||
end
|
||||
elseif param1 == 202 then
|
||||
if 201 == ScriptLib.GetGadgetState(context) then
|
||||
ScriptLib.SetGadgetState(context, 202)
|
||||
else
|
||||
local s = ScriptLib.GetGadgetState(context)
|
||||
ScriptLib.PrintContextLog(context, "error_state="..s)
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
64
Resources/Scripts/Gadget/OneStroke_Test.lua
Normal file
64
Resources/Scripts/Gadget/OneStroke_Test.lua
Normal file
@ -0,0 +1,64 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 101 then
|
||||
ScriptLib.SetGadgetState(context, 101)
|
||||
end
|
||||
if param1 == 102 then
|
||||
ScriptLib.SetGadgetState(context, 102)
|
||||
end
|
||||
|
||||
if param1 == 201 then
|
||||
if CheckGroupChallengeState(context) then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
||||
if param1 == 202 then
|
||||
if CheckGroupChallengeState(context) then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
if CheckGroupChallengeState(context) then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
end
|
||||
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
if param1 == 903 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- 当格子被踩时,先检查Group状态
|
||||
function CheckGroupChallengeState(context)
|
||||
ScriptLib.PrintContextLog(context,"CheckGroupChallengeState")
|
||||
--challenge_state 0-等待开始 1-正在进行 2-完成 3-失败流程中
|
||||
local state = ScriptLib.GetGroupVariableValue(context, "challenge_state")
|
||||
|
||||
if state == 1 then
|
||||
--ScriptLib.PrintContextLog(context,"Cube Set Active Check Ok")
|
||||
return true
|
||||
elseif state == 0 then
|
||||
if ScriptLib.GetContextGadgetConfigId(context) == ScriptLib.GetGroupVariableValue(context, "starter_id") then
|
||||
--ScriptLib.PrintContextLog(context,"Cube Set Active Check Ok for Starter")
|
||||
return true
|
||||
else
|
||||
--ScriptLib.PrintContextLog(context,"Cube Pressed Before Challenge But Not Starter")
|
||||
return false
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
51
Resources/Scripts/Gadget/RockCannon.lua
Normal file
51
Resources/Scripts/Gadget/RockCannon.lua
Normal file
@ -0,0 +1,51 @@
|
||||
|
||||
local stateChain={
|
||||
{0101,0102,0103,0104,0105,0106,0107,0108,0109},
|
||||
{0201,0202,0203,0204,0205,0206,0207,0208,0209},
|
||||
{0301,0302,0303,0304,0305,0306,0307,0308,0309},
|
||||
{0401,0402,0403,0404,0,0406,0407,0408,0409},
|
||||
{0501,0502,0503,0504,0505,0506,0507,0508,0509},
|
||||
}
|
||||
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
local this_config = ScriptLib.GetContextGadgetConfigId(context)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
if param3==1 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_config, false)
|
||||
elseif param3==2 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_config, true)
|
||||
else
|
||||
local gadgetState=ScriptLib.GetGadgetStateByConfigId(context, ScriptLib.GetContextGroupId(context),ScriptLib.GetContextGadgetConfigId(context))
|
||||
for i=1,#stateChain do
|
||||
for j=1,#stateChain[i] do
|
||||
if gadgetState==stateChain[i][j] then
|
||||
if i+param1>0 and i+param1<=#stateChain and j+param2>0 and j+param2 <=#stateChain[i] then
|
||||
ScriptLib.SetGadgetState(context, stateChain[i+param1][j+param2])
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function DisableIntee(context)
|
||||
ScriptLib.PrintContextLog(context, "##[开山炮]尝试禁用")
|
||||
local this_config = ScriptLib.GetContextGadgetConfigId(context)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
if -1~=ScriptLib.SetGadgetEnableInteract(context, this_group, this_config, false) then
|
||||
ScriptLib.PrintContextLog(context, "##[开山炮]禁用成功")
|
||||
else
|
||||
ScriptLib.PrintContextLog(context, "##[开山炮]禁用失败,group="..this_group.." config="..this_config)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function EnableIntee(context)
|
||||
local this_config = ScriptLib.GetContextGadgetConfigId(context)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
ScriptLib.SetGadgetEnableInteract(context, this_group, this_config, true)
|
||||
return 0
|
||||
end
|
26
Resources/Scripts/Gadget/RockController.lua
Normal file
26
Resources/Scripts/Gadget/RockController.lua
Normal file
@ -0,0 +1,26 @@
|
||||
-- 机关初始化配置
|
||||
-- 初始状态
|
||||
local state_ = GadgetState.GearStart
|
||||
-- 启动元素
|
||||
local start_elem_type_ = ElementType.Rock
|
||||
-- 停止元素
|
||||
local stop_elem_type_ = ElementType.None
|
||||
|
||||
|
||||
-- 机关被攻击
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
if is_host == true then
|
||||
-- 获取机关当前状态
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if state == GadgetState.Default or state == GadgetState.GearAction1 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
||||
if state == GadgetState.Action01 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
31
Resources/Scripts/Gadget/RockController_CYJY.lua
Normal file
31
Resources/Scripts/Gadget/RockController_CYJY.lua
Normal file
@ -0,0 +1,31 @@
|
||||
-- 机关初始化配置
|
||||
-- 初始状态
|
||||
local state_ = GadgetState.GearStart
|
||||
-- 启动元素
|
||||
local start_elem_type_ = ElementType.Rock
|
||||
-- 停止元素
|
||||
local stop_elem_type_ = ElementType.None
|
||||
|
||||
|
||||
-- 机关被攻击
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
if is_host == true then
|
||||
-- 获取机关当前状态
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if state == GadgetState.Default or state == GadgetState.GearAction1 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
||||
if state == GadgetState.Action01 then
|
||||
if start_elem_type_ == element_type then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
ScriptLib.SetGadgetState(context, param1)
|
||||
return 0
|
||||
end
|
243
Resources/Scripts/Gadget/RogueDungeon_Gadget.lua
Normal file
243
Resources/Scripts/Gadget/RogueDungeon_Gadget.lua
Normal file
@ -0,0 +1,243 @@
|
||||
local MAX_attackbylevelentity_LV = 20
|
||||
local MAX_mutehurtbylevelentity_LV = 10
|
||||
local MAX_defencebylevelentity_LV = 10
|
||||
local MAX_chargebylevelentity_LV = 10
|
||||
|
||||
|
||||
|
||||
|
||||
--场景破碎物计数
|
||||
function KillLevelEntityCount( context )
|
||||
local UidList = ScriptLib.GetSceneUidList(context)
|
||||
|
||||
-- ScriptLib.AddExhibitionAccumulableData(context, UidList[1], "Rogue_BrokenLevelEntity_AccumulableCount_1", 1)
|
||||
|
||||
-- ScriptLib.AddExhibitionReplaceableData(context, UidList[1], "Rogue_BrokenLevelEntity_ReplaceableCount_1", 1)
|
||||
|
||||
return 0
|
||||
|
||||
end
|
||||
|
||||
--炸药桶计数
|
||||
function KillLevelEntityCount( context )
|
||||
local UidList = ScriptLib.GetSceneUidList(context)
|
||||
|
||||
-- ScriptLib.AddExhibitionAccumulableData(context, UidList[1], "Rogue_BrokenBomb_AccumulableCount_1", 1)
|
||||
|
||||
-- ScriptLib.AddExhibitionAccumulableData(context, UidList[1], "Rogue_BrokenBomb_ReplaceableCount_1", 1)
|
||||
|
||||
return 0
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
--场景破碎物上发消息
|
||||
function LevelEntityBroken_Attack(context)
|
||||
|
||||
ScriptLib.PrintContextLog(context, "##Rogue LOG : LevelEntityBroken ")
|
||||
|
||||
local UidList = ScriptLib.GetSceneUidList(context)
|
||||
|
||||
|
||||
local TeamValue = ScriptLib.GetTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_ATTACKBYLEVELENTITY")
|
||||
|
||||
ScriptLib.PrintContextLog(context, "##Rogue LOG : LevelEntityBroken TeamValue =="..TeamValue)
|
||||
|
||||
|
||||
--改SGV
|
||||
if TeamValue < MAX_attackbylevelentity_LV then
|
||||
|
||||
ScriptLib.AddTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_ATTACKBYLEVELENTITY", 1)
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
--场景破碎物上发消息
|
||||
function LevelEntityBroken_MuteHurt(context)
|
||||
|
||||
ScriptLib.PrintContextLog(context, "##Rogue LOG : LevelEntityBroken ")
|
||||
|
||||
local UidList = ScriptLib.GetSceneUidList(context)
|
||||
|
||||
|
||||
local TeamValue = ScriptLib.GetTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_MUTEHURTBYLEVELENTITY")
|
||||
|
||||
ScriptLib.PrintContextLog(context, "##Rogue LOG : LevelEntityBroken TeamValue =="..TeamValue)
|
||||
|
||||
|
||||
--改SGV
|
||||
if TeamValue < MAX_mutehurtbylevelentity_LV then
|
||||
|
||||
ScriptLib.AddTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_MUTEHURTBYLEVELENTITY", 1)
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
--场景破碎物上发消息
|
||||
function LevelEntityBroken_ChargeSpeed(context)
|
||||
|
||||
ScriptLib.PrintContextLog(context, "##Rogue LOG : LevelEntityBroken ")
|
||||
|
||||
local UidList = ScriptLib.GetSceneUidList(context)
|
||||
|
||||
|
||||
local TeamValue = ScriptLib.GetTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_CHARGEBYLEVELENTITY")
|
||||
|
||||
ScriptLib.PrintContextLog(context, "##Rogue LOG : LevelEntityBroken TeamValue =="..TeamValue)
|
||||
|
||||
|
||||
--改SGV
|
||||
if TeamValue < MAX_chargebylevelentity_LV then
|
||||
|
||||
ScriptLib.AddTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_CHARGEBYLEVELENTITY", 1)
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
--场景破碎物上发消息
|
||||
function LevelEntityBroken_Defence(context)
|
||||
|
||||
ScriptLib.PrintContextLog(context, "##Rogue LOG : LevelEntityBroken ")
|
||||
|
||||
local UidList = ScriptLib.GetSceneUidList(context)
|
||||
|
||||
|
||||
local TeamValue = ScriptLib.GetTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_DEFENCEBYLEVELENTITY")
|
||||
|
||||
ScriptLib.PrintContextLog(context, "##Rogue LOG : LevelEntityBroken TeamValue =="..TeamValue)
|
||||
|
||||
|
||||
--改SGV
|
||||
if TeamValue < MAX_defencebylevelentity_LV then
|
||||
ScriptLib.AddTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_DEFENCEBYLEVELENTITY", 1)
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
--关闭元素机关上发消息
|
||||
function CloseGear(context)
|
||||
local UidList = ScriptLib.GetSceneUidList(context)
|
||||
|
||||
|
||||
local TeamValue = ScriptLib.GetTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_MASTERYBYGEAR")
|
||||
|
||||
ScriptLib.PrintContextLog(context, "##Rogue LOG : LevelEntityBroken TeamValue =="..TeamValue)
|
||||
|
||||
--先改SGV
|
||||
ScriptLib.AddTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_MASTERYBYGEAR", 1)
|
||||
|
||||
--再通知客户端取值更新
|
||||
--ScriptLib.AssignPlayerUidOpNotify(context, param_table)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
--踩到陷阱
|
||||
function TriggerTrap(context, isBlock)
|
||||
local UidList = ScriptLib.GetSceneUidList(context)
|
||||
|
||||
|
||||
local TeamValue = ScriptLib.GetTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_TRAPBLOCK")
|
||||
|
||||
--触发陷阱计数
|
||||
--ScriptLib.AddExhibitionAccumulableData(context, UidList[1], "Rogue_TriggerTrap_Count", 1)
|
||||
|
||||
if isBlock == 0 then
|
||||
--触发陷阱
|
||||
ScriptLib.TriggerRoguelikeCurseByLua(context, UidList[1])
|
||||
elseif isBlock ==1 then
|
||||
--修改抵抗层数
|
||||
ScriptLib.AddTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_TRAPBLOCK", -1)
|
||||
|
||||
ScriptLib.DisableRoguelikeTrapBySgv(context, "SGV_ROGUE_TRAPBLOCK", UidList[1])
|
||||
end
|
||||
|
||||
|
||||
return 0
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--回复房间加BUFF
|
||||
function AddReviveRoomBuff(context)
|
||||
local UidList = ScriptLib.GetSceneUidList(context)
|
||||
|
||||
|
||||
local TeamValue = ScriptLib.GetTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_REVIVEROOMBUFF")
|
||||
|
||||
ScriptLib.PrintContextLog(context, "##Rogue LOG : LevelEntityBroken TeamValue =="..TeamValue)
|
||||
|
||||
|
||||
--先改SGV
|
||||
ScriptLib.AddTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_REVIVEROOMBUFF", 1)
|
||||
|
||||
--再通知客户端取值更新
|
||||
--ScriptLib.AssignPlayerUidOpNotify(context, param_table)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
|
||||
--战斗房间加BUFF
|
||||
function AddBattleRoomBuff(context)
|
||||
local UidList = ScriptLib.GetSceneUidList(context)
|
||||
|
||||
|
||||
local TeamValue = ScriptLib.GetTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_BATTLEROOMBUFF")
|
||||
|
||||
ScriptLib.PrintContextLog(context, "##Rogue LOG : LevelEntityBroken TeamValue =="..TeamValue)
|
||||
|
||||
|
||||
--先改SGV
|
||||
ScriptLib.AddTeamServerGlobalValue(context, UidList[1], "SGV_ROGUE_BATTLEROOMBUFF", 1)
|
||||
|
||||
--再通知客户端取值更新
|
||||
--ScriptLib.AssignPlayerUidOpNotify(context, param_table)
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
|
||||
--吃到增益球
|
||||
function GetRogueBuff( context )
|
||||
|
||||
local UidList = ScriptLib.GetSceneUidList(context)
|
||||
|
||||
--吃到BUFF计数
|
||||
--ScriptLib.AddExhibitionAccumulableData(context, UidList[1], "Rogue_GetBuff_AccumulableCount", 1)
|
||||
|
||||
--ScriptLib.AddExhibitionReplaceableData(context, UidList[1], "Rogue_TriggerTrap_ReplaceableCount", 1)
|
||||
|
||||
return 0
|
||||
|
||||
end
|
||||
|
||||
|
||||
function SetGardianSGV( context, value)
|
||||
|
||||
local entityID = ScriptLib.GetContextGadgetEntityId(context)
|
||||
|
||||
ScriptLib.SetEntityServerGlobalValueByEntityId(context, entityID, "SGV_CAN_CLEAR_THREAT", value )
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function SetGardianState(context, value )
|
||||
|
||||
ScriptLib.SetGadgetState(context, value)
|
||||
|
||||
return 0
|
||||
end
|
4
Resources/Scripts/Gadget/RopeSkipping.lua
Normal file
4
Resources/Scripts/Gadget/RopeSkipping.lua
Normal file
@ -0,0 +1,4 @@
|
||||
-- abilityRequest
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
7
Resources/Scripts/Gadget/SceneObj_Environment_Field.lua
Normal file
7
Resources/Scripts/Gadget/SceneObj_Environment_Field.lua
Normal file
@ -0,0 +1,7 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
elseif param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
end
|
23
Resources/Scripts/Gadget/SceneObj_Gear_Windmill01.lua
Normal file
23
Resources/Scripts/Gadget/SceneObj_Gear_Windmill01.lua
Normal file
@ -0,0 +1,23 @@
|
||||
local _delay = 10
|
||||
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
elseif param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
||||
|
||||
-- 定时器回调
|
||||
function OnTimer(context, now)
|
||||
-- 获取机关当前状态
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if state ~= GadgetState.Default then
|
||||
-- 获取当前状态的开始时间
|
||||
local state_begin_time = ScriptLib.GetGadgetStateBeginTime(context)
|
||||
if now >= state_begin_time + _delay then
|
||||
-- 如果启动时间超过启动持续时间,则转换为Default状态
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
end
|
||||
end
|
102
Resources/Scripts/Gadget/SetALLGadgetState.lua
Normal file
102
Resources/Scripts/Gadget/SetALLGadgetState.lua
Normal file
@ -0,0 +1,102 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
--ScriptLib.PrintLog("GadgetState Get Change!!!!!!!")
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 101 then
|
||||
ScriptLib.SetGadgetState(context, 101)
|
||||
end
|
||||
if param1 == 102 then
|
||||
ScriptLib.SetGadgetState(context, 102)
|
||||
end
|
||||
if param1 == 103 then
|
||||
ScriptLib.SetGadgetState(context, 103)
|
||||
end
|
||||
if param1 == 104 then
|
||||
ScriptLib.SetGadgetState(context, 104)
|
||||
end
|
||||
|
||||
if param1 == 200 then
|
||||
ScriptLib.SetGadgetState(context, 200)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
|
||||
if param1 == 210 then
|
||||
ScriptLib.SetGadgetState(context, 210)
|
||||
end
|
||||
if param1 == 211 then
|
||||
ScriptLib.SetGadgetState(context, 211)
|
||||
end
|
||||
if param1 == 212 then
|
||||
ScriptLib.SetGadgetState(context, 212)
|
||||
end
|
||||
if param1 == 213 then
|
||||
ScriptLib.SetGadgetState(context, 213)
|
||||
end
|
||||
if param1 == 214 then
|
||||
ScriptLib.SetGadgetState(context, 214)
|
||||
end
|
||||
if param1 == 222 then
|
||||
ScriptLib.SetGadgetState(context, 222)
|
||||
end
|
||||
|
||||
if param1 == 300 then
|
||||
ScriptLib.SetGadgetState(context, 300)
|
||||
end
|
||||
if param1 == 301 then
|
||||
ScriptLib.SetGadgetState(context, 301)
|
||||
end
|
||||
if param1 == 302 then
|
||||
ScriptLib.SetGadgetState(context, 302)
|
||||
end
|
||||
if param1 == 303 then
|
||||
ScriptLib.SetGadgetState(context, 303)
|
||||
end
|
||||
if param1 == 304 then
|
||||
ScriptLib.SetGadgetState(context, 304)
|
||||
end
|
||||
|
||||
if param1 == 310 then
|
||||
ScriptLib.SetGadgetState(context, 310)
|
||||
end
|
||||
if param1 == 311 then
|
||||
ScriptLib.SetGadgetState(context, 311)
|
||||
end
|
||||
if param1 == 312 then
|
||||
ScriptLib.SetGadgetState(context, 312)
|
||||
end
|
||||
if param1 == 313 then
|
||||
ScriptLib.SetGadgetState(context, 313)
|
||||
end
|
||||
if param1 == 314 then
|
||||
ScriptLib.SetGadgetState(context, 314)
|
||||
end
|
||||
if param1 == 322 then
|
||||
ScriptLib.SetGadgetState(context, 322)
|
||||
end
|
||||
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
if param1 == 903 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
if param1 == 106 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.ChestRock)
|
||||
end
|
||||
end
|
6
Resources/Scripts/Gadget/SetGadgetState.lua
Normal file
6
Resources/Scripts/Gadget/SetGadgetState.lua
Normal file
@ -0,0 +1,6 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
--ScriptLib.PrintLog("GadgetState Get Change!!!!!!!")
|
||||
ScriptLib.SetGadgetState(context, param1)
|
||||
return 0
|
||||
end
|
37
Resources/Scripts/Gadget/SetGadgetState_BanMP.lua
Normal file
37
Resources/Scripts/Gadget/SetGadgetState_BanMP.lua
Normal file
@ -0,0 +1,37 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
--联机状态下,由于未被及时卸载时被交互的保险
|
||||
if true == ScriptLib.CheckIsInMpMode(context) then
|
||||
ScriptLib.PrintContextLog(context, "#SetGadgetState_BanMP# Is in MP mode, refuse state change.")
|
||||
--重新设为可交互
|
||||
ScriptLib.SetGadgetEnableInteract(context, 0, ScriptLib.GetContextGadgetConfigId(context), true)
|
||||
return 0
|
||||
end
|
||||
--ScriptLib.PrintLog("GadgetState Get Change!!!!!!!")
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
if param1 == 903 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
if param1 == 106 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.ChestRock)
|
||||
end
|
||||
end
|
18
Resources/Scripts/Gadget/SetGadgetWorkOption.lua
Normal file
18
Resources/Scripts/Gadget/SetGadgetWorkOption.lua
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
--- Generated by Luanalysis
|
||||
--- Created by binghong.shen_187191.
|
||||
--- DateTime: 2022/6/13 14:29
|
||||
---
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
local this_target = ScriptLib.GetContextGadgetConfigId(context)
|
||||
--ScriptLib.PrintLog("##config="..this_target)
|
||||
local this_group = ScriptLib.GetContextGroupId(context)
|
||||
|
||||
if (param1 == 0) then
|
||||
ScriptLib.SetWorktopOptionsByGroupId(context, this_group, this_target, {})
|
||||
else
|
||||
ScriptLib.SetWorktopOptionsByGroupId(context, this_group, this_target, {param1})
|
||||
end
|
||||
return 0
|
||||
end
|
34
Resources/Scripts/Gadget/SetInteract.lua
Normal file
34
Resources/Scripts/Gadget/SetInteract.lua
Normal file
@ -0,0 +1,34 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param2 == 1 then
|
||||
local CurConfigID = ScriptLib.GetGadgetConfigId(context, { gadget_eid = param3 })
|
||||
ScriptLib.SetGadgetEnableInteract(context, 0, CurConfigID, true)
|
||||
end
|
||||
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
if param1 == 903 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
if param1 == 106 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.ChestRock)
|
||||
end
|
||||
end
|
33
Resources/Scripts/Gadget/SetInteractOnDefault.lua
Normal file
33
Resources/Scripts/Gadget/SetInteractOnDefault.lua
Normal file
@ -0,0 +1,33 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
--当物件被设为Default状态时,将物件设为可交互
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
ScriptLib.SetGadgetEnableInteract(context, ScriptLib.GetContextGroupId(context), ScriptLib.GetContextGadgetConfigId(context), true)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
if param1 == 903 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
if param1 == 106 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.ChestRock)
|
||||
end
|
||||
|
||||
end
|
35
Resources/Scripts/Gadget/SetSakuraActive.lua
Normal file
35
Resources/Scripts/Gadget/SetSakuraActive.lua
Normal file
@ -0,0 +1,35 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
--ScriptLib.PrintLog("GadgetState Get Change!!!!!!!")
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
if param1 == 903 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
if param1 == 106 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.ChestRock)
|
||||
end
|
||||
local group_id=ScriptLib.GetContextGroupId(context)
|
||||
if group_id ~= nil and group_id ~= -1 then
|
||||
ScriptLib.SetGadgetEnableInteract(context, ScriptLib.GetContextGroupId(context), ScriptLib.GetContextGadgetConfigId(context), true)
|
||||
end
|
||||
end
|
32
Resources/Scripts/Gadget/SetSlidingWallIntee.lua
Normal file
32
Resources/Scripts/Gadget/SetSlidingWallIntee.lua
Normal file
@ -0,0 +1,32 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
--ScriptLib.PrintLog("GadgetState Get Change!!!!!!!")
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
if param1 == 903 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
if param1 == 106 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.ChestRock)
|
||||
end
|
||||
ScriptLib.SetGadgetEnableInteract(context, ScriptLib.GetContextGroupId(context), ScriptLib.GetContextGadgetConfigId(context), true)
|
||||
end
|
17
Resources/Scripts/Gadget/SetSplitterShootType.lua
Normal file
17
Resources/Scripts/Gadget/SetSplitterShootType.lua
Normal file
@ -0,0 +1,17 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGroupVariableValue(context, "SplitterShootType", 202)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGroupVariableValue(context, "SplitterShootType", 203)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGroupVariableValue(context, "SplitterShootType", 204)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGroupVariableValue(context, "SplitterShootType", 901)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGroupVariableValue(context, "SplitterShootType", 902)
|
||||
end
|
||||
end
|
31
Resources/Scripts/Gadget/SetToysCD.lua
Normal file
31
Resources/Scripts/Gadget/SetToysCD.lua
Normal file
@ -0,0 +1,31 @@
|
||||
function SetToysCD_MD_Success(context)
|
||||
return ScriptLib.SetWidgetClientDetectorCoolDown(context, 220009, true)
|
||||
end
|
||||
|
||||
function SetToysCD_MD_Fail(context)
|
||||
return ScriptLib.SetWidgetClientDetectorCoolDown(context, 220009, false)
|
||||
end
|
||||
|
||||
function SetToysCD_LY_Success(context)
|
||||
return ScriptLib.SetWidgetClientDetectorCoolDown(context, 220003, true)
|
||||
end
|
||||
|
||||
function SetToysCD_LY_Fail(context)
|
||||
return ScriptLib.SetWidgetClientDetectorCoolDown(context, 220003, false)
|
||||
end
|
||||
|
||||
function SetToysCD_DQ_Success(context)
|
||||
return ScriptLib.SetWidgetClientDetectorCoolDown(context, 220034, true)
|
||||
end
|
||||
|
||||
function SetToysCD_DQ_Fail(context)
|
||||
return ScriptLib.SetWidgetClientDetectorCoolDown(context, 220034, false)
|
||||
end
|
||||
|
||||
function SetToysCD_XM_Success(context)
|
||||
return ScriptLib.SetWidgetClientDetectorCoolDown(context, 220058, true)
|
||||
end
|
||||
|
||||
function SetToysCD_XM_Fail(context)
|
||||
return ScriptLib.SetWidgetClientDetectorCoolDown(context, 220058, false)
|
||||
end
|
32
Resources/Scripts/Gadget/SmokeDevice.lua
Normal file
32
Resources/Scripts/Gadget/SmokeDevice.lua
Normal file
@ -0,0 +1,32 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 0 then
|
||||
--当物件被设为Default状态时,将物件设为可交互
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
ScriptLib.SetGadgetEnableInteract(context, ScriptLib.GetContextGroupId(context), ScriptLib.GetContextGadgetConfigId(context), true)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
if param1 == 903 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
12
Resources/Scripts/Gadget/SpecialIce.lua
Normal file
12
Resources/Scripts/Gadget/SpecialIce.lua
Normal file
@ -0,0 +1,12 @@
|
||||
-- 特殊冰
|
||||
function OnBeHurt(context, element_type, strike_type, is_host)
|
||||
ScriptLib.PrintContextLog(context, "SpeicalIce OnBeHurt ConfigId is"..ScriptLib.GetContextGadgetConfigId(context))
|
||||
ScriptLib.PrintContextLog(context, "SpeicalIce OnBeHurt Uid is"..context.uid)
|
||||
if context.uid ~= 0 then
|
||||
local configId=ScriptLib.GetContextGadgetConfigId(context)
|
||||
local uidValue=configId.."_Hit_Uid"
|
||||
ScriptLib.SetGroupVariableValue(context, uidValue, context.uid)
|
||||
end
|
||||
end
|
||||
|
||||
|
5
Resources/Scripts/Gadget/SubFieldDrop_LightBall.lua
Normal file
5
Resources/Scripts/Gadget/SubFieldDrop_LightBall.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "LightBall"})
|
||||
end
|
||||
|
||||
|
5
Resources/Scripts/Gadget/SubfieldDrop_DropIce.lua
Normal file
5
Resources/Scripts/Gadget/SubfieldDrop_DropIce.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "DropIce"})
|
||||
end
|
||||
|
||||
|
34
Resources/Scripts/Gadget/SubfieldDrop_Dulins_Blood.lua
Normal file
34
Resources/Scripts/Gadget/SubfieldDrop_Dulins_Blood.lua
Normal file
@ -0,0 +1,34 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "Dulins_Blood"})
|
||||
end
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
|
||||
--ScriptLib.PrintLog("GadgetState Get Change!!!!!!!")
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
if param1 == 903 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
if param1 == 106 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.ChestRock)
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "ElectricRock_Destroy"})
|
||||
end
|
||||
|
||||
|
5
Resources/Scripts/Gadget/SubfieldDrop_ElementBall.lua
Normal file
5
Resources/Scripts/Gadget/SubfieldDrop_ElementBall.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "ElementBall"})
|
||||
end
|
||||
|
||||
|
5
Resources/Scripts/Gadget/SubfieldDrop_Ore_Crystal.lua
Normal file
5
Resources/Scripts/Gadget/SubfieldDrop_Ore_Crystal.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "Ore_Crystal"})
|
||||
end
|
||||
|
||||
|
5
Resources/Scripts/Gadget/SubfieldDrop_Ore_Dig.lua
Normal file
5
Resources/Scripts/Gadget/SubfieldDrop_Ore_Dig.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "Ore_Dig"})
|
||||
end
|
||||
|
||||
|
5
Resources/Scripts/Gadget/SubfieldDrop_Ore_Lots.lua
Normal file
5
Resources/Scripts/Gadget/SubfieldDrop_Ore_Lots.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "Lots"})
|
||||
end
|
||||
|
||||
|
5
Resources/Scripts/Gadget/SubfieldDrop_Ore_Mithril.lua
Normal file
5
Resources/Scripts/Gadget/SubfieldDrop_Ore_Mithril.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "Ore_Mithril"})
|
||||
end
|
||||
|
||||
|
5
Resources/Scripts/Gadget/SubfieldDrop_Ore_MoonMeteor.lua
Normal file
5
Resources/Scripts/Gadget/SubfieldDrop_Ore_MoonMeteor.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "Ore_MoonMeteor"})
|
||||
end
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "Ore_Thundercrystal"})
|
||||
end
|
||||
|
||||
|
5
Resources/Scripts/Gadget/SubfieldDrop_Rewardcrate.lua
Normal file
5
Resources/Scripts/Gadget/SubfieldDrop_Rewardcrate.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "Rewardcrate"})
|
||||
end
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "LightBall"})
|
||||
end
|
||||
|
||||
|
@ -0,0 +1,6 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "Ore_Crystal"})
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "LightBall"})
|
||||
end
|
||||
|
||||
|
5
Resources/Scripts/Gadget/SubfieldDrop_TumbleWeed.lua
Normal file
5
Resources/Scripts/Gadget/SubfieldDrop_TumbleWeed.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "TumbleWeed"})
|
||||
end
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
function OnDie(context, element_type, strike_type)
|
||||
ScriptLib.DropSubfield(context, {subfield_name = "WoodenObject_Broken"})
|
||||
end
|
||||
|
||||
|
17
Resources/Scripts/Gadget/TestGravity.lua
Normal file
17
Resources/Scripts/Gadget/TestGravity.lua
Normal file
@ -0,0 +1,17 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
if param1 == 903 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
if param1 == 201then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
30
Resources/Scripts/Gadget/Test_LightLock.lua
Normal file
30
Resources/Scripts/Gadget/Test_LightLock.lua
Normal file
@ -0,0 +1,30 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if param1 == 1 then
|
||||
if state == GadgetState.Default then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
elseif state == GadgetState.Action01 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
elseif state == GadgetState.Action02 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
elseif param1 == 2 then
|
||||
if state == GadgetState.Default then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
elseif state == GadgetState.Action01 or state == GadgetState.Action02 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
elseif param1 == 3 then
|
||||
if state == GadgetState.Default or state == GadgetState.Action01 or state == GadgetState.Action02 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
end
|
||||
|
||||
local cur_state = ScriptLib.GetGadgetState(context)
|
||||
--临时发送特殊状态信号
|
||||
--groupLua拦截到此事件时可以做数据清理
|
||||
if param2 == 1 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.ChestLocked)
|
||||
ScriptLib.SetGadgetState(context, cur_state)
|
||||
end
|
||||
end
|
5
Resources/Scripts/Gadget/Test_LightLock_Point.lua
Normal file
5
Resources/Scripts/Gadget/Test_LightLock_Point.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 1 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
end
|
31
Resources/Scripts/Gadget/Test_Rotation.lua
Normal file
31
Resources/Scripts/Gadget/Test_Rotation.lua
Normal file
@ -0,0 +1,31 @@
|
||||
-- 默认10秒进行状态转换
|
||||
local default_time = 10
|
||||
local start_time = 10
|
||||
|
||||
function OnTimer(context, now)
|
||||
-- 获取机关当前状态
|
||||
local arguments = ScriptLib.GetGadgetArguments(context)
|
||||
local length = #arguments
|
||||
local state_time = ScriptLib.GetGadgetStateBeginTime(context)
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
|
||||
if arguments[1] ~= nil or arguments[1] > 0 then
|
||||
default_time = arguments[1]
|
||||
end
|
||||
|
||||
if arguments[2] ~= nil or arguments[2] > 0 then
|
||||
start_time = arguments[2]
|
||||
end
|
||||
|
||||
if state == GadgetState.Default then
|
||||
if now > state_time + default_time then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
elseif state == GadgetState.GearStart then
|
||||
if now > state_time + start_time then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
15
Resources/Scripts/Gadget/Test_Sculpture.lua
Normal file
15
Resources/Scripts/Gadget/Test_Sculpture.lua
Normal file
@ -0,0 +1,15 @@
|
||||
local _delay = 2
|
||||
|
||||
-- 定时器回调
|
||||
function OnTimer(context, now)
|
||||
-- 获取机关当前状态
|
||||
local state = ScriptLib.GetGadgetState(context)
|
||||
if state ~= GadgetState.Default then
|
||||
-- 获取当前状态的开始时间
|
||||
local state_begin_time = ScriptLib.GetGadgetStateBeginTime(context)
|
||||
if now >= state_begin_time + _delay then
|
||||
-- 如果启动时间超过启动持续时间,则转换为Default状态
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
end
|
||||
end
|
45
Resources/Scripts/Gadget/ThreatClearField.lua
Normal file
45
Resources/Scripts/Gadget/ThreatClearField.lua
Normal file
@ -0,0 +1,45 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
if param1 == 0 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Default)
|
||||
end
|
||||
if param1 == 201 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
|
||||
end
|
||||
if param1 == 202 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
|
||||
end
|
||||
if param1 == 203 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
|
||||
end
|
||||
if param1 == 204 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
|
||||
end
|
||||
if param1 == 901 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action01)
|
||||
end
|
||||
if param1 == 902 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action02)
|
||||
end
|
||||
if param1 == 903 then
|
||||
ScriptLib.SetGadgetState(context, GadgetState.Action03)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--烟雾弹物件会serverLuaCall处理玩家清仇恨的SGV。清仇恨功能详见单子s1260223。这里仅限单机。
|
||||
function GadgetCallSetThreat(context)
|
||||
ScriptLib.PrintContextLog(context, "[HachiSneak] SGV_CAN_CLEAR_THREAT Set: 0")
|
||||
local uidList = ScriptLib.GetSceneUidList(context)
|
||||
ScriptLib.SetTeamServerGlobalValue(context, uidList[1], "SGV_CAN_CLEAR_THREAT", 0)
|
||||
return 0
|
||||
end
|
||||
--烟雾弹物件会serverLuaCall处理玩家清仇恨的SGV。清仇恨功能详见单子s1260223。这里仅限单机。
|
||||
function GadgetCallClearThreat(context)
|
||||
ScriptLib.PrintContextLog(context, "[HachiSneak] SGV_CAN_CLEAR_THREAT Set: 1")
|
||||
local uidList = ScriptLib.GetSceneUidList(context)
|
||||
ScriptLib.SetTeamServerGlobalValue(context, uidList[1], "SGV_CAN_CLEAR_THREAT", 1)
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
|
13
Resources/Scripts/Gadget/TreeRoot.lua
Normal file
13
Resources/Scripts/Gadget/TreeRoot.lua
Normal file
@ -0,0 +1,13 @@
|
||||
function OnClientExecuteReq(context, param1, param2, param3)
|
||||
local this_target = ScriptLib.GetContextGadgetConfigId(context)
|
||||
|
||||
if 201 == param1 then
|
||||
ScriptLib.SetGadgetStateByConfigId(context,this_target, GadgetState.GearStart)
|
||||
ScriptLib.PrintLog("TreeRootGearStart")
|
||||
end
|
||||
if 0 == param1 then
|
||||
ScriptLib.SetGadgetStateByConfigId(context,this_target, GadgetState.Default)
|
||||
end
|
||||
|
||||
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user