From 46d2b65b40f2897edc0c0b3ef235e733e6dde6c4 Mon Sep 17 00:00:00 2001 From: Yuuki Date: Mon, 3 Jul 2023 01:11:40 +0800 Subject: [PATCH] sync CustomGCResources --- .../Scripts/Gadget/ElectricController.lua | 12 ++ Resources/Scripts/Gadget/FireController.lua | 40 ++---- .../Scripts/Gadget/FireSprayController.lua | 45 +++++++ Resources/Scripts/Gadget/GrassController.lua | 38 ++---- Resources/Scripts/Gadget/IceController.lua | 40 ++---- .../Scripts/Gadget/InmortalFireController.lua | 8 ++ Resources/Scripts/Gadget/RockController.lua | 38 ++---- .../Scripts/Gadget/SetALLGadgetState.lua | 115 +++--------------- Resources/Scripts/Gadget/SetGadgetState.lua | 5 +- .../Scripts/Gadget/SubfieldDrop_Ore_Dig.lua | 4 +- .../Scripts/Gadget/ViewPointController.lua | 7 ++ Resources/Scripts/Gadget/WaterController.lua | 38 ++---- Resources/Scripts/Gadget/WindController.lua | 40 ++---- Resources/Scripts/Gadget/tree.lua | 14 +-- Resources/Server/GadgetMapping.json | 10 +- 15 files changed, 176 insertions(+), 278 deletions(-) create mode 100644 Resources/Scripts/Gadget/ElectricController.lua create mode 100644 Resources/Scripts/Gadget/FireSprayController.lua create mode 100644 Resources/Scripts/Gadget/InmortalFireController.lua create mode 100644 Resources/Scripts/Gadget/ViewPointController.lua diff --git a/Resources/Scripts/Gadget/ElectricController.lua b/Resources/Scripts/Gadget/ElectricController.lua new file mode 100644 index 000000000..ea9ea001b --- /dev/null +++ b/Resources/Scripts/Gadget/ElectricController.lua @@ -0,0 +1,12 @@ +function OnBeHurt(context, element_type, unkParam, is_host) + ScriptLib.PrintContextLog(context, "Test ElectricController") + local state = ScriptLib.GetGadgetState(context) + if element_type == ElementType.Electric then + if state == GadgetState.Default or state == GadgetState.GearAction1 then + ScriptLib.SetGadgetState(context, GadgetState.GearStart) + end + if state == GadgetState.Action01 then + ScriptLib.SetGadgetState(context, GadgetState.Action02) + end + end +end \ No newline at end of file diff --git a/Resources/Scripts/Gadget/FireController.lua b/Resources/Scripts/Gadget/FireController.lua index 6c4712e04..797b899de 100644 --- a/Resources/Scripts/Gadget/FireController.lua +++ b/Resources/Scripts/Gadget/FireController.lua @@ -1,28 +1,12 @@ --- 机关初始化配置 --- 初始状态 -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 - - +function OnBeHurt(context, element_type, unkParam, is_host) + ScriptLib.PrintContextLog(context, "Test FireController") + local state = ScriptLib.GetGadgetState(context) + if element_type == ElementType.Fire then + if state == GadgetState.Default or state == GadgetState.GearAction1 then + ScriptLib.SetGadgetState(context, GadgetState.GearStart) + end + if state == GadgetState.Action01 then + ScriptLib.SetGadgetState(context, GadgetState.Action02) + end + end +end \ No newline at end of file diff --git a/Resources/Scripts/Gadget/FireSprayController.lua b/Resources/Scripts/Gadget/FireSprayController.lua new file mode 100644 index 000000000..797d78d59 --- /dev/null +++ b/Resources/Scripts/Gadget/FireSprayController.lua @@ -0,0 +1,45 @@ +function OnBeHurt(context, element_type, unkParam, is_host) + local state = ScriptLib.GetGadgetState(context) + if state == GadgetState.GearStop then + if element_type == ElementType.Fire then + local value = ScriptLib.GetGearStartValue(context) + value = value + 1 + if value >= 1 then + ScriptLib.SetGadgetState(context, GadgetState.GearStart) + ScriptLib.SetGearStartValue(context, 1) + else + ScriptLib.SetGearStartValue(context, value) + end + elseif element_type == ElementType.Ice then + ScriptLib.ResetGadgetState(context, GadgetState.GearStop) + end + elseif state == GadgetState.GearStart then + if element_type == ElementType.Ice then + local value = ScriptLib.GetGearStopValue(context) + value = value + 1 + if value >= 1 then + ScriptLib.SetGadgetState(context, GadgetState.GearStop) + ScriptLib.SetGearStopValue(context, 1) + else + ScriptLib.SetGearStopValue(context, value) + end + end + end +end + +function OnClientExecuteReq(context, param1, param2, param3) + if param1 == 1 then + ScriptLib.SetGadgetState(context, GadgetState.GearStart) + end +end + +function OnTimer(context, now) + local state = ScriptLib.GetGadgetState(context) + if state == GadgetState.GearStop then + local start_time = ScriptLib.GetGadgetStateBeginTime(context) + if now >= start_time + 4 then + ScriptLib.SetGadgetState(context, GadgetState.GearStart) + ScriptLib.SetGearStopValue(context, 0) + end + end +end \ No newline at end of file diff --git a/Resources/Scripts/Gadget/GrassController.lua b/Resources/Scripts/Gadget/GrassController.lua index 6b80f4d46..3f3a84d70 100644 --- a/Resources/Scripts/Gadget/GrassController.lua +++ b/Resources/Scripts/Gadget/GrassController.lua @@ -1,26 +1,12 @@ --- 机关初始化配置 --- 初始状态 -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 +function OnBeHurt(context, element_type, unkParam, is_host) + ScriptLib.PrintContextLog(context, "Test GrassController") + local state = ScriptLib.GetGadgetState(context) + if element_type == ElementType.Grass then + if state == GadgetState.Default or state == GadgetState.GearAction1 then + ScriptLib.SetGadgetState(context, GadgetState.GearStart) + end + if state == GadgetState.Action01 then + ScriptLib.SetGadgetState(context, GadgetState.Action02) + end + end +end \ No newline at end of file diff --git a/Resources/Scripts/Gadget/IceController.lua b/Resources/Scripts/Gadget/IceController.lua index fb7f4fdeb..6b9212883 100644 --- a/Resources/Scripts/Gadget/IceController.lua +++ b/Resources/Scripts/Gadget/IceController.lua @@ -1,28 +1,12 @@ --- 机关初始化配置 --- 初始状态 -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 OnBeHurt(context, element_type, unkParam, is_host) + ScriptLib.PrintContextLog(context, "Test IceController") + local state = ScriptLib.GetGadgetState(context) + if element_type == ElementType.Ice then + if state == GadgetState.Default or state == GadgetState.GearAction1 then + ScriptLib.SetGadgetState(context, GadgetState.GearStart) + end + if state == GadgetState.Action01 then + ScriptLib.SetGadgetState(context, GadgetState.Action02) + end + end +end \ No newline at end of file diff --git a/Resources/Scripts/Gadget/InmortalFireController.lua b/Resources/Scripts/Gadget/InmortalFireController.lua new file mode 100644 index 000000000..cb4e832c8 --- /dev/null +++ b/Resources/Scripts/Gadget/InmortalFireController.lua @@ -0,0 +1,8 @@ +function OnBeHurt(context, element_type, unkParam, is_host) + local state = ScriptLib.GetGadgetState(context) + if element_type == ElementType.Fire then + if state == GadgetState.Default then + ScriptLib.SetGadgetState(context, GadgetState.GearStart); + end + end +end \ No newline at end of file diff --git a/Resources/Scripts/Gadget/RockController.lua b/Resources/Scripts/Gadget/RockController.lua index 0e5e44a3d..a22525339 100644 --- a/Resources/Scripts/Gadget/RockController.lua +++ b/Resources/Scripts/Gadget/RockController.lua @@ -1,26 +1,12 @@ --- 机关初始化配置 --- 初始状态 -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 OnBeHurt(context, element_type, unkParam, is_host) + ScriptLib.PrintContextLog(context, "Test RockController") + local state = ScriptLib.GetGadgetState(context) + if element_type == ElementType.Rock then + if state == GadgetState.Default or state == GadgetState.GearAction1 then + ScriptLib.SetGadgetState(context, GadgetState.GearStart) + end + if state == GadgetState.Action01 then + ScriptLib.SetGadgetState(context, GadgetState.Action02) + end + end +end \ No newline at end of file diff --git a/Resources/Scripts/Gadget/SetALLGadgetState.lua b/Resources/Scripts/Gadget/SetALLGadgetState.lua index 61caaa531..4fbf6432f 100644 --- a/Resources/Scripts/Gadget/SetALLGadgetState.lua +++ b/Resources/Scripts/Gadget/SetALLGadgetState.lua @@ -1,102 +1,25 @@ 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 + elseif param1 == 106 then ScriptLib.SetGadgetState(context, GadgetState.ChestRock) + elseif param1 == 201 then + ScriptLib.SetGadgetState(context, GadgetState.GearStart) + elseif param1 == 202 then + ScriptLib.SetGadgetState(context, GadgetState.GearStop) + elseif param1 == 203 then + ScriptLib.SetGadgetState(context, GadgetState.GearAction1) + elseif param1 == 204 then + ScriptLib.SetGadgetState(context, GadgetState.GearAction2) + elseif param1 == 901 then + ScriptLib.SetGadgetState(context, GadgetState.Action01) + elseif param1 == 902 then + ScriptLib.SetGadgetState(context, GadgetState.Action02) + elseif param1 == 903 then + ScriptLib.SetGadgetState(context, GadgetState.Action03) + elseif (param1 >= 101 and param1 <= 104) or param1 == 200 or + (param1 >= 211 and param1 <= 214) or param1 == 222 or + (param1 >= 300 and param1 <= 304) or (param1 >= 310 and param1 <= 314) or param1 == 322 then + ScriptLib.SetGadgetState(context, param1) end end \ No newline at end of file diff --git a/Resources/Scripts/Gadget/SetGadgetState.lua b/Resources/Scripts/Gadget/SetGadgetState.lua index 58738fb2e..fe0eaf040 100644 --- a/Resources/Scripts/Gadget/SetGadgetState.lua +++ b/Resources/Scripts/Gadget/SetGadgetState.lua @@ -1,6 +1,3 @@ function OnClientExecuteReq(context, param1, param2, param3) - - --ScriptLib.PrintLog("GadgetState Get Change!!!!!!!") - ScriptLib.SetGadgetState(context, param1) - return 0 + ScriptLib.SetGadgetState(context, param1) end \ No newline at end of file diff --git a/Resources/Scripts/Gadget/SubfieldDrop_Ore_Dig.lua b/Resources/Scripts/Gadget/SubfieldDrop_Ore_Dig.lua index b0b669d6a..c742b7291 100644 --- a/Resources/Scripts/Gadget/SubfieldDrop_Ore_Dig.lua +++ b/Resources/Scripts/Gadget/SubfieldDrop_Ore_Dig.lua @@ -1,5 +1,3 @@ function OnDie(context, element_type, strike_type) ScriptLib.DropSubfield(context, {subfield_name = "Ore_Dig"}) -end - - +end \ No newline at end of file diff --git a/Resources/Scripts/Gadget/ViewPointController.lua b/Resources/Scripts/Gadget/ViewPointController.lua new file mode 100644 index 000000000..a79616fd3 --- /dev/null +++ b/Resources/Scripts/Gadget/ViewPointController.lua @@ -0,0 +1,7 @@ +function OnClientExecuteReq(context, param1, param2, param3) + if param1 == 0 then + ScriptLib.SetGadgetState(context, GadgetState.Default) + elseif param1 == 1 then + ScriptLib.SetGadgetState(context, GadgetState.GearStart) + end +end \ No newline at end of file diff --git a/Resources/Scripts/Gadget/WaterController.lua b/Resources/Scripts/Gadget/WaterController.lua index 5b318b861..c8fa598a3 100644 --- a/Resources/Scripts/Gadget/WaterController.lua +++ b/Resources/Scripts/Gadget/WaterController.lua @@ -1,26 +1,12 @@ --- 机关初始化配置 --- 初始状态 -local state_ = GadgetState.GearStart --- 启动元素 -local start_elem_type_ = ElementType.Water --- 停止元素 -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 OnBeHurt(context, element_type, unkParam, is_host) + ScriptLib.PrintContextLog(context, "Test WaterController") + local state = ScriptLib.GetGadgetState(context) + if element_type == ElementType.Water then + if state == GadgetState.Default or state == GadgetState.GearAction1 then + ScriptLib.SetGadgetState(context, GadgetState.GearStart) + end + if state == GadgetState.Action01 then + ScriptLib.SetGadgetState(context, GadgetState.Action02) + end + end +end \ No newline at end of file diff --git a/Resources/Scripts/Gadget/WindController.lua b/Resources/Scripts/Gadget/WindController.lua index cc9d41b54..3bda87fda 100644 --- a/Resources/Scripts/Gadget/WindController.lua +++ b/Resources/Scripts/Gadget/WindController.lua @@ -1,28 +1,12 @@ --- 机关初始化配置 --- 初始状态 -local state_ = GadgetState.GearStart --- 启动元素 -local start_elem_type_ = ElementType.Wind --- 停止元素 -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 OnBeHurt(context, element_type, unkParam, is_host) + ScriptLib.PrintContextLog(context, "Test WindController") + local state = ScriptLib.GetGadgetState(context) + if element_type == ElementType.Wind then + if state == GadgetState.Default or state == GadgetState.GearAction1 then + ScriptLib.SetGadgetState(context, GadgetState.GearStart) + end + if state == GadgetState.Action01 then + ScriptLib.SetGadgetState(context, GadgetState.Action02) + end + end +end \ No newline at end of file diff --git a/Resources/Scripts/Gadget/tree.lua b/Resources/Scripts/Gadget/tree.lua index 97e52cd6f..d4502f3ac 100644 --- a/Resources/Scripts/Gadget/tree.lua +++ b/Resources/Scripts/Gadget/tree.lua @@ -1,10 +1,8 @@ -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) +function OnBeHurt(context, element_type, unkParam, is_host) + local configIds = ScriptLib.GetGatherConfigIdList(context) + local count = #configIds + if length > 0 then - if 0 ~= ScriptLib.SetGadgetStateByConfigId(context, gather_config_ids[1], GadgetState.GatherDrop) then - ScriptLib.PrintLog("Drop config_id:" .. gather_config_ids[1] .." failed") - end - end + ScriptLib.SetGadgetStateByConfigId(context, configIds[1], GadgetState.GatherDrop) + end end \ No newline at end of file diff --git a/Resources/Server/GadgetMapping.json b/Resources/Server/GadgetMapping.json index aad75d7dd..fff9501f7 100644 --- a/Resources/Server/GadgetMapping.json +++ b/Resources/Server/GadgetMapping.json @@ -5549,7 +5549,7 @@ }, { "gadgetId": 70330400, - "serverController": "ElecController" + "serverController": "ElectricController" }, { "gadgetId": 70330401, @@ -6189,7 +6189,7 @@ }, { "gadgetId": 70360036, - "serverController": "ElecController" + "serverController": "ElectricController" }, { "gadgetId": 70360037, @@ -7813,7 +7813,7 @@ }, { "gadgetId": 70900008, - "serverController": "ElecController" + "serverController": "ElectricController" }, { "gadgetId": 70900009, @@ -7869,7 +7869,7 @@ }, { "gadgetId": 70900056, - "serverController": "ElecController" + "serverController": "ElectricController" }, { "gadgetId": 70900057, @@ -8093,7 +8093,7 @@ }, { "gadgetId": 70900402, - "serverController": "ElecController" + "serverController": "ElectricController" }, { "gadgetId": 70900403,