mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-12 15:04:36 +01:00
fix warnings
This commit is contained in:
@@ -8,15 +8,10 @@ using System.Text;
|
||||
namespace EpinelPS.Controllers
|
||||
{
|
||||
[Route("admin/Users")]
|
||||
public class UsersController : Controller
|
||||
public class UsersController(ILogger<AdminController> logger) : Controller
|
||||
{
|
||||
private readonly ILogger<AdminController> _logger;
|
||||
private static MD5 sha = MD5.Create();
|
||||
|
||||
public UsersController(ILogger<AdminController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
private readonly ILogger<AdminController> _logger = logger;
|
||||
private static readonly MD5 sha = MD5.Create();
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
@@ -30,11 +25,6 @@ namespace EpinelPS.Controllers
|
||||
{
|
||||
if (!AdminController.CheckAuth(HttpContext)) return Redirect("/admin/");
|
||||
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var user = JsonDb.Instance.Users.Where(x => x.ID == id).FirstOrDefault();
|
||||
if (user == null)
|
||||
{
|
||||
@@ -49,11 +39,6 @@ namespace EpinelPS.Controllers
|
||||
{
|
||||
if (!AdminController.CheckAuth(HttpContext)) return Redirect("/admin/");
|
||||
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var user = JsonDb.Instance.Users.Where(x => x.ID == id).FirstOrDefault();
|
||||
if (user == null)
|
||||
{
|
||||
@@ -71,7 +56,7 @@ namespace EpinelPS.Controllers
|
||||
[Route("SetPassword")]
|
||||
[HttpPost, ActionName("SetPassword")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> SetPasswordConfirm(ulong? id)
|
||||
public IActionResult SetPasswordConfirm(ulong? id)
|
||||
{
|
||||
if (!AdminController.CheckAuth(HttpContext)) return Redirect("/admin/");
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace EpinelPS.Database
|
||||
public string Location = "";
|
||||
public long Seq;
|
||||
public BadgeContents BadgeContent;
|
||||
public string BadgeGuid;
|
||||
public string BadgeGuid = "";
|
||||
|
||||
public Badge() {}
|
||||
public Badge(NetBadge badge)
|
||||
@@ -698,7 +698,7 @@ namespace EpinelPS.Database
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"User with ID {selectedUser.ID} not found");
|
||||
throw new Exception($"User not found");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,43 +28,43 @@ namespace EpinelPS.StaticInfo
|
||||
private MemoryStream ZipStream;
|
||||
|
||||
|
||||
private Dictionary<int, MainQuestCompletionRecord> questDataRecords = [];
|
||||
private Dictionary<int, CampaignStageRecord> stageDataRecords;
|
||||
private Dictionary<int, RewardTableRecord> rewardDataRecords;
|
||||
private Dictionary<int, UserExpRecord> userExpDataRecords;
|
||||
private Dictionary<int, CampaignChapterRecord> chapterCampaignData;
|
||||
private Dictionary<int, CharacterCostumeRecord> characterCostumeTable;
|
||||
public Dictionary<int, CharacterRecord> characterTable;
|
||||
public Dictionary<int, ClearedTutorialData> tutorialTable;
|
||||
public Dictionary<int, ItemEquipRecord> itemEquipTable;
|
||||
public Dictionary<int, ItemMaterialRecord> itemMaterialTable;
|
||||
public Dictionary<int, ItemEquipExpRecord> itemEquipExpTable;
|
||||
public Dictionary<int, ItemEquipGradeExpRecord> ItemEquipGradeExpTable;
|
||||
private Dictionary<string, JArray> FieldMapData = new Dictionary<string, JArray>(); // Fixed initialization
|
||||
private Dictionary<int, CharacterLevelData> LevelData = [];
|
||||
private Dictionary<int, TacticAcademyLessonRecord> TacticAcademyLessons = new Dictionary<int, TacticAcademyLessonRecord>(); // Fixed initialization
|
||||
public Dictionary<int, SideStoryStageRecord> SidestoryRewardTable = [];
|
||||
public Dictionary<string, int> PositionReward = new Dictionary<string, int>(); // Fixed initialization
|
||||
public Dictionary<int, FieldItemRecord> FieldItems = new Dictionary<int, FieldItemRecord>(); // Fixed initialization
|
||||
public Dictionary<int, OutpostBattleTableRecord> OutpostBattle = new Dictionary<int, OutpostBattleTableRecord>(); // Fixed initialization
|
||||
public Dictionary<int, JukeboxListRecord> jukeboxListDataRecords;
|
||||
private Dictionary<int, JukeboxThemeRecord> jukeboxThemeDataRecords;
|
||||
public Dictionary<int, GachaType> gachaTypes = new Dictionary<int, GachaType>(); // Fixed initialization
|
||||
public Dictionary<int, EventManager> eventManagers = new Dictionary<int, EventManager>();
|
||||
public Dictionary<int, LiveWallpaperRecord> lwptablemgrs = new Dictionary<int, LiveWallpaperRecord>(); // Fixed initialization
|
||||
public Dictionary<int, AlbumResourceRecord> albumResourceRecords = new Dictionary<int, AlbumResourceRecord>();
|
||||
public Dictionary<int, UserFrameTableRecord> userFrameTable = new Dictionary<int, UserFrameTableRecord>();
|
||||
public Dictionary<int, ArchiveRecordManagerRecord> archiveRecordManagerTable = new Dictionary<int, ArchiveRecordManagerRecord>();
|
||||
public Dictionary<int, ArchiveEventStoryRecord> archiveEventStoryRecords = new Dictionary<int, ArchiveEventStoryRecord>();
|
||||
public Dictionary<int, ArchiveEventQuestRecord> archiveEventQuestRecords = new Dictionary<int, ArchiveEventQuestRecord>();
|
||||
public Dictionary<int, ArchiveEventDungeonStageRecord> archiveEventDungeonStageRecords = new Dictionary<int, ArchiveEventDungeonStageRecord>();
|
||||
public Dictionary<int, UserTitleRecord> userTitleRecords = new Dictionary<int, UserTitleRecord>();
|
||||
public Dictionary<int, ArchiveMessengerConditionRecord> archiveMessengerConditionRecords = [];
|
||||
public Dictionary<int, CharacterStatRecord> characterStatTable = [];
|
||||
public Dictionary<int, SkillInfoRecord> skillInfoTable = [];
|
||||
public Dictionary<int, CostRecord> costTable = [];
|
||||
public Dictionary<string, MidasProductRecord> mediasProductTable = [];
|
||||
public Dictionary<int, TowerRecord> towerTable = [];
|
||||
private readonly Dictionary<int, MainQuestCompletionRecord> questDataRecords = [];
|
||||
private readonly Dictionary<int, CampaignStageRecord> stageDataRecords = [];
|
||||
private readonly Dictionary<int, RewardTableRecord> rewardDataRecords = [];
|
||||
private readonly Dictionary<int, UserExpRecord> userExpDataRecords = [];
|
||||
private readonly Dictionary<int, CampaignChapterRecord> chapterCampaignData = [];
|
||||
private readonly Dictionary<int, CharacterCostumeRecord> characterCostumeTable = [];
|
||||
public readonly Dictionary<int, CharacterRecord> characterTable = [];
|
||||
public readonly Dictionary<int, ClearedTutorialData> tutorialTable = [];
|
||||
public readonly Dictionary<int, ItemEquipRecord> itemEquipTable = [];
|
||||
public readonly Dictionary<int, ItemMaterialRecord> itemMaterialTable = [];
|
||||
public readonly Dictionary<int, ItemEquipExpRecord> itemEquipExpTable = [];
|
||||
public readonly Dictionary<int, ItemEquipGradeExpRecord> ItemEquipGradeExpTable = [];
|
||||
private readonly Dictionary<string, JArray> FieldMapData = [];
|
||||
private readonly Dictionary<int, CharacterLevelData> LevelData = [];
|
||||
private readonly Dictionary<int, TacticAcademyLessonRecord> TacticAcademyLessons = [];
|
||||
public readonly Dictionary<int, SideStoryStageRecord> SidestoryRewardTable = [];
|
||||
public readonly Dictionary<string, int> PositionReward = [];
|
||||
public readonly Dictionary<int, FieldItemRecord> FieldItems = [];
|
||||
public readonly Dictionary<int, OutpostBattleTableRecord> OutpostBattle = [];
|
||||
public readonly Dictionary<int, JukeboxListRecord> jukeboxListDataRecords = [];
|
||||
private readonly Dictionary<int, JukeboxThemeRecord> jukeboxThemeDataRecords = [];
|
||||
public readonly Dictionary<int, GachaType> gachaTypes = [];
|
||||
public readonly Dictionary<int, EventManager> eventManagers = [];
|
||||
public readonly Dictionary<int, LiveWallpaperRecord> lwptablemgrs = [];
|
||||
public readonly Dictionary<int, AlbumResourceRecord> albumResourceRecords = [];
|
||||
public readonly Dictionary<int, UserFrameTableRecord> userFrameTable = [];
|
||||
public readonly Dictionary<int, ArchiveRecordManagerRecord> archiveRecordManagerTable = [];
|
||||
public readonly Dictionary<int, ArchiveEventStoryRecord> archiveEventStoryRecords = [];
|
||||
public readonly Dictionary<int, ArchiveEventQuestRecord> archiveEventQuestRecords = [];
|
||||
public readonly Dictionary<int, ArchiveEventDungeonStageRecord> archiveEventDungeonStageRecords = [];
|
||||
public readonly Dictionary<int, UserTitleRecord> userTitleRecords = [];
|
||||
public readonly Dictionary<int, ArchiveMessengerConditionRecord> archiveMessengerConditionRecords = [];
|
||||
public readonly Dictionary<int, CharacterStatRecord> characterStatTable = [];
|
||||
public readonly Dictionary<int, SkillInfoRecord> skillInfoTable = [];
|
||||
public readonly Dictionary<int, CostRecord> costTable = [];
|
||||
public readonly Dictionary<string, MidasProductRecord> mediasProductTable = [];
|
||||
public readonly Dictionary<int, TowerRecord> towerTable = [];
|
||||
|
||||
|
||||
|
||||
@@ -91,26 +91,6 @@ namespace EpinelPS.StaticInfo
|
||||
|
||||
// disable warnings
|
||||
ZipStream = new();
|
||||
questDataRecords = [];
|
||||
stageDataRecords = [];
|
||||
rewardDataRecords = [];
|
||||
userExpDataRecords = [];
|
||||
chapterCampaignData = [];
|
||||
characterCostumeTable = [];
|
||||
characterTable = [];
|
||||
tutorialTable = [];
|
||||
itemEquipTable = [];
|
||||
itemMaterialTable = [];
|
||||
itemEquipExpTable = [];
|
||||
ItemEquipGradeExpTable = [];
|
||||
characterStatTable = [];
|
||||
skillInfoTable = [];
|
||||
costTable = [];
|
||||
|
||||
// Initialize Jukebox data dictionaries
|
||||
jukeboxListDataRecords = [];
|
||||
jukeboxThemeDataRecords = [];
|
||||
archiveMessengerConditionRecords = [];
|
||||
|
||||
var rawBytes = File.ReadAllBytes(filePath);
|
||||
Sha256Hash = SHA256.HashData(rawBytes);
|
||||
@@ -276,24 +256,13 @@ namespace EpinelPS.StaticInfo
|
||||
return records;
|
||||
}
|
||||
|
||||
int totalFiles = 78;
|
||||
int totalFiles = 90;
|
||||
int currentFile = 0;
|
||||
|
||||
public async Task Parse()
|
||||
{
|
||||
using var progress = new ProgressBar();
|
||||
|
||||
var fieldsWhereGameData = GetType().GetProperties().Where(x => x.GetCustomAttribute<GameDataFileAttribute>() != null);
|
||||
totalFiles = fieldsWhereGameData.Count();
|
||||
|
||||
foreach (var attribs in fieldsWhereGameData)
|
||||
{
|
||||
var attrib = attribs.GetCustomAttribute<GameDataFileAttribute>();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
var questDataRecords = await LoadZip<MainQuestCompletionTable>("MainQuestTable.json", progress);
|
||||
foreach (var obj in questDataRecords.records)
|
||||
{
|
||||
@@ -393,6 +362,7 @@ namespace EpinelPS.StaticInfo
|
||||
var items = x[0]["ItemSpawner"];
|
||||
|
||||
if (items != null)
|
||||
{
|
||||
foreach (var item2 in items)
|
||||
{
|
||||
var posId = item2["positionId"] ?? throw new Exception("positionId cannot be null");
|
||||
@@ -403,6 +373,7 @@ namespace EpinelPS.StaticInfo
|
||||
|
||||
PositionReward.TryAdd(id, reward);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var fieldItems = await LoadZip<FieldItemTable>("FieldItemTable.json", progress);
|
||||
@@ -532,11 +503,6 @@ namespace EpinelPS.StaticInfo
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<int, JukeboxListRecord> GetJukeboxListDataRecords()
|
||||
{
|
||||
return jukeboxListDataRecords;
|
||||
}
|
||||
|
||||
public MainQuestCompletionRecord? GetMainQuestForStageClearCondition(int stage)
|
||||
{
|
||||
foreach (var item in questDataRecords)
|
||||
|
||||
@@ -176,17 +176,17 @@
|
||||
public class ItemEquipRecord
|
||||
{
|
||||
public int id;
|
||||
public string name_localkey;
|
||||
public string description_localkey;
|
||||
public string resource_id;
|
||||
public string item_type;
|
||||
public string item_sub_type;
|
||||
public string @class;
|
||||
public string item_rare;
|
||||
public string name_localkey = "";
|
||||
public string description_localkey = "";
|
||||
public string resource_id = "";
|
||||
public string item_type = "";
|
||||
public string item_sub_type = "";
|
||||
public string @class = "";
|
||||
public string item_rare = "";
|
||||
public int grade_core_id;
|
||||
public int grow_grade;
|
||||
public List<Stat> stat;
|
||||
public List<OptionSlot> option_slot;
|
||||
public List<Stat> stat = null!;
|
||||
public List<OptionSlot> option_slot = null!;
|
||||
public int option_cost;
|
||||
public int option_change_cost;
|
||||
public int option_lock_cost;
|
||||
@@ -606,7 +606,7 @@
|
||||
public int id;
|
||||
public int level;
|
||||
public int exp;
|
||||
public string item_rare;
|
||||
public string item_rare = "";
|
||||
public int grade_core_id;
|
||||
}
|
||||
|
||||
@@ -619,7 +619,7 @@
|
||||
{
|
||||
public int id;
|
||||
public int exp;
|
||||
public string item_rare;
|
||||
public string item_rare = "";
|
||||
public int grade_core_id;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace EpinelPS.LobbyServer.Character
|
||||
var targetCharacter = user.GetCharacterBySerialNumber(req.Csn);
|
||||
|
||||
// Find the element with the current csn from the request
|
||||
var currentCharacter = fullchardata.FirstOrDefault(c => c.id == targetCharacter.Tid);
|
||||
var currentCharacter = fullchardata.FirstOrDefault(c => c.id == targetCharacter.Tid) ?? throw new NullReferenceException();
|
||||
|
||||
if (currentCharacter != null && targetCharacter != null)
|
||||
{
|
||||
@@ -55,7 +55,7 @@ namespace EpinelPS.LobbyServer.Character
|
||||
};
|
||||
|
||||
// remove spare body item
|
||||
var bodyItem = user.Items.FirstOrDefault(i => i.Isn == req.Isn);
|
||||
var bodyItem = user.Items.FirstOrDefault(i => i.Isn == req.Isn) ?? throw new NullReferenceException();
|
||||
user.RemoveItemBySerialNumber(req.Isn, 1);
|
||||
response.Items.Add(NetUtils.ToNet(bodyItem));
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace EpinelPS.LobbyServer.Character
|
||||
|
||||
foreach (var cost in costRecord.costs.Where(i => i.item_type != "None"))
|
||||
{
|
||||
var item = user.Items.FirstOrDefault(i => i.ItemType == cost.item_id);
|
||||
var item = user.Items.FirstOrDefault(i => i.ItemType == cost.item_id) ?? throw new NullReferenceException();
|
||||
|
||||
item.Count -= cost.item_value;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace EpinelPS.LobbyServer.Character
|
||||
// Get all character data from the game's character table
|
||||
var fullchardata = GameData.Instance.characterTable.Values.ToList();
|
||||
|
||||
var targetCharacter = user.GetCharacterBySerialNumber(req.Csn);
|
||||
var targetCharacter = user.GetCharacterBySerialNumber(req.Csn) ?? throw new NullReferenceException();
|
||||
|
||||
// Find the element with the current csn from the request
|
||||
var currentCharacter = fullchardata.FirstOrDefault(c => c.id == targetCharacter.Tid);
|
||||
@@ -56,7 +56,7 @@ namespace EpinelPS.LobbyServer.Character
|
||||
};
|
||||
|
||||
// remove spare body item
|
||||
var bodyItem = user.Items.FirstOrDefault(i => i.Isn == req.Isn);
|
||||
var bodyItem = user.Items.FirstOrDefault(i => i.Isn == req.Isn) ?? throw new NullReferenceException();
|
||||
user.RemoveItemBySerialNumber(req.Isn, 1);
|
||||
response.Items.Add(NetUtils.ToNet(bodyItem));
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace EpinelPS.LobbyServer.Event
|
||||
|
||||
// Retrieve collected objects
|
||||
|
||||
if (!user.FieldInfoNew.TryGetValue(req.MapId, out FieldInfoNew field))
|
||||
if (!user.FieldInfoNew.TryGetValue(req.MapId, out FieldInfoNew? field))
|
||||
{
|
||||
field = new FieldInfoNew();
|
||||
user.FieldInfoNew.Add(req.MapId, field);
|
||||
@@ -35,7 +35,7 @@ namespace EpinelPS.LobbyServer.Event
|
||||
|
||||
|
||||
// Retrieve camera data
|
||||
if (user.MapJson.TryGetValue(req.MapId, out string mapJson))
|
||||
if (user.MapJson.TryGetValue(req.MapId, out string? mapJson))
|
||||
{
|
||||
response.Json = mapJson;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace EpinelPS.LobbyServer.Event.StoryEvent
|
||||
var user = GetUser();
|
||||
|
||||
|
||||
if (!user.EventInfo.TryGetValue(evid, out EventData eventData))
|
||||
if (!user.EventInfo.TryGetValue(evid, out EventData? eventData))
|
||||
{
|
||||
eventData = new();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace EpinelPS.LobbyServer.Inventory
|
||||
[PacketPath("/inventory/increaseexpequipment")]
|
||||
public class IncreaseEquipmentExp : LobbyMsgHandler
|
||||
{
|
||||
readonly Dictionary<int, int> boostExpTable = new Dictionary<int, int>
|
||||
readonly Dictionary<int, int> boostExpTable = new()
|
||||
{
|
||||
{ 7010001, 100 },
|
||||
{ 7010002, 1000 },
|
||||
@@ -19,13 +19,13 @@ namespace EpinelPS.LobbyServer.Inventory
|
||||
var req = await ReadData<ReqIncreaseExpEquip>();
|
||||
var user = GetUser();
|
||||
var response = new ResIncreaseExpEquip();
|
||||
var destItem = user.Items.FirstOrDefault(x => x.Isn == req.Isn);
|
||||
var destItem = user.Items.FirstOrDefault(x => x.Isn == req.Isn) ?? throw new NullReferenceException();;
|
||||
int goldCost = 0;
|
||||
int modules = 0;
|
||||
|
||||
foreach (var srcItem in req.ItemList)
|
||||
{
|
||||
var item = user.Items.FirstOrDefault(x => x.Isn == srcItem.Isn);
|
||||
var item = user.Items.FirstOrDefault(x => x.Isn == srcItem.Isn) ?? throw new NullReferenceException();;
|
||||
item.Count -= srcItem.Count;
|
||||
|
||||
(int addedExp, int addedModules) = AddExp(srcItem, destItem);
|
||||
@@ -67,20 +67,19 @@ namespace EpinelPS.LobbyServer.Inventory
|
||||
|
||||
(int exp, int modules) AddExp(NetItemData srcItem, ItemData destItem)
|
||||
{
|
||||
int[] maxLevel = { 0, 0, 3, 3, 4, 4, 5, 5, 5, 5 };
|
||||
int[] maxLevel = [0, 0, 3, 3, 4, 4, 5, 5, 5, 5];
|
||||
var srcEquipRecord = GameData.Instance.itemEquipTable.Values.FirstOrDefault(x => x.id == srcItem.Tid);
|
||||
var destEquipRecord = GameData.Instance.itemEquipTable.Values.FirstOrDefault(x => x.id == destItem.ItemType);
|
||||
int[] expNextTable = GameData.Instance.itemEquipExpTable.Values
|
||||
var destEquipRecord = GameData.Instance.itemEquipTable.Values.FirstOrDefault(x => x.id == destItem.ItemType) ?? throw new NullReferenceException();;
|
||||
int[] expNextTable = [.. GameData.Instance.itemEquipExpTable.Values
|
||||
.Where(x => x.item_rare == destEquipRecord.item_rare)
|
||||
.Select(x => x.exp)
|
||||
.OrderBy(x => x) // order from lowest to highest
|
||||
.ToArray();
|
||||
.OrderBy(x => x)];
|
||||
int exp = 0;
|
||||
int modules = 0;
|
||||
|
||||
if (srcEquipRecord != null)
|
||||
{
|
||||
var levelRecord = GameData.Instance.ItemEquipGradeExpTable.Values.FirstOrDefault(x => x.grade_core_id == srcEquipRecord.grade_core_id);
|
||||
var levelRecord = GameData.Instance.ItemEquipGradeExpTable.Values.FirstOrDefault(x => x.grade_core_id == srcEquipRecord.grade_core_id) ?? throw new NullReferenceException();;
|
||||
|
||||
exp = srcItem.Count * levelRecord.exp;
|
||||
|
||||
@@ -118,10 +117,10 @@ namespace EpinelPS.LobbyServer.Inventory
|
||||
return (exp, modules);
|
||||
}
|
||||
|
||||
int GetSourceExp(NetItemData srcItem)
|
||||
private int GetSourceExp(NetItemData srcItem)
|
||||
{
|
||||
var item = GetUser().Items.FirstOrDefault(x => x.Isn == srcItem.Isn);
|
||||
var equipRecord = GameData.Instance.itemEquipTable.Values.FirstOrDefault(x => x.id == item.ItemType);
|
||||
var item = GetUser().Items.FirstOrDefault(x => x.Isn == srcItem.Isn) ?? throw new NullReferenceException();
|
||||
var equipRecord = GameData.Instance.itemEquipTable.Values.FirstOrDefault(x => x.id == item.ItemType) ?? throw new NullReferenceException();
|
||||
var levelRecord = GameData.Instance.ItemEquipGradeExpTable.Values.FirstOrDefault(x => x.grade_core_id == equipRecord.grade_core_id);
|
||||
int[] expNextTable = GameData.Instance.itemEquipExpTable.Values
|
||||
.Where(x => x.item_rare == equipRecord.item_rare)
|
||||
@@ -138,10 +137,10 @@ namespace EpinelPS.LobbyServer.Inventory
|
||||
return exp;
|
||||
}
|
||||
|
||||
int CalcTotalExp(ItemData destItem)
|
||||
private static int CalcTotalExp(ItemData destItem)
|
||||
{
|
||||
int exp = 0;
|
||||
var equipRecord = GameData.Instance.itemEquipTable.Values.FirstOrDefault(x => x.id == destItem.ItemType);
|
||||
var equipRecord = GameData.Instance.itemEquipTable.Values.FirstOrDefault(x => x.id == destItem.ItemType) ?? throw new NullReferenceException();
|
||||
var levelRecord = GameData.Instance.ItemEquipGradeExpTable.Values.FirstOrDefault(x => x.grade_core_id == equipRecord.grade_core_id);
|
||||
int[] expNextTable = GameData.Instance.itemEquipExpTable.Values
|
||||
.Where(x => x.item_rare == equipRecord.item_rare)
|
||||
|
||||
@@ -40,7 +40,10 @@ namespace EpinelPS.LobbyServer
|
||||
public static async Task DispatchSingle(HttpContext ctx)
|
||||
{
|
||||
LobbyMsgHandler? handler = null;
|
||||
string path = ctx.Request.Path.Value.Replace("/v1", "");
|
||||
|
||||
string fullPath = ctx.Request.Path.Value ?? throw new Exception();
|
||||
string path = fullPath.Replace("/v1", "");
|
||||
|
||||
foreach (var item in Handlers)
|
||||
{
|
||||
if (path == item.Key)
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace EpinelPS.LobbyServer
|
||||
public async Task HandleAsync(HttpContext ctx)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
if (ctx.Request.Headers.Keys.Contains("Authorization"))
|
||||
if (ctx.Request.Headers.ContainsKey("Authorization"))
|
||||
{
|
||||
var token = ctx.Request.Headers.Authorization.FirstOrDefault();
|
||||
if (token != null)
|
||||
@@ -46,7 +46,7 @@ namespace EpinelPS.LobbyServer
|
||||
|
||||
var encryptionToken = new PasetoBuilder().Use(ProtocolVersion.V4, Purpose.Local)
|
||||
.WithKey(JsonDb.Instance.LauncherTokenKey, Encryption.SymmetricKey)
|
||||
.Decode(authToken, new PasetoTokenValidationParameters() { ValidateLifetime = true});
|
||||
.Decode(authToken, new PasetoTokenValidationParameters() { ValidateLifetime = true });
|
||||
|
||||
UserId = ((System.Text.Json.JsonElement)encryptionToken.Paseto.Payload["userid"]).GetUInt64();
|
||||
|
||||
@@ -57,10 +57,11 @@ namespace EpinelPS.LobbyServer
|
||||
protected abstract Task HandleAsync();
|
||||
|
||||
|
||||
private void PrintMessage<T>(T data) where T : IMessage, new()
|
||||
private static void PrintMessage<T>(T data) where T : IMessage, new()
|
||||
{
|
||||
var str = (string)data.GetType().InvokeMember("ToString", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.InvokeMethod, null, data, null);
|
||||
Console.WriteLine(str);
|
||||
var str = (string?)data.GetType().InvokeMember("ToString", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.InvokeMethod, null, data, null);
|
||||
if (str != null)
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
protected async Task WriteDataAsync<T>(T data) where T : IMessage, new()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using EpinelPS.Database;
|
||||
using EpinelPS.Utils;
|
||||
using EpinelPS.StaticInfo;
|
||||
using EpinelPS.LobbyServer.Stage;
|
||||
|
||||
namespace EpinelPS.LobbyServer.Tower
|
||||
{
|
||||
@@ -23,11 +22,11 @@ namespace EpinelPS.LobbyServer.Tower
|
||||
await WriteDataAsync(response);
|
||||
}
|
||||
|
||||
public static ResClearTower CompleteTower(Database.User user, int TowerId)
|
||||
public static ResClearTower CompleteTower(User user, int TowerId)
|
||||
{
|
||||
var response = new ResClearTower();
|
||||
|
||||
if (!GameData.Instance.towerTable.TryGetValue(TowerId, out TowerRecord record)) throw new Exception("unable to find tower with id " + TowerId);
|
||||
if (!GameData.Instance.towerTable.TryGetValue(TowerId, out TowerRecord? record)) throw new Exception("unable to find tower with id " + TowerId);
|
||||
|
||||
// Parse TowerId to get TowerType and FloorNumber
|
||||
int TowerType = (TowerId / 10000) - 1; // For some weird reason the Type here doesn't match up with NetTowerData, thus the -1
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace EpinelPS
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static async Task Main(string[] args)
|
||||
static void Main(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -195,6 +195,7 @@ namespace EpinelPS
|
||||
Console.Write(prompt);
|
||||
|
||||
var input = Console.ReadLine();
|
||||
if (input == null) break;
|
||||
var args = input.Split(' ');
|
||||
if (string.IsNullOrEmpty(input) || string.IsNullOrWhiteSpace(input))
|
||||
{
|
||||
|
||||
@@ -26,12 +26,10 @@ namespace EpinelPS.Utils
|
||||
Console.WriteLine("Unknown user level value for xp " + newXp);
|
||||
}
|
||||
|
||||
bool leveled = false;
|
||||
int newGems = 0;
|
||||
|
||||
while (newXp >= newLevelExp)
|
||||
{
|
||||
leveled = true;
|
||||
newLevel++;
|
||||
newGems += 30;
|
||||
newXp -= newLevelExp;
|
||||
|
||||
Reference in New Issue
Block a user