mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-12 15:04:36 +01:00
Fix compiler warnings
This commit is contained in:
@@ -55,6 +55,12 @@ namespace EpinelPS.Controllers
|
||||
User user = res.Item1;
|
||||
AccessToken? tok = res.Item2;
|
||||
|
||||
if (tok == null)
|
||||
{
|
||||
// TODO: better error handling
|
||||
return "{}";
|
||||
}
|
||||
|
||||
// Pretend that code is valid
|
||||
return "{\"account_type\":1,\"birthday\":\"1970-01\",\"email\":\"" + user.Username + "\",\"expire\":" + tok.ExpirationTime + ",\"is_receive_email\":1,\"is_receive_email_in_night\":0,\"is_receive_video\":-1,\"lang_type\":\"en\",\"msg\":\"Success\",\"nick_name\":\"\",\"phone\":\"\",\"phone_area_code\":\"\",\"privacy_policy\":\"1\",\"privacy_update_time\":1717783097,\"region\":\"724\",\"ret\":0,\"seq\":\"" + seq + "\",\"terms_of_service\":\"\",\"terms_update_time\":0,\"uid\":\"" + user.ID + "\",\"user_agreed_dt\":\"\",\"user_agreed_pp\":\"1\",\"user_agreed_tos\":\"\",\"user_name\":\"" + user.PlayerName + "\",\"username_pass_verify\":0}";
|
||||
}
|
||||
@@ -102,9 +108,12 @@ namespace EpinelPS.Controllers
|
||||
public static AccessToken CreateLauncherTokenForUser(User user)
|
||||
{
|
||||
// TODO: implement access token expiration
|
||||
AccessToken token = new() { ExpirationTime = DateTimeOffset.UtcNow.AddYears(1).ToUnixTimeSeconds() };
|
||||
token.Token = Rng.RandomString(64);
|
||||
token.UserID = user.ID;
|
||||
AccessToken token = new()
|
||||
{
|
||||
ExpirationTime = DateTimeOffset.UtcNow.AddYears(1).ToUnixTimeSeconds(),
|
||||
Token = Rng.RandomString(64),
|
||||
UserID = user.ID
|
||||
};
|
||||
JsonDb.Instance.LauncherAccessTokens.Add(token);
|
||||
JsonDb.Save();
|
||||
|
||||
|
||||
@@ -91,6 +91,11 @@ namespace EpinelPS.Controllers
|
||||
[Route("fleet.repo.game.RepoSVC/GetVersion")]
|
||||
public string LauncherGetVersion([FromBody] LauncherVersionRequest? body)
|
||||
{
|
||||
if (body == null)
|
||||
{
|
||||
return "{}";
|
||||
}
|
||||
|
||||
Console.WriteLine("Requesting gameId: " + body.game_id);
|
||||
return System.IO.File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "gameversion.json"));
|
||||
}
|
||||
|
||||
@@ -84,25 +84,25 @@ namespace EpinelPS.StaticInfo
|
||||
if (!File.Exists(filePath)) throw new ArgumentException("Static data file must exist", nameof(filePath));
|
||||
|
||||
// disable warnings
|
||||
questDataRecords = new();
|
||||
stageDataRecords = new();
|
||||
rewardDataRecords = new();
|
||||
userExpDataRecords = new();
|
||||
chapterCampaignData = new();
|
||||
characterCostumeTable = new();
|
||||
characterTable = new();
|
||||
ZipStream = new();
|
||||
tutorialTable = new();
|
||||
itemEquipTable = new();
|
||||
itemMaterialTable = new();
|
||||
characterStatTable = new();
|
||||
skillInfoTable = new();
|
||||
costTable = new();
|
||||
questDataRecords = [];
|
||||
stageDataRecords = [];
|
||||
rewardDataRecords = [];
|
||||
userExpDataRecords = [];
|
||||
chapterCampaignData = [];
|
||||
characterCostumeTable = [];
|
||||
characterTable = [];
|
||||
tutorialTable = [];
|
||||
itemEquipTable = [];
|
||||
itemMaterialTable = [];
|
||||
characterStatTable = [];
|
||||
skillInfoTable = [];
|
||||
costTable = [];
|
||||
|
||||
// Initialize Jukebox data dictionaries
|
||||
jukeboxListDataRecords = new Dictionary<int, JukeboxListRecord>();
|
||||
jukeboxThemeDataRecords = new Dictionary<int, JukeboxThemeRecord>();
|
||||
archiveMessengerConditionRecords = new Dictionary<int, ArchiveMessengerConditionRecord>();
|
||||
jukeboxListDataRecords = [];
|
||||
jukeboxThemeDataRecords = [];
|
||||
archiveMessengerConditionRecords = [];
|
||||
|
||||
var rawBytes = File.ReadAllBytes(filePath);
|
||||
Sha256Hash = SHA256.HashData(rawBytes);
|
||||
@@ -240,10 +240,8 @@ namespace EpinelPS.StaticInfo
|
||||
|
||||
private async Task<T> LoadZip<T>(string entry, ProgressBar bar)
|
||||
{
|
||||
var mainQuestData = MainZip.GetEntry(entry);
|
||||
if (mainQuestData == null) throw new Exception(entry + " does not exist in static data");
|
||||
|
||||
using StreamReader mainQuestReader = new StreamReader(MainZip.GetInputStream(mainQuestData));
|
||||
var mainQuestData = MainZip.GetEntry(entry) ?? throw new Exception(entry + " does not exist in static data");
|
||||
using StreamReader mainQuestReader = new(MainZip.GetInputStream(mainQuestData));
|
||||
var mainQuestDataString = await mainQuestReader.ReadToEndAsync();
|
||||
|
||||
var questdata = JsonConvert.DeserializeObject<T>(mainQuestDataString);
|
||||
@@ -257,18 +255,12 @@ namespace EpinelPS.StaticInfo
|
||||
|
||||
private async Task<JArray> LoadZip(string entry, ProgressBar bar)
|
||||
{
|
||||
var mainQuestData = MainZip.GetEntry(entry);
|
||||
if (mainQuestData == null) throw new Exception(entry + " does not exist in static data");
|
||||
|
||||
using StreamReader mainQuestReader = new StreamReader(MainZip.GetInputStream(mainQuestData));
|
||||
var mainQuestData = MainZip.GetEntry(entry) ?? throw new Exception(entry + " does not exist in static data");
|
||||
using StreamReader mainQuestReader = new(MainZip.GetInputStream(mainQuestData));
|
||||
var mainQuestDataString = await mainQuestReader.ReadToEndAsync();
|
||||
|
||||
var questdata = JObject.Parse(mainQuestDataString);
|
||||
if (questdata == null) throw new Exception("failed to parse " + entry);
|
||||
|
||||
var records = (JArray?)questdata["records"];
|
||||
if (records == null) throw new Exception(entry + " is missing records element");
|
||||
|
||||
JObject questdata = JObject.Parse(mainQuestDataString) ?? throw new Exception("failed to parse " + entry);
|
||||
JArray? records = (JArray?)questdata["records"] ?? throw new Exception(entry + " is missing records element");
|
||||
currentFile++;
|
||||
|
||||
bar.Report((double)currentFile / totalFiles);
|
||||
@@ -380,11 +372,13 @@ namespace EpinelPS.StaticInfo
|
||||
if (items != null)
|
||||
foreach (var item2 in items)
|
||||
{
|
||||
var id = item2["positionId"].ToObject<string>();
|
||||
var reward = item2["itemId"].ToObject<int>();
|
||||
var posId = item2["positionId"] ?? throw new Exception("positionId cannot be null");
|
||||
var rewardObj = item2["itemId"] ?? throw new Exception("itemId cannot be null");
|
||||
|
||||
if (!PositionReward.ContainsKey(id))
|
||||
PositionReward.Add(id, reward);
|
||||
var id = posId.ToObject<string>() ?? throw new Exception("positionId cannot be null");
|
||||
var reward = rewardObj.ToObject<int>();
|
||||
|
||||
PositionReward.TryAdd(id, reward);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
}
|
||||
public class MainQuestCompletionTable
|
||||
{
|
||||
public List<MainQuestCompletionRecord> records;
|
||||
public List<MainQuestCompletionRecord> records = [];
|
||||
}
|
||||
public class CampaignStageRecord
|
||||
{
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
public class CampaignStageTable
|
||||
{
|
||||
public List<CampaignStageRecord> records;
|
||||
public List<CampaignStageRecord> records = [];
|
||||
}
|
||||
public class RewardTableRecord
|
||||
{
|
||||
@@ -41,7 +41,7 @@
|
||||
}
|
||||
public class RewardTable
|
||||
{
|
||||
public List<RewardTableRecord> records;
|
||||
public List<RewardTableRecord> records = [];
|
||||
}
|
||||
|
||||
public class RewardEntry
|
||||
@@ -68,7 +68,7 @@
|
||||
}
|
||||
public class TutorialTable
|
||||
{
|
||||
public List<ClearedTutorialData> records;
|
||||
public List<ClearedTutorialData> records = [];
|
||||
}
|
||||
|
||||
public class CharacterLevelData
|
||||
@@ -112,117 +112,117 @@
|
||||
|
||||
public class TacticAcademyLessonTable
|
||||
{
|
||||
public List<TacticAcademyLessonRecord> records;
|
||||
public List<TacticAcademyLessonRecord> records = [];
|
||||
}
|
||||
|
||||
public class CampaignChapterRecord
|
||||
{
|
||||
public int id;
|
||||
public int chapter;
|
||||
public string field_id;
|
||||
public string hard_field_id;
|
||||
public string field_id = "";
|
||||
public string hard_field_id = "";
|
||||
}
|
||||
public class CampaignChapterTable
|
||||
{
|
||||
public List<CampaignChapterRecord> records;
|
||||
public List<CampaignChapterRecord> records = [];
|
||||
}
|
||||
|
||||
public class CharacterRecord
|
||||
{
|
||||
public int id;
|
||||
public int piece_id;
|
||||
public string original_rare;
|
||||
public string corporation;
|
||||
public string original_rare = "";
|
||||
public string corporation = "";
|
||||
public int grade_core_id;
|
||||
public int name_code;
|
||||
public int grow_grade;
|
||||
public int stat_enhance_id;
|
||||
public string character_class;
|
||||
public List<int> element_id;
|
||||
public string character_class = "";
|
||||
public List<int> element_id = [];
|
||||
public int critical_ratio;
|
||||
public int critical_damage;
|
||||
public int shot_id;
|
||||
public int bonusrange_min;
|
||||
public int bonusrange_max;
|
||||
public string use_burst_skill;
|
||||
public string change_burst_step;
|
||||
public string use_burst_skill = "";
|
||||
public string change_burst_step = "";
|
||||
public int burst_apply_delay;
|
||||
public int burst_duration;
|
||||
public int ulti_skill_id;
|
||||
public int skill1_id;
|
||||
public string skill1_table;
|
||||
public string skill1_table = "";
|
||||
public int skill2_id;
|
||||
public string skill2_table;
|
||||
public string eff_category_type;
|
||||
public string skill2_table = "";
|
||||
public string eff_category_type = "";
|
||||
public int eff_category_value;
|
||||
public string category_type_1;
|
||||
public string category_type_2;
|
||||
public string category_type_3;
|
||||
public string cv_localkey;
|
||||
public string squad;
|
||||
public string category_type_1 = "";
|
||||
public string category_type_2 = "";
|
||||
public string category_type_3 = "";
|
||||
public string cv_localkey = "";
|
||||
public string squad = "";
|
||||
public bool is_visible;
|
||||
public bool prism_is_active;
|
||||
public bool is_detail_close;
|
||||
}
|
||||
public class CharacterTable
|
||||
{
|
||||
public List<CharacterRecord> records;
|
||||
public List<CharacterRecord> records = [];
|
||||
}
|
||||
|
||||
public class ItemEquipRecord
|
||||
{
|
||||
public int id;
|
||||
public string item_sub_type;
|
||||
public string item_sub_type = "";
|
||||
}
|
||||
public class ItemEquipTable
|
||||
{
|
||||
public List<ItemEquipRecord> records;
|
||||
public List<ItemEquipRecord> records = [];
|
||||
}
|
||||
|
||||
public class FieldItemRecord
|
||||
{
|
||||
public int id;
|
||||
public string item_type;
|
||||
public string item_type = "";
|
||||
public int type_value;
|
||||
public bool is_final_reward;
|
||||
public string difficulty;
|
||||
public string difficulty = "";
|
||||
}
|
||||
public class FieldItemTable
|
||||
{
|
||||
public List<FieldItemRecord> records;
|
||||
public List<FieldItemRecord> records = [];
|
||||
}
|
||||
public class JukeboxListRecord
|
||||
{
|
||||
public int id;
|
||||
public int theme;
|
||||
public string bgm;
|
||||
public string bgm = "";
|
||||
public bool is_loop;
|
||||
public int play_time;
|
||||
public string name;
|
||||
public string name = "";
|
||||
public int order;
|
||||
public string artist;
|
||||
public string get_info_type;
|
||||
public string get_info_value;
|
||||
public string artist = "";
|
||||
public string get_info_type = "";
|
||||
public string get_info_value = "";
|
||||
}
|
||||
|
||||
public class JukeboxListTable
|
||||
{
|
||||
public List<JukeboxListRecord> records;
|
||||
public List<JukeboxListRecord> records = [];
|
||||
}
|
||||
|
||||
public class JukeboxThemeRecord
|
||||
{
|
||||
public int id;
|
||||
public string name_localkey;
|
||||
public string description_localkey;
|
||||
public string name_localkey = "";
|
||||
public string description_localkey = "";
|
||||
public int order;
|
||||
public string theme_resource;
|
||||
public string bg_color;
|
||||
public string theme_resource = "";
|
||||
public string bg_color = "";
|
||||
}
|
||||
|
||||
public class JukeboxThemeTable
|
||||
{
|
||||
public List<JukeboxThemeRecord> records;
|
||||
public List<JukeboxThemeRecord> records = [];
|
||||
}
|
||||
public class OutpostBattleTableRecord
|
||||
{
|
||||
@@ -234,7 +234,7 @@
|
||||
}
|
||||
public class OutpostBattleTable
|
||||
{
|
||||
public List<OutpostBattleTableRecord> records;
|
||||
public List<OutpostBattleTableRecord> records = [];
|
||||
}
|
||||
|
||||
public class GachaPriceGroup
|
||||
@@ -248,18 +248,18 @@
|
||||
public class GachaType
|
||||
{
|
||||
public int id;
|
||||
public string type;
|
||||
public string type = "";
|
||||
public int order_id;
|
||||
public int event_id;
|
||||
public string gacha_provide_count_type;
|
||||
public string gacha_provide_count_type = "";
|
||||
public bool use_daily_discount_one;
|
||||
public int daily_free_gacha_event_id;
|
||||
public List<GachaPriceGroup> gacha_price_group;
|
||||
public List<GachaPriceGroup> gacha_price_group = [];
|
||||
public int grade_prob_id;
|
||||
public bool is_max_count;
|
||||
public int max_ceiling_count;
|
||||
public int fixed_char_amount;
|
||||
public string gacha_page_prefab;
|
||||
public string gacha_page_prefab = "";
|
||||
public int pickup_char_group_id;
|
||||
public bool use_wish_list;
|
||||
public int gacha_play_max_count;
|
||||
@@ -270,45 +270,45 @@
|
||||
|
||||
public class GachaTypeTable
|
||||
{
|
||||
public List<GachaType> records;
|
||||
public List<GachaType> records = [];
|
||||
}
|
||||
|
||||
public class EventManager
|
||||
{
|
||||
public int id;
|
||||
public string event_system_type;
|
||||
public string event_shortcut_id;
|
||||
public string name_localkey;
|
||||
public string description_localkey;
|
||||
public string schedule_type;
|
||||
public string schedule_value;
|
||||
public string event_disable_locale;
|
||||
public string event_resource_id;
|
||||
public string event_thumbnail_resource_table;
|
||||
public string event_thumbnail_resource_id;
|
||||
public string thumbnail_color;
|
||||
public string event_banner_resource_table;
|
||||
public string event_banner_resource_id;
|
||||
public string event_system_type = "";
|
||||
public string event_shortcut_id = "";
|
||||
public string name_localkey = "";
|
||||
public string description_localkey = "";
|
||||
public string schedule_type = "";
|
||||
public string schedule_value = "";
|
||||
public string event_disable_locale = "";
|
||||
public string event_resource_id = "";
|
||||
public string event_thumbnail_resource_table = "";
|
||||
public string event_thumbnail_resource_id = "";
|
||||
public string thumbnail_color = "";
|
||||
public string event_banner_resource_table = "";
|
||||
public string event_banner_resource_id = "";
|
||||
public long event_order;
|
||||
public bool is_popup;
|
||||
public string active_type;
|
||||
public string banner_print_type;
|
||||
public string active_type = "";
|
||||
public string banner_print_type = "";
|
||||
}
|
||||
|
||||
public class EventManagerTable
|
||||
{
|
||||
public List<EventManager> records;
|
||||
public List<EventManager> records = [];
|
||||
}
|
||||
|
||||
public class LiveWallpaperRecord
|
||||
{
|
||||
public int id;
|
||||
public string livewallpaper_type;
|
||||
public string livewallpaper_type = "";
|
||||
}
|
||||
|
||||
public class LiveWallpaperTable
|
||||
{
|
||||
public List<LiveWallpaperRecord> records;
|
||||
public List<LiveWallpaperRecord> records = [];
|
||||
}
|
||||
public class AlbumResourceRecord
|
||||
{
|
||||
@@ -324,32 +324,32 @@
|
||||
|
||||
public class AlbumResourceTable
|
||||
{
|
||||
public List<AlbumResourceRecord> records;
|
||||
public List<AlbumResourceRecord> records = [];
|
||||
}
|
||||
|
||||
public class UserFrameTableRecord
|
||||
{
|
||||
public int id;
|
||||
public string resource_id;
|
||||
public string tab_type;
|
||||
public string user_profile_type;
|
||||
public string filter_type;
|
||||
public string resource_id = "";
|
||||
public string tab_type = "";
|
||||
public string user_profile_type = "";
|
||||
public string filter_type = "";
|
||||
public int order;
|
||||
public string name_localkey;
|
||||
public string description_localkey;
|
||||
public string name_localkey = "";
|
||||
public string description_localkey = "";
|
||||
public bool is_sub_resource_prism;
|
||||
}
|
||||
|
||||
public class UserFrameTable
|
||||
{
|
||||
public List<UserFrameTableRecord> records;
|
||||
public List<UserFrameTableRecord> records = [];
|
||||
}
|
||||
|
||||
public class ArchiveRecordManagerRecord
|
||||
{
|
||||
public int id;
|
||||
public string record_type;
|
||||
public string record_title_locale;
|
||||
public string record_type = "";
|
||||
public string record_title_locale = "";
|
||||
public int record_main_archive_event_id;
|
||||
public int record_list_order;
|
||||
public int unlock_ticket_id;
|
||||
@@ -358,13 +358,13 @@
|
||||
public int event_quest_clear_reward_id;
|
||||
public int recommended_story_list_id;
|
||||
public int included_contents_group_id;
|
||||
public string record_slot_bg_addressable;
|
||||
public string record_unlock_bg_addressable;
|
||||
public string record_slot_bg_addressable = "";
|
||||
public string record_unlock_bg_addressable = "";
|
||||
}
|
||||
|
||||
public class ArchiveRecordManagerTable
|
||||
{
|
||||
public List<ArchiveRecordManagerRecord> records;
|
||||
public List<ArchiveRecordManagerRecord> records = [];
|
||||
}
|
||||
|
||||
public class ArchiveEventStoryRecord
|
||||
@@ -381,7 +381,7 @@
|
||||
|
||||
public class ArchiveEventStoryTable
|
||||
{
|
||||
public List<ArchiveEventStoryRecord> records;
|
||||
public List<ArchiveEventStoryRecord> records = [];
|
||||
}
|
||||
|
||||
public class ArchiveEventQuestRecord
|
||||
@@ -398,7 +398,7 @@
|
||||
|
||||
public class ArchiveEventQuestTable
|
||||
{
|
||||
public List<ArchiveEventQuestRecord> records;
|
||||
public List<ArchiveEventQuestRecord> records = [];
|
||||
}
|
||||
|
||||
public class ArchiveEventDungeonStageRecord
|
||||
@@ -414,7 +414,7 @@
|
||||
|
||||
public class ArchiveEventDungeonStageTable
|
||||
{
|
||||
public List<ArchiveEventDungeonStageRecord> records;
|
||||
public List<ArchiveEventDungeonStageRecord> records = [];
|
||||
}
|
||||
public class UserTitleRecord
|
||||
{
|
||||
@@ -431,12 +431,12 @@
|
||||
|
||||
public class UserTitleTable
|
||||
{
|
||||
public List<UserTitleRecord> records;
|
||||
public List<UserTitleRecord> records = [];
|
||||
}
|
||||
|
||||
public class ArchiveMessengerConditionList
|
||||
{
|
||||
public string condition_type;
|
||||
public string condition_type = "";
|
||||
public int condition_id;
|
||||
}
|
||||
|
||||
@@ -444,14 +444,14 @@
|
||||
{
|
||||
public int id;
|
||||
public int archive_messenger_group_id;
|
||||
public List<ArchiveMessengerConditionList> archive_messenger_condition_list;
|
||||
public string tid;
|
||||
public List<ArchiveMessengerConditionList> archive_messenger_condition_list = [];
|
||||
public string tid = "";
|
||||
}
|
||||
|
||||
public class ArchiveMessengerConditionTable
|
||||
{
|
||||
public string version;
|
||||
public List<ArchiveMessengerConditionRecord> records;
|
||||
public string version = "";
|
||||
public List<ArchiveMessengerConditionRecord> records = [];
|
||||
}
|
||||
|
||||
public class CharacterStatRecord
|
||||
@@ -468,27 +468,27 @@
|
||||
|
||||
public class CharacterStatTable
|
||||
{
|
||||
public List<CharacterStatRecord> records;
|
||||
public List<CharacterStatRecord> records = [];
|
||||
}
|
||||
|
||||
public class ItemMaterialRecord
|
||||
{
|
||||
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 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 item_rare = "";
|
||||
public int item_value;
|
||||
public string material_type;
|
||||
public string material_type = "";
|
||||
public int material_value;
|
||||
public int stack_max;
|
||||
}
|
||||
|
||||
public class ItemMaterialTable
|
||||
{
|
||||
public List<ItemMaterialRecord> records;
|
||||
public List<ItemMaterialRecord> records = [];
|
||||
}
|
||||
|
||||
public class SkillInfoRecord
|
||||
@@ -498,54 +498,54 @@
|
||||
public int skill_level;
|
||||
public int next_level_id;
|
||||
public int level_up_cost_id;
|
||||
public string icon;
|
||||
public string name_localkey;
|
||||
public string description_localkey;
|
||||
public string info_description_localkey;
|
||||
public List<DescriptionValue> description_value_list;
|
||||
public string icon = "";
|
||||
public string name_localkey = "";
|
||||
public string description_localkey = "";
|
||||
public string info_description_localkey = "";
|
||||
public List<DescriptionValue> description_value_list = [];
|
||||
}
|
||||
|
||||
public class DescriptionValue
|
||||
{
|
||||
public string description_value;
|
||||
public string description_value = "";
|
||||
}
|
||||
|
||||
public class SkillInfoTable
|
||||
{
|
||||
public List<SkillInfoRecord> records;
|
||||
public List<SkillInfoRecord> records = [];
|
||||
}
|
||||
|
||||
public class CostRecord
|
||||
{
|
||||
public int id;
|
||||
public List<CostData> costs;
|
||||
public List<CostData> costs = [];
|
||||
}
|
||||
|
||||
public class CostData
|
||||
{
|
||||
public string item_type;
|
||||
public string item_type = "";
|
||||
public int item_id;
|
||||
public int item_value;
|
||||
}
|
||||
|
||||
public class CostTable
|
||||
{
|
||||
public List<CostRecord> records;
|
||||
public List<CostRecord> records = [];
|
||||
}
|
||||
public class MidasProductRecord
|
||||
{
|
||||
public int id;
|
||||
public string product_type;
|
||||
public string product_type = "";
|
||||
public int product_id;
|
||||
public string item_type;
|
||||
public string midas_product_id_proximabeta;
|
||||
public string midas_product_id_gamamobi;
|
||||
public string item_type = "";
|
||||
public string midas_product_id_proximabeta = "";
|
||||
public string midas_product_id_gamamobi = "";
|
||||
public bool is_free;
|
||||
public string cost;
|
||||
public string cost = "";
|
||||
}
|
||||
public class MidasProductTable
|
||||
{
|
||||
public List<MidasProductRecord> records;
|
||||
public List<MidasProductRecord> records = [];
|
||||
}
|
||||
public enum ShopCategoryType
|
||||
{
|
||||
|
||||
@@ -25,9 +25,7 @@ namespace EpinelPS.LobbyServer.Campaign
|
||||
key = req.MapId;
|
||||
}
|
||||
|
||||
FieldInfoNew field;
|
||||
|
||||
if (!user.FieldInfoNew.TryGetValue(key, out field))
|
||||
if (!user.FieldInfoNew.TryGetValue(key, out FieldInfoNew? field))
|
||||
{
|
||||
field = new FieldInfoNew();
|
||||
user.FieldInfoNew.Add(key, field);
|
||||
@@ -45,11 +43,9 @@ namespace EpinelPS.LobbyServer.Campaign
|
||||
|
||||
// Register and return reward
|
||||
|
||||
if (!GameData.Instance.PositionReward.ContainsKey(req.FieldObject.PositionId)) throw new Exception("bad position id");
|
||||
var fieldReward = GameData.Instance.PositionReward[req.FieldObject.PositionId];
|
||||
if (!GameData.Instance.PositionReward.TryGetValue(req.FieldObject.PositionId, out int fieldReward)) throw new Exception("bad position id");
|
||||
var positionReward = GameData.Instance.FieldItems[fieldReward];
|
||||
var reward = GameData.Instance.GetRewardTableEntry(positionReward.type_value);
|
||||
if (reward == null) throw new Exception("failed to get reward");
|
||||
var reward = GameData.Instance.GetRewardTableEntry(positionReward.type_value) ?? throw new Exception("failed to get reward");
|
||||
response.Reward = ClearStage.RegisterRewardsForUser(user, reward);
|
||||
|
||||
// Hide it from the field
|
||||
|
||||
@@ -12,8 +12,10 @@ namespace EpinelPS.LobbyServer.Character
|
||||
var req = await ReadData<ReqCharacterSkillLevelUp>();
|
||||
var user = GetUser();
|
||||
var response = new ResCharacterSkillLevelUp();
|
||||
var character = user.Characters.FirstOrDefault(c => c.Csn == req.Csn);
|
||||
var charRecord = GameData.Instance.characterTable.Values.FirstOrDefault(c => c.id == character.Tid);
|
||||
|
||||
var character = user.Characters.FirstOrDefault(c => c.Csn == req.Csn) ?? throw new Exception("cannot find character");
|
||||
|
||||
var charRecord = GameData.Instance.characterTable.Values.FirstOrDefault(c => c.id == character.Tid) ?? throw new Exception("cannot find character record");
|
||||
var skillIdMap = new Dictionary<int, int>
|
||||
{
|
||||
{ 1, charRecord.ulti_skill_id },
|
||||
@@ -26,8 +28,8 @@ namespace EpinelPS.LobbyServer.Character
|
||||
{ 2, character.Skill1Lvl },
|
||||
{ 3, character.Skill2Lvl }
|
||||
};
|
||||
var skillRecord = GameData.Instance.skillInfoTable.Values.FirstOrDefault(s => s.id == skillIdMap[req.Category] + (skillLevelMap[req.Category] - 1));
|
||||
var costRecord = GameData.Instance.costTable.Values.FirstOrDefault(c => c.id == skillRecord.level_up_cost_id);
|
||||
var skillRecord = GameData.Instance.skillInfoTable.Values.FirstOrDefault(s => s.id == skillIdMap[req.Category] + (skillLevelMap[req.Category] - 1)) ?? throw new Exception("cannot find character skill record");
|
||||
var costRecord = GameData.Instance.costTable.Values.FirstOrDefault(c => c.id == skillRecord.level_up_cost_id) ?? throw new Exception("cannot find character cost record");
|
||||
|
||||
foreach (var cost in costRecord.costs.Where(i => i.item_type != "None"))
|
||||
{
|
||||
|
||||
@@ -11,15 +11,14 @@ namespace EpinelPS.LobbyServer.Event
|
||||
var req = await ReadData<ReqEnterEventField>();
|
||||
var user = GetUser();
|
||||
|
||||
var response = new ResEnterEventField();
|
||||
|
||||
response.Field = new();
|
||||
ResEnterEventField response = new()
|
||||
{
|
||||
Field = new()
|
||||
};
|
||||
|
||||
// Retrieve collected objects
|
||||
|
||||
FieldInfoNew field;
|
||||
|
||||
if (!user.FieldInfoNew.TryGetValue(req.MapId, out field))
|
||||
if (!user.FieldInfoNew.TryGetValue(req.MapId, out FieldInfoNew field))
|
||||
{
|
||||
field = new FieldInfoNew();
|
||||
user.FieldInfoNew.Add(req.MapId, field);
|
||||
|
||||
@@ -12,11 +12,11 @@ namespace EpinelPS.LobbyServer.Gacha
|
||||
[PacketPath("/gacha/execute")]
|
||||
public class ExecGacha : LobbyMsgHandler
|
||||
{
|
||||
private static readonly Random random = new Random();
|
||||
private static readonly Random random = new();
|
||||
|
||||
// Exclusion lists for sick pulls mode and normal mode 2500601 is the broken R rarity dorothy
|
||||
private static readonly List<int> sickPullsExclusionList = new List<int> { 2500601 }; // Add more IDs as needed
|
||||
private static readonly List<int> normalPullsExclusionList = new List<int> { 2500601,422401,306201,399901,399902,399903,399904,201401,301501,112101,313201,319301,319401,320301,422601,426101,328301,328401,235101,235301,136101,339201,140001,140101,140201,580001,580101,580201,581001,581101,581201,582001,582101,582201,583001,583101,583201,583301,190101,290701 }; // Add more IDs as needed
|
||||
private static readonly List<int> sickPullsExclusionList = [2500601 ]; // Add more IDs as needed
|
||||
private static readonly List<int> normalPullsExclusionList = [2500601,422401,306201,399901,399902,399903,399904,201401,301501,112101,313201,319301,319401,320301,422601,426101,328301,328401,235101,235301,136101,339201,140001,140101,140201,580001,580101,580201,581001,581101,581201,582001,582101,582201,583001,583101,583201,583301,190101,290701 ]; // Add more IDs as needed
|
||||
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
@@ -173,7 +173,7 @@ namespace EpinelPS.LobbyServer.Gacha
|
||||
await WriteDataAsync(response);
|
||||
}
|
||||
|
||||
private CharacterRecord SelectRandomCharacter(List<CharacterRecord> rCharacters, List<CharacterRecord> srCharacters, List<CharacterRecord> ssrCharacters, List<CharacterRecord> pilgrimCharacters, List<int> exclusionList)
|
||||
private static CharacterRecord SelectRandomCharacter(List<CharacterRecord> rCharacters, List<CharacterRecord> srCharacters, List<CharacterRecord> ssrCharacters, List<CharacterRecord> pilgrimCharacters, List<int> exclusionList)
|
||||
{
|
||||
// Remove excluded characters from each category
|
||||
var availableRCharacters = rCharacters.Where(c => !exclusionList.Contains(c.id)).ToList();
|
||||
@@ -184,12 +184,12 @@ namespace EpinelPS.LobbyServer.Gacha
|
||||
// Each time we call this method, a new category will be selected for a single character
|
||||
double roll = random.NextDouble() * 100; // Roll from 0 to 100
|
||||
|
||||
if (roll < 53 && availableRCharacters.Any())
|
||||
if (roll < 53 && availableRCharacters.Count != 0)
|
||||
{
|
||||
// R category
|
||||
return availableRCharacters[random.Next(availableRCharacters.Count)];
|
||||
}
|
||||
else if (roll < 53 + 43 && availableSRCharacters.Any())
|
||||
else if (roll < 53 + 43 && availableSRCharacters.Count != 0)
|
||||
{
|
||||
// SR category
|
||||
return availableSRCharacters[random.Next(availableSRCharacters.Count)];
|
||||
@@ -199,12 +199,12 @@ namespace EpinelPS.LobbyServer.Gacha
|
||||
// SSR category
|
||||
double ssrRoll = random.NextDouble() * 100;
|
||||
|
||||
if (ssrRoll < 4.55 && availablePilgrimCharacters.Any())
|
||||
if (ssrRoll < 4.55 && availablePilgrimCharacters.Count != 0)
|
||||
{
|
||||
// PILGRIM SSR
|
||||
return availablePilgrimCharacters[random.Next(availablePilgrimCharacters.Count)];
|
||||
}
|
||||
else if (availableSSRCharacters.Any())
|
||||
else if (availableSSRCharacters.Count != 0)
|
||||
{
|
||||
// Non-PILGRIM SSR
|
||||
return availableSSRCharacters[random.Next(availableSSRCharacters.Count)];
|
||||
@@ -212,7 +212,7 @@ namespace EpinelPS.LobbyServer.Gacha
|
||||
}
|
||||
|
||||
// Fallback to a random R character if somehow no SSR characters are left after exclusion
|
||||
return availableRCharacters.Any() ? availableRCharacters[random.Next(availableRCharacters.Count)] : null;
|
||||
return availableRCharacters.Count != 0 ? availableRCharacters[random.Next(availableRCharacters.Count)] : throw new Exception("cannot find any characters");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,9 +92,9 @@ namespace EpinelPS.LobbyServer
|
||||
.WithKey(JsonDb.Instance.LauncherTokenKey, Encryption.SymmetricKey)
|
||||
.Decode(token, new PasetoTokenValidationParameters() { ValidateLifetime = true });
|
||||
|
||||
var p = ((System.Text.Json.JsonElement)encryptionToken.Paseto.Payload["data"]).GetString();
|
||||
var p = ((System.Text.Json.JsonElement)encryptionToken.Paseto.Payload["data"]).GetString() ?? throw new Exception("auth token cannot be null");
|
||||
|
||||
return JsonConvert.DeserializeObject<GameClientInfo>(p);
|
||||
return JsonConvert.DeserializeObject<GameClientInfo>(p ?? throw new Exception("data cannot be null"));
|
||||
}
|
||||
|
||||
public static void Init()
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using Google.Protobuf;
|
||||
using EpinelPS.Database;
|
||||
using EpinelPS.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using Paseto.Builder;
|
||||
using Paseto;
|
||||
using System.Security.Cryptography;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace EpinelPS.LobbyServer
|
||||
{
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
using DnsClient;
|
||||
using EpinelPS.Database;
|
||||
using EpinelPS.Database;
|
||||
using EpinelPS.LobbyServer;
|
||||
using EpinelPS.LobbyServer.Stage;
|
||||
using EpinelPS.StaticInfo;
|
||||
using EpinelPS.Utils;
|
||||
using Google.Api;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Https;
|
||||
using Microsoft.Extensions.Logging.EventLog;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Reflection;
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace EpinelPS.Utils
|
||||
var result = await lookup.QueryAsync("cloud.nikke-kr.com", QueryType.A);
|
||||
|
||||
var record = result.Answers.ARecords().FirstOrDefault();
|
||||
var ip = record?.Address;
|
||||
var ip = record?.Address ?? throw new Exception("Failed to find IP address of cloud.nikke-kr.com, check your internet connection.");
|
||||
|
||||
return ip.ToString();
|
||||
}
|
||||
|
||||
@@ -40,9 +40,7 @@ namespace EpinelPS.Utils
|
||||
[LogLevel.Information] = ConsoleColor.Green
|
||||
};
|
||||
}
|
||||
public sealed class ColorConsoleLogger(
|
||||
string name,
|
||||
Func<ColorConsoleLoggerConfiguration> getCurrentConfig) : ILogger
|
||||
public sealed class ColorConsoleLogger(string name, Func<ColorConsoleLoggerConfiguration> getCurrentConfig) : ILogger
|
||||
{
|
||||
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => default!;
|
||||
|
||||
|
||||
@@ -7,8 +7,14 @@ namespace EpinelPS.Utils
|
||||
public static int CalculateCP(Database.User user, long csn)
|
||||
{
|
||||
var character = user.Characters.FirstOrDefault(c => c.Csn == csn);
|
||||
if (character == null) return 0;
|
||||
|
||||
var charRecord = GameData.Instance.characterTable.Values.FirstOrDefault(c => c.id == character.Tid);
|
||||
if (charRecord == null) return 0;
|
||||
|
||||
var statRecord = GameData.Instance.characterStatTable.Values.FirstOrDefault(s => charRecord.stat_enhance_id == s.group + (character.Level - 1));
|
||||
if (statRecord == null) return 0;
|
||||
|
||||
float coreMult = 1f + character.Grade * 0.02f;
|
||||
float hp = statRecord.level_hp * coreMult;
|
||||
float atk = statRecord.level_attack * coreMult;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace EpinelPS.Utils
|
||||
Interlocked.Exchange(ref currentProgress, value);
|
||||
}
|
||||
|
||||
private void TimerHandler(object state)
|
||||
private void TimerHandler(object? state)
|
||||
{
|
||||
lock (timer)
|
||||
{
|
||||
@@ -70,11 +70,11 @@ namespace EpinelPS.Utils
|
||||
}
|
||||
|
||||
// Backtrack to the first differing character
|
||||
StringBuilder outputBuilder = new StringBuilder();
|
||||
StringBuilder outputBuilder = new();
|
||||
outputBuilder.Append('\b', currentText.Length - commonPrefixLength);
|
||||
|
||||
// Output new suffix
|
||||
outputBuilder.Append(text.Substring(commonPrefixLength));
|
||||
outputBuilder.Append(text.AsSpan(commonPrefixLength));
|
||||
|
||||
// If the new text is shorter than the old one: delete overlapping characters
|
||||
int overlapCount = currentText.Length - text.Length;
|
||||
@@ -100,6 +100,7 @@ namespace EpinelPS.Utils
|
||||
disposed = true;
|
||||
UpdateText(string.Empty);
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
</form>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
||||
<script src="/admin/assets/js/loginpage.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user