|
@@ -1,28 +1,28 @@
|
|
|
using System;
|
|
|
+using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using Newtonsoft.Json;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
namespace ET.Server
|
|
|
{
|
|
|
- [FriendOf(typeof(MapEventComponent))]
|
|
|
- [FriendOfAttribute(typeof(ET.Server.Map))]
|
|
|
+ [FriendOf(typeof (MapEventComponent))]
|
|
|
+ [FriendOfAttribute(typeof (Map))]
|
|
|
public static class MapEventComponentSystem
|
|
|
{
|
|
|
- public class MapEventComponentAwakeSystem : AwakeSystem<MapEventComponent, Map>
|
|
|
+ public class MapEventComponentAwakeSystem: AwakeSystem<MapEventComponent>
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 场景事件组件创建
|
|
|
/// </summary>
|
|
|
/// <param name="self"></param>
|
|
|
- /// <param name="map"></param>
|
|
|
- protected override void Awake(MapEventComponent self, Map map)
|
|
|
+ protected override void Awake(MapEventComponent self)
|
|
|
{
|
|
|
Log.Info($"创建事件组件...");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public class MapEventComponentDestroySystem : DestroySystem<MapEventComponent>
|
|
|
+ public class MapEventComponentDestroySystem: DestroySystem<MapEventComponent>
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 场景事件组件销毁
|
|
@@ -37,7 +37,6 @@ namespace ET.Server
|
|
|
/** 玩家进场景后推的消息 **/
|
|
|
public static void OnReady(this MapEventComponent self, WNPlayer player)
|
|
|
{
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/** 玩家登录事件 **/
|
|
@@ -56,8 +55,8 @@ namespace ET.Server
|
|
|
Log.Debug($"单位死亡...");
|
|
|
int unitType = Convert.ToInt32(msg.SelectToken("unitType"));
|
|
|
// 攻击者
|
|
|
- long hitFinalPlayerId = msg.SelectToken("hitFinal").ToString() == "" ? 0 : Convert.ToInt64(msg.SelectToken("hitFinal"));
|
|
|
- long belongPlayerId = msg.SelectToken("belongPlayerId").ToString() == "" ? 0 : Convert.ToInt64(msg.SelectToken("belongPlayerId"));
|
|
|
+ long hitFinalPlayerId = msg.SelectToken("hitFinal").ToString() == ""? 0 : Convert.ToInt64(msg.SelectToken("hitFinal"));
|
|
|
+ long belongPlayerId = msg.SelectToken("belongPlayerId").ToString() == ""? 0 : Convert.ToInt64(msg.SelectToken("belongPlayerId"));
|
|
|
long[] atkAssistantList = JsonConvert.DeserializeObject<long[]>(Convert.ToString(msg.SelectToken("atkAssistantList")) ?? string.Empty);
|
|
|
WNPlayer hitFinalPlayer = null;
|
|
|
|
|
@@ -83,6 +82,7 @@ namespace ET.Server
|
|
|
Log.Error($"unitDead not fount montster : {unitTemplateId}, {map.MapId}, {msg}");
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
// todo 怪物死亡处理逻辑
|
|
|
Log.Debug($"怪物死亡处理...");
|
|
|
break;
|
|
@@ -121,7 +121,6 @@ namespace ET.Server
|
|
|
/** 副本消息 **/
|
|
|
public static void OnMessageEvent(this MapEventComponent self, JObject msg)
|
|
|
{
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/** 场景结算事件 **/
|
|
@@ -150,19 +149,63 @@ namespace ET.Server
|
|
|
/** 拾取道具 **/
|
|
|
public static void OnPickItem(this MapEventComponent self, JObject msg)
|
|
|
{
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/** 击杀boss **/
|
|
|
public static void OnKillBoss(this MapEventComponent self, JObject msg)
|
|
|
{
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/** 战斗统计 **/
|
|
|
- public static void OnBattleReport(this MapEventComponent self, JObject msg)
|
|
|
+ public static void OnBattleReport(this MapEventComponent self, Map map, JObject msg)
|
|
|
{
|
|
|
+ string data = Convert.ToString(msg.SelectToken("data"));
|
|
|
+ if (string.IsNullOrEmpty(data))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Struct.BattleReports> list = new List<Struct.BattleReports>();
|
|
|
+
|
|
|
+ var battleReports = JsonConvert.DeserializeObject<List<Struct.BattleReports>>(data);
|
|
|
+ if (battleReports is { Count: > 0 })
|
|
|
+ {
|
|
|
+ foreach (Struct.BattleReports report in battleReports)
|
|
|
+ {
|
|
|
+ // 过滤一下非我方单位
|
|
|
+ if (report.Force != 1)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ uint ID = report.ID;
|
|
|
+ long PlayerUUID = string.IsNullOrEmpty(report.PlayerUUID)? 0 : Convert.ToInt64(report.PlayerUUID);
|
|
|
+ int TemplateID = report.TemplateId;
|
|
|
+ int Force = report.Force;
|
|
|
+ int TotalDamage = report.TotalDamage;
|
|
|
+
|
|
|
+ string name = "";
|
|
|
+ if (PlayerUUID > 0)
|
|
|
+ {
|
|
|
+ name = "玩家-" + TemplateID;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (TemplateID > 0)
|
|
|
+ {
|
|
|
+ Monster prop = MonsterCategory.Instance.Get(TemplateID);
|
|
|
+ if (prop != null)
|
|
|
+ {
|
|
|
+ name = prop.Name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ list.Add(new Struct.BattleReports(ID, report.PlayerUUID, TemplateID, name, Force, TotalDamage));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ map.GetComponent<MapRankComponent>().UpdateRank(list, map);
|
|
|
}
|
|
|
}
|
|
|
}
|