mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-02 20:26:03 +08:00
fix: tourn rogue room id
This commit is contained in:
@@ -12,6 +12,26 @@ public static class TournRoomGenerator
|
||||
public static List<int> AllowedFloorIdList { get; set; } = [80601001, 80602001, 80603001, 80604001];
|
||||
public static List<RogueTournRoomConfig> SavedRoomInstanceList { get; set; } = [];
|
||||
|
||||
#region Prefix
|
||||
|
||||
public static Dictionary<RogueTournRoomTypeEnum, List<int>> RoomPrefix { get; set; } = new()
|
||||
{
|
||||
{ RogueTournRoomTypeEnum.Battle, [0, 120300000, 1120300000] },
|
||||
{ RogueTournRoomTypeEnum.Event, [620500000, 320500000, 1120500000] },
|
||||
{ RogueTournRoomTypeEnum.Encounter, [420400000, 120400000, 0] },
|
||||
{ RogueTournRoomTypeEnum.Reward, [420800000, 120800000, 0] },
|
||||
{ RogueTournRoomTypeEnum.Coin, [620600000, 0, 0] } // 20
|
||||
};
|
||||
|
||||
public static Dictionary<RogueTournRoomTypeEnum, List<int>> RoomFloorDiffPrefix { get; set; } = new()
|
||||
{
|
||||
{ RogueTournRoomTypeEnum.Boss, [320100000, 320100000, 220100000, 220100000] },
|
||||
{ RogueTournRoomTypeEnum.Respite, [321000000, 321000000, 221000000, 221000000] }, // 20
|
||||
{ RogueTournRoomTypeEnum.Elite, [320200000, 320200000, 220200000, 220200000] },
|
||||
{ RogueTournRoomTypeEnum.Shop, [320700000, 320700000, 220700000, 220700000] } // 20
|
||||
};
|
||||
|
||||
#endregion
|
||||
public static void GenerateFile(string path)
|
||||
{
|
||||
// get floor info
|
||||
@@ -31,7 +51,7 @@ public static class TournRoomGenerator
|
||||
{
|
||||
if (areaGroupId > 0 && baseModuleId > 0 && contentGroupId.Count > 0)
|
||||
foreach (var group in contentGroupId)
|
||||
FlushRoom(GameData.MapEntranceData.First(x => x.Value.FloorID == floorId).Key, areaGroupId,
|
||||
FlushRoom(GameData.MapEntranceData.First(x => x.Value.FloorID == floorId).Key, floorId, areaGroupId,
|
||||
baseModuleId, group.Value, group.Key);
|
||||
|
||||
contentGroupId.Clear();
|
||||
@@ -44,7 +64,7 @@ public static class TournRoomGenerator
|
||||
{
|
||||
if (areaGroupId > 0 && baseModuleId > 0 && contentGroupId.Count > 0)
|
||||
foreach (var group in contentGroupId)
|
||||
FlushRoom(GameData.MapEntranceData.First(x => x.Value.FloorID == floorId).Key, areaGroupId,
|
||||
FlushRoom(GameData.MapEntranceData.First(x => x.Value.FloorID == floorId).Key, floorId, areaGroupId,
|
||||
baseModuleId, group.Value, group.Key);
|
||||
|
||||
contentGroupId.Clear();
|
||||
@@ -98,6 +118,10 @@ public static class TournRoomGenerator
|
||||
}
|
||||
}
|
||||
|
||||
// clear old file
|
||||
if (File.Exists(path))
|
||||
File.WriteAllText(path, "", Encoding.UTF8);
|
||||
|
||||
// save
|
||||
File.AppendAllText(path, JsonConvert.SerializeObject(SavedRoomInstanceList, Formatting.Indented),
|
||||
Encoding.UTF8);
|
||||
@@ -106,9 +130,22 @@ public static class TournRoomGenerator
|
||||
Logger.GetByClassName().Info($"Generated in {path} Successfully!");
|
||||
}
|
||||
|
||||
public static void FlushRoom(int entranceId, int areaGroupId, int baseGroupId, List<int> contentGroupIds,
|
||||
public static void FlushRoom(int entranceId, int floorId, int areaGroupId, int baseGroupId, List<int> contentGroupIds,
|
||||
RogueTournRoomTypeEnum type)
|
||||
{
|
||||
var prefix = RoomPrefix.GetValueOrDefault(type)?.LastOrDefault(x => x != 0);
|
||||
if (prefix == null)
|
||||
prefix = RoomFloorDiffPrefix.GetValueOrDefault(type)?[AllowedFloorIdList.IndexOf(floorId)];
|
||||
|
||||
var entryIdSuffix = entranceId % 1000;
|
||||
var roomId = prefix + entryIdSuffix * 100 + 20;
|
||||
if (roomId == null)
|
||||
{
|
||||
roomId = 0;
|
||||
Logger.GetByClassName().Error(
|
||||
$"Cannot find prefix for RoomType {type} at Floor {floorId} (EntranceId {entranceId})");
|
||||
}
|
||||
|
||||
SavedRoomInstanceList.Add(new RogueTournRoomConfig
|
||||
{
|
||||
AnchorGroup = baseGroupId,
|
||||
@@ -116,7 +153,8 @@ public static class TournRoomGenerator
|
||||
DefaultLoadBasicGroup = { areaGroupId, baseGroupId },
|
||||
DefaultLoadGroup = contentGroupIds,
|
||||
EntranceId = entranceId,
|
||||
RoomType = type
|
||||
RoomType = type,
|
||||
//RoomId = (uint)roomId
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user