mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-02 20:26:03 +08:00
[BREAK CHANGE] Feature: Implement the basic task system
- Support for the 2.0&2.1 mission - The story line is still not working
This commit is contained in:
@@ -38,7 +38,6 @@ namespace EggLink.DanhengServer.Command.Cmd
|
||||
{
|
||||
avatar.CurrentHp = 10000;
|
||||
}
|
||||
player.SceneInstance!.SyncLineup();
|
||||
player.SendPacket(new PacketSyncLineupNotify(player.LineupManager.GetCurLineup()!));
|
||||
arg.SendMsg(I18nManager.Translate("Game.Command.Lineup.HealedAllAvatars"));
|
||||
}
|
||||
|
||||
@@ -153,6 +153,11 @@ namespace EggLink.DanhengServer.Command.Cmd
|
||||
player.SceneData.ScenePropData[floorId] = [];
|
||||
}
|
||||
|
||||
if (player.SceneData?.FloorSavedData.TryGetValue(floorId, out var _) == true)
|
||||
{
|
||||
player.SceneData.FloorSavedData[floorId] = [];
|
||||
}
|
||||
|
||||
arg.SendMsg(I18nManager.Translate("Game.Command.Scene.SceneReset", floorId.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
15
Common/Data/Config/FetchAdvPropData.cs
Normal file
15
Common/Data/Config/FetchAdvPropData.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using EggLink.DanhengServer.Data.Config.Task;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config
|
||||
{
|
||||
public class FetchAdvPropData
|
||||
{
|
||||
public DynamicFloat GroupID { get; set; } = new();
|
||||
public DynamicFloat ID { get; set; } = new();
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ namespace EggLink.DanhengServer.Data.Config
|
||||
public GroupLoadSideEnum LoadSide { get; set; }
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public GroupCategoryEnum Category { get; set; }
|
||||
public string LevelGraph { get; set; } = "";
|
||||
public bool LoadOnInitial { get; set; }
|
||||
public string GroupName { get; set; } = "";
|
||||
public LoadCondition LoadCondition { get; set; } = new();
|
||||
@@ -28,6 +29,9 @@ namespace EggLink.DanhengServer.Data.Config
|
||||
public List<PropInfo> PropList { get; set; } = [];
|
||||
public List<NpcInfo> NPCList { get; set; } = [];
|
||||
|
||||
[JsonIgnore]
|
||||
public LevelGraphConfigInfo? LevelGraphConfig { get; set; }
|
||||
|
||||
public void Load()
|
||||
{
|
||||
foreach (var prop in PropList)
|
||||
|
||||
29
Common/Data/Config/LevelGraphConfigInfo.cs
Normal file
29
Common/Data/Config/LevelGraphConfigInfo.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config
|
||||
{
|
||||
public class LevelGraphConfigInfo
|
||||
{
|
||||
public List<LevelInitSequeceConfigInfo> OnInitSequece { get; set; } = [];
|
||||
public List<LevelStartSequeceConfigInfo> OnStartSequece { get; set; } = [];
|
||||
|
||||
public static LevelGraphConfigInfo LoadFromJsonObject(JObject obj)
|
||||
{
|
||||
LevelGraphConfigInfo info = new();
|
||||
if (obj.ContainsKey(nameof(OnInitSequece)))
|
||||
{
|
||||
info.OnInitSequece = obj[nameof(OnInitSequece)]?.Select(x => LevelInitSequeceConfigInfo.LoadFromJsonObject((x as JObject)!)).ToList() ?? [];
|
||||
}
|
||||
if (obj.ContainsKey(nameof(OnStartSequece)))
|
||||
{
|
||||
info.OnStartSequece = obj[nameof(OnStartSequece)]?.Select(x => LevelStartSequeceConfigInfo.LoadFromJsonObject((x as JObject)!)).ToList() ?? [];
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Common/Data/Config/LevelInitSequeceConfigInfo.cs
Normal file
25
Common/Data/Config/LevelInitSequeceConfigInfo.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using EggLink.DanhengServer.Data.Config.Task;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config
|
||||
{
|
||||
public class LevelInitSequeceConfigInfo
|
||||
{
|
||||
public List<TaskConfigInfo> TaskList { get; set; } = [];
|
||||
|
||||
public static LevelInitSequeceConfigInfo LoadFromJsonObject(JObject obj)
|
||||
{
|
||||
LevelInitSequeceConfigInfo info = new();
|
||||
if (obj.ContainsKey(nameof(TaskList)))
|
||||
{
|
||||
info.TaskList = obj[nameof(TaskList)]?.Select(x => TaskConfigInfo.LoadFromJsonObject((x as JObject)!)).ToList() ?? [];
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Common/Data/Config/LevelStartSequeceConfigInfo.cs
Normal file
37
Common/Data/Config/LevelStartSequeceConfigInfo.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using EggLink.DanhengServer.Data.Config.Task;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config
|
||||
{
|
||||
public class LevelStartSequeceConfigInfo
|
||||
{
|
||||
public List<TaskConfigInfo> TaskList { get; set; } = [];
|
||||
public bool IsLoop { get; set; } = false;
|
||||
public int Order { get; set; }
|
||||
|
||||
public static LevelStartSequeceConfigInfo LoadFromJsonObject(JObject obj)
|
||||
{
|
||||
LevelStartSequeceConfigInfo info = new();
|
||||
if (obj.ContainsKey(nameof(TaskList)))
|
||||
{
|
||||
info.TaskList = obj[nameof(TaskList)]?.Select(x => TaskConfigInfo.LoadFromJsonObject((x as JObject)!)).ToList() ?? [];
|
||||
}
|
||||
|
||||
if (obj.ContainsKey(nameof(IsLoop)))
|
||||
{
|
||||
info.IsLoop = obj[nameof(IsLoop)]?.Value<bool>() ?? false;
|
||||
}
|
||||
|
||||
if (obj.ContainsKey(nameof(Order)))
|
||||
{
|
||||
info.Order = obj[nameof(Order)]?.Value<int>() ?? 0;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config
|
||||
{
|
||||
public class MissionActInfo
|
||||
{
|
||||
public List<MissionActTaskInfo> OnInitSequece { get; set; } = [];
|
||||
public List<MissionActTaskInfo> OnStartSequece { get; set; } = [];
|
||||
}
|
||||
|
||||
public class MissionActTaskInfo
|
||||
{
|
||||
public List<MissionActTaskInfo> TaskList { get; set; } = [];
|
||||
public string Type { get; set; } = "";
|
||||
public int MessageSectionID { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Data.Config.Task;
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Enums;
|
||||
using EggLink.DanhengServer.Enums.Scene;
|
||||
using EggLink.DanhengServer.Util;
|
||||
@@ -39,93 +40,8 @@ namespace EggLink.DanhengServer.Data.Config
|
||||
public int Progress { get; set; }
|
||||
public List<int>? GroupIDList { get; set; } = [];
|
||||
public int SubRewardID { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public SubMissionTask<EnterFloorTaskInfo> Task { get; set; } = new();
|
||||
[JsonIgnore]
|
||||
public SubMissionTask<PropStateTaskInfo> PropTask { get; set; } = new();
|
||||
[JsonIgnore]
|
||||
public SubMissionTask<StageWinTaskInfo> StageWinTask { get; set; } = new();
|
||||
|
||||
[JsonIgnore]
|
||||
public int MapEntranceID { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int AnchorGroupID { get; set; }
|
||||
[JsonIgnore]
|
||||
public int AnchorID { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<int> StageList { get; set; } = [];
|
||||
|
||||
[JsonIgnore]
|
||||
public PropStateEnum SourceState { get; set; } = PropStateEnum.Closed;
|
||||
|
||||
public void Loaded(int type) // 1 for EnterFloor, 2 for PropState
|
||||
{
|
||||
if (type == 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Task.OnStartSequece.Count > 0)
|
||||
{
|
||||
MapEntranceID = Task.OnStartSequece[0].TaskList[0].EntranceID;
|
||||
AnchorGroupID = Task.OnStartSequece[0].TaskList[0].GroupID;
|
||||
AnchorID = Task.OnStartSequece[0].TaskList[0].AnchorID;
|
||||
}
|
||||
else if (Task.OnInitSequece.Count > 0)
|
||||
{
|
||||
MapEntranceID = Task.OnInitSequece[0].TaskList[0].EntranceID;
|
||||
AnchorGroupID = Task.OnInitSequece[0].TaskList[0].GroupID;
|
||||
AnchorID = Task.OnInitSequece[0].TaskList[0].AnchorID;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
} else if (type == 2)
|
||||
{
|
||||
foreach (var task in PropTask.OnStartSequece)
|
||||
{
|
||||
foreach (var prop in task.TaskList)
|
||||
{
|
||||
if (prop.ButtonCallBack != null)
|
||||
{
|
||||
SourceState = prop.ButtonCallBack[0].State;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var task in PropTask.OnInitSequece)
|
||||
{
|
||||
foreach (var prop in task.TaskList)
|
||||
{
|
||||
if (prop.ButtonCallBack != null)
|
||||
{
|
||||
SourceState = prop.ButtonCallBack[0].State;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (type == 3)
|
||||
{
|
||||
foreach (var task in StageWinTask.OnStartSequece)
|
||||
{
|
||||
foreach (var stageWinTask in task.TaskList)
|
||||
{
|
||||
if (stageWinTask.Type == "RPG.GameCore.TriggerBattle")
|
||||
{
|
||||
if (stageWinTask.EventID.GetValue() > 0)
|
||||
{
|
||||
StageList.Add(stageWinTask.EventID.GetValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class CustomValueInfo
|
||||
{
|
||||
public int Index { get; set; }
|
||||
@@ -139,48 +55,4 @@ namespace EggLink.DanhengServer.Data.Config
|
||||
public List<int> FinishActionPara { get; set; } = [];
|
||||
public List<string> FinishActionParaString { get; set; } = [];
|
||||
}
|
||||
|
||||
public class SubMissionTask<T>
|
||||
{
|
||||
public List<SubMissionTaskInfo<T>> OnInitSequece { get; set; } = [];
|
||||
public List<SubMissionTaskInfo<T>> OnStartSequece { get; set; } = [];
|
||||
}
|
||||
|
||||
public class SubMissionTaskInfo<T>
|
||||
{
|
||||
public List<T> TaskList { get; set; } = [];
|
||||
}
|
||||
|
||||
public class EnterFloorTaskInfo
|
||||
{
|
||||
public int EntranceID { get; set; }
|
||||
public int GroupID { get; set; }
|
||||
public int AnchorID { get; set; }
|
||||
}
|
||||
|
||||
public class PropStateTaskInfo
|
||||
{
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public PropStateEnum State { get; set; } = PropStateEnum.Closed;
|
||||
|
||||
public List<PropStateTaskInfo>? ButtonCallBack { get; set; }
|
||||
}
|
||||
|
||||
public class StageWinTaskInfo
|
||||
{
|
||||
public string Type { get; set; } = "";
|
||||
public StageWinTaskEventInfo EventID { get; set; } = new();
|
||||
}
|
||||
|
||||
public class StageWinTaskEventInfo
|
||||
{
|
||||
public bool IsDynamic { get; set; }
|
||||
public FixedValueInfo<int> FixedValue { get; set; } = new();
|
||||
|
||||
public int GetValue()
|
||||
{
|
||||
return IsDynamic ? 0 : FixedValue.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ namespace EggLink.DanhengServer.Data.Config
|
||||
[JsonIgnore()]
|
||||
public Dictionary<int, List<int>> UnlockDoorID { get; set; } = [];
|
||||
|
||||
[JsonIgnore()]
|
||||
public Dictionary<int, List<int>> UnlockControllerID { get; set; } = [];
|
||||
|
||||
public void Load(GroupInfo info)
|
||||
{
|
||||
if (ValueSource != null)
|
||||
@@ -55,6 +58,20 @@ namespace EggLink.DanhengServer.Data.Config
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
else if (key.ToString().Contains("Controller"))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (UnlockControllerID.ContainsKey(int.Parse(value.ToString().Split(",")[0])) == false)
|
||||
{
|
||||
UnlockControllerID.Add(int.Parse(value.ToString().Split(",")[0]), []);
|
||||
}
|
||||
UnlockControllerID[int.Parse(value.ToString().Split(",")[0])].Add(int.Parse(value.ToString().Split(",")[1]));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
20
Common/Data/Config/Task/ByCompareFloorSavedValue.cs
Normal file
20
Common/Data/Config/Task/ByCompareFloorSavedValue.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using EggLink.DanhengServer.Enums.Task;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class ByCompareFloorSavedValue : PredicateConfigInfo
|
||||
{
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public CompareTypeEnum CompareType { get; set; } = CompareTypeEnum.Equal;
|
||||
public short CompareValue { get; set; } = 0;
|
||||
}
|
||||
}
|
||||
16
Common/Data/Config/Task/ByCompareSubMissionState.cs
Normal file
16
Common/Data/Config/Task/ByCompareSubMissionState.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using EggLink.DanhengServer.Enums.Task;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class ByCompareSubMissionState : PredicateConfigInfo
|
||||
{
|
||||
public int SubMissionID { get; set; }
|
||||
public SubMissionStateEnum SubMissionState { get; set; }
|
||||
public bool AllStoryLine { get; set; }
|
||||
}
|
||||
}
|
||||
15
Common/Data/Config/Task/CreateProp.cs
Normal file
15
Common/Data/Config/Task/CreateProp.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class CreateProp : TaskConfigInfo
|
||||
{
|
||||
public DynamicFloat GroupID { get; set; } = new();
|
||||
public DynamicFloat GroupPropID { get; set; } = new();
|
||||
public List<GroupEntityInfo> CreateList { get; set; } = [];
|
||||
}
|
||||
}
|
||||
32
Common/Data/Config/Task/DestroyProp.cs
Normal file
32
Common/Data/Config/Task/DestroyProp.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class DestroyProp : TaskConfigInfo
|
||||
{
|
||||
public DynamicFloat ID { get; set; } = new();
|
||||
public DynamicFloat GroupID { get; set; } = new();
|
||||
public List<GroupEntityInfo> DestroyList { get; set; } = [];
|
||||
}
|
||||
|
||||
public class GroupEntityInfo
|
||||
{
|
||||
public DynamicFloat GroupID { get; set; } = new();
|
||||
public DynamicFloat GroupInstanceID { get; set; } = new();
|
||||
}
|
||||
|
||||
public class DynamicFloat
|
||||
{
|
||||
public bool IsDynamic { get; set; }
|
||||
public FixedValueInfo<int> FixedValue { get; set; } = new();
|
||||
|
||||
public int GetValue()
|
||||
{
|
||||
return IsDynamic ? 0 : FixedValue.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Common/Data/Config/Task/EnterMap.cs
Normal file
15
Common/Data/Config/Task/EnterMap.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class EnterMap : TaskConfigInfo
|
||||
{
|
||||
public int EntranceID { get; set; }
|
||||
public int GroupID { get; set; }
|
||||
public int AnchorID { get; set; }
|
||||
}
|
||||
}
|
||||
13
Common/Data/Config/Task/EnterMapByCondition.cs
Normal file
13
Common/Data/Config/Task/EnterMapByCondition.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class EnterMapByCondition : TaskConfigInfo
|
||||
{
|
||||
public DynamicFloat EntranceID { get; set; } = new();
|
||||
}
|
||||
}
|
||||
13
Common/Data/Config/Task/PlayMessage.cs
Normal file
13
Common/Data/Config/Task/PlayMessage.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class PlayMessage : TaskConfigInfo
|
||||
{
|
||||
public int MessageSectionID { get; set; }
|
||||
}
|
||||
}
|
||||
33
Common/Data/Config/Task/PredicateConfigInfo.cs
Normal file
33
Common/Data/Config/Task/PredicateConfigInfo.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class PredicateConfigInfo : TaskConfigInfo
|
||||
{
|
||||
public bool Inverse { get; set; } = false;
|
||||
|
||||
public static new PredicateConfigInfo LoadFromJsonObject(JObject obj)
|
||||
{
|
||||
PredicateConfigInfo info = new();
|
||||
info.Type = obj[nameof(Type)]!.ToObject<string>()!;
|
||||
|
||||
var typeStr = info.Type.Replace("RPG.GameCore.", "");
|
||||
var className = "EggLink.DanhengServer.Data.Config.Task." + typeStr;
|
||||
var typeClass = System.Type.GetType(className);
|
||||
if (typeClass != null)
|
||||
{
|
||||
info = (PredicateConfigInfo)obj.ToObject(typeClass)!;
|
||||
}
|
||||
else
|
||||
{
|
||||
info = Newtonsoft.Json.JsonConvert.DeserializeObject<PredicateConfigInfo>(obj.ToString())!;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Common/Data/Config/Task/PredicateTaskList.cs
Normal file
37
Common/Data/Config/Task/PredicateTaskList.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class PredicateTaskList : TaskConfigInfo
|
||||
{
|
||||
public PredicateConfigInfo Predicate { get; set; } = new();
|
||||
public List<TaskConfigInfo> SuccessTaskList { get; set; } = [];
|
||||
public List<TaskConfigInfo> FailedTaskList { get; set; } = [];
|
||||
|
||||
public static new TaskConfigInfo LoadFromJsonObject(JObject obj)
|
||||
{
|
||||
PredicateTaskList info = new();
|
||||
info.Type = obj[nameof(Type)]!.ToObject<string>()!;
|
||||
if (obj.ContainsKey(nameof(Predicate)))
|
||||
{
|
||||
info.Predicate = (PredicateConfigInfo.LoadFromJsonObject((obj[nameof(Predicate)] as JObject)!)!);
|
||||
}
|
||||
|
||||
if (obj.ContainsKey(nameof(SuccessTaskList)))
|
||||
{
|
||||
info.SuccessTaskList = obj[nameof(SuccessTaskList)]?.Select(x => TaskConfigInfo.LoadFromJsonObject((x as JObject)!)).ToList() ?? [];
|
||||
}
|
||||
|
||||
if (obj.ContainsKey(nameof(FailedTaskList)))
|
||||
{
|
||||
info.FailedTaskList = obj[nameof(FailedTaskList)]?.Select(x => TaskConfigInfo.LoadFromJsonObject((x as JObject)!)).ToList() ?? [];
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
68
Common/Data/Config/Task/PropSetupUITrigger.cs
Normal file
68
Common/Data/Config/Task/PropSetupUITrigger.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class PropSetupUITrigger : TaskConfigInfo
|
||||
{
|
||||
public string ColliderRelativePath { get; set; } = string.Empty;
|
||||
public bool DestroyAfterTriggered { get; set; }
|
||||
public bool DisableAfterTriggered { get; set; }
|
||||
public bool DisableWhenTriggered { get; set; }
|
||||
public string ButtonIcon { get; set; } = string.Empty;
|
||||
//DialogueIconType IconType;
|
||||
//TextID ButtonText;
|
||||
//DynamicString ButtonTextCustom;
|
||||
public List<TaskConfigInfo> ButtonCallback { get; set; } = [];
|
||||
public bool ForceInteractInDanger { get; set; }
|
||||
public bool ConsiderAngleLimit { get; set; }
|
||||
public float InteractAngleRange { get; set; }
|
||||
//EntityType[] OverrideTargetTypes;
|
||||
public bool TriggerByFakeAvatar { get; set; }
|
||||
public bool SkipFakeAvatar { get; set; }
|
||||
public PredicateConfigInfo OnEnterFilter { get; set; } = new();
|
||||
public TargetEvaluator TargetType { get; set; } = new();
|
||||
|
||||
public static new TaskConfigInfo LoadFromJsonObject(JObject obj)
|
||||
{
|
||||
PropSetupUITrigger info = new();
|
||||
info.Type = obj[nameof(Type)]!.ToObject<string>()!;
|
||||
|
||||
if (obj.ContainsKey(nameof(OnEnterFilter)))
|
||||
{
|
||||
info.OnEnterFilter = (PredicateConfigInfo.LoadFromJsonObject((obj[nameof(OnEnterFilter)] as JObject)!) as PredicateConfigInfo)!;
|
||||
}
|
||||
|
||||
if (obj.ContainsKey(nameof(ButtonCallback)))
|
||||
{
|
||||
info.ButtonCallback = obj[nameof(ButtonCallback)]?.Select(x => TaskConfigInfo.LoadFromJsonObject((x as JObject)!)).ToList() ?? [];
|
||||
}
|
||||
|
||||
if (obj.ContainsKey(nameof(TargetType)))
|
||||
{
|
||||
var targetType = obj[nameof(TargetType)] as JObject;
|
||||
var classType = System.Type.GetType($"EggLink.DanhengServer.Data.Config.Task.{targetType?["Type"]?.ToString().Replace("RPG.GameCore.","")}");
|
||||
classType ??= System.Type.GetType($"EggLink.DanhengServer.Data.Config.Task.TargetEvaluator");
|
||||
info.TargetType = (targetType!.ToObject(classType!) as TargetEvaluator)!;
|
||||
}
|
||||
|
||||
if (info.ButtonCallback.Count > 0 && info.ButtonCallback[0].Type == "RPG.GameCore.PropStateExecute")
|
||||
{
|
||||
info.Type = obj[nameof(Type)]!.ToObject<string>()!;
|
||||
}
|
||||
|
||||
info.ColliderRelativePath = obj[nameof(ColliderRelativePath)]?.ToString() ?? string.Empty;
|
||||
info.DestroyAfterTriggered = obj[nameof(DestroyAfterTriggered)]?.ToObject<bool>() ?? false;
|
||||
info.DisableAfterTriggered = obj[nameof(DisableAfterTriggered)]?.ToObject<bool>() ?? false;
|
||||
info.DisableWhenTriggered = obj[nameof(DisableWhenTriggered)]?.ToObject<bool>() ?? false;
|
||||
info.ButtonIcon = obj[nameof(ButtonIcon)]?.ToString() ?? string.Empty;
|
||||
info.ForceInteractInDanger = obj[nameof(ForceInteractInDanger)]?.ToObject<bool>() ?? false;
|
||||
info.ConsiderAngleLimit = obj[nameof(ConsiderAngleLimit)]?.ToObject<bool>() ?? false;
|
||||
info.InteractAngleRange = obj[nameof(InteractAngleRange)]?.ToObject<float>() ?? 0;
|
||||
info.TriggerByFakeAvatar = obj[nameof(TriggerByFakeAvatar)]?.ToObject<bool>() ?? false;
|
||||
info.SkipFakeAvatar = obj[nameof(SkipFakeAvatar)]?.ToObject<bool>() ?? false;
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
46
Common/Data/Config/Task/PropStateExecute.cs
Normal file
46
Common/Data/Config/Task/PropStateExecute.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using EggLink.DanhengServer.Enums.Scene;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class PropStateExecute : TaskConfigInfo
|
||||
{
|
||||
public TargetEvaluator TargetType { get; set; } = new();
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public PropStateEnum PropState { get; set; } = PropStateEnum.Closed;
|
||||
public List<TaskConfigInfo> Execute { get; set; } = [];
|
||||
|
||||
public static new TaskConfigInfo LoadFromJsonObject(JObject obj)
|
||||
{
|
||||
var info = new PropStateExecute();
|
||||
|
||||
info.Type = obj[nameof(Type)]!.ToObject<string>()!;
|
||||
if (obj.ContainsKey(nameof(TargetType)))
|
||||
{
|
||||
var targetType = obj[nameof(TargetType)] as JObject;
|
||||
var classType = System.Type.GetType($"EggLink.DanhengServer.Data.Config.Task.{targetType?["Type"]?.ToString().Replace("RPG.GameCore.", "")}");
|
||||
classType ??= System.Type.GetType($"EggLink.DanhengServer.Data.Config.Task.TargetEvaluator");
|
||||
info.TargetType = (targetType!.ToObject(classType!) as TargetEvaluator)!;
|
||||
}
|
||||
|
||||
if (obj.ContainsKey(nameof(PropState)))
|
||||
{
|
||||
info.PropState = obj[nameof(PropState)]?.ToObject<PropStateEnum>() ?? PropStateEnum.Closed;
|
||||
}
|
||||
|
||||
foreach (var item in obj[nameof(Execute)]?.Select(x => TaskConfigInfo.LoadFromJsonObject((x as JObject)!)) ?? [])
|
||||
{
|
||||
info.Execute.Add(item);
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Common/Data/Config/Task/TargetEvaluator.cs
Normal file
13
Common/Data/Config/Task/TargetEvaluator.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class TargetEvaluator
|
||||
{
|
||||
public string Type { get; set; } = "";
|
||||
}
|
||||
}
|
||||
25
Common/Data/Config/Task/TargetFetchAdvPropEx.cs
Normal file
25
Common/Data/Config/Task/TargetFetchAdvPropEx.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using EggLink.DanhengServer.Enums.Task;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class TargetFetchAdvPropEx : TargetEvaluator
|
||||
{
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public TargetFetchAdvPropFetchTypeEnum FetchType { get; set; }
|
||||
//public DynamicString SinglePropKey;
|
||||
public FetchAdvPropData SinglePropID { get; set; } = new();
|
||||
//public DynamicString SingleUniqueName;
|
||||
//public DynamicString[] MultiPropKey;
|
||||
//public FetchAdvPropData[] MultiPropID;
|
||||
//public DynamicString[] MultiUniqueName;
|
||||
public DynamicFloat PropGroup { get; set; } = new();
|
||||
public DynamicFloat PropIDInOwnerGroup { get; set; } = new();
|
||||
}
|
||||
}
|
||||
52
Common/Data/Config/Task/TaskConfigInfo.cs
Normal file
52
Common/Data/Config/Task/TaskConfigInfo.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class TaskConfigInfo
|
||||
{
|
||||
public string Type { get; set; } = "";
|
||||
public bool TaskEnabled { get; set; } = false;
|
||||
|
||||
public static TaskConfigInfo LoadFromJsonObject(JObject json)
|
||||
{
|
||||
string type = json[nameof(Type)]?.Value<string>() ?? "";
|
||||
if (string.IsNullOrEmpty(type))
|
||||
{
|
||||
return new TaskConfigInfo();
|
||||
}
|
||||
|
||||
var typeStr = type.Replace("RPG.GameCore.", "");
|
||||
var className = "EggLink.DanhengServer.Data.Config.Task." + typeStr;
|
||||
var typeClass = System.Type.GetType(className);
|
||||
if (typeStr == "PredicateTaskList")
|
||||
{
|
||||
var res = PredicateTaskList.LoadFromJsonObject(json);
|
||||
res.Type = type;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (typeStr == "PropSetupUITrigger")
|
||||
{
|
||||
var res = PropSetupUITrigger.LoadFromJsonObject(json);
|
||||
res.Type = type;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (typeStr == "PropStateExecute")
|
||||
{
|
||||
var res = PropStateExecute.LoadFromJsonObject(json);
|
||||
res.Type = type;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (typeClass != null)
|
||||
{
|
||||
var res = (TaskConfigInfo)json.ToObject(typeClass)!;
|
||||
res.Type = type;
|
||||
return res;
|
||||
}
|
||||
|
||||
return Newtonsoft.Json.JsonConvert.DeserializeObject<TaskConfigInfo>(json.ToString())!;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Common/Data/Config/Task/TriggerEntityEvent.cs
Normal file
13
Common/Data/Config/Task/TriggerEntityEvent.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class TriggerEntityEvent : TaskConfigInfo
|
||||
{
|
||||
public DynamicFloat InstanceID { get; set; } = new();
|
||||
}
|
||||
}
|
||||
18
Common/Data/Config/Task/TriggerPerformance.cs
Normal file
18
Common/Data/Config/Task/TriggerPerformance.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using EggLink.DanhengServer.Enums.Task;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task
|
||||
{
|
||||
public class TriggerPerformance : TaskConfigInfo
|
||||
{
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public ELevelPerformanceTypeEnum PerformanceType { get; set; }
|
||||
public int PerformanceID { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace EggLink.DanhengServer.Data.Excel
|
||||
public string PerformancePath { get; set; } = "";
|
||||
|
||||
[JsonIgnore]
|
||||
public MissionActInfo? ActInfo { get; set; }
|
||||
public LevelGraphConfigInfo? ActInfo { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
|
||||
@@ -17,6 +17,9 @@ namespace EggLink.DanhengServer.Data.Excel
|
||||
[JsonIgnore()]
|
||||
public SubMissionInfo? SubMissionInfo { get; set; }
|
||||
|
||||
[JsonIgnore()]
|
||||
public LevelGraphConfigInfo? SubMissionTaskInfo { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return SubMissionID;
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace EggLink.DanhengServer.Data
|
||||
LoadMazeSkill();
|
||||
LoadDialogueInfo();
|
||||
LoadPerformanceInfo();
|
||||
LoadSubMissionInfo();
|
||||
LoadRogueChestMapInfo();
|
||||
GameData.ActivityConfig = LoadCustomFile<ActivityConfig>("Activity", "ActivityConfig") ?? new();
|
||||
GameData.BannersConfig = LoadCustomFile<BannersConfig>("Banner", "Banners") ?? new();
|
||||
@@ -168,6 +169,22 @@ namespace EggLink.DanhengServer.Data
|
||||
group.Id = groupInfo.ID;
|
||||
info.Groups.TryAdd(groupInfo.ID, group);
|
||||
group.Load();
|
||||
|
||||
// load graph
|
||||
var graphPath = ConfigManager.Config.Path.ResourcePath + "/" + group.LevelGraph;
|
||||
var graphFile = new FileInfo(graphPath);
|
||||
if (graphFile.Exists)
|
||||
{
|
||||
using var graphReader = graphFile.OpenRead();
|
||||
using StreamReader graphReader2 = new(graphReader);
|
||||
var graphText = graphReader2.ReadToEnd().Replace("$type", "Type");
|
||||
var graphObj = JObject.Parse(graphText);
|
||||
if (graphObj != null)
|
||||
{
|
||||
LevelGraphConfigInfo graphInfo = LevelGraphConfigInfo.LoadFromJsonObject(graphObj);
|
||||
group.LevelGraphConfig = graphInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex)
|
||||
{
|
||||
@@ -216,42 +233,6 @@ namespace EggLink.DanhengServer.Data
|
||||
if (File.Exists(missionJsonPath))
|
||||
{
|
||||
var missionJson = File.ReadAllText(missionJsonPath).Replace("$type", "Type");
|
||||
try
|
||||
{
|
||||
if (subMission.FinishType == Enums.MissionFinishTypeEnum.EnterFloor)
|
||||
{
|
||||
var mission = JsonConvert.DeserializeObject<SubMissionTask<EnterFloorTaskInfo>>(missionJson);
|
||||
|
||||
if (mission != null)
|
||||
{
|
||||
subMission.Task = mission;
|
||||
subMission.Loaded(1);
|
||||
}
|
||||
} else if (subMission.FinishType == Enums.MissionFinishTypeEnum.PropState)
|
||||
{
|
||||
var mission = JsonConvert.DeserializeObject<SubMissionTask<PropStateTaskInfo>>(missionJson);
|
||||
if (mission != null)
|
||||
{
|
||||
subMission.PropTask = mission;
|
||||
subMission.Loaded(2);
|
||||
}
|
||||
} else if (subMission.FinishType == Enums.MissionFinishTypeEnum.StageWin)
|
||||
{
|
||||
var mission = JsonConvert.DeserializeObject<SubMissionTask<StageWinTaskInfo>>(missionJson);
|
||||
if (mission != null)
|
||||
{
|
||||
subMission.StageWinTask = mission;
|
||||
subMission.Loaded(3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
subMission.Loaded(0);
|
||||
}
|
||||
} catch (Exception ex)
|
||||
{
|
||||
Logger.Error(I18nManager.Translate("Server.ServerInfo.FailedToReadItem", missionJsonPath, I18nManager.Translate("Word.Error")), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
count++;
|
||||
@@ -405,10 +386,11 @@ namespace EggLink.DanhengServer.Data
|
||||
using var reader = file.OpenRead();
|
||||
using StreamReader reader2 = new(reader);
|
||||
var text = reader2.ReadToEnd().Replace("$type", "Type");
|
||||
var act = JsonConvert.DeserializeObject<MissionActInfo>(text);
|
||||
if (act != null)
|
||||
var obj = JObject.Parse(text);
|
||||
if (obj != null)
|
||||
{
|
||||
performance.ActInfo = act;
|
||||
LevelGraphConfigInfo info = LevelGraphConfigInfo.LoadFromJsonObject(obj);
|
||||
performance.ActInfo = info;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -428,6 +410,48 @@ namespace EggLink.DanhengServer.Data
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", count.ToString(), I18nManager.Translate("Word.PerformanceInfo")));
|
||||
}
|
||||
|
||||
public static void LoadSubMissionInfo()
|
||||
{
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadingItem", I18nManager.Translate("Word.SubMissionInfo")));
|
||||
var count = 0;
|
||||
foreach (var subMission in GameData.SubMissionData.Values)
|
||||
{
|
||||
if (subMission.SubMissionInfo == null || subMission.SubMissionInfo.MissionJsonPath == "")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var path = ConfigManager.Config.Path.ResourcePath + "/" + subMission.SubMissionInfo.MissionJsonPath;
|
||||
var file = new FileInfo(path);
|
||||
if (!file.Exists) continue;
|
||||
try
|
||||
{
|
||||
using var reader = file.OpenRead();
|
||||
using StreamReader reader2 = new(reader);
|
||||
var text = reader2.ReadToEnd().Replace("$type", "Type");
|
||||
var obj = JObject.Parse(text);
|
||||
if (obj != null)
|
||||
{
|
||||
LevelGraphConfigInfo info = LevelGraphConfigInfo.LoadFromJsonObject(obj);
|
||||
subMission.SubMissionTaskInfo = info;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(I18nManager.Translate("Server.ServerInfo.FailedToReadItem", file.Name, I18nManager.Translate("Word.Error")), ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (count < GameData.SubMissionData.Count)
|
||||
{
|
||||
//Logger.Warn("Performance infos are missing, please check your resources folder: " + ConfigManager.Config.Path.ResourcePath + "/Config/Level/Mission/*/Act. Performances may not work!");
|
||||
}
|
||||
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", count.ToString(), I18nManager.Translate("Word.SubMissionInfo")));
|
||||
}
|
||||
|
||||
public static void LoadRogueChestMapInfo()
|
||||
{
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadingItem", I18nManager.Translate("Word.RogueChestMapInfo")));
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace EggLink.DanhengServer.Database.Lineup
|
||||
Name = Name,
|
||||
MaxMp = 5,
|
||||
Mp = (uint)Mp,
|
||||
ExtraLineupType = (ExtraLineupType)LineupType,
|
||||
ExtraLineupType = (ExtraLineupType)(LineupType == (int)ExtraLineupType.LineupHeliobus ? (int)ExtraLineupType.LineupNone : LineupType),
|
||||
Index = (uint)(LineupData?.Lineups?.Values.ToList().IndexOf(this) ?? 0),
|
||||
};
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ namespace EggLink.DanhengServer.Database.Mission
|
||||
[SugarColumn(IsJson = true)]
|
||||
public List<int> RunningMainMissionIds { get; set; } = [];
|
||||
|
||||
[SugarColumn(IsJson = true)]
|
||||
public Dictionary<int, int> SubMissionProgressDict { get; set; } = [];
|
||||
|
||||
public int TrackingMainMissionId { get; set; }
|
||||
|
||||
public MissionPhaseEnum GetMainMissionStatus(int missionId)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Enums.Task;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
namespace EggLink.DanhengServer.Enums
|
||||
{
|
||||
@@ -23,5 +24,17 @@ namespace EggLink.DanhengServer.Enums
|
||||
_ => MissionStatus.MissionNone,
|
||||
};
|
||||
}
|
||||
|
||||
public static SubMissionStateEnum ToStateEnum(this MissionPhaseEnum status)
|
||||
{
|
||||
return status switch
|
||||
{
|
||||
MissionPhaseEnum.None => SubMissionStateEnum.Unknow,
|
||||
MissionPhaseEnum.Accept => SubMissionStateEnum.Started,
|
||||
MissionPhaseEnum.Finish => SubMissionStateEnum.Finish,
|
||||
MissionPhaseEnum.Cancel => SubMissionStateEnum.TakenAndNotStarted,
|
||||
_ => SubMissionStateEnum.Unknow,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
13
Common/Enums/Task/CompareTypeEnum.cs
Normal file
13
Common/Enums/Task/CompareTypeEnum.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace EggLink.DanhengServer.Enums.Task
|
||||
{
|
||||
public enum CompareTypeEnum
|
||||
{
|
||||
Unknow = 0,
|
||||
Greater = 1,
|
||||
GreaterEqual = 2,
|
||||
NotEqual = 3,
|
||||
Equal = 4,
|
||||
LessEqual = 5,
|
||||
Less = 6,
|
||||
}
|
||||
}
|
||||
12
Common/Enums/Task/ELevelPerformanceTypeEnum.cs
Normal file
12
Common/Enums/Task/ELevelPerformanceTypeEnum.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace EggLink.DanhengServer.Enums.Task
|
||||
{
|
||||
public enum ELevelPerformanceTypeEnum
|
||||
{
|
||||
Unknown = 0,
|
||||
A = 1,
|
||||
C = 2,
|
||||
D = 3,
|
||||
E = 4,
|
||||
PlayVideo = 10,
|
||||
}
|
||||
}
|
||||
10
Common/Enums/Task/SubMissionStateEnum.cs
Normal file
10
Common/Enums/Task/SubMissionStateEnum.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace EggLink.DanhengServer.Enums.Task
|
||||
{
|
||||
public enum SubMissionStateEnum
|
||||
{
|
||||
Unknow = 0,
|
||||
Started = 1,
|
||||
Finish = 2,
|
||||
TakenAndNotStarted = 3
|
||||
}
|
||||
}
|
||||
15
Common/Enums/Task/TargetFetchAdvPropFetchTypeEnum.cs
Normal file
15
Common/Enums/Task/TargetFetchAdvPropFetchTypeEnum.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace EggLink.DanhengServer.Enums.Task
|
||||
{
|
||||
public enum TargetFetchAdvPropFetchTypeEnum
|
||||
{
|
||||
Owner = 0,
|
||||
SinglePropByPropKey = 1,
|
||||
SinglePropByPropID = 2,
|
||||
SinglePropByUniqueName = 3,
|
||||
MultiPropByPropKey = 4,
|
||||
MultiPropByPropID = 5,
|
||||
MultiPropByUniqueName = 6,
|
||||
MultiPropByGroup = 7,
|
||||
SinglePropByOwnerGroupAndID = 8,
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,8 @@ namespace EggLink.DanhengServer.Internationalization.Message
|
||||
public string FloorGroupMissingResult { get; } = "传送、怪物战斗与世界生成";
|
||||
public string Mission { get; } = "任务";
|
||||
public string MissionInfo { get; } = "任务文件";
|
||||
public string SubMission { get; } = "子任务";
|
||||
public string SubMissionInfo { get; } = "子任务文件";
|
||||
public string MazeSkill { get; } = "角色秘技";
|
||||
public string MazeSkillInfo { get; } = "角色秘技文件";
|
||||
public string Dialogue { get; } = "模拟宇宙事件";
|
||||
|
||||
@@ -151,6 +151,9 @@ namespace EggLink.DanhengServer.Game.Inventory
|
||||
AddItem(itemId + 200000, 1, false);
|
||||
}
|
||||
break;
|
||||
case ItemMainTypeEnum.Mission:
|
||||
itemData = PutItem(itemId, count);
|
||||
break;
|
||||
default:
|
||||
itemData = PutItem(itemId, Math.Min(count, itemConfig.PileLimit));
|
||||
break;
|
||||
@@ -167,6 +170,8 @@ namespace EggLink.DanhengServer.Game.Inventory
|
||||
{
|
||||
Player.SendPacket(new PacketScenePlaneEventScNotify(clone));
|
||||
}
|
||||
|
||||
Player.MissionManager?.HandleFinishType(Enums.MissionFinishTypeEnum.GetItem, itemData);
|
||||
}
|
||||
|
||||
return returnRaw ? itemData : clone ?? itemData;
|
||||
@@ -314,11 +319,18 @@ namespace EggLink.DanhengServer.Game.Inventory
|
||||
itemData = relic;
|
||||
break;
|
||||
}
|
||||
|
||||
if (itemData != null && sync)
|
||||
{
|
||||
Player.SendPacket(new PacketPlayerSyncScNotify(itemData));
|
||||
}
|
||||
DatabaseHelper.Instance?.UpdateInstance(Data);
|
||||
|
||||
Player.MissionManager?.HandleFinishType(Enums.MissionFinishTypeEnum.UseItem, new ItemData()
|
||||
{
|
||||
ItemId = itemId,
|
||||
Count = count,
|
||||
});
|
||||
|
||||
return itemData;
|
||||
}
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace EggLink.DanhengServer.Game.Lineup
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveAvatar(int lineupIndex, int avatarId)
|
||||
public void RemoveAvatar(int lineupIndex, int avatarId, bool sendPacket = true)
|
||||
{
|
||||
if (lineupIndex < 0)
|
||||
{
|
||||
@@ -308,19 +308,31 @@ namespace EggLink.DanhengServer.Game.Lineup
|
||||
{
|
||||
return;
|
||||
}
|
||||
lineup.BaseAvatars?.RemoveAll(avatar => avatar.BaseAvatarId == avatarId);
|
||||
GameData.SpecialAvatarData.TryGetValue(avatarId * 10 + Player.Data.WorldLevel, out var specialAvatar);
|
||||
if (specialAvatar != null)
|
||||
{
|
||||
lineup.BaseAvatars?.RemoveAll(avatar => avatar.BaseAvatarId == specialAvatar.AvatarID);
|
||||
}
|
||||
else
|
||||
{
|
||||
lineup.BaseAvatars?.RemoveAll(avatar => avatar.BaseAvatarId == avatarId);
|
||||
}
|
||||
LineupData.Lineups[lineupIndex] = lineup;
|
||||
DatabaseHelper.Instance?.UpdateInstance(LineupData);
|
||||
if (lineupIndex == LineupData.GetCurLineupIndex())
|
||||
|
||||
if (sendPacket)
|
||||
{
|
||||
Player.SceneInstance?.SyncLineup();
|
||||
if (lineupIndex == LineupData.GetCurLineupIndex())
|
||||
{
|
||||
Player.SceneInstance?.SyncLineup();
|
||||
}
|
||||
Player.SendPacket(new PacketSyncLineupNotify(lineup));
|
||||
}
|
||||
Player.SendPacket(new PacketSyncLineupNotify(lineup));
|
||||
}
|
||||
|
||||
public void RemoveAvatarFromCurTeam(int avatarId)
|
||||
public void RemoveAvatarFromCurTeam(int avatarId, bool sendPacket = true)
|
||||
{
|
||||
RemoveAvatar(LineupData.GetCurLineupIndex(), avatarId);
|
||||
RemoveAvatar(LineupData.GetCurLineupIndex(), avatarId, sendPacket);
|
||||
}
|
||||
|
||||
public void RemoveSpecialAvatarFromCurTeam(int specialAvatarId)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using EggLink.DanhengServer.Enums;
|
||||
using EggLink.DanhengServer.Game.Player;
|
||||
using EggLink.DanhengServer.GameServer.Server.Packet.Send.Scene;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -13,6 +14,7 @@ namespace EggLink.DanhengServer.Game.Mission.FinishAction.Handler
|
||||
{
|
||||
public override void OnHandle(List<int> Params, List<string> ParamString, PlayerInstance Player)
|
||||
{
|
||||
_ = int.TryParse(ParamString[0], out var plane);
|
||||
_ = int.TryParse(ParamString[1], out var floor);
|
||||
Player.SceneData!.FloorSavedData.TryGetValue(floor, out var value);
|
||||
if (value == null)
|
||||
@@ -22,6 +24,9 @@ namespace EggLink.DanhengServer.Game.Mission.FinishAction.Handler
|
||||
}
|
||||
|
||||
value[ParamString[2]] = int.Parse(ParamString[3]); // ParamString[2] is the key
|
||||
Player.SendPacket(new PacketUpdateFloorSavedValueNotify(ParamString[2], int.Parse(ParamString[3])));
|
||||
|
||||
Player.TaskManager?.SceneTaskTrigger.TriggerFloor(plane, floor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,12 @@ namespace EggLink.DanhengServer.Game.Mission.FinishType.Handler
|
||||
{
|
||||
public override void Init(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
{
|
||||
if (player.LineupManager!.GetCurLineup() == null) return;
|
||||
var actualSpecialAvatarId = info.ParamInt1 * 10 + player.Data.WorldLevel;
|
||||
var item = player.LineupManager!.GetCurLineup()!.BaseAvatars!.Find(item => item.SpecialAvatarId == actualSpecialAvatarId);
|
||||
if (item == null) return; // avatar not found
|
||||
player.LineupManager!.RemoveSpecialAvatarFromCurTeam(actualSpecialAvatarId);
|
||||
// MOVE TO TASK HANDLER
|
||||
//if (player.LineupManager!.GetCurLineup() == null) return;
|
||||
//var actualSpecialAvatarId = info.ParamInt1 * 10 + player.Data.WorldLevel;
|
||||
//var item = player.LineupManager!.GetCurLineup()!.BaseAvatars!.Find(item => item.SpecialAvatarId == actualSpecialAvatarId);
|
||||
//if (item == null) return; // avatar not found
|
||||
//player.LineupManager!.RemoveSpecialAvatarFromCurTeam(actualSpecialAvatarId);
|
||||
}
|
||||
|
||||
public override void HandleFinishType(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
|
||||
@@ -14,7 +14,8 @@ namespace EggLink.DanhengServer.Game.Mission.FinishType.Handler
|
||||
{
|
||||
public override void Init(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
{
|
||||
player.EnterMissionScene(info.MapEntranceID, info.AnchorGroupID, info.AnchorID, true);
|
||||
// MOVE TO TASK HANDLER
|
||||
//player.EnterMissionScene(info.MapEntranceID, info.AnchorGroupID, info.AnchorID, true);
|
||||
}
|
||||
|
||||
public override void HandleFinishType(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using EggLink.DanhengServer.Data.Config;
|
||||
using EggLink.DanhengServer.Database.Inventory;
|
||||
using EggLink.DanhengServer.Game.Mission.FinishType;
|
||||
using EggLink.DanhengServer.Game.Player;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Mission.FinishType.Handler
|
||||
{
|
||||
[MissionFinishType(Enums.MissionFinishTypeEnum.GetItem)]
|
||||
internal class MissionHandlerGetItem : MissionFinishTypeHandler
|
||||
{
|
||||
public override void Init(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
{
|
||||
}
|
||||
|
||||
public override void HandleFinishType(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
{
|
||||
if (arg != null && arg is ItemData item)
|
||||
{
|
||||
if (item.ItemId == info.ParamInt1)
|
||||
{
|
||||
player.MissionManager!.FinishSubMission(info.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,11 +11,12 @@ namespace EggLink.DanhengServer.Game.Mission.FinishType.Handler
|
||||
{
|
||||
public override void Init(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
{
|
||||
if (player.LineupManager!.GetCurLineup() == null) return;
|
||||
var actualSpecialAvatarId = info.ParamInt1 * 10 + player.Data.WorldLevel;
|
||||
var item = player.LineupManager!.GetCurLineup()!.BaseAvatars!.Find(item => item.SpecialAvatarId == actualSpecialAvatarId);
|
||||
if (item != null) return; // existing avatar
|
||||
player.LineupManager!.AddSpecialAvatarToCurTeam(actualSpecialAvatarId);
|
||||
// MOVE TO TASK HANDLER
|
||||
//if (player.LineupManager!.GetCurLineup() == null) return;
|
||||
//var actualSpecialAvatarId = info.ParamInt1 * 10 + player.Data.WorldLevel;
|
||||
//var item = player.LineupManager!.GetCurLineup()!.BaseAvatars!.Find(item => item.SpecialAvatarId == actualSpecialAvatarId);
|
||||
//if (item != null) return; // existing avatar
|
||||
//player.LineupManager!.AddSpecialAvatarToCurTeam(actualSpecialAvatarId);
|
||||
}
|
||||
|
||||
public override void HandleFinishType(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
|
||||
@@ -14,7 +14,8 @@ namespace EggLink.DanhengServer.Game.Mission.FinishType.Handler
|
||||
{
|
||||
public override void Init(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
{
|
||||
player.MessageManager!.AddMessageSection(info.ParamInt1);
|
||||
// MOVE TO TASK HANDLER
|
||||
//player.MessageManager!.AddMessageSection(info.ParamInt1);
|
||||
}
|
||||
|
||||
public override void HandleFinishType(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
|
||||
@@ -14,7 +14,8 @@ namespace EggLink.DanhengServer.Game.Mission.FinishType.Handler
|
||||
{
|
||||
public override void Init(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
{
|
||||
player.MessageManager!.AddMessageSection(info.ParamInt1);
|
||||
// MOVE TO TASK HANDLER
|
||||
//player.MessageManager!.AddMessageSection(info.ParamInt1);
|
||||
}
|
||||
|
||||
public override void HandleFinishType(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
|
||||
@@ -12,37 +12,38 @@ namespace EggLink.DanhengServer.Game.Mission.FinishType.Handler
|
||||
{
|
||||
public override void Init(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
{
|
||||
var prop = player.SceneInstance?.GetEntitiesInGroup<EntityProp>(info.ParamInt1);
|
||||
if (prop == null) return;
|
||||
|
||||
foreach (var p in prop)
|
||||
{
|
||||
if (p.PropInfo.ID == info.ParamInt2)
|
||||
{
|
||||
//if (player.SceneInstance?.Excel.WorldID != 101)
|
||||
//{
|
||||
// if (p.PropInfo.State == PropStateEnum.Locked && info.SourceState == PropStateEnum.Closed)
|
||||
// {
|
||||
// GameData.MazePropData.TryGetValue(p.PropInfo.PropID, out var propData);
|
||||
// if (propData != null && propData.PropStateList.Contains(PropStateEnum.Closed))
|
||||
// {
|
||||
// p.SetState(PropStateEnum.Closed);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
//} else
|
||||
//{
|
||||
// p.SetState(info.SourceState);
|
||||
//}
|
||||
GameData.MazePropData.TryGetValue(p.PropInfo.PropID, out var data);
|
||||
if (data?.PropStateList.Contains(info.SourceState) == true)
|
||||
{
|
||||
p.SetState(info.SourceState);
|
||||
}
|
||||
}
|
||||
}
|
||||
// MOVE TO TASK HANDLER
|
||||
//var prop = player.SceneInstance?.GetEntitiesInGroup<EntityProp>(info.ParamInt1);
|
||||
//if (prop == null) return;
|
||||
|
||||
//foreach (var p in prop)
|
||||
//{
|
||||
// if (p.PropInfo.ID == info.ParamInt2)
|
||||
// {
|
||||
// //if (player.SceneInstance?.Excel.WorldID != 101)
|
||||
// //{
|
||||
// // if (p.PropInfo.State == PropStateEnum.Locked && info.SourceState == PropStateEnum.Closed)
|
||||
// // {
|
||||
// // GameData.MazePropData.TryGetValue(p.PropInfo.PropID, out var propData);
|
||||
// // if (propData != null && propData.PropStateList.Contains(PropStateEnum.Closed))
|
||||
// // {
|
||||
// // p.SetState(PropStateEnum.Closed);
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
// // }
|
||||
// // }
|
||||
// //} else
|
||||
// //{
|
||||
// // p.SetState(info.SourceState);
|
||||
// //}
|
||||
// GameData.MazePropData.TryGetValue(p.PropInfo.PropID, out var data);
|
||||
// if (data?.PropStateList.Contains(info.SourceState) == true)
|
||||
// {
|
||||
// p.SetState(info.SourceState);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
public override void HandleFinishType(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
|
||||
@@ -29,22 +29,9 @@ namespace EggLink.DanhengServer.Game.Mission.FinishType.Handler
|
||||
player.MissionManager!.FinishSubMission(info.ID);
|
||||
} else // update progress
|
||||
{
|
||||
if (finishCount > 0)
|
||||
if (player.MissionManager!.GetMissionProgress(info.ID) != finishCount)
|
||||
{
|
||||
var sync = new Proto.MissionSync()
|
||||
{
|
||||
MissionList =
|
||||
{
|
||||
new Proto.Mission()
|
||||
{
|
||||
Id = (uint)info.ID,
|
||||
Status = Proto.MissionStatus.MissionDoing,
|
||||
Progress = (uint)finishCount
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
player.SendPacket(new PacketPlayerSyncScNotify(sync));
|
||||
player.MissionManager!.SetMissionProgress(info.ID, finishCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using EggLink.DanhengServer.Data.Config;
|
||||
using EggLink.DanhengServer.Database.Inventory;
|
||||
using EggLink.DanhengServer.Enums;
|
||||
using EggLink.DanhengServer.Game.Mission.FinishType;
|
||||
using EggLink.DanhengServer.Game.Player;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Mission.FinishType.Handler
|
||||
{
|
||||
[MissionFinishType(MissionFinishTypeEnum.UseItem)]
|
||||
public class MissionHandlerUseItem : MissionFinishTypeHandler
|
||||
{
|
||||
public override void Init(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
{
|
||||
}
|
||||
|
||||
public override void HandleFinishType(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
{
|
||||
if (arg is ItemData item)
|
||||
{
|
||||
if (info.ParamInt1 == item.ItemId)
|
||||
{
|
||||
player.MissionManager?.AddMissionProgress(info.ID, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (player.MissionManager?.GetMissionProgress(info.ID) >= info.Progress)
|
||||
{
|
||||
player.MissionManager?.FinishSubMission(info.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using EggLink.DanhengServer.Database;
|
||||
using EggLink.DanhengServer.Database.Inventory;
|
||||
using EggLink.DanhengServer.Database.Mission;
|
||||
using EggLink.DanhengServer.Enums;
|
||||
using EggLink.DanhengServer.Enums.Item;
|
||||
using EggLink.DanhengServer.Game.Mission.FinishAction;
|
||||
using EggLink.DanhengServer.Game.Mission.FinishType;
|
||||
using EggLink.DanhengServer.Game.Player;
|
||||
@@ -24,7 +25,7 @@ namespace EggLink.DanhengServer.Game.Mission
|
||||
public Dictionary<FinishActionTypeEnum, MissionFinishActionHandler> ActionHandlers = [];
|
||||
public Dictionary<MissionFinishTypeEnum, MissionFinishTypeHandler> FinishTypeHandlers = [];
|
||||
|
||||
public readonly List<int> SkipSubMissionList = [101030104, 101050116]; // bug
|
||||
public readonly List<int> SkipSubMissionList = []; // bug
|
||||
|
||||
public MissionManager(PlayerInstance player) : base(player)
|
||||
{
|
||||
@@ -144,6 +145,7 @@ namespace EggLink.DanhengServer.Game.Mission
|
||||
foreach (var subMission in mission.SubMissionIds)
|
||||
{
|
||||
Data.SetSubMissionStatus(subMission, MissionPhaseEnum.None);
|
||||
SetMissionProgress(subMission, 0);
|
||||
sync.MissionList.Add(new Proto.Mission()
|
||||
{
|
||||
Id = (uint)subMission,
|
||||
@@ -194,7 +196,7 @@ namespace EggLink.DanhengServer.Game.Mission
|
||||
|
||||
if (SkipSubMissionList.Contains(missionId))
|
||||
{
|
||||
FinishSubMission(missionId);
|
||||
//FinishSubMission(missionId);
|
||||
}
|
||||
|
||||
if (mission.SubMissionInfo?.LevelFloorID == Player.SceneInstance?.FloorId)
|
||||
@@ -208,9 +210,8 @@ namespace EggLink.DanhengServer.Game.Mission
|
||||
}
|
||||
}
|
||||
|
||||
// performance
|
||||
|
||||
Player.PerformanceTrigger!.TriggerPerformance(missionId);
|
||||
// TODO: Mission Task
|
||||
Player.TaskManager?.MissionTaskTrigger?.TriggerMissionTask(missionId);
|
||||
|
||||
return sync;
|
||||
}
|
||||
@@ -240,12 +241,6 @@ namespace EggLink.DanhengServer.Game.Mission
|
||||
}
|
||||
}
|
||||
|
||||
if (missionId == 1021301)
|
||||
{
|
||||
Player.LineupManager!.SetExtraLineup(Proto.ExtraLineupType.LineupHeliobus, [1021213]);
|
||||
Player.SendPacket(new PacketSyncLineupNotify(Player.LineupManager!.GetCurLineup()!));
|
||||
}
|
||||
|
||||
var mainSync = AcceptMainMissionByCondition(false);
|
||||
sync.MissionList.AddRange(mainSync.MissionList);
|
||||
|
||||
@@ -270,6 +265,8 @@ namespace EggLink.DanhengServer.Game.Mission
|
||||
if (mainMission == null) return;
|
||||
Data.SetSubMissionStatus(missionId, MissionPhaseEnum.Finish); // set finish
|
||||
|
||||
SetMissionProgress(missionId, subMission.SubMissionInfo?.Progress ?? 1);
|
||||
|
||||
var sync = new Proto.MissionSync();
|
||||
sync.MissionList.Add(new Proto.Mission()
|
||||
{
|
||||
@@ -347,11 +344,6 @@ namespace EggLink.DanhengServer.Game.Mission
|
||||
Player.LineupManager!.SetExtraLineup(Proto.ExtraLineupType.LineupHeliobus, list);
|
||||
}
|
||||
|
||||
if (missionId == 100040117 || missionId == 100040118)
|
||||
{
|
||||
FinishSubMission(100040119);
|
||||
}
|
||||
|
||||
// handle reward
|
||||
HandleSubMissionReward(missionId);
|
||||
//Player.StoryLineManager!.CheckIfEnterStoryLine();
|
||||
@@ -385,7 +377,8 @@ namespace EggLink.DanhengServer.Game.Mission
|
||||
var ItemList = new Proto.ItemList();
|
||||
reward?.GetItems().ForEach(i =>
|
||||
{
|
||||
var res = Player.InventoryManager!.AddItem(i.Item1, i.Item2, false);
|
||||
GameData.ItemConfigData.TryGetValue(i.Item1, out var item);
|
||||
var res = Player.InventoryManager!.AddItem(i.Item1, i.Item2, item?.ItemMainType == ItemMainTypeEnum.AvatarCard);
|
||||
if (res != null)
|
||||
{
|
||||
ItemList.ItemList_.Add(res.ToProto());
|
||||
@@ -397,7 +390,8 @@ namespace EggLink.DanhengServer.Game.Mission
|
||||
GameData.RewardDataData.TryGetValue(i, out var reward);
|
||||
reward?.GetItems().ForEach(j =>
|
||||
{
|
||||
var res = Player.InventoryManager!.AddItem(j.Item1, j.Item2, false);
|
||||
GameData.ItemConfigData.TryGetValue(j.Item1, out var item);
|
||||
var res = Player.InventoryManager!.AddItem(j.Item1, j.Item2, item?.ItemMainType == ItemMainTypeEnum.AvatarCard);
|
||||
if (res != null)
|
||||
{
|
||||
ItemList.ItemList_.Add(res.ToProto());
|
||||
@@ -492,6 +486,53 @@ namespace EggLink.DanhengServer.Game.Mission
|
||||
}
|
||||
}
|
||||
|
||||
public void AddMissionProgress(int missionId, int progress)
|
||||
{
|
||||
if (!ConfigManager.Config.ServerOption.EnableMission) return;
|
||||
|
||||
Data.SubMissionProgressDict.TryGetValue(missionId, out var currentProgress);
|
||||
Data.SubMissionProgressDict[missionId] = currentProgress + progress;
|
||||
GameData.SubMissionData.TryGetValue(missionId, out var subMission);
|
||||
if (subMission == null) return;
|
||||
|
||||
if ((currentProgress + progress) >= (subMission.SubMissionInfo?.Progress ?? 1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var sync = new Proto.MissionSync();
|
||||
sync.MissionList.Add(new Proto.Mission()
|
||||
{
|
||||
Id = (uint)missionId,
|
||||
Progress = (uint)(currentProgress + progress),
|
||||
});
|
||||
|
||||
Player.SendPacket(new PacketPlayerSyncScNotify(sync));
|
||||
}
|
||||
|
||||
public void SetMissionProgress(int missionId, int progress)
|
||||
{
|
||||
if (!ConfigManager.Config.ServerOption.EnableMission) return;
|
||||
|
||||
Data.SubMissionProgressDict[missionId] = progress;
|
||||
GameData.SubMissionData.TryGetValue(missionId, out var subMission);
|
||||
if (subMission == null) return;
|
||||
|
||||
if (progress >= (subMission.SubMissionInfo?.Progress ?? 1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var sync = new Proto.MissionSync();
|
||||
sync.MissionList.Add(new Proto.Mission()
|
||||
{
|
||||
Id = (uint)missionId,
|
||||
Progress = (uint)progress,
|
||||
});
|
||||
|
||||
Player.SendPacket(new PacketPlayerSyncScNotify(sync));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mission Status
|
||||
@@ -545,6 +586,15 @@ namespace EggLink.DanhengServer.Game.Mission
|
||||
return list;
|
||||
}
|
||||
|
||||
public int GetMissionProgress(int missionId)
|
||||
{
|
||||
GameData.SubMissionData.TryGetValue(missionId, out var subMission);
|
||||
if (!ConfigManager.Config.ServerOption.EnableMission) return subMission?.SubMissionInfo?.Progress ?? 0;
|
||||
|
||||
Data.SubMissionProgressDict.TryGetValue(missionId, out var progress);
|
||||
return progress;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handlers
|
||||
@@ -606,6 +656,7 @@ namespace EggLink.DanhengServer.Game.Mission
|
||||
{
|
||||
Id = (uint)subMission.ID,
|
||||
Status = GetSubMissionStatus(subMission.ID).ToProto(),
|
||||
Progress = (uint)GetMissionProgress(subMission.ID),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -621,10 +672,6 @@ namespace EggLink.DanhengServer.Game.Mission
|
||||
{
|
||||
info.SceneMissionInfo.AcceptMainMissionIdList.Add((uint)mainMission.MainMissionID);
|
||||
}
|
||||
info.SceneMissionInfo.COLDABMKNDH.Add(new Proto.GBGPCCLIIEA()
|
||||
{
|
||||
MainMissionId = (uint)mainMission.MainMissionID,
|
||||
});
|
||||
break; // only one
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ using EggLink.DanhengServer.Game.Task;
|
||||
using EggLink.DanhengServer.GameServer.Game.Mail;
|
||||
using EggLink.DanhengServer.GameServer.Game.Raid;
|
||||
using EggLink.DanhengServer.GameServer.Game.Mission;
|
||||
using EggLink.DanhengServer.GameServer.Game.Task;
|
||||
|
||||
namespace EggLink.DanhengServer.Game.Player
|
||||
{
|
||||
@@ -63,7 +64,7 @@ namespace EggLink.DanhengServer.Game.Player
|
||||
public ShopService? ShopService { get; private set; }
|
||||
public ChallengeManager? ChallengeManager { get; private set; }
|
||||
|
||||
public PerformanceTrigger? PerformanceTrigger { get; private set; }
|
||||
public TaskManager? TaskManager { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -131,7 +132,7 @@ namespace EggLink.DanhengServer.Game.Player
|
||||
ShopService = new(this);
|
||||
ChessRogueManager = new(this);
|
||||
ChallengeManager = new(this);
|
||||
PerformanceTrigger = new(this);
|
||||
TaskManager = new(this);
|
||||
RaidManager = new(this);
|
||||
StoryLineManager = new(this);
|
||||
|
||||
|
||||
@@ -195,28 +195,9 @@ namespace EggLink.DanhengServer.GameServer.Game.Raid
|
||||
GameData.RaidConfigData.TryGetValue(RaidData.CurRaidId * 100 + record.WorldLevel, out var config);
|
||||
if (config == null) return;
|
||||
|
||||
if (Player.LineupManager!.GetCurLineup()!.IsExtraLineup())
|
||||
{
|
||||
Player.LineupManager!.SetExtraLineup(ExtraLineupType.LineupNone, []);
|
||||
Player.SendPacket(new PacketSyncLineupNotify(Player.LineupManager!.GetCurLineup()!));
|
||||
}
|
||||
|
||||
if (config.FinishEntranceID > 0)
|
||||
{
|
||||
Player.EnterScene(config.FinishEntranceID, 0, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Player.EnterScene(record.OldEntryId, 0, true);
|
||||
Player.MoveTo(record.OldPos, record.OldRot);
|
||||
}
|
||||
record.Status = RaidStatus.Finish;
|
||||
|
||||
Player.SendPacket(new PacketRaidInfoNotify(record));
|
||||
|
||||
// reset raid info
|
||||
RaidData.CurRaidId = 0;
|
||||
RaidData.CurRaidWorldLevel = 0;
|
||||
}
|
||||
|
||||
public void LeaveRaid(bool save)
|
||||
@@ -239,21 +220,36 @@ namespace EggLink.DanhengServer.GameServer.Game.Raid
|
||||
Player.SendPacket(new PacketSyncLineupNotify(Player.LineupManager!.GetCurLineup()!));
|
||||
}
|
||||
|
||||
Player.EnterScene(record.OldEntryId, 0, true);
|
||||
Player.MoveTo(record.OldPos, record.OldRot);
|
||||
if (record.Status == RaidStatus.Finish)
|
||||
{
|
||||
if (config.FinishEntranceID > 0)
|
||||
{
|
||||
Player.EnterScene(config.FinishEntranceID, 0, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Player.EnterScene(record.OldEntryId, 0, true);
|
||||
Player.MoveTo(record.OldPos, record.OldRot);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Player.EnterScene(record.OldEntryId, 0, true);
|
||||
Player.MoveTo(record.OldPos, record.OldRot);
|
||||
|
||||
// reset raid info
|
||||
record.Status = RaidStatus.Doing;
|
||||
// reset raid info
|
||||
record.Status = RaidStatus.Doing;
|
||||
|
||||
Player.SendPacket(new PacketRaidInfoNotify(record));
|
||||
Player.SendPacket(new PacketRaidInfoNotify(record));
|
||||
|
||||
if (!save)
|
||||
{
|
||||
ClearRaid(record.RaidId, record.WorldLevel);
|
||||
}
|
||||
}
|
||||
|
||||
RaidData.CurRaidId = 0;
|
||||
RaidData.CurRaidWorldLevel = 0;
|
||||
|
||||
if (!save)
|
||||
{
|
||||
ClearRaid(record.RaidId, record.WorldLevel);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearRaid(int raidId, int worldLevel)
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace EggLink.DanhengServer.Game.Scene.Entity
|
||||
|
||||
public void SetState(PropStateEnum state)
|
||||
{
|
||||
if (state == State) return;
|
||||
SetState(state, Scene.IsLoaded);
|
||||
}
|
||||
|
||||
|
||||
@@ -320,6 +320,12 @@ namespace EggLink.DanhengServer.Game.Scene
|
||||
prop.SetState(PropStateEnum.Open);
|
||||
Scene.AddEntity(prop, sendPacket);
|
||||
}
|
||||
|
||||
if (group.GroupName.Contains("Machine"))
|
||||
{
|
||||
prop.SetState(PropStateEnum.Open);
|
||||
Scene.AddEntity(prop, sendPacket);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@ using EggLink.DanhengServer.Server.Packet;
|
||||
using EggLink.DanhengServer.Server.Packet.Send.Lineup;
|
||||
using EggLink.DanhengServer.Server.Packet.Send.Scene;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using System.Numerics;
|
||||
|
||||
namespace EggLink.DanhengServer.Game.Scene
|
||||
{
|
||||
@@ -77,6 +78,8 @@ namespace EggLink.DanhengServer.Game.Scene
|
||||
}
|
||||
|
||||
EntityLoader.LoadEntity();
|
||||
|
||||
Player.TaskManager?.SceneTaskTrigger.TriggerFloor(PlaneId, FloorId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
424
GameServer/Game/Task/LevelTask.cs
Normal file
424
GameServer/Game/Task/LevelTask.cs
Normal file
@@ -0,0 +1,424 @@
|
||||
using EggLink.DanhengServer.Data.Config.Task;
|
||||
using EggLink.DanhengServer.Data.Config;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using EggLink.DanhengServer.Game.Player;
|
||||
using EggLink.DanhengServer.Game.Scene.Entity;
|
||||
using EggLink.DanhengServer.Enums;
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Enums.Task;
|
||||
using EggLink.DanhengServer.Enums.Scene;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Task
|
||||
{
|
||||
public class LevelTask(PlayerInstance player)
|
||||
{
|
||||
public PlayerInstance Player { get; } = player;
|
||||
|
||||
#region Manage
|
||||
|
||||
public void TriggerInitAct(LevelInitSequeceConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
foreach (var task in act.TaskList)
|
||||
{
|
||||
TriggerTask(task, subMission, group);
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerStartAct(LevelStartSequeceConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
foreach (var task in act.TaskList)
|
||||
{
|
||||
TriggerTask(task, subMission, group);
|
||||
}
|
||||
}
|
||||
|
||||
private void TriggerTask(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var methodName = act.Type.Replace("RPG.GameCore.", "");
|
||||
|
||||
var method = GetType().GetMethod(methodName);
|
||||
if (method != null)
|
||||
{
|
||||
_ = method.Invoke(this, [act, subMission, group]);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Task
|
||||
|
||||
public void PlayMessage(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (act is PlayMessage message)
|
||||
{
|
||||
Player.MessageManager!.AddMessageSection(message.MessageSectionID);
|
||||
}
|
||||
}
|
||||
|
||||
public void DestroyProp(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (act is DestroyProp destroyProp)
|
||||
{
|
||||
foreach (var entity in Player.SceneInstance!.Entities.Values)
|
||||
{
|
||||
if (entity is EntityProp prop && prop.GroupID == destroyProp.GroupID.GetValue() && prop.InstId == destroyProp.ID.GetValue())
|
||||
{
|
||||
Player.SceneInstance.RemoveEntity(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void EnterMap(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (act is EnterMap enterMap)
|
||||
{
|
||||
Player.EnterMissionScene(enterMap.EntranceID, enterMap.GroupID, enterMap.AnchorID, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void EnterMapByCondition(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (act is EnterMapByCondition enterMapByCondition)
|
||||
{
|
||||
Player.EnterMissionScene(enterMapByCondition.EntranceID.GetValue(), 0, 0, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerPerformance(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (act is TriggerPerformance triggerPerformance)
|
||||
{
|
||||
if (triggerPerformance.PerformanceType != ELevelPerformanceTypeEnum.E) return;
|
||||
Player.TaskManager?.PerformanceTrigger.TriggerPerformance(triggerPerformance.PerformanceID, subMission);
|
||||
}
|
||||
}
|
||||
|
||||
public void PredicateTaskList(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (act is PredicateTaskList predicateTaskList)
|
||||
{
|
||||
// handle predicateCondition
|
||||
var methodName = predicateTaskList.Predicate.Type.Replace("RPG.GameCore.", "");
|
||||
|
||||
var method = GetType().GetMethod(methodName);
|
||||
if (method != null)
|
||||
{
|
||||
var resp = method.Invoke(this, [predicateTaskList.Predicate, subMission, group]);
|
||||
if (resp is bool result && result)
|
||||
{
|
||||
foreach (var task in predicateTaskList.SuccessTaskList)
|
||||
{
|
||||
TriggerTask(task, subMission, group);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var task in predicateTaskList.FailedTaskList)
|
||||
{
|
||||
TriggerTask(task, subMission, group);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangePropState(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.PropState)
|
||||
{
|
||||
foreach (var entity in Player.SceneInstance!.Entities.Values)
|
||||
{
|
||||
if (entity is EntityProp prop && prop.GroupID == subMission.SubMissionInfo.ParamInt1 && prop.InstId == subMission.SubMissionInfo.ParamInt2)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (prop.Excel.PropStateList.Contains(PropStateEnum.Closed))
|
||||
{
|
||||
prop.SetState(PropStateEnum.Closed);
|
||||
}
|
||||
else
|
||||
{
|
||||
prop.SetState(prop.Excel.PropStateList[prop.Excel.PropStateList.IndexOf(prop.State) + 1]);
|
||||
|
||||
// Elevator
|
||||
foreach (var id in prop.PropInfo.UnlockControllerID)
|
||||
{
|
||||
foreach (var entity2 in Player.SceneInstance!.Entities.Values)
|
||||
{
|
||||
if (entity2 is EntityProp prop2 && prop2.GroupID == id.Key && id.Value.Contains(prop2.InstId))
|
||||
{
|
||||
prop2.SetState(PropStateEnum.Closed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateTrialPlayer(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.GetTrialAvatar)
|
||||
{
|
||||
Player.LineupManager!.AddAvatarToCurTeam(subMission.SubMissionInfo.ParamInt1);
|
||||
}
|
||||
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.GetTrialAvatarList)
|
||||
{
|
||||
subMission.SubMissionInfo.ParamIntList?.ForEach(x => Player.LineupManager!.AddAvatarToCurTeam(x));
|
||||
}
|
||||
}
|
||||
|
||||
public void ReplaceTrialPlayer(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.GetTrialAvatar)
|
||||
{
|
||||
Player.LineupManager!.GetCurLineup()?.BaseAvatars?.ForEach(x => Player.LineupManager!.RemoveAvatarFromCurTeam(x.BaseAvatarId, false));
|
||||
Player.LineupManager!.AddAvatarToCurTeam(subMission.SubMissionInfo.ParamInt1);
|
||||
}
|
||||
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.GetTrialAvatarList)
|
||||
{
|
||||
Player.LineupManager!.GetCurLineup()?.BaseAvatars?.ForEach(x => Player.LineupManager!.RemoveAvatarFromCurTeam(x.BaseAvatarId, false));
|
||||
subMission.SubMissionInfo.ParamIntList?.ForEach(x => Player.LineupManager!.AddAvatarToCurTeam(x));
|
||||
}
|
||||
}
|
||||
|
||||
public void ReplaceVirtualTeam(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (!(Player.LineupManager!.GetCurLineup()?.IsExtraLineup() == true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.GetTrialAvatar)
|
||||
{
|
||||
Player.LineupManager!.GetCurLineup()?.BaseAvatars?.ForEach(x => Player.LineupManager!.RemoveAvatarFromCurTeam(x.BaseAvatarId, false));
|
||||
Player.LineupManager!.AddAvatarToCurTeam(subMission.SubMissionInfo.ParamInt1);
|
||||
}
|
||||
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.GetTrialAvatarList)
|
||||
{
|
||||
Player.LineupManager!.GetCurLineup()?.BaseAvatars?.ForEach(x => Player.LineupManager!.RemoveAvatarFromCurTeam(x.BaseAvatarId, false));
|
||||
subMission.SubMissionInfo.ParamIntList?.ForEach(x => Player.LineupManager!.AddAvatarToCurTeam(x));
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateHeroTrialPlayer(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.GetTrialAvatar)
|
||||
{
|
||||
Player.LineupManager!.AddAvatarToCurTeam(subMission.SubMissionInfo.ParamInt1);
|
||||
}
|
||||
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.GetTrialAvatarList)
|
||||
{
|
||||
List<int> list = [.. subMission.SubMissionInfo.ParamIntList];
|
||||
|
||||
if (list.Count > 0)
|
||||
{
|
||||
if (Player.Data.CurrentGender == Gender.Man)
|
||||
{
|
||||
foreach (var avatar in subMission.SubMissionInfo?.ParamIntList ?? [])
|
||||
{
|
||||
if (avatar > 10000) // else is Base Avatar
|
||||
{
|
||||
if (avatar.ToString().EndsWith("8002") ||
|
||||
avatar.ToString().EndsWith("8004") ||
|
||||
avatar.ToString().EndsWith("8006"))
|
||||
{
|
||||
list.Remove(avatar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var avatar in subMission.SubMissionInfo?.ParamIntList ?? [])
|
||||
{
|
||||
if (avatar > 10000) // else is Base Avatar
|
||||
{
|
||||
if (avatar.ToString().EndsWith("8001") ||
|
||||
avatar.ToString().EndsWith("8003") ||
|
||||
avatar.ToString().EndsWith("8005"))
|
||||
{
|
||||
list.Remove(avatar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
list.ForEach(x => Player.LineupManager!.AddAvatarToCurTeam(x));
|
||||
}
|
||||
}
|
||||
|
||||
public void DestroyTrialPlayer(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.DelTrialAvatar)
|
||||
{
|
||||
Player.LineupManager!.RemoveAvatarFromCurTeam(subMission.SubMissionInfo.ParamInt1);
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeGroupState(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (group != null)
|
||||
{
|
||||
foreach (var entity in Player.SceneInstance?.Entities.Values.ToList() ?? [])
|
||||
{
|
||||
if (entity is EntityProp prop && prop.GroupID == group.Id)
|
||||
{
|
||||
if (prop.Excel.PropStateList.Contains(PropStateEnum.Open))
|
||||
{
|
||||
prop.SetState(PropStateEnum.Open);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerEntityServerEvent(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (group != null)
|
||||
{
|
||||
foreach (var entity in Player.SceneInstance?.Entities.Values.ToList() ?? [])
|
||||
{
|
||||
if (entity is EntityProp prop && prop.GroupID == group.Id)
|
||||
{
|
||||
if (prop.Excel.PropStateList.Contains(PropStateEnum.Open) && (prop.State == PropStateEnum.Closed || prop.State == PropStateEnum.Locked))
|
||||
{
|
||||
prop.SetState(PropStateEnum.Open);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerEntityEvent(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (act is TriggerEntityEvent triggerEntityEvent)
|
||||
{
|
||||
if (group != null)
|
||||
{
|
||||
foreach (var entity in Player.SceneInstance?.Entities.Values.ToList() ?? [])
|
||||
{
|
||||
if (entity is EntityProp prop && prop.GroupID == group.Id && prop.InstId == triggerEntityEvent.InstanceID.GetValue())
|
||||
{
|
||||
if (prop.Excel.PropStateList.Contains(PropStateEnum.Closed))
|
||||
{
|
||||
prop.SetState(PropStateEnum.Closed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PropSetupUITrigger(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (act is PropSetupUITrigger propSetupUITrigger)
|
||||
{
|
||||
foreach (var task in propSetupUITrigger.ButtonCallback)
|
||||
{
|
||||
TriggerTask(task, subMission, group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PropStateExecute(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (act is PropStateExecute propStateExecute)
|
||||
{
|
||||
// handle targetType
|
||||
var methodName = propStateExecute.TargetType.Type.Replace("RPG.GameCore.", "");
|
||||
|
||||
var method = GetType().GetMethod(methodName);
|
||||
if (method != null)
|
||||
{
|
||||
var resp = method.Invoke(this, [propStateExecute.TargetType, subMission, group]);
|
||||
if (resp is EntityProp result && result != null)
|
||||
{
|
||||
result.SetState(propStateExecute.PropState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Task Condition
|
||||
|
||||
public bool ByCompareSubMissionState(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (act is ByCompareSubMissionState compare)
|
||||
{
|
||||
var mission = Player.MissionManager!.GetSubMissionStatus(compare.SubMissionID);
|
||||
return mission.ToStateEnum() == compare.SubMissionState;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ByCompareFloorSavedValue(TaskConfigInfo act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (act is ByCompareFloorSavedValue compare)
|
||||
{
|
||||
var value = Player.SceneData!.FloorSavedData.GetValueOrDefault(Player.Data.FloorId, []);
|
||||
return compare.CompareType switch
|
||||
{
|
||||
CompareTypeEnum.Equal => value.GetValueOrDefault(compare.Name, 0) == compare.CompareValue,
|
||||
CompareTypeEnum.Greater => value.GetValueOrDefault(compare.Name, 0) > compare.CompareValue,
|
||||
CompareTypeEnum.Less => value.GetValueOrDefault(compare.Name, 0) < compare.CompareValue,
|
||||
CompareTypeEnum.GreaterEqual => value.GetValueOrDefault(compare.Name, 0) >= compare.CompareValue,
|
||||
CompareTypeEnum.LessEqual => value.GetValueOrDefault(compare.Name, 0) <= compare.CompareValue,
|
||||
CompareTypeEnum.NotEqual => value.GetValueOrDefault(compare.Name, 0) != compare.CompareValue,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Prop Target
|
||||
|
||||
public EntityProp? TargetFetchAdvPropEx(TargetEvaluator act, SubMissionExcel subMission, GroupInfo? group = null)
|
||||
{
|
||||
if (act is TargetFetchAdvPropEx fetch)
|
||||
{
|
||||
if (fetch.FetchType != TargetFetchAdvPropFetchTypeEnum.SinglePropByPropID) return null;
|
||||
foreach (var entity in Player.SceneInstance!.Entities.Values)
|
||||
{
|
||||
if (entity is EntityProp prop && prop.GroupID == fetch.SinglePropID.GroupID.GetValue() && prop.InstId == fetch.SinglePropID.ID.GetValue())
|
||||
{
|
||||
return prop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
39
GameServer/Game/Task/MissionTaskTrigger.cs
Normal file
39
GameServer/Game/Task/MissionTaskTrigger.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using EggLink.DanhengServer.Data;
|
||||
using EggLink.DanhengServer.Data.Config;
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Game.Player;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Task
|
||||
{
|
||||
public class MissionTaskTrigger(PlayerInstance player)
|
||||
{
|
||||
public PlayerInstance Player { get; } = player;
|
||||
|
||||
public void TriggerMissionTask(int missionId)
|
||||
{
|
||||
GameData.SubMissionData.TryGetValue(missionId, out var subMission);
|
||||
if (subMission != null)
|
||||
{
|
||||
TriggerMissionTask(subMission.SubMissionTaskInfo ?? new(), subMission);
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerMissionTask(LevelGraphConfigInfo subMissionTaskInfo, SubMissionExcel subMission)
|
||||
{
|
||||
foreach (var task in subMissionTaskInfo.OnInitSequece)
|
||||
{
|
||||
Player.TaskManager?.LevelTask.TriggerInitAct(task, subMission);
|
||||
}
|
||||
|
||||
foreach (var task in subMissionTaskInfo.OnStartSequece)
|
||||
{
|
||||
Player.TaskManager?.LevelTask.TriggerStartAct(task, subMission);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using EggLink.DanhengServer.Data;
|
||||
using EggLink.DanhengServer.Data.Config;
|
||||
using EggLink.DanhengServer.Data.Config.Task;
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Game.Player;
|
||||
using System;
|
||||
@@ -10,67 +11,31 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.Game.Task
|
||||
{
|
||||
public class PerformanceTrigger(PlayerInstance player) : BasePlayerManager(player)
|
||||
public class PerformanceTrigger(PlayerInstance player)
|
||||
{
|
||||
public void TriggerPerformance(int performanceId)
|
||||
public PlayerInstance Player { get; } = player;
|
||||
|
||||
public void TriggerPerformance(int performanceId, SubMissionExcel subMission)
|
||||
{
|
||||
GameData.PerformanceEData.TryGetValue(performanceId, out var excel);
|
||||
if (excel != null)
|
||||
{
|
||||
TriggerPerformance(excel);
|
||||
TriggerPerformance(excel, subMission);
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerPerformance(PerformanceEExcel excel)
|
||||
public void TriggerPerformance(PerformanceEExcel excel, SubMissionExcel subMission)
|
||||
{
|
||||
if (excel.ActInfo == null) return;
|
||||
foreach (var act in excel.ActInfo.OnInitSequece)
|
||||
{
|
||||
TriggerAct(act);
|
||||
Player.TaskManager?.LevelTask.TriggerInitAct(act, subMission);
|
||||
}
|
||||
|
||||
foreach (var act in excel.ActInfo.OnStartSequece)
|
||||
{
|
||||
TriggerAct(act);
|
||||
Player.TaskManager?.LevelTask.TriggerStartAct(act, subMission);
|
||||
}
|
||||
}
|
||||
|
||||
private void TriggerAct(MissionActTaskInfo act)
|
||||
{
|
||||
foreach (var task in act.TaskList)
|
||||
{
|
||||
TriggerTask(task);
|
||||
}
|
||||
|
||||
foreach (var task in act.TaskList)
|
||||
{
|
||||
TriggerTask(task);
|
||||
}
|
||||
}
|
||||
|
||||
private void TriggerTask(MissionActTaskInfo act)
|
||||
{
|
||||
try
|
||||
{
|
||||
var methodName = act.Type.Replace("RPG.GameCore.", "");
|
||||
|
||||
var method = GetType().GetMethod(methodName);
|
||||
if (method != null)
|
||||
{
|
||||
_ = method.Invoke(this, [act]);
|
||||
}
|
||||
} catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#region Task
|
||||
|
||||
public void PlayMessage(MissionActTaskInfo act)
|
||||
{
|
||||
Player.MessageManager!.AddMessageSection(act.MessageSectionID);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
54
GameServer/Game/Task/SceneTaskTrigger.cs
Normal file
54
GameServer/Game/Task/SceneTaskTrigger.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using EggLink.DanhengServer.Data;
|
||||
using EggLink.DanhengServer.Game.Player;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Task
|
||||
{
|
||||
public class SceneTaskTrigger(PlayerInstance player)
|
||||
{
|
||||
public PlayerInstance Player { get; } = player;
|
||||
|
||||
public void TriggerFloor(int planeId, int floorId)
|
||||
{
|
||||
GameData.GetFloorInfo(planeId, floorId, out var floor);
|
||||
if (floor == null) return;
|
||||
|
||||
foreach (var group in floor.Groups.Values)
|
||||
{
|
||||
if (group.LevelGraphConfig == null) continue;
|
||||
foreach (var task in group.LevelGraphConfig.OnInitSequece)
|
||||
{
|
||||
Player.TaskManager?.LevelTask.TriggerInitAct(task, new(), group);
|
||||
}
|
||||
|
||||
foreach (var task in group.LevelGraphConfig.OnStartSequece)
|
||||
{
|
||||
Player.TaskManager?.LevelTask.TriggerStartAct(task, new(), group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerGroup(int planeId, int floorId, int groupId)
|
||||
{
|
||||
GameData.GetFloorInfo(planeId, floorId, out var floor);
|
||||
if (floor == null) return;
|
||||
if (floor.Groups.TryGetValue(groupId, out var group))
|
||||
{
|
||||
if (group.LevelGraphConfig == null) return;
|
||||
foreach (var task in group.LevelGraphConfig.OnInitSequece)
|
||||
{
|
||||
Player.TaskManager?.LevelTask.TriggerInitAct(task, new(), group);
|
||||
}
|
||||
|
||||
foreach (var task in group.LevelGraphConfig.OnStartSequece)
|
||||
{
|
||||
Player.TaskManager?.LevelTask.TriggerStartAct(task, new(), group);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
GameServer/Game/Task/TaskManager.cs
Normal file
19
GameServer/Game/Task/TaskManager.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using EggLink.DanhengServer.Game;
|
||||
using EggLink.DanhengServer.Game.Player;
|
||||
using EggLink.DanhengServer.Game.Task;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Task
|
||||
{
|
||||
public class TaskManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
public PerformanceTrigger PerformanceTrigger { get; } = new(player);
|
||||
public LevelTask LevelTask { get; } = new(player);
|
||||
public MissionTaskTrigger MissionTaskTrigger { get; } = new(player);
|
||||
public SceneTaskTrigger SceneTaskTrigger { get; } = new(player);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Server.Packet.Send.Challenge;
|
||||
using EggLink.DanhengServer.Server.Packet.Send.Gacha;
|
||||
using EggLink.DanhengServer.Server.Packet.Send.Shop;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -46,7 +47,7 @@ namespace EggLink.DanhengServer.Server.Packet.Recv.Shop
|
||||
}
|
||||
});
|
||||
});
|
||||
var RewardId = RewardIds.Keys.ToList()[new Random().Next(0, RewardIds.Count)];
|
||||
var RewardId = RewardIds.Keys.ToList().RandomElement();
|
||||
var type = RewardIds[RewardId];
|
||||
if (type < maxtype) maxtype = type;
|
||||
var rewardExcel = GameData.RewardDataData[(int)RewardId];
|
||||
@@ -56,8 +57,11 @@ namespace EggLink.DanhengServer.Server.Packet.Recv.Shop
|
||||
ItemId = rewardItems[0].Item1,
|
||||
Count = rewardItems[0].Item2
|
||||
};
|
||||
|
||||
itemList.ItemList_.Add(itemData.ToProto());
|
||||
var rsp = connection.Player!.InventoryManager!.AddItem(itemData.ItemId, itemData.Count);
|
||||
if (rsp != null)
|
||||
{
|
||||
itemList.ItemList_.Add(rsp.ToProto());
|
||||
}
|
||||
connection.Player!.InventoryManager!.RemoveItem(122000, 1);
|
||||
}
|
||||
connection.SendPacket(new PacketDoGachaInRollShopScRsp(req.RollShopId, itemList, maxtype));
|
||||
|
||||
@@ -33,7 +33,8 @@ namespace EggLink.DanhengServer.Server.Packet.Send.Mission
|
||||
proto.MissionList.Add(new Proto.Mission()
|
||||
{
|
||||
Id = (uint)mission,
|
||||
Status = MissionStatus.MissionDoing
|
||||
Status = MissionStatus.MissionDoing,
|
||||
Progress = (uint)player.MissionManager!.GetMissionProgress(mission)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,11 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Mission
|
||||
RunningStoryLineIdList = { storyLineIdList },
|
||||
};
|
||||
|
||||
if (!proto.RunningStoryLineIdList.Contains(proto.CurStoryLineId))
|
||||
{
|
||||
proto.RunningStoryLineIdList.Add(proto.CurStoryLineId);
|
||||
}
|
||||
|
||||
GameData.StroyLineTrialAvatarDataData.TryGetValue(player.StoryLineManager!.StoryLineData.CurStoryLineId, out var storyExcel);
|
||||
if (storyExcel != null)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Server.Packet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Scene
|
||||
{
|
||||
public class PacketUpdateFloorSavedValueNotify : BasePacket
|
||||
{
|
||||
public PacketUpdateFloorSavedValueNotify(string name, int savedValue) : base(CmdIds.UpdateFloorSavedValueNotify)
|
||||
{
|
||||
var proto = new UpdateFloorSavedValueNotify();
|
||||
proto.SavedValue.Add(name, savedValue);
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user