mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-02 20:26:03 +08:00
Better Monster Spawning
This commit is contained in:
19
Common/Data/Excel/RogueMonsterGroupExcel.cs
Normal file
19
Common/Data/Excel/RogueMonsterGroupExcel.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("RogueMonsterGroup.json")]
|
||||
public class RogueMonsterGroupExcel : ExcelResource
|
||||
{
|
||||
public Dictionary<string, int> RogueMonsterListAndWeight { get; set; } = [];
|
||||
public int RogueMonsterGroupID { get; set; }
|
||||
public int EliteGroup { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return RogueMonsterGroupID;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.RogueMonsterGroupData.Add(GetId(), this);
|
||||
}
|
||||
}
|
||||
@@ -205,6 +205,7 @@ public static class GameData
|
||||
public static Dictionary<int, List<int>> RogueMiracleGroupData { get; set; } = [];
|
||||
public static Dictionary<int, RogueMiracleDisplayExcel> RogueMiracleDisplayData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueMonsterExcel> RogueMonsterData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueMonsterGroupExcel> RogueMonsterGroupData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueNPCExcel> RogueNPCData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueRoomExcel> RogueRoomData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueTalentExcel> RogueTalentData { get; private set; } = [];
|
||||
|
||||
@@ -258,9 +258,9 @@ public class ChessRogueInstance : BaseRogueInstance
|
||||
}
|
||||
}
|
||||
|
||||
public override async ValueTask UpdateMenu()
|
||||
public override async ValueTask UpdateMenu(int position = 0)
|
||||
{
|
||||
await base.UpdateMenu();
|
||||
await base.UpdateMenu(position);
|
||||
|
||||
|
||||
await AddAeonBuff(); // check if aeon buff can be added
|
||||
|
||||
@@ -14,6 +14,7 @@ using EggLink.DanhengServer.GameServer.Server.Packet.Send.RogueCommon;
|
||||
using EggLink.DanhengServer.GameServer.Server.Packet.Send.Scene;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using System;
|
||||
using LineupInfo = EggLink.DanhengServer.Database.Lineup.LineupInfo;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Rogue;
|
||||
@@ -162,7 +163,7 @@ public abstract class BaseRogueInstance(PlayerInstance player, RogueSubModeEnum
|
||||
return RogueBuffs.FindAll(x => group.BuffList.Contains(x.BuffExcel));
|
||||
}
|
||||
|
||||
public virtual async ValueTask HandleBuffSelect(int buffId)
|
||||
public virtual async ValueTask HandleBuffSelect(int buffId, int location)
|
||||
{
|
||||
if (RogueActions.Count == 0) return;
|
||||
|
||||
@@ -192,10 +193,10 @@ public abstract class BaseRogueInstance(PlayerInstance player, RogueSubModeEnum
|
||||
|
||||
await UpdateMenu();
|
||||
|
||||
await Player.SendPacket(new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, true));
|
||||
await Player.SendPacket(new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, location, true));
|
||||
}
|
||||
|
||||
public virtual async ValueTask HandleBuffReforgeSelect(int buffId)
|
||||
public virtual async ValueTask HandleBuffReforgeSelect(int buffId, int location)
|
||||
{
|
||||
if (RogueActions.Count == 0) return;
|
||||
|
||||
@@ -225,10 +226,10 @@ public abstract class BaseRogueInstance(PlayerInstance player, RogueSubModeEnum
|
||||
|
||||
await UpdateMenu();
|
||||
|
||||
await Player.SendPacket(new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, reforgeBuff:true));
|
||||
await Player.SendPacket(new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, location, reforgeBuff:true));
|
||||
}
|
||||
|
||||
public virtual async ValueTask HandleRerollBuff()
|
||||
public virtual async ValueTask HandleRerollBuff(int location)
|
||||
{
|
||||
if (RogueActions.Count == 0) return;
|
||||
var action = RogueActions.First().Value;
|
||||
@@ -236,7 +237,7 @@ public abstract class BaseRogueInstance(PlayerInstance player, RogueSubModeEnum
|
||||
{
|
||||
await action.RogueBuffSelectMenu.RerollBuff(); // reroll
|
||||
await Player.SendPacket(
|
||||
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, menu: action.RogueBuffSelectMenu));
|
||||
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, location, menu: action.RogueBuffSelectMenu));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,7 +320,7 @@ public abstract class BaseRogueInstance(PlayerInstance player, RogueSubModeEnum
|
||||
await UpdateMenu();
|
||||
}
|
||||
|
||||
public virtual async ValueTask HandleMiracleSelect(uint miracleId)
|
||||
public virtual async ValueTask HandleMiracleSelect(uint miracleId, int location)
|
||||
{
|
||||
if (RogueActions.Count == 0) return;
|
||||
|
||||
@@ -334,7 +335,7 @@ public abstract class BaseRogueInstance(PlayerInstance player, RogueSubModeEnum
|
||||
await UpdateMenu();
|
||||
|
||||
await Player.SendPacket(
|
||||
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, selectMiracle: true));
|
||||
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, location, selectMiracle: true));
|
||||
}
|
||||
|
||||
public virtual async ValueTask AddMiracle(int miracleId)
|
||||
@@ -354,7 +355,7 @@ public abstract class BaseRogueInstance(PlayerInstance player, RogueSubModeEnum
|
||||
|
||||
#region Actions
|
||||
|
||||
public virtual async ValueTask HandleBonusSelect(int bonusId)
|
||||
public virtual async ValueTask HandleBonusSelect(int bonusId, int location)
|
||||
{
|
||||
if (RogueActions.Count == 0) return;
|
||||
|
||||
@@ -367,14 +368,28 @@ public abstract class BaseRogueInstance(PlayerInstance player, RogueSubModeEnum
|
||||
RogueActions.Remove(action.QueuePosition);
|
||||
await UpdateMenu();
|
||||
|
||||
await Player.SendPacket(new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, selectBonus: true));
|
||||
await Player.SendPacket(new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, location, selectBonus: true));
|
||||
}
|
||||
|
||||
public virtual async ValueTask UpdateMenu()
|
||||
public virtual async ValueTask UpdateMenu(int position = 0)
|
||||
{
|
||||
if (RogueActions.Count > 0)
|
||||
await Player.SendPacket(
|
||||
new PacketSyncRogueCommonPendingActionScNotify(RogueActions.First().Value, RogueSubMode));
|
||||
{
|
||||
if (position == 0)
|
||||
{
|
||||
var action = RogueActions.Values.First();
|
||||
action.GetSelectMenu()?.Roll();
|
||||
await Player.SendPacket(
|
||||
new PacketSyncRogueCommonPendingActionScNotify(action, RogueSubMode));
|
||||
}
|
||||
else
|
||||
{
|
||||
var action = RogueActions[position];
|
||||
action.GetSelectMenu()?.Roll();
|
||||
await Player.SendPacket(
|
||||
new PacketSyncRogueCommonPendingActionScNotify(action, RogueSubMode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
6
GameServer/Game/Rogue/BaseRogueSelectMenu.cs
Normal file
6
GameServer/Game/Rogue/BaseRogueSelectMenu.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Rogue;
|
||||
|
||||
public abstract class BaseRogueSelectMenu
|
||||
{
|
||||
public abstract void Roll();
|
||||
}
|
||||
@@ -51,4 +51,15 @@ public class RogueActionInstance
|
||||
RogueAction = action
|
||||
};
|
||||
}
|
||||
|
||||
public BaseRogueSelectMenu? GetSelectMenu()
|
||||
{
|
||||
//if (RogueBuffSelectMenu != null) return RogueBuffSelectMenu;
|
||||
//if (RogueMiracleSelectMenu != null) return RogueMiracleSelectMenu;
|
||||
//if (RogueFormulaSelectMenu != null) return RogueFormulaSelectMenu;
|
||||
if (RogueMagicUnitSelectMenu != null) return RogueMagicUnitSelectMenu;
|
||||
if (RogueScepterSelectMenu != null) return RogueScepterSelectMenu;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -141,9 +141,9 @@ public class RogueInstance : BaseRogueInstance
|
||||
|
||||
#region Methods
|
||||
|
||||
public override async ValueTask UpdateMenu()
|
||||
public override async ValueTask UpdateMenu(int position = 0)
|
||||
{
|
||||
await base.UpdateMenu();
|
||||
await base.UpdateMenu(position);
|
||||
|
||||
|
||||
await AddAeonBuff(); // check if aeon buff can be added
|
||||
|
||||
@@ -5,28 +5,36 @@ using EggLink.DanhengServer.Util;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.RogueMagic.MagicUnit;
|
||||
|
||||
public class RogueMagicUnitSelectMenu(BaseRogueInstance rogue)
|
||||
public class RogueMagicUnitSelectMenu(BaseRogueInstance rogue) : BaseRogueSelectMenu
|
||||
{
|
||||
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 int Count { get; set; } = 3;
|
||||
public int QueueAppend { get; set; } = 2;
|
||||
public List<RogueMagicUnitExcel> MagicUnitPool { get; set; } = [];
|
||||
|
||||
public void RollMagicUnit(List<RogueMagicUnitExcel> magicUnits, int count = 3)
|
||||
public override void Roll()
|
||||
{
|
||||
MagicUnitPool.Clear();
|
||||
MagicUnitPool.AddRange(magicUnits);
|
||||
|
||||
if (MagicUnits.Count > 0) return; // already init
|
||||
// Remove existing magic units
|
||||
if (rogue is RogueMagicInstance magic)
|
||||
{
|
||||
foreach (var excel in MagicUnitPool.Clone())
|
||||
{
|
||||
if (magic.RogueMagicUnits.Any(x => x.Value.Excel.MagicUnitID == excel.MagicUnitID))
|
||||
MagicUnitPool.Remove(excel);
|
||||
}
|
||||
}
|
||||
var list = new RandomList<RogueMagicUnitExcel>();
|
||||
|
||||
foreach (var unitExcel in magicUnits)
|
||||
foreach (var unitExcel in MagicUnitPool)
|
||||
list.Add(unitExcel, (int)(6 - unitExcel.MagicUnitCategory));
|
||||
var result = new List<RogueMagicUnitExcel>();
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
var unitExcel = list.GetRandom();
|
||||
if (unitExcel != null)
|
||||
@@ -41,6 +49,13 @@ public class RogueMagicUnitSelectMenu(BaseRogueInstance rogue)
|
||||
MagicUnits = result;
|
||||
}
|
||||
|
||||
public void SetPool(List<RogueMagicUnitExcel> magicUnits, int count = 3)
|
||||
{
|
||||
MagicUnitPool.Clear();
|
||||
MagicUnitPool.AddRange(magicUnits);
|
||||
Count = count;
|
||||
}
|
||||
|
||||
public async ValueTask RerollMagicUnit()
|
||||
{
|
||||
if (RollFreeCount > 0)
|
||||
@@ -54,7 +69,7 @@ public class RogueMagicUnitSelectMenu(BaseRogueInstance rogue)
|
||||
await rogue.CostMoney(RollCost);
|
||||
}
|
||||
|
||||
RollMagicUnit(MagicUnitPool.Clone().ToList());
|
||||
Roll();
|
||||
}
|
||||
|
||||
public RogueActionInstance GetActionInstance()
|
||||
@@ -76,7 +91,10 @@ public class RogueMagicUnitSelectMenu(BaseRogueInstance rogue)
|
||||
{
|
||||
MagicUnitId = (uint)x.MagicUnitID,
|
||||
Level = (uint)x.MagicUnitLevel
|
||||
}) }
|
||||
}) },
|
||||
SelectHintId = 260002,
|
||||
ABHPIGOGACI = 1,
|
||||
OMPAAKLLLFD = 1
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,13 @@ public class RogueMagicInstance : BaseRogueInstance
|
||||
DifficultyCompExcels.Add(excel);
|
||||
}
|
||||
|
||||
foreach (var id in AreaExcel.DifficultyIDList)
|
||||
{
|
||||
GameData.RogueTournDifficultyData.TryGetValue(1000 + id, out var excel);
|
||||
if (excel != null)
|
||||
DifficultyExcels.Add(excel);
|
||||
}
|
||||
|
||||
StyleType = (RogueMagicStyleTypeEnum)styleType;
|
||||
|
||||
var t = RollScepter(1, 1);
|
||||
@@ -57,6 +64,7 @@ public class RogueMagicInstance : BaseRogueInstance
|
||||
public RogueMagicAreaExcel AreaExcel { get; set; }
|
||||
public List<RogueMagicDifficultyCompExcel> DifficultyCompExcels { get; set; } = [];
|
||||
public Dictionary<int, RogueMagicLevelInstance> Levels { get; set; } = [];
|
||||
public List<RogueTournDifficultyExcel> DifficultyExcels { get; set; } = []; // for battle
|
||||
|
||||
public int CurLayerId { get; set; }
|
||||
public RogueMagicLevelInstance? CurLevel => Levels.GetValueOrDefault(CurLayerId);
|
||||
@@ -93,7 +101,7 @@ public class RogueMagicInstance : BaseRogueInstance
|
||||
}
|
||||
|
||||
CurLayerId = AreaExcel.LayerIDList[curIndex];
|
||||
await EnterRoom(roomIndex, type);
|
||||
await EnterRoom(1, type);
|
||||
}
|
||||
|
||||
public async ValueTask EnterRoom(int roomIndex, RogueMagicRoomTypeEnum type)
|
||||
@@ -115,7 +123,6 @@ public class RogueMagicInstance : BaseRogueInstance
|
||||
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;
|
||||
@@ -132,7 +139,8 @@ public class RogueMagicInstance : BaseRogueInstance
|
||||
await Player.EnterMissionScene(entrance, group, anchor, false);
|
||||
|
||||
// sync
|
||||
await Player.SendPacket(new PacketRogueMagicLevelInfoUpdateScNotify(this, [CurLevel]));
|
||||
await Player.SendPacket(new PacketRogueMagicLevelInfoUpdateScNotify(this, [CurLevel], [next?.RoomIndex ?? 0,
|
||||
(next?.RoomIndex ?? 0) - 1]));
|
||||
}
|
||||
|
||||
public async ValueTask QuitRogue()
|
||||
@@ -152,15 +160,15 @@ public class RogueMagicInstance : BaseRogueInstance
|
||||
for (var i = 0; i < amount; i++)
|
||||
{
|
||||
var menu = new RogueScepterSelectMenu(this);
|
||||
menu.RollScepter(scepterExcels);
|
||||
menu.SetScepterPool(scepterExcels);
|
||||
var action = menu.GetActionInstance();
|
||||
RogueActions.Add(action.QueuePosition, action);
|
||||
}
|
||||
|
||||
await UpdateMenu();
|
||||
await UpdateMenu(action.QueuePosition);
|
||||
}
|
||||
}
|
||||
|
||||
public async ValueTask HandleScepterSelect(RogueMagicScepter selectScepter)
|
||||
public async ValueTask HandleScepterSelect(RogueMagicScepter selectScepter, int location)
|
||||
{
|
||||
if (RogueActions.Count == 0) return;
|
||||
|
||||
@@ -175,7 +183,7 @@ public class RogueMagicInstance : BaseRogueInstance
|
||||
await UpdateMenu();
|
||||
|
||||
await Player.SendPacket(
|
||||
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, selectScepter: true));
|
||||
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, location, selectScepter: true));
|
||||
}
|
||||
|
||||
public async ValueTask AddScepter(RogueMagicScepterExcel excel, RogueCommonActionResultSourceType source = RogueCommonActionResultSourceType.Select)
|
||||
@@ -211,15 +219,15 @@ public class RogueMagicInstance : BaseRogueInstance
|
||||
for (var i = 0; i < amount; i++)
|
||||
{
|
||||
var menu = new RogueMagicUnitSelectMenu(this);
|
||||
menu.RollMagicUnit(unitExcels);
|
||||
menu.SetPool(unitExcels);
|
||||
var action = menu.GetActionInstance();
|
||||
RogueActions.Add(action.QueuePosition, action);
|
||||
}
|
||||
|
||||
await UpdateMenu();
|
||||
await UpdateMenu(action.QueuePosition);
|
||||
}
|
||||
}
|
||||
|
||||
public async ValueTask HandleMagicUnitSelect(RogueMagicGameUnit selectMagicUnit)
|
||||
public async ValueTask HandleMagicUnitSelect(RogueMagicGameUnit selectMagicUnit, int location)
|
||||
{
|
||||
if (RogueActions.Count == 0) return;
|
||||
|
||||
@@ -234,7 +242,7 @@ public class RogueMagicInstance : BaseRogueInstance
|
||||
await UpdateMenu();
|
||||
|
||||
await Player.SendPacket(
|
||||
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, selectMagicUnit: true));
|
||||
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, location, selectMagicUnit: true));
|
||||
}
|
||||
|
||||
public async ValueTask AddMagicUnit(RogueMagicUnitExcel excel, RogueCommonActionResultSourceType source = RogueCommonActionResultSourceType.Select)
|
||||
@@ -255,7 +263,12 @@ public class RogueMagicInstance : BaseRogueInstance
|
||||
public override void OnBattleStart(BattleInstance battle)
|
||||
{
|
||||
base.OnBattleStart(battle);
|
||||
battle.CustomLevel = AreaExcel.DifficultyIDList.RandomElement();
|
||||
if (DifficultyExcels.Count > 0)
|
||||
{
|
||||
var excel = DifficultyExcels.RandomElement();
|
||||
if (excel.LevelList.Count > 0)
|
||||
battle.CustomLevel = excel.LevelList.RandomElement();
|
||||
}
|
||||
battle.MagicInfo = new BattleRogueMagicInfo
|
||||
{
|
||||
ModifierContent = new IGEFNGNCKOG
|
||||
|
||||
@@ -8,6 +8,7 @@ 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.Proto;
|
||||
using EggLink.DanhengServer.Util;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.RogueMagic.Scene;
|
||||
@@ -15,8 +16,10 @@ 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 int FinalRoomBossGroup = 500401;
|
||||
|
||||
public int LayerNormalBossGroup2 = 500301;
|
||||
public int LayerNormalBossGroup1 = 400711;
|
||||
public PlayerInstance Player = player;
|
||||
public List<int> RogueDoorPropIds = [1033, 1034, 1035, 1036, 1037, 1000, 1053, 1054, 1055, 1056, 1057];
|
||||
|
||||
@@ -121,9 +124,38 @@ public class RogueMagicEntityLoader(SceneInstance scene, PlayerInstance player)
|
||||
if (config.RoomType == RogueMagicRoomTypeEnum.Boss)
|
||||
{
|
||||
if (rogueInstance.CurLevel?.LevelIndex == 3)
|
||||
rogueMonster = GameData.RogueMonsterData[FinalRoomBossIds.RandomElement()];
|
||||
{
|
||||
var dict = GameData.RogueMonsterGroupData[FinalRoomBossGroup].RogueMonsterListAndWeight;
|
||||
var random = new RandomList<int>();
|
||||
foreach (var i in dict)
|
||||
{
|
||||
random.Add(int.Parse(i.Key), i.Value);
|
||||
}
|
||||
|
||||
rogueMonster = GameData.RogueMonsterData[random.GetRandom()];
|
||||
}
|
||||
else if (rogueInstance.CurLevel?.LevelIndex == 2)
|
||||
{
|
||||
var dict = GameData.RogueMonsterGroupData[LayerNormalBossGroup2].RogueMonsterListAndWeight;
|
||||
var random = new RandomList<int>();
|
||||
foreach (var i in dict)
|
||||
{
|
||||
random.Add(int.Parse(i.Key), i.Value);
|
||||
}
|
||||
|
||||
rogueMonster = GameData.RogueMonsterData[random.GetRandom()];
|
||||
}
|
||||
else
|
||||
rogueMonster = GameData.RogueMonsterData[LayerNormalBossIds.RandomElement()];
|
||||
{
|
||||
var dict = GameData.RogueMonsterGroupData[LayerNormalBossGroup1].RogueMonsterListAndWeight;
|
||||
var random = new RandomList<int>();
|
||||
foreach (var i in dict)
|
||||
{
|
||||
random.Add(int.Parse(i.Key), i.Value);
|
||||
}
|
||||
|
||||
rogueMonster = GameData.RogueMonsterData[random.GetRandom()];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -138,12 +170,21 @@ public class RogueMagicEntityLoader(SceneInstance scene, PlayerInstance player)
|
||||
GameData.NpcMonsterDataData.TryGetValue(rogueMonster.NpcMonsterID, out var excel);
|
||||
if (excel == null) return null;
|
||||
|
||||
var customLevel = 0;
|
||||
if (rogueInstance.DifficultyExcels.Count > 0)
|
||||
{
|
||||
var diff = rogueInstance.DifficultyExcels.RandomElement();
|
||||
if (diff.LevelList.Count > 0)
|
||||
customLevel = diff.LevelList.RandomElement();
|
||||
}
|
||||
|
||||
EntityMonster entity =
|
||||
new(Scene, info.ToPositionProto(), info.ToRotationProto(), group.Id, info.ID, excel, info)
|
||||
{
|
||||
EventID = rogueMonster.EventID,
|
||||
CustomStageID = rogueMonster.EventID,
|
||||
RogueMonsterId = rogueMonster.RogueMonsterID
|
||||
RogueMonsterId = rogueMonster.RogueMonsterID,
|
||||
CustomLevel = customLevel
|
||||
};
|
||||
|
||||
await Scene.AddEntity(entity, sendPacket);
|
||||
@@ -165,9 +206,9 @@ public class RogueMagicEntityLoader(SceneInstance scene, PlayerInstance player)
|
||||
|
||||
if (RogueDoorPropIds.Contains(prop.PropInfo.PropID))
|
||||
{
|
||||
if (room is { RoomIndex: 4, LevelInstance.LevelIndex: 3 }) // last room
|
||||
if (room is { RoomIndex: 6, LevelInstance.LevelIndex: 3 }) // last room
|
||||
// exit
|
||||
prop.CustomPropID = 1033;
|
||||
prop.CustomPropID = 1053;
|
||||
else
|
||||
do // find next room
|
||||
{
|
||||
|
||||
@@ -35,17 +35,20 @@ public class RogueMagicLevelInstance
|
||||
|
||||
public int EntranceId { get; set; }
|
||||
|
||||
public RogueMagicLayerInfo ToProto()
|
||||
public RogueMagicLayerInfo ToProto(List<int>? updateRoomIndexList = null)
|
||||
{
|
||||
var proto = new RogueMagicLayerInfo
|
||||
{
|
||||
Status = LevelStatus,
|
||||
CurRoomIndex = (uint)CurRoomIndex,
|
||||
LayerId = (uint)LayerId,
|
||||
LevelIndex = (uint)LevelIndex,
|
||||
TournRoomList = { Rooms.Select(x => x.ToProto()) }
|
||||
LevelIndex = (uint)LevelIndex
|
||||
};
|
||||
|
||||
proto.TournRoomList.AddRange(updateRoomIndexList != null
|
||||
? Rooms.Where(x => updateRoomIndexList.Contains(x.RoomIndex)).Select(x => x.ToProto())
|
||||
: Rooms.Select(x => x.ToProto()));
|
||||
|
||||
return proto;
|
||||
}
|
||||
}
|
||||
@@ -2,31 +2,40 @@
|
||||
using EggLink.DanhengServer.GameServer.Game.Rogue;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using System;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.RogueMagic.Scepter;
|
||||
|
||||
public class RogueScepterSelectMenu(BaseRogueInstance rogue)
|
||||
public class RogueScepterSelectMenu(BaseRogueInstance rogue) : BaseRogueSelectMenu
|
||||
{
|
||||
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 int QueueAppend { get; set; } = 2;
|
||||
public int Count { get; set; } = 3;
|
||||
public List<RogueMagicScepterExcel> ScepterPool { get; set; } = [];
|
||||
|
||||
public void RollScepter(List<RogueMagicScepterExcel> scepters, int count = 3)
|
||||
public override void Roll()
|
||||
{
|
||||
ScepterPool.Clear();
|
||||
ScepterPool.AddRange(scepters);
|
||||
|
||||
if (Scepters.Count > 0) return; // already init
|
||||
// Remove existing scepters
|
||||
if (rogue is RogueMagicInstance magic)
|
||||
{
|
||||
foreach (var excel in ScepterPool.Clone())
|
||||
{
|
||||
if (magic.RogueScepters.Any(x => x.Value.Excel.ScepterID == excel.ScepterID))
|
||||
ScepterPool.Remove(excel);
|
||||
}
|
||||
}
|
||||
var list = new RandomList<RogueMagicScepterExcel>();
|
||||
|
||||
foreach (var magicScepterExcel in scepters)
|
||||
foreach (var magicScepterExcel in ScepterPool)
|
||||
list.Add(magicScepterExcel, 1);
|
||||
var result = new List<RogueMagicScepterExcel>();
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
for (var i = 0; i < Count; i++)
|
||||
{
|
||||
var scepterExcel = list.GetRandom();
|
||||
if (scepterExcel != null)
|
||||
@@ -41,6 +50,13 @@ public class RogueScepterSelectMenu(BaseRogueInstance rogue)
|
||||
Scepters = result;
|
||||
}
|
||||
|
||||
public void SetScepterPool(List<RogueMagicScepterExcel> scepters, int count = 3)
|
||||
{
|
||||
ScepterPool.Clear();
|
||||
ScepterPool.AddRange(scepters);
|
||||
Count = count;
|
||||
}
|
||||
|
||||
public async ValueTask RerollScepter()
|
||||
{
|
||||
if (RollFreeCount > 0)
|
||||
@@ -54,7 +70,7 @@ public class RogueScepterSelectMenu(BaseRogueInstance rogue)
|
||||
await rogue.CostMoney(RollCost);
|
||||
}
|
||||
|
||||
RollScepter(ScepterPool.Clone().ToList());
|
||||
Roll();
|
||||
}
|
||||
|
||||
public RogueActionInstance GetActionInstance()
|
||||
|
||||
@@ -77,7 +77,7 @@ public class RogueTournInstance : BaseRogueInstance
|
||||
public async ValueTask EnterNextLayer(int roomIndex, RogueTournRoomTypeEnum type)
|
||||
{
|
||||
CurLayerId += 100;
|
||||
await EnterRoom(roomIndex, type);
|
||||
await EnterRoom(1, type);
|
||||
}
|
||||
|
||||
public async ValueTask EnterRoom(int roomIndex, RogueTournRoomTypeEnum type)
|
||||
@@ -149,7 +149,7 @@ public class RogueTournInstance : BaseRogueInstance
|
||||
await UpdateMenu();
|
||||
}
|
||||
|
||||
public override async ValueTask HandleBuffSelect(int buffId)
|
||||
public override async ValueTask HandleBuffSelect(int buffId, int location)
|
||||
{
|
||||
if (RogueActions.Count == 0) return;
|
||||
|
||||
@@ -180,7 +180,7 @@ public class RogueTournInstance : BaseRogueInstance
|
||||
await ExpandFormula();
|
||||
await UpdateMenu();
|
||||
|
||||
await Player.SendPacket(new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, true));
|
||||
await Player.SendPacket(new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, location, true));
|
||||
}
|
||||
|
||||
public override async ValueTask<RogueCommonActionResult?> AddBuff(int buffId, int level = 1,
|
||||
@@ -255,7 +255,7 @@ public class RogueTournInstance : BaseRogueInstance
|
||||
}, RogueCommonActionResultDisplayType.Single));
|
||||
}
|
||||
|
||||
public async ValueTask HandleFormulaSelect(int formulaId)
|
||||
public async ValueTask HandleFormulaSelect(int formulaId, int location)
|
||||
{
|
||||
if (RogueActions.Count == 0) return;
|
||||
|
||||
@@ -278,7 +278,7 @@ public class RogueTournInstance : BaseRogueInstance
|
||||
await UpdateMenu();
|
||||
|
||||
await Player.SendPacket(
|
||||
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, selectFormula: true));
|
||||
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, location, selectFormula: true));
|
||||
}
|
||||
|
||||
public virtual async ValueTask<RogueCommonActionResult?> RemoveFormula(int formulaId,
|
||||
|
||||
@@ -36,6 +36,7 @@ public class EntityMonster(
|
||||
public int GroupID { get; set; } = GroupID;
|
||||
|
||||
public int RogueMonsterId { get; set; } = 0;
|
||||
public int CustomLevel { get; set; } = 0;
|
||||
|
||||
public async ValueTask AddBuff(SceneBuff buff)
|
||||
{
|
||||
@@ -91,7 +92,8 @@ public class EntityMonster(
|
||||
{
|
||||
RogueGameInfo = new NpcMonsterRogueInfo
|
||||
{
|
||||
RogueMonsterId = (uint)RogueMonsterId
|
||||
RogueMonsterId = (uint)RogueMonsterId,
|
||||
Level = (uint)CustomLevel
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -15,23 +15,23 @@ public class HandlerHandleRogueCommonPendingActionCsReq : Handler
|
||||
var rogue = connection.Player!.RogueManager?.GetRogueInstance();
|
||||
if (rogue == null) return;
|
||||
|
||||
if (req.BuffSelectResult != null) await rogue.HandleBuffSelect((int)req.BuffSelectResult.BuffSelectId);
|
||||
if (req.BuffSelectResult != null) await rogue.HandleBuffSelect((int)req.BuffSelectResult.BuffSelectId, (int)req.QueueLocation);
|
||||
|
||||
if (req.BuffReforgeSelectResult != null) await rogue.HandleBuffReforgeSelect((int)req.BuffReforgeSelectResult.BuffSelectId);
|
||||
if (req.BuffReforgeSelectResult != null) await rogue.HandleBuffReforgeSelect((int)req.BuffReforgeSelectResult.BuffSelectId, (int)req.QueueLocation);
|
||||
|
||||
if (req.BuffRerollSelectResult != null) await rogue.HandleRerollBuff();
|
||||
if (req.BuffRerollSelectResult != null) await rogue.HandleRerollBuff((int)req.QueueLocation);
|
||||
|
||||
if (req.BonusSelectResult != null) await rogue.HandleBonusSelect((int)req.BonusSelectResult.BonusId);
|
||||
if (req.BonusSelectResult != null) await rogue.HandleBonusSelect((int)req.BonusSelectResult.BonusId, (int)req.QueueLocation);
|
||||
|
||||
if (req.MiracleSelectResult != null) await rogue.HandleMiracleSelect(req.MiracleSelectResult.MiracleSelectId);
|
||||
if (req.MiracleSelectResult != null) await rogue.HandleMiracleSelect(req.MiracleSelectResult.MiracleSelectId, (int)req.QueueLocation);
|
||||
|
||||
if (req.RogueTournFormulaResult != null && rogue is RogueTournInstance tournInstance)
|
||||
await tournInstance.HandleFormulaSelect((int)req.RogueTournFormulaResult.TournFormulaId);
|
||||
await tournInstance.HandleFormulaSelect((int)req.RogueTournFormulaResult.TournFormulaId, (int)req.QueueLocation);
|
||||
|
||||
if (req.MagicUnitSelectResult != null && rogue is RogueMagicInstance magic)
|
||||
await magic.HandleMagicUnitSelect(req.MagicUnitSelectResult.SelectMagicUnit);
|
||||
await magic.HandleMagicUnitSelect(req.MagicUnitSelectResult.SelectMagicUnit, (int)req.QueueLocation);
|
||||
|
||||
if (req.ScepterSelectResult != null && rogue is RogueMagicInstance magic2)
|
||||
await magic2.HandleScepterSelect(req.ScepterSelectResult.SelectScepter);
|
||||
await magic2.HandleScepterSelect(req.ScepterSelectResult.SelectScepter, (int)req.QueueLocation);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.RogueCommon;
|
||||
|
||||
public class PacketHandleRogueCommonPendingActionScRsp : BasePacket
|
||||
{
|
||||
public PacketHandleRogueCommonPendingActionScRsp(int queuePosition, bool selectBuff = false,
|
||||
public PacketHandleRogueCommonPendingActionScRsp(int queuePosition, int queueLocation, bool selectBuff = false,
|
||||
bool selectMiracle = false, bool selectBonus = false, bool selectFormula = false,
|
||||
bool reforgeBuff = false, bool selectMagicUnit = false, bool selectScepter = false,
|
||||
RogueBuffSelectMenu? menu = null) : base(
|
||||
@@ -14,7 +14,7 @@ public class PacketHandleRogueCommonPendingActionScRsp : BasePacket
|
||||
{
|
||||
var proto = new HandleRogueCommonPendingActionScRsp
|
||||
{
|
||||
QueueLocation = (uint)queuePosition,
|
||||
QueueLocation = (uint)queueLocation,
|
||||
QueuePosition = (uint)queuePosition
|
||||
};
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.RogueMagic;
|
||||
|
||||
public class PacketRogueMagicLevelInfoUpdateScNotify : BasePacket
|
||||
{
|
||||
public PacketRogueMagicLevelInfoUpdateScNotify(RogueMagicInstance instance, List<RogueMagicLevelInstance> levels) : base(CmdIds.RogueMagicLevelInfoUpdateScNotify)
|
||||
public PacketRogueMagicLevelInfoUpdateScNotify(RogueMagicInstance instance, List<RogueMagicLevelInstance> levels, List<int>? updateRoomIndexList = null) : base(CmdIds.RogueMagicLevelInfoUpdateScNotify)
|
||||
{
|
||||
var proto = new RogueMagicLevelInfoUpdateScNotify
|
||||
{
|
||||
Status = instance.LevelStatus,
|
||||
CurLevelIndex = (uint)(instance.CurLevel?.LevelIndex ?? 0),
|
||||
LevelInfoList = { levels.Select(x => x.ToProto()) }
|
||||
LevelInfoList = { levels.Select(x => x.ToProto(updateRoomIndexList)) }
|
||||
};
|
||||
|
||||
SetData(proto);
|
||||
|
||||
Reference in New Issue
Block a user