Update to 2.6.0 & Implement Rogue Magic

This commit is contained in:
StopWuyu
2024-10-05 22:40:41 +08:00
parent 50c2f6d13a
commit f432026d56
2369 changed files with 178947 additions and 133932 deletions

View File

@@ -60,6 +60,7 @@ public class BattleInstance(PlayerInstance player, LineupInfo lineup, List<Stage
public List<EntityMonster> EntityMonsters { get; set; } = [];
public List<AvatarSceneInfo> AvatarInfo { get; set; } = [];
public List<MazeBuff> Buffs { get; set; } = [];
public BattleRogueMagicInfo? MagicInfo { get; set; }
public Dictionary<int, BattleEventInstance> BattleEvents { get; set; } = [];
public Dictionary<int, BattleTargetList> BattleTargets { get; set; } = [];
public BattleCollegeConfigExcel? CollegeConfigExcel { get; set; }
@@ -216,6 +217,8 @@ public class BattleInstance(PlayerInstance player, LineupInfo lineup, List<Stage
LogicRandomSeed = (uint)Random.Shared.Next()
};
if (MagicInfo != null) proto.BattleRogueMagicInfo = MagicInfo;
foreach (var protoWave in Stages.Select(wave => wave.ToProto()))
{
if (CustomLevel > 0)

View File

@@ -169,7 +169,7 @@ public class ChallengeInstance
{
BuffId = (uint)BossBuffs[1]
},
LBOJBINABDG = true
CPNMHNAFDJM = true
};
foreach (var lineupAvatar in Player.LineupManager?.GetExtraLineup(ExtraLineupType.LineupChallenge)
@@ -259,7 +259,7 @@ public class ChallengeInstance
if (IsStory())
{
// Calculate score for current stage
var stageScore = (int)req.Stt.ChallengeScore - GetTotalScore();
var stageScore = (int)req.Stt.BATTLETARGETTYPECHALLENGESCORE - GetTotalScore();
// Set score
if (CurrentStage == 1)

View File

@@ -167,13 +167,13 @@ public class ChessRogueCellInstance
var info = new ChessRogueCell
{
CellStatus = CellStatus,
PosY = (uint)PosY,
//PosY = (uint)PosY,
Id = (uint)GetCellId(),
BlockType = (uint)BlockType,
//BlockType = (uint)BlockType,
IsUnlock = true,
RoomId = (uint)RoomId,
PLOEJLHMONC = true,
PosX = (uint)GetRow()
//PLOEJLHMONC = true,
//PosX = (uint)GetRow()
};
if (CellAdvanceInfo.Count <= 0) return info;
@@ -182,7 +182,7 @@ public class ChessRogueCellInstance
{
FinalBossInfo = new CellFinalMonsterInfo
{
BossInfo = new CellMonsterInfo
CellBossInfo = new CellMonsterInfo
{
CellMonsterList = { CellAdvanceInfo.Select(x => x.ToProto()).ToList() },
SelectBossId = (uint)SelectMonsterId
@@ -196,7 +196,7 @@ public class ChessRogueCellInstance
else
info.StageInfo = new CellAdvanceInfo
{
BossInfo = new CellMonsterInfo
CellBossInfo = new CellMonsterInfo
{
CellMonsterList = { CellAdvanceInfo.Select(x => x.ToProto()).ToList() },
SelectBossId = (uint)SelectMonsterId

View File

@@ -660,8 +660,8 @@ public class ChessRogueInstance : BaseRogueInstance
{
var info = new ChessRogueFinishInfo
{
EndAreaId = (uint)AreaExcel.AreaID,
LastLayerId = (uint)CurLayer,
//EndAreaId = (uint)AreaExcel.AreaID,
//LastLayerId = (uint)CurLayer,
RogueLineup = CurLineup!.ToProto(),
DifficultyLevel =
uint.Parse(AreaExcel.AreaID.ToString().Substring(AreaExcel.AreaID.ToString().Length - 1, 1)),

View File

@@ -211,7 +211,7 @@ public class ChessRogueManager(PlayerInstance player) : BasePlayerManager(player
AreaInfo = new ChessRogueAreaInfo
{
Cell = new CellInfo(),
EFCBJHLHGFG = new KKCPDACDMKM()
DOHIBBPIKDD = new IEKCBAHADKE()
}
};
@@ -265,8 +265,8 @@ public class ChessRogueManager(PlayerInstance player) : BasePlayerManager(player
foreach (var dice in GameData.RogueNousDiceBranchData) proto.DiceList.Add(GetDice(dice.Key).ToProto());
for (var i = 1; i < 7; i++) proto.BJDFPFAKCFH.Add((uint)i, i % 3 == 0);
proto.BJDFPFAKCFH[5] = true;
for (var i = 1; i < 7; i++) proto.Sus.Add((uint)i, i % 3 == 0);
proto.Sus[5] = true;
return proto;
}

View File

@@ -27,20 +27,20 @@ public class ChessRogueDiceInstance(ChessRogueInstance instance, ChessRogueNousD
var index = DiceData.Surfaces.ToList().FindIndex(x => x.Value == CurSurfaceId) + 1;
return new ChessRogueDiceInfo
{
GameBranchId = (uint)DiceData.BranchId,
//GameBranchId = (uint)DiceData.BranchId,
Dice = DiceData.ToProto(),
DiceStatus = DiceStatus,
CurSurfaceId = (uint)CurSurfaceId,
CheatTimes = (uint)CheatTimes,
RerollTimes = (uint)RerollTimes,
GameDiceBranchId = (uint)DiceData.BranchId,
//CurSurfaceId = (uint)CurSurfaceId,
//CheatTimes = (uint)CheatTimes,
//RerollTimes = (uint)RerollTimes,
//GameDiceBranchId = (uint)DiceData.BranchId,
DiceType = ChessRogueDiceType.ChessRogueDiceEditable,
KMHBLNCILEL = true,
CurSurfaceSlotId = (uint)(index > 0 ? index : 0),
//KMHBLNCILEL = true,
//CurSurfaceSlotId = (uint)(index > 0 ? index : 0),
//DisplayId = (uint)(CurSurfaceId > 0 ? GameData.RogueNousDiceSurfaceData[CurSurfaceId].Sort : 0),
CanRerollDice = RerollTimes > 0,
//CanRerollDice = RerollTimes > 0,
DiceModifier = new RogueModifier(),
DMHLBBFPELI = new BAKPIDLEIFI()
//DMHLBBFPELI = new BAKPIDLEIFI()
};
}
}

View File

@@ -23,6 +23,7 @@ using EggLink.DanhengServer.GameServer.Game.Mission;
using EggLink.DanhengServer.GameServer.Game.Quest;
using EggLink.DanhengServer.GameServer.Game.Raid;
using EggLink.DanhengServer.GameServer.Game.Rogue;
using EggLink.DanhengServer.GameServer.Game.RogueMagic;
using EggLink.DanhengServer.GameServer.Game.RogueTourn;
using EggLink.DanhengServer.GameServer.Game.Scene;
using EggLink.DanhengServer.GameServer.Game.Scene.Entity;
@@ -63,6 +64,7 @@ public class PlayerInstance(PlayerData data)
public RogueManager? RogueManager { get; private set; }
public ChessRogueManager? ChessRogueManager { get; private set; }
public RogueTournManager? RogueTournManager { get; private set; }
public RogueMagicManager? RogueMagicManager { get; internal set; }
public ShopService? ShopService { get; private set; }
public ChallengeManager? ChallengeManager { get; private set; }
@@ -142,6 +144,7 @@ public class PlayerInstance(PlayerData data)
ShopService = new ShopService(this);
ChessRogueManager = new ChessRogueManager(this);
RogueTournManager = new RogueTournManager(this);
RogueMagicManager = new RogueMagicManager(this);
ChallengeManager = new ChallengeManager(this);
TaskManager = new TaskManager(this);
RaidManager = new RaidManager(this);

View File

@@ -1,5 +1,7 @@
using EggLink.DanhengServer.GameServer.Game.Rogue.Buff;
using EggLink.DanhengServer.GameServer.Game.Rogue.Miracle;
using EggLink.DanhengServer.GameServer.Game.RogueMagic.MagicUnit;
using EggLink.DanhengServer.GameServer.Game.RogueMagic.Scepter;
using EggLink.DanhengServer.GameServer.Game.RogueTourn.Formula;
using EggLink.DanhengServer.Proto;
@@ -12,6 +14,8 @@ public class RogueActionInstance
public RogueMiracleSelectMenu? RogueMiracleSelectMenu { get; set; }
public RogueBonusSelectInfo? RogueBonusSelectInfo { get; set; }
public RogueFormulaSelectMenu? RogueFormulaSelectMenu { get; set; }
public RogueMagicUnitSelectMenu? RogueMagicUnitSelectMenu { get; set; }
public RogueScepterSelectMenu? RogueScepterSelectMenu { get; set; }
public bool IsReforge { get; set; }
@@ -37,6 +41,10 @@ public class RogueActionInstance
if (RogueFormulaSelectMenu != null) action.RogueFormulaSelectInfo = RogueFormulaSelectMenu.ToProto();
if (RogueMagicUnitSelectMenu != null) action.MagicUnitSelectInfo = RogueMagicUnitSelectMenu.ToProto();
if (RogueScepterSelectMenu != null) action.ScepterSelectInfo = RogueScepterSelectMenu.ToProto();
return new RogueCommonPendingAction
{
QueuePosition = (uint)QueuePosition,

View File

@@ -85,6 +85,9 @@ public class RogueManager(PlayerInstance player) : BasePlayerManager(player)
if (Player.ChessRogueManager?.RogueInstance != null)
return Player.ChessRogueManager.RogueInstance;
if (Player.RogueMagicManager?.RogueMagicInstance != null)
return Player.RogueMagicManager.RogueMagicInstance;
return Player.RogueTournManager?.RogueTournInstance;
}

View File

@@ -1,6 +1,7 @@
using EggLink.DanhengServer.Data.Config.Scene;
using EggLink.DanhengServer.Data.Excel;
using EggLink.DanhengServer.Enums.Rogue;
using EggLink.DanhengServer.Enums.RogueMagic;
using EggLink.DanhengServer.Enums.TournRogue;
using EggLink.DanhengServer.GameServer.Game.Scene;
using EggLink.DanhengServer.GameServer.Game.Scene.Entity;
using EggLink.DanhengServer.Proto;
@@ -26,6 +27,9 @@ public class RogueProp(SceneInstance scene, MazePropExcel excel, GroupInfo group
public bool EnterNextLayer { get; set; } = false;
public RogueTournRoomTypeEnum RoomType { get; set; } = RogueTournRoomTypeEnum.Unknown;
public bool IsMagicRogue { get; set; } = false;
public RogueMagicRoomTypeEnum MagicRoomType { get; set; } = RogueMagicRoomTypeEnum.Unknown;
public override SceneEntityInfo ToProto()
{
var proto = base.ToProto();
@@ -55,7 +59,17 @@ public class RogueProp(SceneInstance scene, MazePropExcel excel, GroupInfo group
RogueTournDoorInfo = new RogueTournDoorInfo
{
EnterNextLayer = EnterNextLayer,
RogueTournRoomType = (uint)RoomType
RogueDoorNextRoomType = (uint)RoomType
}
};
if (IsMagicRogue)
proto.Prop.ExtraInfo = new PropExtraInfo
{
RogueMagicDoorInfo = new RogueMagicDoorInfo
{
EnterNextLayer = EnterNextLayer,
RogueDoorNextRoomType = (uint)MagicRoomType
}
};

View File

@@ -0,0 +1,40 @@
using EggLink.DanhengServer.Data.Excel;
using EggLink.DanhengServer.Proto;
namespace EggLink.DanhengServer.GameServer.Game.RogueMagic.MagicUnit;
public class RogueMagicUnitInstance(RogueMagicUnitExcel excel)
{
public RogueMagicUnitExcel Excel { get; set; } = excel;
public int UniqueId { get; set; }
public RogueMagicGameUnitInfo ToProto()
{
return new RogueMagicGameUnitInfo
{
UniqueId = (uint)UniqueId,
GameMagicUnit = ToBasicInfo()
};
}
public RogueMagicGameUnit ToBasicInfo()
{
return new RogueMagicGameUnit
{
MagicUnitId = (uint)Excel.MagicUnitID,
Level = (uint)Excel.MagicUnitLevel
};
}
public RogueCommonActionResult ToGetInfo(RogueCommonActionResultSourceType source)
{
return new RogueCommonActionResult
{
Source = source,
RogueAction = new RogueCommonActionResultData
{
GetMagicUnitList = ToProto()
}
};
}
}

View File

@@ -0,0 +1,82 @@
using EggLink.DanhengServer.Data.Excel;
using EggLink.DanhengServer.GameServer.Game.Rogue;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Util;
namespace EggLink.DanhengServer.GameServer.Game.RogueMagic.MagicUnit;
public class RogueMagicUnitSelectMenu(BaseRogueInstance rogue)
{
public List<RogueMagicUnitExcel> MagicUnits { get; set; } = [];
public int RollMaxCount { get; set; } = rogue.BaseRerollCount;
public int RollCount { get; set; }
public int RollFreeCount { get; set; } = rogue.BaseRerollFreeCount;
public int RollCost { get; set; } = rogue.CurRerollCost;
public int QueueAppend { get; set; } = 3;
public List<RogueMagicUnitExcel> MagicUnitPool { get; set; } = [];
public void RollMagicUnit(List<RogueMagicUnitExcel> magicUnits, int count = 3)
{
MagicUnitPool.Clear();
MagicUnitPool.AddRange(magicUnits);
var list = new RandomList<RogueMagicUnitExcel>();
foreach (var unitExcel in magicUnits)
list.Add(unitExcel, (int)(6 - unitExcel.MagicUnitCategory));
var result = new List<RogueMagicUnitExcel>();
for (var i = 0; i < count; i++)
{
var unitExcel = list.GetRandom();
if (unitExcel != null)
{
result.Add(unitExcel);
list.Remove(unitExcel);
}
if (list.GetCount() == 0) break; // No more magic unit to roll
}
MagicUnits = result;
}
public async ValueTask RerollMagicUnit()
{
if (RollFreeCount > 0)
{
RollFreeCount--; // Free reroll
}
else
{
if (RollMaxCount - RollCount <= 0) return;
RollCount++; // Paid reroll
await rogue.CostMoney(RollCost);
}
RollMagicUnit(MagicUnitPool.Clone().ToList());
}
public RogueActionInstance GetActionInstance()
{
rogue.CurActionQueuePosition += QueueAppend;
return new RogueActionInstance
{
QueuePosition = rogue.CurActionQueuePosition,
RogueMagicUnitSelectMenu = this
};
}
public RogueMagicUnitSelectInfo ToProto()
{
return new RogueMagicUnitSelectInfo
{
SelectMagicUnits = { MagicUnits.Select(x => new RogueMagicGameUnit
{
MagicUnitId = (uint)x.MagicUnitID,
Level = (uint)x.MagicUnitLevel
}) }
};
}
}

View File

@@ -0,0 +1,425 @@
using EggLink.DanhengServer.Data;
using EggLink.DanhengServer.Data.Excel;
using EggLink.DanhengServer.Enums.Rogue;
using EggLink.DanhengServer.Enums.RogueMagic;
using EggLink.DanhengServer.GameServer.Game.Battle;
using EggLink.DanhengServer.GameServer.Game.Player;
using EggLink.DanhengServer.GameServer.Game.Rogue;
using EggLink.DanhengServer.GameServer.Game.Rogue.Event;
using EggLink.DanhengServer.GameServer.Game.RogueMagic.MagicUnit;
using EggLink.DanhengServer.GameServer.Game.RogueMagic.Scene;
using EggLink.DanhengServer.GameServer.Game.RogueMagic.Scepter;
using EggLink.DanhengServer.GameServer.Server.Packet.Send.RogueCommon;
using EggLink.DanhengServer.GameServer.Server.Packet.Send.RogueMagic;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Util;
namespace EggLink.DanhengServer.GameServer.Game.RogueMagic;
public class RogueMagicInstance : BaseRogueInstance
{
#region Initializer
public RogueMagicInstance(PlayerInstance player, int areaId, List<int> difficultyIds, int styleType) : base(player, RogueSubModeEnum.MagicRogue, 0)
{
// generate levels
AreaExcel = GameData.RogueMagicAreaData.GetValueOrDefault(areaId) ??
throw new Exception("Invalid area id"); // wont be null because of validation in RogueTournManager
foreach (var index in Enumerable.Range(1, AreaExcel.LayerIDList.Count))
{
var levelInstance = new RogueMagicLevelInstance(index, AreaExcel.LayerIDList[index - 1]);
Levels.Add(levelInstance.LayerId, levelInstance);
}
CurLayerId = AreaExcel.LayerIDList[0];
EventManager = new RogueEventManager(player, this);
BaseRerollCount = 0;
foreach (var id in difficultyIds)
{
GameData.RogueMagicDifficultyCompData.TryGetValue(id, out var excel);
if (excel != null)
DifficultyCompExcels.Add(excel);
}
StyleType = (RogueMagicStyleTypeEnum)styleType;
var t = RollScepter(1, 1);
t.AsTask().Wait();
}
#endregion
#region Properties
public RogueMagicAreaExcel AreaExcel { get; set; }
public List<RogueMagicDifficultyCompExcel> DifficultyCompExcels { get; set; } = [];
public Dictionary<int, RogueMagicLevelInstance> Levels { get; set; } = [];
public int CurLayerId { get; set; }
public RogueMagicLevelInstance? CurLevel => Levels.GetValueOrDefault(CurLayerId);
public RogueMagicLevelStatus LevelStatus { get; set; } = RogueMagicLevelStatus.Processing;
public RogueMagicStyleTypeEnum StyleType { get; set; }
public Dictionary<int, RogueScepterInstance> RogueScepters { get; set; } = [];
public Dictionary<int, RogueMagicUnitInstance> RogueMagicUnits { get; set; } = [];
public int CurMagicUnitUniqueId { get; set; } = 1;
public Dictionary<RogueMagicRoomTypeEnum, int> RoomTypeWeight { get; set; } = new()
{
{ RogueMagicRoomTypeEnum.Battle, 15 },
{ RogueMagicRoomTypeEnum.Wealth, 4 },
{ RogueMagicRoomTypeEnum.Shop, 4 },
{ RogueMagicRoomTypeEnum.Event, 7 },
{ RogueMagicRoomTypeEnum.Adventure, 6 },
{ RogueMagicRoomTypeEnum.Reward, 5 },
{ RogueMagicRoomTypeEnum.Elite, 1 }
};
#endregion
#region Scene
public async ValueTask EnterNextLayer(int roomIndex, RogueMagicRoomTypeEnum type)
{
var curIndex = CurLevel?.LevelIndex ?? 0;
if (curIndex == 3)
{
// last layer
return;
}
CurLayerId = AreaExcel.LayerIDList[curIndex - 1];
await EnterRoom(roomIndex, type);
}
public async ValueTask EnterRoom(int roomIndex, RogueMagicRoomTypeEnum type)
{
if (CurLevel == null) return;
//if (CurLevel.CurRoomIndex == roomIndex)
// // same room
// return;
//if (CurLevel.CurRoomIndex + 1 != roomIndex) // only allow to enter next room
// // invalid room
// return;
if (CurLevel.CurRoom != null)
CurLevel.CurRoom.Status = RogueMagicRoomStatus.Finish;
// enter room
CurLevel.CurRoomIndex = roomIndex;
CurLevel.CurRoom?.Init(type);
// next room
CurActionQueuePosition += 15;
var next = CurLevel.Rooms.Find(x => x.RoomIndex == roomIndex + 1);
if (next != null)
next.Status = RogueMagicRoomStatus.Inited;
// scene
var entrance = CurLevel.CurRoom?.Config?.EntranceId ?? 0;
var group = CurLevel.CurRoom?.Config?.AnchorGroup ?? 0;
var anchor = CurLevel.CurRoom?.Config?.AnchorId ?? 1;
// call event
EventManager?.OnNextRoom();
foreach (var miracle in RogueMiracles.Values) miracle.OnEnterNextRoom();
await Player.EnterMissionScene(entrance, group, anchor, false);
// sync
await Player.SendPacket(new PacketRogueMagicLevelInfoUpdateScNotify(this, [CurLevel]));
}
public async ValueTask QuitRogue()
{
await Player.EnterMissionScene(801120102, 0, 0, false);
Player.RogueMagicManager!.RogueMagicInstance = null;
}
#endregion
#region Scepter
public async ValueTask RollScepter(int amount, int level)
{
var scepterExcels = GameData.RogueMagicScepterData.Values.Where(x => !RogueScepters.ContainsKey(x.ScepterID) && x.ScepterLevel == level).ToList();
for (var i = 0; i < amount; i++)
{
var menu = new RogueScepterSelectMenu(this);
menu.RollScepter(scepterExcels);
var action = menu.GetActionInstance();
RogueActions.Add(action.QueuePosition, action);
}
await UpdateMenu();
}
public async ValueTask HandleScepterSelect(RogueMagicScepter selectScepter)
{
if (RogueActions.Count == 0) return;
var action = RogueActions.First().Value;
if (action.RogueScepterSelectMenu != null)
{
var scepterExcel = action.RogueScepterSelectMenu.Scepters.Find(x => x.ScepterID == selectScepter.ScepterId);
if (scepterExcel != null) await AddScepter(scepterExcel);
RogueActions.Remove(action.QueuePosition);
}
await UpdateMenu();
await Player.SendPacket(
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, selectScepter: true));
}
public async ValueTask AddScepter(RogueMagicScepterExcel excel, RogueCommonActionResultSourceType source = RogueCommonActionResultSourceType.Select)
{
var scepter = new RogueScepterInstance(excel);
RogueScepters.Add(excel.ScepterID, scepter);
await Player.SendPacket(new PacketSyncRogueCommonActionResultScNotify(RogueSubMode, scepter.ToGetInfo(source)));
}
public async ValueTask DressScepter(int scepterId, int slot, int unitUniqueId)
{
var scepter = RogueScepters.GetValueOrDefault(scepterId);
if (scepter == null) return;
var unit = RogueMagicUnits.GetValueOrDefault(unitUniqueId);
if (unit == null) return;
// add
scepter.AddUnit(slot, unit);
await Player.SendPacket(new PacketSyncRogueCommonActionResultScNotify(RogueSubMode, scepter.ToDressInfo(RogueCommonActionResultSourceType.None)));
}
#endregion
#region MagicUnit
public async ValueTask RollMagicUnit(int amount, int level, List<RogueMagicUnitCategoryEnum> categories)
{
var unitExcels = GameData.RogueMagicUnitData.Values.Where(x => !RogueMagicUnits.ContainsKey(x.MagicUnitID) && x.MagicUnitLevel == level && categories.Contains(x.MagicUnitCategory)).ToList();
for (var i = 0; i < amount; i++)
{
var menu = new RogueMagicUnitSelectMenu(this);
menu.RollMagicUnit(unitExcels);
var action = menu.GetActionInstance();
RogueActions.Add(action.QueuePosition, action);
}
await UpdateMenu();
}
public async ValueTask HandleMagicUnitSelect(RogueMagicGameUnit selectMagicUnit)
{
if (RogueActions.Count == 0) return;
var action = RogueActions.First().Value;
if (action.RogueMagicUnitSelectMenu != null)
{
var unitExcel = action.RogueMagicUnitSelectMenu.MagicUnits.Find(x => x.MagicUnitID == selectMagicUnit.MagicUnitId);
if (unitExcel != null) await AddMagicUnit(unitExcel);
RogueActions.Remove(action.QueuePosition);
}
await UpdateMenu();
await Player.SendPacket(
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, selectMagicUnit: true));
}
public async ValueTask AddMagicUnit(RogueMagicUnitExcel excel, RogueCommonActionResultSourceType source = RogueCommonActionResultSourceType.Select)
{
var unit = new RogueMagicUnitInstance(excel)
{
UniqueId = CurMagicUnitUniqueId++
};
RogueMagicUnits.Add(unit.UniqueId, unit);
await Player.SendPacket(new PacketSyncRogueCommonActionResultScNotify(RogueSubMode, unit.ToGetInfo(source)));
}
#endregion
#region Handlers
public override void OnBattleStart(BattleInstance battle)
{
base.OnBattleStart(battle);
battle.CustomLevel = AreaExcel.DifficultyIDList.RandomElement();
battle.MagicInfo = new BattleRogueMagicInfo
{
ModifierContent = new IGEFNGNCKOG
{
OJIBOBNAIKH = 5
},
DetailInfo = new BattleRogueMagicDetailInfo
{
ILAPCDFJHNH = new BattleRogueMagicItemInfo
{
BattleRoundCount = new BattleRogueMagicRoundCount(),
BattleScepterList = { RogueScepters.Select(x => x.Value.ToBattleScepterInfo()) }
}
}
};
}
public override async ValueTask OnBattleEnd(BattleInstance battle, PVEBattleResultCsReq req)
{
if (battle.BattleEndStatus != BattleEndStatus.BattleEndWin)
{
// quit
return;
}
if (CurLevel!.CurRoom!.RoomType == RogueMagicRoomTypeEnum.Boss)
{
await RollScepter(battle.Stages.Count, 1);
await RollMagicUnit(battle.Stages.Count, 1, [RogueMagicUnitCategoryEnum.Ultra]);
}
else
{
await RollMagicUnit(battle.Stages.Count, 1, [RogueMagicUnitCategoryEnum.Common]);
}
}
#endregion
#region Serialization
public RogueMagicCurInfo ToProto()
{
var proto = new RogueMagicCurInfo
{
Lineup = ToLineupInfo(),
Level = ToLevelInfo(),
ItemValue = ToGameItemValueInfo(),
MiracleInfo = ToMiracleInfo(),
GameDifficultyInfo = ToDifficultyInfo(),
MagicItem = ToMagicItemInfo(),
BasicInfo = ToCurAreaInfo(),
JDMGJDBMHEJ = new LKJMDOAHGIN()
};
return proto;
}
public RogueTournCurAreaInfo ToCurAreaInfo()
{
var proto = new RogueTournCurAreaInfo
{
RogueSubMode = (uint)RogueSubMode,
SubAreaId = (uint)AreaExcel.AreaID,
PendingAction = RogueActions.Count > 0
? RogueActions.First().Value.ToProto()
: new RogueCommonPendingAction() // to serialize empty action
};
return proto;
}
public RogueMagicGameItemInfo ToMagicItemInfo()
{
var proto = new RogueMagicGameItemInfo
{
GameStyleType = (uint)StyleType
};
return proto;
}
public RogueMagicGameDifficultyInfo ToDifficultyInfo()
{
var proto = new RogueMagicGameDifficultyInfo
{
DifficultyIdList = { DifficultyCompExcels.Select(x => (uint)x.DifficultyCompID) }
};
return proto;
}
public RogueGameItemValue ToGameItemValueInfo()
{
return new RogueGameItemValue
{
VirtualItem = { { 31, (uint)CurMoney } }
};
}
public RogueTournLineupInfo ToLineupInfo()
{
return new RogueTournLineupInfo
{
AvatarIdList = { Player.LineupManager!.GetCurLineup()!.BaseAvatars!.Select(x => (uint)x.BaseAvatarId) },
RogueReviveCost = new ItemCostData
{
ItemList =
{
new ItemCost
{
PileItem = new PileItem
{
ItemId = 31,
ItemNum = (uint)CurReviveCost
}
}
}
}
};
}
public ChessRogueMiracleInfo ToMiracleInfo()
{
var proto = new ChessRogueMiracleInfo
{
ChessRogueMiracleInfo_ = new ChessRogueMiracle()
};
proto.ChessRogueMiracleInfo_.MiracleList.AddRange(RogueMiracles.Select(x => x.Value.ToGameMiracleProto())
.ToList());
return proto;
}
public RogueMagicGameLevelInfo ToLevelInfo()
{
var proto = new RogueMagicGameLevelInfo
{
Status = LevelStatus,
CurLevelIndex = (uint)(CurLevel?.CurRoomIndex ?? 0),
Reason = RogueMagicSettleReason.None
};
foreach (var levelInstance in Levels.Values) proto.LevelInfoList.Add(levelInstance.ToProto());
return proto;
}
public RogueMagicCurSceneInfo ToCurSceneInfo()
{
return new RogueMagicCurSceneInfo
{
Lineup = Player.LineupManager!.GetCurLineup()!.ToProto(),
Scene = Player.SceneInstance!.ToProto(),
//RotateInfo = new RogueMapRotateInfo
//{
// IsRotate = CurLevel?.CurRoom?.Config?.RotateInfo.IsRotate ?? false,
// BJPBAJECKFO = (uint)(CurLevel?.CurRoom?.Config?.RotateInfo.RotateNum ?? 0) // HDEHHKEMOCD
//}
RotateInfo = new RogueMapRotateInfo()
};
}
#endregion
}

View File

@@ -0,0 +1,105 @@
using EggLink.DanhengServer.Data;
using EggLink.DanhengServer.Enums.RogueMagic;
using EggLink.DanhengServer.Enums.TournRogue;
using EggLink.DanhengServer.GameServer.Game.Player;
using EggLink.DanhengServer.GameServer.Server.Packet.Send.Lineup;
using EggLink.DanhengServer.Proto;
namespace EggLink.DanhengServer.GameServer.Game.RogueMagic;
public class RogueMagicManager(PlayerInstance player) : BasePlayerManager(player)
{
public RogueMagicInstance? RogueMagicInstance { get; set; }
public async ValueTask<(Retcode, RogueMagicInstance?)> StartRogueMagic(List<int> avatars, int area, int styleType,
List<int> difficulty)
{
RogueMagicInstance = null;
var areaExcel = GameData.RogueMagicAreaData.GetValueOrDefault(area);
if (areaExcel == null)
return (Retcode.RetRogueAreaInvalid, null);
var baseAvatarIds = new List<int>();
foreach (var avatar in avatars.Select(id => Player.AvatarManager!.GetAvatar(id)))
{
if (avatar == null)
return (Retcode.RetAvatarNotExist, null);
avatar.SetCurHp(10000, true);
avatar.SetCurSp(5000, true);
baseAvatarIds.Add(avatar.GetBaseAvatarId());
}
Player.LineupManager!.SetExtraLineup(ExtraLineupType.LineupMagicRogue, baseAvatarIds);
await Player.LineupManager!.GainMp(5, false);
await Player.SendPacket(new PacketSyncLineupNotify(Player.LineupManager!.GetCurLineup()!));
var instance = new RogueMagicInstance(Player, area, difficulty, styleType);
RogueMagicInstance = instance;
await instance.EnterRoom(1, RogueMagicRoomTypeEnum.Battle);
return (Retcode.RetSucc, instance);
}
#region Serialization
public RogueMagicGetInfo ToGetInfo()
{
var proto = new RogueMagicGetInfo
{
StoryInfo = ToStoryInfo(),
RogueMagicTalentInfo = ToTalentInfo(),
RogueMagicUnitInfoList = { },
RogueMagicScepterInfoList = { }
};
proto.RogueTournAreaInfo.AddRange(ToAreaInfoList());
proto.RogueTournDifficultyInfo.AddRange(ToDifficultyInfoList());
return proto;
}
public RogueMagicStoryInfo ToStoryInfo()
{
var proto = new RogueMagicStoryInfo
{
FinishedMagicStoryList = { GameData.RogueMagicStoryData.Keys.Select(x => (uint)x) }
};
return proto;
}
public RogueMagicTalentInfo ToTalentInfo()
{
var proto = new RogueMagicTalentInfo
{
TalentInfoList = new RogueTalentInfoList
{
TalentInfo = { GameData.RogueMagicTalentData.Keys.Select(x => new RogueTalentInfo
{
TalentId = (uint)x,
Status = RogueTalentStatus.Enable
}) }
}
};
return proto;
}
public List<RogueMagicAreaInfo> ToAreaInfoList()
{
return (from area in GameData.RogueMagicAreaData.Values
select new RogueMagicAreaInfo
{ AreaId = (uint)area.AreaID, IsTournFinish = true, IsUnlocked = true, IsTakenReward = true }).ToList();
}
public List<RogueMagicDifficultyInfo> ToDifficultyInfoList()
{
return (from difficulty in GameData.RogueMagicDifficultyCompData.Values
select new RogueMagicDifficultyInfo
{ DifficultyId = (uint)difficulty.DifficultyCompID, IsUnlocked = true }).ToList();
}
#endregion
}

View File

@@ -0,0 +1,245 @@
using EggLink.DanhengServer.Data;
using EggLink.DanhengServer.Data.Config.Scene;
using EggLink.DanhengServer.Data.Excel;
using EggLink.DanhengServer.Enums.RogueMagic;
using EggLink.DanhengServer.Enums.Scene;
using EggLink.DanhengServer.GameServer.Game.Player;
using EggLink.DanhengServer.GameServer.Game.Rogue.Scene.Entity;
using EggLink.DanhengServer.GameServer.Game.RogueTourn.Scene;
using EggLink.DanhengServer.GameServer.Game.Scene;
using EggLink.DanhengServer.GameServer.Game.Scene.Entity;
using EggLink.DanhengServer.Util;
namespace EggLink.DanhengServer.GameServer.Game.RogueMagic.Scene;
public class RogueMagicEntityLoader(SceneInstance scene, PlayerInstance player) : SceneEntityLoader(scene)
{
public List<RogueMagicRoomTypeEnum> ExistTypes = [];
public List<int> FinalRoomBossIds = [3007091, 3007101, 3007111, 3007121, 3007131, 3007141];
public List<int> LayerNormalBossIds = [3007011, 3007021, 3007031, 3007041, 3007051, 3007061, 3007071, 3007081];
public PlayerInstance Player = player;
public List<int> RogueDoorPropIds = [1033, 1034, 1035, 1036, 1037, 1000, 1053, 1054, 1055, 1056, 1057];
public override async ValueTask LoadEntity()
{
if (Scene.IsLoaded) return;
var instance = Player.RogueManager?.GetRogueInstance();
if (instance is RogueMagicInstance rogue)
{
var config = rogue.CurLevel?.CurRoom?.Config;
if (config == null) return;
foreach (var group in Scene.FloorInfo?.Groups.Values!)
if (rogue.CurLevel?.CurRoom?.GetLoadGroupList().Contains(group.Id) == true)
await LoadGroup(group);
else if (group.Category == GroupCategoryEnum.Normal) await LoadGroup(group);
}
Scene.IsLoaded = true;
}
public override async ValueTask<List<IGameEntity>?> LoadGroup(GroupInfo info, bool forceLoad = false)
{
var entityList = new List<IGameEntity>();
foreach (var npc in info.NPCList)
try
{
if (await LoadNpc(npc, info) is EntityNpc entity) entityList.Add(entity);
}
catch
{
}
foreach (var monster in info.MonsterList)
try
{
if (await LoadMonster(monster, info) is EntityMonster entity) entityList.Add(entity);
}
catch
{
}
foreach (var prop in info.PropList)
try
{
if (await LoadProp(prop, info) is EntityProp entity) entityList.Add(entity);
}
catch
{
}
return entityList;
}
public override async ValueTask<EntityNpc?> LoadNpc(NpcInfo info, GroupInfo group, bool sendPacket = false)
{
if (info.IsClientOnly || info.IsDelete) return null;
if (!GameData.NpcDataData.ContainsKey(info.NPCID)) return null;
RogueNpc npc = new(Scene, group, info);
if (info.NPCID == 3013)
{
// generate event
var instance = await Player.RogueManager!.GetRogueInstance()!.GenerateEvent(npc);
npc.RogueEvent = instance;
npc.RogueNpcId = instance.EventId;
npc.UniqueId = instance.EventUniqueId;
}
await Scene.AddEntity(npc, sendPacket);
return npc;
}
public override async ValueTask<EntityMonster?> LoadMonster(MonsterInfo info, GroupInfo group,
bool sendPacket = false)
{
if (info.IsClientOnly || info.IsDelete) return null;
var instance = Player.RogueManager?.GetRogueInstance();
if (instance is not RogueMagicInstance rogueInstance) return null;
var config = rogueInstance.CurLevel?.CurRoom?.Config;
if (config == null) return null;
List<MonsterRankEnum> allowedRank = [];
switch (config.RoomType)
{
case RogueMagicRoomTypeEnum.Elite:
allowedRank.Add(MonsterRankEnum.Elite);
break;
default:
allowedRank.Add(MonsterRankEnum.Minion);
allowedRank.Add(MonsterRankEnum.MinionLv2);
break;
}
if (allowedRank.Count == 0) return null;
RogueMonsterExcel? rogueMonster;
if (config.RoomType == RogueMagicRoomTypeEnum.Boss)
{
if (rogueInstance.CurLevel?.LevelIndex == 3)
rogueMonster = GameData.RogueMonsterData[FinalRoomBossIds.RandomElement()];
else
rogueMonster = GameData.RogueMonsterData[LayerNormalBossIds.RandomElement()];
}
else
{
NPCMonsterDataExcel? data;
do
{
rogueMonster = GameData.RogueMonsterData.Values.ToList().RandomElement();
GameData.NpcMonsterDataData.TryGetValue(rogueMonster.NpcMonsterID, out data);
} while (data == null || !allowedRank.Contains(data.Rank));
}
GameData.NpcMonsterDataData.TryGetValue(rogueMonster.NpcMonsterID, out var excel);
if (excel == null) return null;
EntityMonster entity =
new(Scene, info.ToPositionProto(), info.ToRotationProto(), group.Id, info.ID, excel, info)
{
EventID = rogueMonster.EventID,
CustomStageID = rogueMonster.EventID,
RogueMonsterId = rogueMonster.RogueMonsterID
};
await Scene.AddEntity(entity, sendPacket);
return entity;
}
public override async ValueTask<EntityProp?> LoadProp(PropInfo info, GroupInfo group, bool sendPacket = false)
{
var room = Player.RogueMagicManager?.RogueMagicInstance?.CurLevel?.CurRoom;
if (room == null) return null;
GameData.MazePropData.TryGetValue(info.PropID, out var propExcel);
if (propExcel == null) return null;
if (info.PropID == 1049) return null; // gamble machine
var prop = new RogueProp(Scene, propExcel, group, info);
if (RogueDoorPropIds.Contains(prop.PropInfo.PropID))
{
if (room is { RoomIndex: 4, LevelInstance.LevelIndex: 3 }) // last room
// exit
prop.CustomPropID = 1033;
else
do // find next room
{
RandomList<RogueMagicRoomTypeEnum> roomTypes = new();
foreach (var kv in Player.RogueMagicManager!.RogueMagicInstance!.RoomTypeWeight.Where(kv =>
kv.Value != 0)) roomTypes.Add(kv.Key, kv.Value);
var nextRoom = roomTypes.GetRandom();
if (room.LevelInstance.Rooms.Last().RoomIndex - 1 == room.RoomIndex) // boss only
{
if (prop.InstId != 300002) return null; // not center door
nextRoom = RogueMagicRoomTypeEnum.Boss;
}
else if (room.LevelInstance.Rooms.Last().RoomIndex - 2 == room.RoomIndex && room.LevelInstance.LevelIndex == 3) // respite only
{
if (prop.InstId != 300002) return null; // not center door
nextRoom = RogueMagicRoomTypeEnum.Reforge;
}
else
{
if (ExistTypes.Contains(nextRoom)) continue;
ExistTypes.Add(nextRoom);
}
prop.CustomPropID = nextRoom switch // door style
{
RogueMagicRoomTypeEnum.Event => 1055,
RogueMagicRoomTypeEnum.Wealth => 1055,
RogueMagicRoomTypeEnum.Shop => 1055,
RogueMagicRoomTypeEnum.Reward => 1055,
RogueMagicRoomTypeEnum.Adventure => 1055,
RogueMagicRoomTypeEnum.Reforge => 1054,
_ => 1054
};
if (room.LevelInstance.Rooms.Last() == room) // last room
prop.EnterNextLayer = true;
prop.MagicRoomType = nextRoom;
prop.IsMagicRogue = true;
break;
} while (true);
await prop.SetState(PropStateEnum.Open);
}
else if (prop.PropInfo.PropID == 1038)
{
var p = new RogueWorkbenchProp(Scene, propExcel, group, info)
{
WorkbenchId = 105
};
var workbenchExcel = GameData.RogueTournWorkbenchData.GetValueOrDefault(p.WorkbenchId);
if (workbenchExcel != null)
{
foreach (var funcExcel in workbenchExcel.Funcs)
{
p.WorkbenchFuncs.Add(new RogueWorkbenchFunc(funcExcel));
}
}
prop = p;
await prop.SetState(info.State);
}
else
{
await prop.SetState(info.State);
}
await Scene.AddEntity(prop, sendPacket);
return prop;
}
}

View File

@@ -0,0 +1,51 @@
using EggLink.DanhengServer.Data;
using EggLink.DanhengServer.Enums.RogueMagic;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Util;
namespace EggLink.DanhengServer.GameServer.Game.RogueMagic.Scene;
public class RogueMagicLevelInstance
{
public RogueMagicLevelInstance(int levelIndex, int layerId)
{
LevelIndex = levelIndex;
LayerId = layerId;
EntranceId = GameData.RogueMagicRoomGenData.Where(x => x.RoomType != RogueMagicRoomTypeEnum.Adventure)
.Select(x => x.EntranceId).ToHashSet().ToList()
.RandomElement();
if (levelIndex == 2)
foreach (var index in Enumerable.Range(1, 8))
Rooms.Add(new RogueMagicRoomInstance(index, this));
else if (levelIndex == 1)
foreach (var index in Enumerable.Range(1, 4))
Rooms.Add(new RogueMagicRoomInstance(index, this));
else
foreach (var index in Enumerable.Range(1, 6))
Rooms.Add(new RogueMagicRoomInstance(index, this));
}
public List<RogueMagicRoomInstance> Rooms { get; set; } = [];
public int LayerId { get; set; }
public int CurRoomIndex { get; set; }
public int LevelIndex { get; set; }
public RogueMagicLayerStatus LevelStatus { get; set; } = RogueMagicLayerStatus.Processing;
public RogueMagicRoomInstance? CurRoom => Rooms.FirstOrDefault(x => x.RoomIndex == CurRoomIndex);
public int EntranceId { get; set; }
public RogueMagicLayerInfo ToProto()
{
var proto = new RogueMagicLayerInfo
{
Status = LevelStatus,
CurRoomIndex = (uint)CurRoomIndex,
LayerId = (uint)LayerId,
LevelIndex = (uint)LevelIndex,
TournRoomList = { Rooms.Select(x => x.ToProto()) }
};
return proto;
}
}

View File

@@ -0,0 +1,64 @@
using EggLink.DanhengServer.Data;
using EggLink.DanhengServer.Data.Custom;
using EggLink.DanhengServer.Enums.RogueMagic;
using EggLink.DanhengServer.Enums.TournRogue;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Util;
namespace EggLink.DanhengServer.GameServer.Game.RogueMagic.Scene;
public class RogueMagicRoomInstance(int roomIndex, RogueMagicLevelInstance levelInstance)
{
public int RoomId { get; set; }
public int RoomIndex { get; set; } = roomIndex;
public RogueMagicRoomStatus Status { get; set; } = RogueMagicRoomStatus.None;
public RogueMagicLevelInstance LevelInstance { get; set; } = levelInstance;
public RogueMagicRoomTypeEnum RoomType { get; set; }
public RogueMagicRoomConfig? Config { get; set; }
public RogueMagicRoomInfo ToProto()
{
return new RogueMagicRoomInfo
{
RoomId = (uint)RoomId,
RoomIndex = (uint)RoomIndex,
Status = Status
};
}
public void Init(RogueMagicRoomTypeEnum type)
{
if (Status == RogueMagicRoomStatus.Processing || Status == RogueMagicRoomStatus.Finish) return; // already initialized
RoomType = type;
Status = RogueMagicRoomStatus.Processing;
// get config
Config = RoomType == RogueMagicRoomTypeEnum.Adventure
? GameData.RogueMagicRoomGenData.Where(x => x.RoomType == RoomType).ToList().RandomElement()
: GameData.RogueMagicRoomGenData
.Where(x => x.EntranceId == LevelInstance.EntranceId && x.RoomType == RoomType).ToList()
.RandomElement();
if (Config == null)
{
Status = RogueMagicRoomStatus.Finish;
return;
}
RoomId = GameData.RogueMagicRoomData.Where(x => x.Value.RogueRoomType == RoomType).Select(x => x.Key).ToList()
.RandomElement();
}
public List<int> GetLoadGroupList()
{
var groupList = new List<int>();
groupList.AddRange(Config!.DefaultLoadBasicGroup);
groupList.AddRange(Config.DefaultLoadGroup);
//if (RoomIndex == 1) // first room
groupList.AddRange(Config.SubMonsterGroup);
return groupList;
}
}

View File

@@ -0,0 +1,141 @@
using EggLink.DanhengServer.Data.Excel;
using EggLink.DanhengServer.GameServer.Game.RogueMagic.MagicUnit;
using EggLink.DanhengServer.Proto;
namespace EggLink.DanhengServer.GameServer.Game.RogueMagic.Scepter;
public class RogueScepterInstance(RogueMagicScepterExcel excel)
{
public RogueMagicScepterExcel Excel { get; set; } = excel;
public Dictionary<int, RogueMagicUnitInstance> DressedUnits { get; set; } = [];
public void AddUnit(int slot, RogueMagicUnitInstance unit)
{
DressedUnits[slot] = unit;
}
public void RemoveUnit(int slot)
{
DressedUnits.Remove(slot);
}
public RogueMagicGameScepterInfo ToProto()
{
var proto = new RogueMagicGameScepterInfo
{
ModifierContent = ToBasicInfo(),
ScepterDressInfo = { DressedUnits.Select(x => new RogueMagicScepterDressInfo
{
Slot = (uint)x.Key,
DressMagicUnitUniqueId = (uint)x.Value.UniqueId,
Type = (uint)x.Value.Excel.MagicUnitType
}) }
};
foreach (var trench in Excel.TrenchCount)
{
proto.TrenchCount.Add((uint)trench.Key, (uint)trench.Value);
}
foreach (var unitInfo in Excel.LockMagicUnit)
{
proto.LockedMagicUnitList.Add(new RogueMagicGameUnit
{
MagicUnitId = (uint)unitInfo.MagicUnitId,
Level = (uint)unitInfo.MagicUnitLevel
});
}
return proto;
}
public RogueCommonActionResult ToGetInfo(RogueCommonActionResultSourceType source)
{
return new RogueCommonActionResult
{
Source = source,
RogueAction = new RogueCommonActionResultData
{
GetScepterList = ToGetInfo()
}
};
}
public RogueCommonActionResult ToDressInfo(RogueCommonActionResultSourceType source)
{
return new RogueCommonActionResult
{
Source = source,
RogueAction = new RogueCommonActionResultData
{
DressScepterList = ToDressInfo()
}
};
}
public BattleRogueMagicScepter ToBattleScepterInfo()
{
var proto = new BattleRogueMagicScepter
{
ScepterId = (uint)Excel.ScepterID,
Level = (uint)Excel.ScepterLevel
};
foreach (var trench in Excel.TrenchCount)
{
proto.TrenchCount.Add((uint)trench.Key, (uint)trench.Value);
}
foreach (var unitInfo in Excel.LockMagicUnit)
{
proto.RogueMagicUnitInfoList.Add(new BattleRogueMagicUnit
{
MagicUnitId = (uint)unitInfo.MagicUnitId,
Level = (uint)unitInfo.MagicUnitLevel
});
}
foreach (var unitInfo in DressedUnits)
{
proto.RogueMagicUnitInfoList.Add(new BattleRogueMagicUnit
{
MagicUnitId = (uint)unitInfo.Value.Excel.MagicUnitID,
Level = (uint)unitInfo.Value.Excel.MagicUnitLevel,
DiceSlotId = (uint)unitInfo.Key
});
}
return proto;
}
public RogueMagicScepter ToBasicInfo()
{
var proto = new RogueMagicScepter
{
ScepterId = (uint)Excel.ScepterID,
Level = (uint)Excel.ScepterLevel
};
return proto;
}
public RogueCommonGetScepter ToGetInfo()
{
var proto = new RogueCommonGetScepter
{
UpdateScepterInfo = ToProto()
};
return proto;
}
public RogueCommonDressScepter ToDressInfo()
{
var proto = new RogueCommonDressScepter
{
UpdateScepterInfo = ToProto()
};
return proto;
}
}

View File

@@ -0,0 +1,82 @@
using EggLink.DanhengServer.Data.Excel;
using EggLink.DanhengServer.GameServer.Game.Rogue;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Util;
namespace EggLink.DanhengServer.GameServer.Game.RogueMagic.Scepter;
public class RogueScepterSelectMenu(BaseRogueInstance rogue)
{
public List<RogueMagicScepterExcel> Scepters { get; set; } = [];
public int RollMaxCount { get; set; } = rogue.BaseRerollCount;
public int RollCount { get; set; }
public int RollFreeCount { get; set; } = rogue.BaseRerollFreeCount;
public int RollCost { get; set; } = rogue.CurRerollCost;
public int QueueAppend { get; set; } = 3;
public List<RogueMagicScepterExcel> ScepterPool { get; set; } = [];
public void RollScepter(List<RogueMagicScepterExcel> scepters, int count = 3)
{
ScepterPool.Clear();
ScepterPool.AddRange(scepters);
var list = new RandomList<RogueMagicScepterExcel>();
foreach (var magicScepterExcel in scepters)
list.Add(magicScepterExcel, 1);
var result = new List<RogueMagicScepterExcel>();
for (var i = 0; i < count; i++)
{
var scepterExcel = list.GetRandom();
if (scepterExcel != null)
{
result.Add(scepterExcel);
list.Remove(scepterExcel);
}
if (list.GetCount() == 0) break; // No more scepter to roll
}
Scepters = result;
}
public async ValueTask RerollScepter()
{
if (RollFreeCount > 0)
{
RollFreeCount--; // Free reroll
}
else
{
if (RollMaxCount - RollCount <= 0) return;
RollCount++; // Paid reroll
await rogue.CostMoney(RollCost);
}
RollScepter(ScepterPool.Clone().ToList());
}
public RogueActionInstance GetActionInstance()
{
rogue.CurActionQueuePosition += QueueAppend;
return new RogueActionInstance
{
QueuePosition = rogue.CurActionQueuePosition,
RogueScepterSelectMenu = this
};
}
public RogueMagicScepterSelectInfo ToProto()
{
return new RogueMagicScepterSelectInfo
{
SelectScepters = { Scepters.Select(x => new RogueMagicScepter
{
ScepterId = (uint)x.ScepterID,
Level = (uint)x.ScepterLevel
}) }
};
}
}

View File

@@ -1,6 +1,5 @@
using EggLink.DanhengServer.Data;
using EggLink.DanhengServer.Data.Excel;
using EggLink.DanhengServer.Enums.Rogue;
using EggLink.DanhengServer.Enums.TournRogue;
using EggLink.DanhengServer.GameServer.Game.Player;
using EggLink.DanhengServer.GameServer.Game.Rogue;
@@ -107,7 +106,7 @@ public class RogueTournManager(PlayerInstance player) : BasePlayerManager(player
where areaExcel.Value.AreaGroupID != RogueTournAreaGroupIDEnum.WeekChallenge
select new RogueTournAreaInfo
{
AreaId = (uint)areaExcel.Value.AreaID, IsTournFinish = true, IsTakenReward = true, IsUnlock = true
AreaId = (uint)areaExcel.Value.AreaID, IsTournFinish = true, IsTakenReward = true, IsUnlocked = true
})
.ToList();
}
@@ -116,7 +115,7 @@ public class RogueTournManager(PlayerInstance player) : BasePlayerManager(player
{
return (from difficultyExcel in GameData.RogueTournDifficultyCompData.Values
select new RogueTournDifficultyInfo
{ DifficultyId = (uint)difficultyExcel.DifficultyCompID, IsUnlock = true }).ToList();
{ DifficultyId = (uint)difficultyExcel.DifficultyCompID, IsUnlocked = true }).ToList();
}
public RogueTournExpInfo ToExpProto()
@@ -135,22 +134,22 @@ public class RogueTournManager(PlayerInstance player) : BasePlayerManager(player
{
var proto = new RogueTournHandbookInfo
{
DFPKGDJNMHA = 1
LMIJCPOICHI = 1
};
foreach (var hexAvatar in GameData.RogueTournHexAvatarBaseTypeData.Keys)
proto.HandbookAvatarBaseList.Add((uint)hexAvatar);
//foreach (var hexAvatar in GameData.RogueTournHexAvatarBaseTypeData.Keys)
// proto.HandbookAvatarBaseList.Add((uint)hexAvatar);
foreach (var buff in GameData.RogueBuffData.Values)
if (buff is RogueTournBuffExcel { IsInHandbook: true })
proto.HandbookBuffList.Add((uint)buff.MazeBuffID);
foreach (var formulaId in GameData.RogueTournFormulaData.Keys) proto.HandbookFormulaList.Add((uint)formulaId);
//foreach (var formulaId in GameData.RogueTournFormulaData.Keys) proto.HandbookFormulaList.Add((uint)formulaId);
foreach (var miracleId in GameData.RogueTournHandbookMiracleData.Keys)
proto.HandbookMiracleList.Add((uint)miracleId);
//foreach (var miracleId in GameData.RogueTournHandbookMiracleData.Keys)
// proto.HandbookMiracleList.Add((uint)miracleId);
foreach (var eventId in GameData.RogueTournHandBookEventData.Keys) proto.HandbookEventList.Add((uint)eventId);
//foreach (var eventId in GameData.RogueTournHandBookEventData.Keys) proto.HandbookEventList.Add((uint)eventId);
return proto;
}

View File

@@ -1,8 +1,8 @@
using EggLink.DanhengServer.Data;
using EggLink.DanhengServer.Data.Config.Scene;
using EggLink.DanhengServer.Data.Excel;
using EggLink.DanhengServer.Enums.Rogue;
using EggLink.DanhengServer.Enums.Scene;
using EggLink.DanhengServer.Enums.TournRogue;
using EggLink.DanhengServer.GameServer.Game.Player;
using EggLink.DanhengServer.GameServer.Game.Rogue.Scene.Entity;
using EggLink.DanhengServer.GameServer.Game.Scene;

View File

@@ -1,5 +1,5 @@
using EggLink.DanhengServer.Data;
using EggLink.DanhengServer.Enums.Rogue;
using EggLink.DanhengServer.Enums.TournRogue;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Util;

View File

@@ -1,6 +1,6 @@
using EggLink.DanhengServer.Data;
using EggLink.DanhengServer.Data.Custom;
using EggLink.DanhengServer.Enums.Rogue;
using EggLink.DanhengServer.Enums.TournRogue;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Util;

View File

@@ -10,6 +10,7 @@ using EggLink.DanhengServer.GameServer.Game.ChessRogue.Cell;
using EggLink.DanhengServer.GameServer.Game.Mission;
using EggLink.DanhengServer.GameServer.Game.Player;
using EggLink.DanhengServer.GameServer.Game.Rogue.Scene;
using EggLink.DanhengServer.GameServer.Game.RogueMagic.Scene;
using EggLink.DanhengServer.GameServer.Game.RogueTourn.Scene;
using EggLink.DanhengServer.GameServer.Game.Scene.Entity;
using EggLink.DanhengServer.GameServer.Server.Packet.Send.Scene;
@@ -205,6 +206,11 @@ public class SceneInstance
EntityLoader = new RogueTournEntityLoader(this, Player);
GameModeType = GameModeTypeEnum.TournRogue; // TournRogue
}
else if (Player.RogueMagicManager!.RogueMagicInstance != null)
{
EntityLoader = new RogueMagicEntityLoader(this, Player);
GameModeType = GameModeTypeEnum.MagicRogue; // MagicRogue
}
else
{
EntityLoader = new RogueEntityLoader(this, Player);