mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-02 20:26:03 +08:00
feat: extra mp
This commit is contained in:
@@ -262,8 +262,9 @@ public class CommandManager
|
||||
sender.SendMsg(I18NManager.Translate("Game.Command.Notice.CommandNotFound"));
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(I18NManager.Translate("Game.Command.Notice.InternalError"), e);
|
||||
sender.SendMsg(I18NManager.Translate("Game.Command.Notice.InternalError"));
|
||||
}
|
||||
}
|
||||
|
||||
12
Common/Data/Config/Task/AdvModifyMaxMazeMP.cs
Normal file
12
Common/Data/Config/Task/AdvModifyMaxMazeMP.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task;
|
||||
|
||||
public class AdvModifyMaxMazeMP : TaskConfigInfo
|
||||
{
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public PropertyModifyFunctionEnum ModifyFunction { get; set; }
|
||||
public DynamicFloat ModifyValue { get; set; }
|
||||
}
|
||||
@@ -5,6 +5,7 @@ public class AdventurePlayerExcel : ExcelResource
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int AvatarID { get; set; }
|
||||
public List<int> MazeSkillIdList { get; set; } = [];
|
||||
public string PlayerJsonPath { get; set; } = "";
|
||||
|
||||
public override int GetId()
|
||||
|
||||
19
Common/Data/Excel/MazeSkillExcel.cs
Normal file
19
Common/Data/Excel/MazeSkillExcel.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("MazeSkill.json,MazeSkillLD.json",isMultifile:true)]
|
||||
public class MazeSkillExcel : ExcelResource
|
||||
{
|
||||
public int MazeSkillId { get; set; }
|
||||
public int MPCost { get; set; }
|
||||
public int MazeSkilltype { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return MazeSkillId;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.MazeSkillData.TryAdd(MazeSkillId, this);
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,7 @@ public static class GameData
|
||||
public static Dictionary<int, AvatarPromotionConfigExcel> AvatarPromotionConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, AvatarExpItemConfigExcel> AvatarExpItemConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, AvatarSkillTreeConfigExcel> AvatarSkillTreeConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, MazeSkillExcel> MazeSkillData { get; private set; } = [];
|
||||
public static Dictionary<int, AvatarSkinExcel> AvatarSkinData { get; private set; } = [];
|
||||
public static Dictionary<int, AvatarDemoConfigExcel> AvatarDemoConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, ExpTypeExcel> ExpTypeData { get; } = [];
|
||||
@@ -65,7 +66,7 @@ public static class GameData
|
||||
public static Dictionary<int, AdventurePlayerExcel> AdventurePlayerData { get; private set; } = [];
|
||||
public static Dictionary<int, SummonUnitDataExcel> SummonUnitDataData { get; private set; } = [];
|
||||
public static Dictionary<int, DecideAvatarOrderExcel> DecideAvatarOrderData { get; private set; } = [];
|
||||
public static Dictionary<int, CharacterConfigInfo> CharacterConfigInfoData { get; private set; } = [];
|
||||
public static ConcurrentDictionary<int, CharacterConfigInfo> CharacterConfigInfoData { get; private set; } = [];
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -812,7 +812,7 @@ public class ResourceManager
|
||||
var info = JsonConvert.DeserializeObject<CharacterConfigInfo>(text);
|
||||
if (info == null) return;
|
||||
|
||||
GameData.CharacterConfigInfoData.Add(excel.ID, info);
|
||||
GameData.CharacterConfigInfoData.TryAdd(excel.ID, info);
|
||||
count++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -12,7 +12,7 @@ public class LineupData : BaseDatabaseDataHelper
|
||||
{
|
||||
public int CurLineup { get; set; } // index of current lineup
|
||||
public int CurExtraLineup { get; set; } = -1; // index of current extra lineup
|
||||
|
||||
[SugarColumn(IsIgnore = true)] public int ExtraMpCount { get; set; }
|
||||
[SugarColumn(IsJson = true)] public Dictionary<int, LineupInfo> Lineups { get; set; } = []; // 9 * 4
|
||||
|
||||
public int GetCurLineupIndex()
|
||||
@@ -132,10 +132,11 @@ public class LineupInfo
|
||||
|
||||
public Proto.LineupInfo ToProto()
|
||||
{
|
||||
Mp = Math.Max(5 + (LineupData?.ExtraMpCount ?? 0), Mp);
|
||||
Proto.LineupInfo info = new()
|
||||
{
|
||||
Name = Name,
|
||||
MaxMp = 5,
|
||||
MaxMp = (uint)(5 + (LineupData?.ExtraMpCount ?? 0)),
|
||||
Mp = (uint)Mp,
|
||||
ExtraLineupType = (ExtraLineupType)(LineupType == (int)ExtraLineupType.LineupHeliobus
|
||||
? (int)ExtraLineupType.LineupNone
|
||||
|
||||
11
Common/Enums/Avatar/PropertyModifyFunctionEnum.cs
Normal file
11
Common/Enums/Avatar/PropertyModifyFunctionEnum.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace EggLink.DanhengServer.Enums.Avatar;
|
||||
|
||||
public enum PropertyModifyFunctionEnum
|
||||
{
|
||||
Unknow = 0,
|
||||
Set,
|
||||
Add,
|
||||
Mul,
|
||||
MinSet,
|
||||
MaxSet
|
||||
}
|
||||
@@ -458,6 +458,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
// calculate drops
|
||||
List<ItemData> items = [];
|
||||
List<ItemData> resItems = [];
|
||||
GameData.MappingInfoData.TryGetValue(mappingId * 10 + worldLevel, out var mapping);
|
||||
if (mapping != null)
|
||||
{
|
||||
@@ -494,10 +495,12 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
var i = (await Player.InventoryManager!.AddItem(item.ItemId, item.Count, false))!;
|
||||
i.Count = item.Count; // return the all thing
|
||||
|
||||
resItems.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
return resItems;
|
||||
}
|
||||
|
||||
public async ValueTask<(int, ItemData?)> HandleRelic(
|
||||
|
||||
@@ -48,12 +48,17 @@ public class LineupManager : BasePlayerManager
|
||||
return lineup;
|
||||
}
|
||||
|
||||
public List<AvatarSceneInfo> GetAvatarsFromTeam(int index)
|
||||
public int GetMaxMp()
|
||||
{
|
||||
return 5 + LineupData.ExtraMpCount;
|
||||
}
|
||||
|
||||
public List<AvatarLineupData> GetAvatarsFromTeam(int index)
|
||||
{
|
||||
var lineup = GetLineup(index);
|
||||
if (lineup == null) return [];
|
||||
|
||||
var avatarList = new List<AvatarSceneInfo>();
|
||||
var avatarList = new List<AvatarLineupData>();
|
||||
foreach (var avatar in lineup.BaseAvatars!)
|
||||
{
|
||||
var avatarType = AvatarType.AvatarFormalType;
|
||||
@@ -81,13 +86,13 @@ public class LineupManager : BasePlayerManager
|
||||
}
|
||||
|
||||
if (avatarInfo == null) continue;
|
||||
avatarList.Add(new AvatarSceneInfo(avatarInfo, avatarType, Player));
|
||||
avatarList.Add(new AvatarLineupData(avatarInfo, avatarType));
|
||||
}
|
||||
|
||||
return avatarList;
|
||||
}
|
||||
|
||||
public List<AvatarSceneInfo> GetAvatarsFromCurTeam()
|
||||
public List<AvatarLineupData> GetAvatarsFromCurTeam()
|
||||
{
|
||||
return GetAvatarsFromTeam(LineupData.GetCurLineupIndex());
|
||||
}
|
||||
@@ -359,7 +364,7 @@ public class LineupManager : BasePlayerManager
|
||||
{
|
||||
var curLineup = GetCurLineup()!;
|
||||
curLineup.Mp -= count;
|
||||
curLineup.Mp = Math.Min(Math.Max(0, curLineup.Mp), 5);
|
||||
curLineup.Mp = Math.Min(Math.Max(0, curLineup.Mp), GetMaxMp());
|
||||
|
||||
await Player.SendPacket(new PacketSceneCastSkillMpUpdateScNotify(castEntityId, curLineup.Mp));
|
||||
}
|
||||
@@ -369,11 +374,13 @@ public class LineupManager : BasePlayerManager
|
||||
{
|
||||
var curLineup = GetCurLineup()!;
|
||||
curLineup.Mp += count;
|
||||
curLineup.Mp = Math.Min(Math.Max(0, curLineup.Mp), 5);
|
||||
curLineup.Mp = Math.Min(Math.Max(0, curLineup.Mp), GetMaxMp());
|
||||
if (sendPacket)
|
||||
await Player.SendPacket(
|
||||
new PacketSyncLineupNotify(GetCurLineup()!, reason));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
public record AvatarLineupData(BaseAvatarInfo AvatarInfo, AvatarType AvatarType);
|
||||
@@ -823,9 +823,13 @@ public class PlayerInstance(PlayerData data)
|
||||
var notSendMove = true;
|
||||
if (planeId != Data.PlaneId || floorId != Data.FloorId || entryId != Data.EntryId || SceneInstance == null)
|
||||
{
|
||||
if (SceneInstance != null)
|
||||
await SceneInstance.OnDestroy();
|
||||
SceneInstance instance = new(this, plane, floorId, entryId);
|
||||
InvokeOnPlayerLoadScene(this, instance);
|
||||
SceneInstance = instance;
|
||||
|
||||
await instance.SyncLineup(true);
|
||||
Data.PlaneId = planeId;
|
||||
Data.FloorId = floorId;
|
||||
Data.EntryId = entryId;
|
||||
|
||||
@@ -185,8 +185,6 @@ public class SceneInstance
|
||||
EntryId = entryId;
|
||||
LeaveEntryId = 0;
|
||||
|
||||
System.Threading.Tasks.Task.Run(async () => { await SyncLineup(true); }).Wait();
|
||||
|
||||
GameData.GetFloorInfo(PlaneId, FloorId, out FloorInfo);
|
||||
if (FloorInfo == null) return;
|
||||
|
||||
@@ -273,7 +271,15 @@ public class SceneInstance
|
||||
sendPacket = true;
|
||||
}
|
||||
|
||||
foreach (var avatar in removeAvatar) Entities.Remove(avatar.EntityId);
|
||||
foreach (var avatar in removeAvatar)
|
||||
{
|
||||
Entities.Remove(avatar.EntityId);
|
||||
|
||||
if (avatar is AvatarSceneInfo info)
|
||||
{
|
||||
await info.OnDestroyInstance();
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var avatar in addAvatar) Entities.Add(avatar.EntityId, avatar);
|
||||
|
||||
@@ -343,6 +349,14 @@ public class SceneInstance
|
||||
}
|
||||
}
|
||||
|
||||
public async ValueTask OnDestroy()
|
||||
{
|
||||
foreach (var value in AvatarInfo.Values)
|
||||
{
|
||||
await value.OnDestroyInstance();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Entity Management
|
||||
@@ -726,4 +740,20 @@ public class AvatarSceneInfo : IGameEntity, IGameModifier
|
||||
|
||||
BuffList.Clear();
|
||||
}
|
||||
|
||||
public async ValueTask OnDestroyInstance()
|
||||
{
|
||||
foreach (var modifier in Modifiers.ToArray())
|
||||
{
|
||||
await RemoveModifier(modifier);
|
||||
}
|
||||
|
||||
foreach (var monsterInfo in Player.SceneInstance!.Entities.OfType<EntityMonster>().ToArray())
|
||||
{
|
||||
foreach (var buff in monsterInfo.BuffList.Where(x => x.OwnerAvatarId == AvatarInfo.BaseAvatarId).ToArray())
|
||||
{
|
||||
await monsterInfo.RemoveBuff(buff.BuffId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ using EggLink.DanhengServer.GameServer.Game.Scene.Entity;
|
||||
using EggLink.DanhengServer.GameServer.Server.Packet.Send.Scene;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using System.Threading;
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Task.AvatarTask;
|
||||
|
||||
@@ -365,8 +367,39 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
return new AbilityLevelResult();
|
||||
}
|
||||
|
||||
public async ValueTask<AbilityLevelResult> AdvModifyMaxMazeMP(AbilityLevelParam param)
|
||||
{
|
||||
if (param.Act is AdvModifyMaxMazeMP advModifyMaxMazeMp)
|
||||
{
|
||||
switch (advModifyMaxMazeMp.ModifyFunction)
|
||||
{
|
||||
case PropertyModifyFunctionEnum.Add:
|
||||
Player.LineupManager!.LineupData.ExtraMpCount += advModifyMaxMazeMp.ModifyValue.GetValue();
|
||||
break;
|
||||
case PropertyModifyFunctionEnum.Set:
|
||||
Player.LineupManager!.LineupData.ExtraMpCount = advModifyMaxMazeMp.ModifyValue.GetValue() - 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new AbilityLevelResult();
|
||||
}
|
||||
|
||||
public async ValueTask AdventureSetAttackTargetMonsterDie(AbilityLevelParam param)
|
||||
{
|
||||
var avatar = param.CasterEntity as AvatarSceneInfo;
|
||||
if (GameData.AvatarConfigData.TryGetValue(avatar?.AvatarInfo.AvatarId ?? 0, out var excel))
|
||||
{
|
||||
var adventurePlayerExcel = GameData.AdventurePlayerData.GetValueOrDefault(excel.AdventurePlayerID);
|
||||
if (adventurePlayerExcel != null && adventurePlayerExcel.MazeSkillIdList.Count > param.Request.SkillIndex)
|
||||
{
|
||||
var skill = GameData.MazeSkillData.GetValueOrDefault(
|
||||
adventurePlayerExcel.MazeSkillIdList[(int)param.Request.SkillIndex]);
|
||||
|
||||
await Player.LineupManager!.CostMp(skill?.MPCost ?? 1, param.Request.CastEntityId);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var targetEntity in param.TargetEntities)
|
||||
{
|
||||
if (targetEntity is not EntityMonster monster) continue;
|
||||
@@ -375,7 +408,6 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
{
|
||||
await monster.Kill();
|
||||
|
||||
await monster.Scene.Player.LineupManager!.CostMp(1, param.Request.CastEntityId);
|
||||
var instance = monster.Scene.Player.RogueManager!.GetRogueInstance();
|
||||
switch (instance)
|
||||
{
|
||||
|
||||
@@ -14,8 +14,8 @@ public class HandlerMusicRhythmDataCsReq : Handler
|
||||
await connection.SendPacket(CmdIds.MusicRhythmMaxDifficultyLevelsUnlockNotify);
|
||||
|
||||
// Unknwon fields
|
||||
await connection.SendPacket(new PacketMusicRhythmUnlockSongNotify());
|
||||
await connection.SendPacket(new PacketMusicRhythmUnlockSongSfxScNotify());
|
||||
await connection.SendPacket(new PacketMusicRhythmUnlockTrackScNotify());
|
||||
//await connection.SendPacket(new PacketMusicRhythmUnlockSongNotify());
|
||||
//await connection.SendPacket(new PacketMusicRhythmUnlockSongSfxScNotify());
|
||||
//await connection.SendPacket(new PacketMusicRhythmUnlockTrackScNotify());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user