Browse Source

【增加】玩家特殊效果接口

johnclot69 1 year ago
parent
commit
3a4034fe6d

+ 16 - 0
Config/Proto/OuterMessage_C_10001.proto

@@ -271,6 +271,22 @@ message G2C_RemoveUnit // IActorLocationResponse
 	string Message = 3;
 }
 
+//ResponseType G2C_TriggrBattleFunction
+message C2G_TriggrBattleFunction // IActorLocationRequest
+{
+	int32 RpcId = 1;
+	int32 EffectID = 2;	// 效果id
+	int32 Value = 3;	// 属性数值
+	int32 Time = 4;	// 持续时间(秒)
+}
+
+message G2C_TriggrBattleFunction // IActorLocationResponse
+{
+	int32 RpcId = 1;
+	int32 Error = 2;
+	string Message = 3;
+}
+
 message G2C_TestHotfixMessage // IMessage
 {
 	string Info = 1;

+ 37 - 0
DotNet/Hotfix/Scenes/Game/Handler/C2G_TriggrBattleFunctionHandler.cs

@@ -0,0 +1,37 @@
+using System;
+
+namespace ET.Server
+{
+    /// <summary>
+    /// 玩家特殊效果(buff)
+    /// </summary>
+    [MessageHandler(SceneType.Game)]
+    public class C2G_TriggrBattleFunctionHandler: AMRpcHandler<C2G_TriggrBattleFunction, G2C_TriggrBattleFunction>
+    {
+        protected override async ETTask Run(Session session, C2G_TriggrBattleFunction request, G2C_TriggrBattleFunction response, Action reply)
+        {
+            WNPlayer player = session.GetComponent<SessionPlayerComponent>().GetMyPlayer();
+            if (player == null)
+            {
+                Log.Debug($"操作错误, player is null");
+                response.Error = ErrorCode.ERR_OperationError;
+                reply();
+                return;
+            }
+            // 参数判断
+            if (request.EffectID <= 0 || request.Value <= 0 || request.Time <= 0)
+            {
+                Log.Debug($"参数错误...EffectID={request.EffectID}, Value={request.Value}, Time={request.Time}");
+                response.Error = ErrorCode.ERR_ParameterError;
+                reply();
+                return;
+            }
+
+            player.GetXmdsManager().triggrBattleFunction(player.GetId().ToString().Trim(), request.EffectID, request.Value, request.Time, 0, 0, 0 ,0);
+
+            reply();
+
+            await ETTask.CompletedTask;
+        }
+    }
+}