Parcourir la source

【游戏服】修改未评论参加游戏的玩家刷礼物时,会默认添加随机单位

大爷 il y a 1 an
Parent
commit
d626eae0c5
1 fichiers modifiés avec 6 ajouts et 2 suppressions
  1. 6 2
      DotNet/Hotfix/Scenes/Game/Handler/R2G_LiveGiftHandler.cs

+ 6 - 2
DotNet/Hotfix/Scenes/Game/Handler/R2G_LiveGiftHandler.cs

@@ -28,8 +28,12 @@ namespace ET.Server
             // 数据是否存在
             if (unitPlayerData == null)
             {
-                Log.Error($"未找到单位玩家数据...openId={request.OpenId}");
-                return;
+                Log.Debug($"未找到单位玩家数据...openId={request.OpenId}, to create");
+                // 初始模板id
+                int[] units = { 101, 121, 111, 131 };
+                var templateId = RandomGenerator.RandomArray(units);
+                Vector2 pos = map.GetRandomPlayerPos();
+                unitPlayerData = await map.AddUnitPlayer(request.OpenId, templateId, 1, "", pos.X, pos.Y, request.NickName, request.Url);
             }
 
             unitPlayerData.GiftMoney += (int)request.GiftValue;