Merge pull request #3 from raphaeIl/master

Implement Gacha, Dorm, Partial Ship and Item Management, and add additional commands
This commit is contained in:
rfi
2024-04-07 16:25:07 +07:00
committed by GitHub
29 changed files with 88740 additions and 343 deletions

View File

@@ -31,6 +31,13 @@ public static class Data
[LoadData("task_data_template.json", LoadDataType.ShareCfgData)]
public static Dictionary<int, TaskDateTemplate> TaskDataTemplate { get; private set; } = null!;
[LoadData("item_data_statistics.json", LoadDataType.ShareCfgData)]
public static Dictionary<int, ItemDataStatistics> ItemDataStatistics { get; private set; } = null!;
[LoadData("activity_ship_create.json", LoadDataType.ShareCfg)]
public static Dictionary<uint, ActivityShipCreate> ActivityShipCreate { get; private set; } = null!;
public static void Load()
{
foreach (var prop in typeof(Data).GetProperties().Where(x => x.GetCustomAttribute<LoadDataAttribute>() is not null))

View File

@@ -0,0 +1,23 @@
using System.Text.Json.Serialization;
namespace BLHX.Server.Common.Data {
public class ActivityShipCreate {
[JsonPropertyName("activity_id")]
public uint ActivityId { get; set; }
[JsonPropertyName("create_id")]
public uint CreateId { get; set; }
[JsonPropertyName("id")]
public uint Id { get; set; }
[JsonPropertyName("pickup_list")]
public uint[] PickupList { get; set; }
[JsonPropertyName("pickup_num")]
public uint PickupNum { get; set; }
[JsonPropertyName("ratio_display")]
public uint[] RatioDisplay { get; set; }
}
}

View File

@@ -0,0 +1,86 @@
using System.Text.Json.Serialization;
namespace BLHX.Server.Common.Data;
public class ItemDataStatistics : Model {
[JsonPropertyName("combination_display")]
public int[] CombinationDisplay { get; set; } // Empty array implies List<object>
[JsonPropertyName("compose_number")]
public int ComposeNumber { get; set; }
[JsonPropertyName("display")]
public string Display { get; set; }
[JsonPropertyName("display_effect")]
public string DisplayEffect { get; set; }
[JsonPropertyName("display_icon")]
public object DisplayIcon { get; set; }
[JsonPropertyName("icon")]
public string Icon { get; set; }
[JsonPropertyName("id")]
public int Id { get; set; }
[JsonPropertyName("index")]
public int[] Index { get; set; } // Assuming empty array
[JsonPropertyName("is_world")]
public int IsWorld { get; set; }
[JsonPropertyName("limit")]
public string Limit { get; set; }
[JsonPropertyName("link_id")]
public int LinkId { get; set; }
[JsonPropertyName("max_num")]
public int MaxNum { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("open_directly")]
public int OpenDirectly { get; set; }
[JsonPropertyName("order")]
public int Order { get; set; }
[JsonPropertyName("other_item_cost")]
public string OtherItemCost { get; set; }
[JsonPropertyName("other_resource_cost")]
public string OtherResourceCost { get; set; }
[JsonPropertyName("price")]
public object Price { get; set; }
[JsonPropertyName("rarity")]
public int Rarity { get; set; }
[JsonPropertyName("replace_item")]
public int ReplaceItem { get; set; }
[JsonPropertyName("shiptrans_id")]
public int[] ShiptransId { get; set; } // Assuming empty array
[JsonPropertyName("target_id")]
public int TargetId { get; set; }
[JsonPropertyName("time_limit")]
public int TimeLimit { get; set; }
[JsonPropertyName("type")]
public int Type { get; set; }
[JsonPropertyName("usage")]
public string Usage { get; set; }
[JsonPropertyName("usage_arg")]
public object UsageArg { get; set; }
[JsonPropertyName("virtual_type")]
public int VirtualType { get; set; }
}

View File

@@ -6,10 +6,8 @@ using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BLHX.Server.Common.Database
{
public sealed class PlayerContext : DbContext, IBLHXDBContext<PlayerContext>
{
namespace BLHX.Server.Common.Database {
public sealed class PlayerContext : DbContext, IBLHXDBContext<PlayerContext> {
SavingState savingState;
public static string DbPath => "Databases/players.db";
public DbSet<Player> Players { get; set; }
@@ -18,8 +16,7 @@ namespace BLHX.Server.Common.Database
public DbSet<PlayerShip> Ships { get; set; }
public DbSet<ChapterInfo> ChapterInfoes { get; set; }
public PlayerContext()
{
public PlayerContext() {
if (Database.GetPendingMigrations().Any())
Database.Migrate();
@@ -29,13 +26,11 @@ namespace BLHX.Server.Common.Database
}
// Thread-safe method pls
public void Save()
{
public void Save() {
if (savingState == SavingState.Attempting)
return;
while (savingState != SavingState.None)
{
while (savingState != SavingState.None) {
savingState = SavingState.Attempting;
Task.Delay(1).Wait();
}
@@ -43,8 +38,7 @@ namespace BLHX.Server.Common.Database
SaveChanges();
}
public Player Init(string token, uint shipId, string name)
{
public Player Init(string token, uint shipId, string name) {
var player = new Player(token, new Displayinfo() { Icon = shipId }, name);
Players.Add(player);
@@ -66,8 +60,7 @@ namespace BLHX.Server.Common.Database
return player;
}
public void PlayerRoutine(Player player)
{
public void PlayerRoutine(Player player) {
if (!ResourceFields.Any(x => x.Type == ResourceFieldType.Gold))
ResourceFields.Add(new() { Type = ResourceFieldType.Gold, PlayerUid = player.Uid });
if (!ResourceFields.Any(x => x.Type == ResourceFieldType.Oil))
@@ -76,13 +69,13 @@ namespace BLHX.Server.Common.Database
Save();
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
protected override void OnModelCreating(ModelBuilder modelBuilder) {
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Player>(e =>
{
modelBuilder.Entity<Player>(e => {
e.Property(b => b.DisplayInfo)
.HasJsonConversion();
e.Property(b => b.Appreciation)
.HasJsonConversion();
e.Property(b => b.Fleets)
.HasJsonConversion()
.HasDefaultValue(new List<Groupinfo>() {
@@ -108,9 +101,13 @@ namespace BLHX.Server.Common.Database
.WithOne(e => e.Player)
.HasForeignKey(e => e.PlayerUid)
.IsRequired();
e.OwnsOne(x => x.RefundShopInfoLists);
e.OwnsOne(x => x.CardLists);
e.OwnsOne(x => x.CdLists);
e.OwnsOne(x => x.TakingShipLists);
});
modelBuilder.Entity<PlayerShip>(e =>
{
modelBuilder.Entity<PlayerShip>(e => {
e.Property(b => b.Id)
.ValueGeneratedOnAdd();
e.Property(b => b.State)
@@ -128,8 +125,7 @@ namespace BLHX.Server.Common.Database
e.Property(b => b.CoreLists)
.HasJsonConversion();
});
modelBuilder.Entity<ChapterInfo>(e =>
{
modelBuilder.Entity<ChapterInfo>(e => {
e.Property(x => x.EscortLists)
.HasJsonConversion();
e.Property(x => x.AiLists)
@@ -163,43 +159,128 @@ namespace BLHX.Server.Common.Database
[PrimaryKey(nameof(Uid))]
[Index(nameof(Token), IsUnique = true)]
public class Player
{
public class Player {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public uint Uid { get; set; }
public string Token { get; set; }
public string Name { get; set; }
// Aka. manifesto
public string Adv { get; set; } = string.Empty;
public uint Level { get; set; }
// TODO: Exp add setter to recalculate cap and set level
public uint Exp { get; set; }
public uint Exp { get; set; } // TODO: Exp add setter to recalculate cap and set level
public uint AttackCount { get; set; }
public uint WinCount { get; set; }
public string Adv { get; set; } = string.Empty; // Aka. manifesto
public uint ShipBagMax { get; set; } = 150;
public uint EquipBagMax { get; set; } = 250;
public uint GmFlag { get; set; } = 1;
public uint Rank { get; set; } = 1;
public uint PvpAttackCount { get; set; }
public uint PvpWinCount { get; set; }
public uint CollectAttackCount { get; set; }
public uint GuideIndex { get; set; } = 1000000;
public uint BuyOilCount { get; set; }
public uint ChatRoomId { get; set; } = 1;
public uint MaxRank { get; set; }
public uint ShipCount { get { return (uint)Ships.Count; } }
public uint AccPayLv { get; set; }
public uint GuildWaitTime { get; set; }
public uint ChatMsgBanTime { get; set; }
public uint CommanderBagMax { get; set; } = 40;
public Displayinfo DisplayInfo { get; set; }
public uint Rmb { get; set; }
public Appreciationinfo Appreciation { get; set; }
public uint ThemeUploadNotAllowedTime { get; set; }
public uint RandomShipMode { get; set; }
public uint MarryShip { get; set; }
public uint ChildDisplay { get; set; }
public DateTime CreatedAt { get; set; }
public List<Groupinfo> Fleets { get; set; } = null!;
public List<Idtimeinfo> ShipSkins { get; set; } = null!;
public List<uint> Characters { get; set; } = [1];
public List<uint> StoryLists { get; set; } = [];
public List<uint> FlagLists { get; set; } = [];
public List<uint> MedalIds { get; set; } = [];
public List<uint> CartoonReadMarks { get; set; } = [];
public List<uint> CartoonCollectMarks { get; set; } = [];
public List<uint> RandomShipLists { get; set; } = [];
public List<uint> Soundstories { get; set; } = [];
public virtual List<Proto.p11.Cardinfo> CardLists { get; set; } = [];
public virtual List<Proto.p11.Cooldown> CdLists { get; set; } = [];
public virtual List<Idtimeinfo> IconFrameLists { get; set; } = [];
public virtual List<Idtimeinfo> ChatFrameLists { get; set; } = [];
public virtual List<RefundShopinfo> RefundShopInfoLists { get; set; } = [];
public virtual List<Proto.p11.ShipTakingData> TakingShipLists { get; set; } = [];
//
public string Token { get; set; }
public uint? CurrentChapter { get; set; }
public List<Groupinfo> Fleets { get; set; } = null!;
public List<Idtimeinfo> ShipSkins { get; set; } = null!;
public virtual ICollection<PlayerResource> Resources { get; set; } = [];
public virtual ICollection<ResourceField> ResourceFields { get; set; } = [];
public virtual ICollection<PlayerShip> Ships { get; set; } = [];
public virtual ICollection<ChapterInfo> ChapterInfoes { get; set; } = [];
public Player(string token, Displayinfo displayInfo, string name)
{
public Player(string token, Displayinfo displayInfo, string name) {
DisplayInfo = displayInfo;
Token = token;
Name = name;
Level = 1;
CreatedAt = DateTime.Now;
Appreciation = new Appreciationinfo() { Gallerys = [], Musics = [], FavorGallerys = [], FavorMusics = [] };
}
public void DoResource(uint id, int num)
{
public void DoResource(uint id, int num) {
var res = Resources.SingleOrDefault(x => x.Id == id);
if (res is null)
{
if (res is null) {
res = new() { Id = id, PlayerUid = Uid };
DBManager.PlayerContext.Resources.Add(res);
}
@@ -210,13 +291,11 @@ namespace BLHX.Server.Common.Database
res.Num = Math.Min(res.Num + (uint)num, uint.MaxValue);
}
public void AddShip(uint shipTemplateId)
{
public void AddShip(uint shipTemplateId) {
if (!Data.Data.ShipDataTemplate.TryGetValue((int)shipTemplateId, out var shipTemplate))
throw new InvalidDataException($"Ship template {shipTemplateId} not found!");
var ship = new PlayerShip()
{
var ship = new PlayerShip() {
TemplateId = shipTemplateId,
Level = 1,
EquipInfoLists = [
@@ -238,15 +317,11 @@ namespace BLHX.Server.Common.Database
DBManager.PlayerContext.Ships.Add(ship);
}
public void HarvestResourceField(ResourceFieldType type)
{
foreach (var resourceField in ResourceFields)
{
if (resourceField.Type == type)
{
public void HarvestResourceField(ResourceFieldType type) {
foreach (var resourceField in ResourceFields) {
if (resourceField.Type == type) {
var amount = resourceField.Flush();
switch (type)
{
switch (type) {
case ResourceFieldType.Gold:
DoResource(1, (int)amount);
break;
@@ -262,8 +337,7 @@ namespace BLHX.Server.Common.Database
}
[PrimaryKey(nameof(Id), nameof(PlayerUid))]
public class PlayerResource
{
public class PlayerResource {
[Key]
public uint Id { get; set; }
public uint Num { get; set; }
@@ -274,8 +348,7 @@ namespace BLHX.Server.Common.Database
}
[PrimaryKey(nameof(Id))]
public class PlayerShip
{
public class PlayerShip {
[Key]
public uint Id { get; set; }
public uint TemplateId { get; set; }
@@ -307,10 +380,8 @@ namespace BLHX.Server.Common.Database
public DateTime CreatedAt { get; set; } = DateTime.Now;
public DateTime? LastChangeName { get; set; }
public Shipinfo ToProto()
{
return new()
{
public Shipinfo ToProto() {
return new() {
Id = Id,
TemplateId = TemplateId,
Level = Level,
@@ -340,15 +411,13 @@ namespace BLHX.Server.Common.Database
}
}
public enum ResourceFieldType
{
public enum ResourceFieldType {
Gold = 1,
Oil = 2
}
[PrimaryKey(nameof(Type), nameof(PlayerUid))]
public class ResourceField
{
public class ResourceField {
[Key]
public ResourceFieldType Type { get; set; }
public uint Level { get; set; } = 1;
@@ -359,14 +428,11 @@ namespace BLHX.Server.Common.Database
public uint PlayerUid { get; set; }
public virtual Player Player { get; set; } = null!;
public void CalculateYield()
{
public void CalculateYield() {
// TODO: Take UpgradeTime into acccount of the reward
switch (Type)
{
switch (Type) {
case ResourceFieldType.Gold:
if (Data.Data.GoldFieldTemplate.TryGetValue((int)Level, out var goldTemplate))
{
if (Data.Data.GoldFieldTemplate.TryGetValue((int)Level, out var goldTemplate)) {
var res = Player.Resources.FirstOrDefault(x => x.Id == 7);
var num = (goldTemplate.HourTime * goldTemplate.Production) / 3600f * LastHarvestTime.GetSecondsPassed();
@@ -375,8 +441,7 @@ namespace BLHX.Server.Common.Database
}
break;
case ResourceFieldType.Oil:
if (Data.Data.OilFieldTemplate.TryGetValue((int)Level, out var oilTemplate))
{
if (Data.Data.OilFieldTemplate.TryGetValue((int)Level, out var oilTemplate)) {
var res = Player.Resources.FirstOrDefault(x => x.Id == 5);
var num = (oilTemplate.HourTime * oilTemplate.Production) / 3600f * LastHarvestTime.GetSecondsPassed();
@@ -387,15 +452,12 @@ namespace BLHX.Server.Common.Database
}
}
public uint Flush()
{
public uint Flush() {
uint amount = 0;
// TODO: Take UpgradeTime into acccount of the reward
switch (Type)
{
switch (Type) {
case ResourceFieldType.Gold:
if (Data.Data.GoldFieldTemplate.TryGetValue((int)Level, out var goldTemplate))
{
if (Data.Data.GoldFieldTemplate.TryGetValue((int)Level, out var goldTemplate)) {
var goldField = Player.Resources.First(x => x.Id == 7);
amount = goldField.Num;
@@ -403,8 +465,7 @@ namespace BLHX.Server.Common.Database
}
break;
case ResourceFieldType.Oil:
if (Data.Data.OilFieldTemplate.TryGetValue((int)Level, out var oilTemplate))
{
if (Data.Data.OilFieldTemplate.TryGetValue((int)Level, out var oilTemplate)) {
var oilField = Player.Resources.First(x => x.Id == 5);
amount = oilField.Num;
@@ -419,8 +480,7 @@ namespace BLHX.Server.Common.Database
}
[PrimaryKey(nameof(Id), nameof(PlayerUid))]
public class ChapterInfo
{
public class ChapterInfo {
[Key]
public uint Id { get; set; }
public DateTime Time { get; set; }
@@ -449,10 +509,8 @@ namespace BLHX.Server.Common.Database
public uint PlayerUid { get; set; }
public virtual Player Player { get; set; } = null!;
public Currentchapterinfo ToProto()
{
return new Currentchapterinfo()
{
public Currentchapterinfo ToProto() {
return new Currentchapterinfo() {
Id = Id,
AiLists = AiLists,
BattleStatistics = BattleStatistics,
@@ -478,10 +536,8 @@ namespace BLHX.Server.Common.Database
};
}
public static ChapterInfo FromProto(Currentchapterinfo chapterInfo, uint uid)
{
return new()
{
public static ChapterInfo FromProto(Currentchapterinfo chapterInfo, uint uid) {
return new() {
Id = chapterInfo.Id,
AiLists = chapterInfo.AiLists,
BattleStatistics = chapterInfo.BattleStatistics,

View File

@@ -3,18 +3,14 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BLHX.Server.Common.Migrations.Player
{
namespace BLHX.Server.Common.Migrations.Player {
/// <inheritdoc />
public partial class Init_PlayerContext : Migration
{
public partial class Init_PlayerContext : Migration {
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
protected override void Up(MigrationBuilder migrationBuilder) {
migrationBuilder.CreateTable(
name: "Players",
columns: table => new
{
columns: table => new {
Uid = table.Column<uint>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Token = table.Column<string>(type: "TEXT", nullable: false),
@@ -24,21 +20,18 @@ namespace BLHX.Server.Common.Migrations.Player
DisplayInfo = table.Column<string>(type: "jsonb", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
constraints: table => {
table.PrimaryKey("PK_Players", x => x.Uid);
});
migrationBuilder.CreateTable(
name: "Resources",
columns: table => new
{
columns: table => new {
Id = table.Column<uint>(type: "INTEGER", nullable: false),
PlayerUid = table.Column<uint>(type: "INTEGER", nullable: false),
Num = table.Column<uint>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
constraints: table => {
table.PrimaryKey("PK_Resources", x => new { x.Id, x.PlayerUid });
table.ForeignKey(
name: "FK_Resources_Players_PlayerUid",
@@ -50,8 +43,7 @@ namespace BLHX.Server.Common.Migrations.Player
migrationBuilder.CreateTable(
name: "Ships",
columns: table => new
{
columns: table => new {
Id = table.Column<uint>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
TemplateId = table.Column<uint>(type: "INTEGER", nullable: false),
@@ -79,8 +71,7 @@ namespace BLHX.Server.Common.Migrations.Player
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
LastChangeName = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
constraints: table => {
table.PrimaryKey("PK_Ships", x => x.Id);
table.ForeignKey(
name: "FK_Ships_Players_PlayerUid",
@@ -108,8 +99,7 @@ namespace BLHX.Server.Common.Migrations.Player
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
protected override void Down(MigrationBuilder migrationBuilder) {
migrationBuilder.DropTable(
name: "Resources");

View File

@@ -0,0 +1,583 @@
// <auto-generated />
using System;
using BLHX.Server.Common.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BLHX.Server.Common.Migrations.Player
{
[DbContext(typeof(PlayerContext))]
[Migration("20240405053357_Players_AddParams")]
partial class Players_AddParams
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.2")
.HasAnnotation("Proxies:ChangeTracking", false)
.HasAnnotation("Proxies:CheckEquality", false)
.HasAnnotation("Proxies:LazyLoading", true);
modelBuilder.Entity("BLHX.Server.Common.Database.ChapterInfo", b =>
{
b.Property<uint>("Id")
.HasColumnType("INTEGER");
b.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b.Property<string>("AiLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("BattleStatistics")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("BuffLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("CellFlagLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("CellLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("ChapterHp")
.HasColumnType("INTEGER");
b.Property<string>("ChapterStrategyLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("ContinuousKillCount")
.HasColumnType("INTEGER");
b.Property<string>("EscortLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("ExtraFlagLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("FleetDuties")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("GroupLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("InitShipCount")
.HasColumnType("INTEGER");
b.Property<bool>("IsSubmarineAutoAttack")
.HasColumnType("INTEGER");
b.Property<uint>("KillCount")
.HasColumnType("INTEGER");
b.Property<uint>("LoopFlag")
.HasColumnType("INTEGER");
b.Property<uint>("ModelActCount")
.HasColumnType("INTEGER");
b.Property<uint>("MoveStepCount")
.HasColumnType("INTEGER");
b.Property<string>("OperationBuffs")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("Round")
.HasColumnType("INTEGER");
b.Property<DateTime>("Time")
.HasColumnType("TEXT");
b.HasKey("Id", "PlayerUid");
b.HasIndex("PlayerUid");
b.ToTable("ChapterInfoes");
});
modelBuilder.Entity("BLHX.Server.Common.Database.Player", b =>
{
b.Property<uint>("Uid")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<uint>("AccPayLv")
.HasColumnType("INTEGER");
b.Property<string>("Adv")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValue("");
b.Property<string>("Appreciation")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("AttackCount")
.HasColumnType("INTEGER");
b.Property<uint>("BuyOilCount")
.HasColumnType("INTEGER");
b.Property<string>("CartoonCollectMarks")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("CartoonReadMarks")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Characters")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("ChatMsgBanTime")
.HasColumnType("INTEGER");
b.Property<uint>("ChatRoomId")
.HasColumnType("INTEGER");
b.Property<uint>("ChildDisplay")
.HasColumnType("INTEGER");
b.Property<uint>("CollectAttackCount")
.HasColumnType("INTEGER");
b.Property<uint>("CommanderBagMax")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<uint?>("CurrentChapter")
.HasColumnType("INTEGER");
b.Property<string>("DisplayInfo")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("EquipBagMax")
.HasColumnType("INTEGER");
b.Property<uint>("Exp")
.HasColumnType("INTEGER");
b.Property<string>("FlagLists")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Fleets")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("jsonb")
.HasDefaultValue("[{\"Id\":1,\"Name\":null,\"ShipLists\":[1,2],\"Commanders\":[]},{\"Id\":2,\"Name\":null,\"ShipLists\":[],\"Commanders\":[]},{\"Id\":11,\"Name\":null,\"ShipLists\":[],\"Commanders\":[]},{\"Id\":12,\"Name\":null,\"ShipLists\":[],\"Commanders\":[]}]");
b.Property<uint>("GmFlag")
.HasColumnType("INTEGER");
b.Property<uint>("GuideIndex")
.HasColumnType("INTEGER");
b.Property<uint>("GuildWaitTime")
.HasColumnType("INTEGER");
b.Property<uint>("Level")
.HasColumnType("INTEGER");
b.Property<uint>("MarryShip")
.HasColumnType("INTEGER");
b.Property<uint>("MaxRank")
.HasColumnType("INTEGER");
b.Property<string>("MedalIds")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("PvpAttackCount")
.HasColumnType("INTEGER");
b.Property<uint>("PvpWinCount")
.HasColumnType("INTEGER");
b.Property<string>("RandomShipLists")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("RandomShipMode")
.HasColumnType("INTEGER");
b.Property<uint>("Rank")
.HasColumnType("INTEGER");
b.Property<uint>("Rmb")
.HasColumnType("INTEGER");
b.Property<uint>("ShipBagMax")
.HasColumnType("INTEGER");
b.Property<string>("ShipSkins")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("jsonb")
.HasDefaultValue("[]");
b.Property<string>("Soundstories")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("StoryLists")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("ThemeUploadNotAllowedTime")
.HasColumnType("INTEGER");
b.Property<string>("Token")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("WinCount")
.HasColumnType("INTEGER");
b.HasKey("Uid");
b.HasIndex("Token")
.IsUnique();
b.ToTable("Players");
});
modelBuilder.Entity("BLHX.Server.Common.Database.PlayerResource", b =>
{
b.Property<uint>("Id")
.HasColumnType("INTEGER");
b.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b.Property<uint>("Num")
.HasColumnType("INTEGER");
b.HasKey("Id", "PlayerUid");
b.HasIndex("PlayerUid");
b.ToTable("Resources");
});
modelBuilder.Entity("BLHX.Server.Common.Database.PlayerShip", b =>
{
b.Property<uint>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<uint>("ActivityNpc")
.HasColumnType("INTEGER");
b.Property<uint>("BluePrintFlag")
.HasColumnType("INTEGER");
b.Property<uint>("CommanderId")
.HasColumnType("INTEGER");
b.Property<uint?>("CommonFlag")
.HasColumnType("INTEGER");
b.Property<string>("CoreLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<uint>("Energy")
.HasColumnType("INTEGER");
b.Property<string>("EquipInfoLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("Exp")
.HasColumnType("INTEGER");
b.Property<uint>("Intimacy")
.HasColumnType("INTEGER");
b.Property<bool>("IsLocked")
.HasColumnType("INTEGER");
b.Property<DateTime?>("LastChangeName")
.HasColumnType("TEXT");
b.Property<uint>("Level")
.HasColumnType("INTEGER");
b.Property<string>("MetaRepairLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b.Property<uint>("Proficiency")
.HasColumnType("INTEGER");
b.Property<uint>("Propose")
.HasColumnType("INTEGER");
b.Property<string>("SkillIdLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("SkinId")
.HasColumnType("INTEGER");
b.Property<string>("State")
.IsRequired()
.HasColumnType("jsonb");
b.Property<string>("StrengthLists")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("TemplateId")
.HasColumnType("INTEGER");
b.Property<string>("TransformLists")
.IsRequired()
.HasColumnType("jsonb");
b.HasKey("Id");
b.HasIndex("PlayerUid");
b.ToTable("Ships");
});
modelBuilder.Entity("BLHX.Server.Common.Database.ResourceField", b =>
{
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastHarvestTime")
.HasColumnType("TEXT");
b.Property<uint>("Level")
.HasColumnType("INTEGER");
b.Property<DateTime>("UpgradeTime")
.HasColumnType("TEXT");
b.HasKey("Type", "PlayerUid");
b.HasIndex("PlayerUid");
b.ToTable("ResourceFields");
});
modelBuilder.Entity("BLHX.Server.Common.Proto.common.Idtimeinfo", b =>
{
b.Property<uint>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<uint?>("PlayerUid")
.HasColumnType("INTEGER");
b.Property<uint?>("PlayerUid1")
.HasColumnType("INTEGER");
b.Property<uint>("Time")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PlayerUid");
b.HasIndex("PlayerUid1");
b.ToTable("Idtimeinfo");
});
modelBuilder.Entity("BLHX.Server.Common.Database.ChapterInfo", b =>
{
b.HasOne("BLHX.Server.Common.Database.Player", "Player")
.WithMany("ChapterInfoes")
.HasForeignKey("PlayerUid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("BLHX.Server.Common.Database.Player", b =>
{
b.OwnsOne("System.Collections.Generic.List<BLHX.Server.Common.Proto.common.RefundShopinfo>", "RefundShopInfoLists", b1 =>
{
b1.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b1.Property<int>("Capacity")
.HasColumnType("INTEGER");
b1.HasKey("PlayerUid");
b1.ToTable("Players");
b1.WithOwner()
.HasForeignKey("PlayerUid");
});
b.OwnsOne("System.Collections.Generic.List<BLHX.Server.Common.Proto.p11.Cardinfo>", "CardLists", b1 =>
{
b1.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b1.Property<int>("Capacity")
.HasColumnType("INTEGER");
b1.HasKey("PlayerUid");
b1.ToTable("Players");
b1.WithOwner()
.HasForeignKey("PlayerUid");
});
b.OwnsOne("System.Collections.Generic.List<BLHX.Server.Common.Proto.p11.Cooldown>", "CdLists", b1 =>
{
b1.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b1.Property<int>("Capacity")
.HasColumnType("INTEGER");
b1.HasKey("PlayerUid");
b1.ToTable("Players");
b1.WithOwner()
.HasForeignKey("PlayerUid");
});
b.OwnsOne("System.Collections.Generic.List<BLHX.Server.Common.Proto.p11.ShipTakingData>", "TakingShipLists", b1 =>
{
b1.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b1.Property<int>("Capacity")
.HasColumnType("INTEGER");
b1.HasKey("PlayerUid");
b1.ToTable("Players");
b1.WithOwner()
.HasForeignKey("PlayerUid");
});
b.Navigation("CardLists")
.IsRequired();
b.Navigation("CdLists")
.IsRequired();
b.Navigation("RefundShopInfoLists")
.IsRequired();
b.Navigation("TakingShipLists")
.IsRequired();
});
modelBuilder.Entity("BLHX.Server.Common.Database.PlayerResource", b =>
{
b.HasOne("BLHX.Server.Common.Database.Player", "Player")
.WithMany("Resources")
.HasForeignKey("PlayerUid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("BLHX.Server.Common.Database.PlayerShip", b =>
{
b.HasOne("BLHX.Server.Common.Database.Player", "Player")
.WithMany("Ships")
.HasForeignKey("PlayerUid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("BLHX.Server.Common.Database.ResourceField", b =>
{
b.HasOne("BLHX.Server.Common.Database.Player", "Player")
.WithMany("ResourceFields")
.HasForeignKey("PlayerUid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("BLHX.Server.Common.Proto.common.Idtimeinfo", b =>
{
b.HasOne("BLHX.Server.Common.Database.Player", null)
.WithMany("ChatFrameLists")
.HasForeignKey("PlayerUid");
b.HasOne("BLHX.Server.Common.Database.Player", null)
.WithMany("IconFrameLists")
.HasForeignKey("PlayerUid1");
});
modelBuilder.Entity("BLHX.Server.Common.Database.Player", b =>
{
b.Navigation("ChapterInfoes");
b.Navigation("ChatFrameLists");
b.Navigation("IconFrameLists");
b.Navigation("ResourceFields");
b.Navigation("Resources");
b.Navigation("Ships");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,441 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BLHX.Server.Common.Migrations.Player
{
/// <inheritdoc />
public partial class Players_AddParams : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<uint>(
name: "AccPayLv",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<string>(
name: "Appreciation",
table: "Players",
type: "jsonb",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<uint>(
name: "AttackCount",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "BuyOilCount",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<int>(
name: "CardLists_Capacity",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "CartoonCollectMarks",
table: "Players",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "CartoonReadMarks",
table: "Players",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<int>(
name: "CdLists_Capacity",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "Characters",
table: "Players",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<uint>(
name: "ChatMsgBanTime",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "ChatRoomId",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "ChildDisplay",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "CollectAttackCount",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "CommanderBagMax",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "EquipBagMax",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<string>(
name: "FlagLists",
table: "Players",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<uint>(
name: "GmFlag",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "GuideIndex",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "GuildWaitTime",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "MarryShip",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "MaxRank",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<string>(
name: "MedalIds",
table: "Players",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<uint>(
name: "PvpAttackCount",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "PvpWinCount",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<string>(
name: "RandomShipLists",
table: "Players",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<uint>(
name: "RandomShipMode",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "Rank",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<int>(
name: "RefundShopInfoLists_Capacity",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<uint>(
name: "Rmb",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "ShipBagMax",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<string>(
name: "Soundstories",
table: "Players",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "StoryLists",
table: "Players",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<int>(
name: "TakingShipLists_Capacity",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<uint>(
name: "ThemeUploadNotAllowedTime",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<uint>(
name: "WinCount",
table: "Players",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
migrationBuilder.CreateTable(
name: "Idtimeinfo",
columns: table => new
{
Id = table.Column<uint>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Time = table.Column<uint>(type: "INTEGER", nullable: false),
PlayerUid = table.Column<uint>(type: "INTEGER", nullable: true),
PlayerUid1 = table.Column<uint>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Idtimeinfo", x => x.Id);
table.ForeignKey(
name: "FK_Idtimeinfo_Players_PlayerUid",
column: x => x.PlayerUid,
principalTable: "Players",
principalColumn: "Uid");
table.ForeignKey(
name: "FK_Idtimeinfo_Players_PlayerUid1",
column: x => x.PlayerUid1,
principalTable: "Players",
principalColumn: "Uid");
});
migrationBuilder.CreateIndex(
name: "IX_Idtimeinfo_PlayerUid",
table: "Idtimeinfo",
column: "PlayerUid");
migrationBuilder.CreateIndex(
name: "IX_Idtimeinfo_PlayerUid1",
table: "Idtimeinfo",
column: "PlayerUid1");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Idtimeinfo");
migrationBuilder.DropColumn(
name: "AccPayLv",
table: "Players");
migrationBuilder.DropColumn(
name: "Appreciation",
table: "Players");
migrationBuilder.DropColumn(
name: "AttackCount",
table: "Players");
migrationBuilder.DropColumn(
name: "BuyOilCount",
table: "Players");
migrationBuilder.DropColumn(
name: "CardLists_Capacity",
table: "Players");
migrationBuilder.DropColumn(
name: "CartoonCollectMarks",
table: "Players");
migrationBuilder.DropColumn(
name: "CartoonReadMarks",
table: "Players");
migrationBuilder.DropColumn(
name: "CdLists_Capacity",
table: "Players");
migrationBuilder.DropColumn(
name: "Characters",
table: "Players");
migrationBuilder.DropColumn(
name: "ChatMsgBanTime",
table: "Players");
migrationBuilder.DropColumn(
name: "ChatRoomId",
table: "Players");
migrationBuilder.DropColumn(
name: "ChildDisplay",
table: "Players");
migrationBuilder.DropColumn(
name: "CollectAttackCount",
table: "Players");
migrationBuilder.DropColumn(
name: "CommanderBagMax",
table: "Players");
migrationBuilder.DropColumn(
name: "EquipBagMax",
table: "Players");
migrationBuilder.DropColumn(
name: "FlagLists",
table: "Players");
migrationBuilder.DropColumn(
name: "GmFlag",
table: "Players");
migrationBuilder.DropColumn(
name: "GuideIndex",
table: "Players");
migrationBuilder.DropColumn(
name: "GuildWaitTime",
table: "Players");
migrationBuilder.DropColumn(
name: "MarryShip",
table: "Players");
migrationBuilder.DropColumn(
name: "MaxRank",
table: "Players");
migrationBuilder.DropColumn(
name: "MedalIds",
table: "Players");
migrationBuilder.DropColumn(
name: "PvpAttackCount",
table: "Players");
migrationBuilder.DropColumn(
name: "PvpWinCount",
table: "Players");
migrationBuilder.DropColumn(
name: "RandomShipLists",
table: "Players");
migrationBuilder.DropColumn(
name: "RandomShipMode",
table: "Players");
migrationBuilder.DropColumn(
name: "Rank",
table: "Players");
migrationBuilder.DropColumn(
name: "RefundShopInfoLists_Capacity",
table: "Players");
migrationBuilder.DropColumn(
name: "Rmb",
table: "Players");
migrationBuilder.DropColumn(
name: "ShipBagMax",
table: "Players");
migrationBuilder.DropColumn(
name: "Soundstories",
table: "Players");
migrationBuilder.DropColumn(
name: "StoryLists",
table: "Players");
migrationBuilder.DropColumn(
name: "TakingShipLists_Capacity",
table: "Players");
migrationBuilder.DropColumn(
name: "ThemeUploadNotAllowedTime",
table: "Players");
migrationBuilder.DropColumn(
name: "WinCount",
table: "Players");
}
}
}

View File

@@ -116,12 +116,52 @@ namespace BLHX.Server.Common.Migrations.Player
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<uint>("AccPayLv")
.HasColumnType("INTEGER");
b.Property<string>("Adv")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValue("");
b.Property<string>("Appreciation")
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("AttackCount")
.HasColumnType("INTEGER");
b.Property<uint>("BuyOilCount")
.HasColumnType("INTEGER");
b.Property<string>("CartoonCollectMarks")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("CartoonReadMarks")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Characters")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("ChatMsgBanTime")
.HasColumnType("INTEGER");
b.Property<uint>("ChatRoomId")
.HasColumnType("INTEGER");
b.Property<uint>("ChildDisplay")
.HasColumnType("INTEGER");
b.Property<uint>("CollectAttackCount")
.HasColumnType("INTEGER");
b.Property<uint>("CommanderBagMax")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
@@ -132,32 +172,94 @@ namespace BLHX.Server.Common.Migrations.Player
.IsRequired()
.HasColumnType("jsonb");
b.Property<uint>("EquipBagMax")
.HasColumnType("INTEGER");
b.Property<uint>("Exp")
.HasColumnType("INTEGER");
b.Property<string>("FlagLists")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Fleets")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("jsonb")
.HasDefaultValue("[{\"Id\":1,\"Name\":null,\"ShipLists\":[1,2],\"Commanders\":[]},{\"Id\":2,\"Name\":null,\"ShipLists\":[],\"Commanders\":[]},{\"Id\":11,\"Name\":null,\"ShipLists\":[],\"Commanders\":[]},{\"Id\":12,\"Name\":null,\"ShipLists\":[],\"Commanders\":[]}]");
b.Property<uint>("GmFlag")
.HasColumnType("INTEGER");
b.Property<uint>("GuideIndex")
.HasColumnType("INTEGER");
b.Property<uint>("GuildWaitTime")
.HasColumnType("INTEGER");
b.Property<uint>("Level")
.HasColumnType("INTEGER");
b.Property<uint>("MarryShip")
.HasColumnType("INTEGER");
b.Property<uint>("MaxRank")
.HasColumnType("INTEGER");
b.Property<string>("MedalIds")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("PvpAttackCount")
.HasColumnType("INTEGER");
b.Property<uint>("PvpWinCount")
.HasColumnType("INTEGER");
b.Property<string>("RandomShipLists")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("RandomShipMode")
.HasColumnType("INTEGER");
b.Property<uint>("Rank")
.HasColumnType("INTEGER");
b.Property<uint>("Rmb")
.HasColumnType("INTEGER");
b.Property<uint>("ShipBagMax")
.HasColumnType("INTEGER");
b.Property<string>("ShipSkins")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("jsonb")
.HasDefaultValue("[]");
b.Property<string>("Soundstories")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("StoryLists")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("ThemeUploadNotAllowedTime")
.HasColumnType("INTEGER");
b.Property<string>("Token")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("WinCount")
.HasColumnType("INTEGER");
b.HasKey("Uid");
b.HasIndex("Token")
@@ -300,6 +402,30 @@ namespace BLHX.Server.Common.Migrations.Player
b.ToTable("ResourceFields");
});
modelBuilder.Entity("BLHX.Server.Common.Proto.common.Idtimeinfo", b =>
{
b.Property<uint>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<uint?>("PlayerUid")
.HasColumnType("INTEGER");
b.Property<uint?>("PlayerUid1")
.HasColumnType("INTEGER");
b.Property<uint>("Time")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PlayerUid");
b.HasIndex("PlayerUid1");
b.ToTable("Idtimeinfo");
});
modelBuilder.Entity("BLHX.Server.Common.Database.ChapterInfo", b =>
{
b.HasOne("BLHX.Server.Common.Database.Player", "Player")
@@ -311,6 +437,85 @@ namespace BLHX.Server.Common.Migrations.Player
b.Navigation("Player");
});
modelBuilder.Entity("BLHX.Server.Common.Database.Player", b =>
{
b.OwnsOne("System.Collections.Generic.List<BLHX.Server.Common.Proto.common.RefundShopinfo>", "RefundShopInfoLists", b1 =>
{
b1.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b1.Property<int>("Capacity")
.HasColumnType("INTEGER");
b1.HasKey("PlayerUid");
b1.ToTable("Players");
b1.WithOwner()
.HasForeignKey("PlayerUid");
});
b.OwnsOne("System.Collections.Generic.List<BLHX.Server.Common.Proto.p11.Cardinfo>", "CardLists", b1 =>
{
b1.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b1.Property<int>("Capacity")
.HasColumnType("INTEGER");
b1.HasKey("PlayerUid");
b1.ToTable("Players");
b1.WithOwner()
.HasForeignKey("PlayerUid");
});
b.OwnsOne("System.Collections.Generic.List<BLHX.Server.Common.Proto.p11.Cooldown>", "CdLists", b1 =>
{
b1.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b1.Property<int>("Capacity")
.HasColumnType("INTEGER");
b1.HasKey("PlayerUid");
b1.ToTable("Players");
b1.WithOwner()
.HasForeignKey("PlayerUid");
});
b.OwnsOne("System.Collections.Generic.List<BLHX.Server.Common.Proto.p11.ShipTakingData>", "TakingShipLists", b1 =>
{
b1.Property<uint>("PlayerUid")
.HasColumnType("INTEGER");
b1.Property<int>("Capacity")
.HasColumnType("INTEGER");
b1.HasKey("PlayerUid");
b1.ToTable("Players");
b1.WithOwner()
.HasForeignKey("PlayerUid");
});
b.Navigation("CardLists")
.IsRequired();
b.Navigation("CdLists")
.IsRequired();
b.Navigation("RefundShopInfoLists")
.IsRequired();
b.Navigation("TakingShipLists")
.IsRequired();
});
modelBuilder.Entity("BLHX.Server.Common.Database.PlayerResource", b =>
{
b.HasOne("BLHX.Server.Common.Database.Player", "Player")
@@ -344,10 +549,25 @@ namespace BLHX.Server.Common.Migrations.Player
b.Navigation("Player");
});
modelBuilder.Entity("BLHX.Server.Common.Proto.common.Idtimeinfo", b =>
{
b.HasOne("BLHX.Server.Common.Database.Player", null)
.WithMany("ChatFrameLists")
.HasForeignKey("PlayerUid");
b.HasOne("BLHX.Server.Common.Database.Player", null)
.WithMany("IconFrameLists")
.HasForeignKey("PlayerUid1");
});
modelBuilder.Entity("BLHX.Server.Common.Database.Player", b =>
{
b.Navigation("ChapterInfoes");
b.Navigation("ChatFrameLists");
b.Navigation("IconFrameLists");
b.Navigation("ResourceFields");
b.Navigation("Resources");

View File

@@ -9,6 +9,7 @@
Cs10026 = 10026,
Cs10100 = 10100,
Cs10800 = 10800,
Cs10992 = 10992,
Cs10993 = 10993,
Cs10994 = 10994,
Cs10996 = 10996,

View File

@@ -6,12 +6,10 @@
#region Designer generated code
#pragma warning disable CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192
namespace BLHX.Server.Common.Proto.p10
{
namespace BLHX.Server.Common.Proto.p10 {
[global::ProtoBuf.ProtoContract(Name = @"cs_10001")]
public partial class Cs10001 : global::ProtoBuf.IExtensible
{
public partial class Cs10001 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -28,8 +26,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"cs_10020")]
public partial class Cs10020 : global::ProtoBuf.IExtensible
{
public partial class Cs10020 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -42,8 +39,7 @@ namespace BLHX.Server.Common.Proto.p10
[global::ProtoBuf.ProtoMember(3, Name = @"arg2")]
[global::System.ComponentModel.DefaultValue("")]
public string Arg2
{
public string Arg2 {
get => __pbn__Arg2 ?? "";
set => __pbn__Arg2 = value;
}
@@ -53,8 +49,7 @@ namespace BLHX.Server.Common.Proto.p10
[global::ProtoBuf.ProtoMember(4, Name = @"arg3")]
[global::System.ComponentModel.DefaultValue("")]
public string Arg3
{
public string Arg3 {
get => __pbn__Arg3 ?? "";
set => __pbn__Arg3 = value;
}
@@ -64,8 +59,7 @@ namespace BLHX.Server.Common.Proto.p10
[global::ProtoBuf.ProtoMember(5, Name = @"arg4")]
[global::System.ComponentModel.DefaultValue("")]
public string Arg4
{
public string Arg4 {
get => __pbn__Arg4 ?? "";
set => __pbn__Arg4 = value;
}
@@ -77,8 +71,7 @@ namespace BLHX.Server.Common.Proto.p10
public string CheckKey { get; set; }
[global::ProtoBuf.ProtoMember(7, Name = @"device")]
public uint Device
{
public uint Device {
get => __pbn__Device.GetValueOrDefault();
set => __pbn__Device = value;
}
@@ -89,8 +82,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"cs_10022")]
public partial class Cs10022 : global::ProtoBuf.IExtensible
{
public partial class Cs10022 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -116,8 +108,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"cs_10024")]
public partial class Cs10024 : global::ProtoBuf.IExtensible
{
public partial class Cs10024 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -134,8 +125,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"cs_10026")]
public partial class Cs10026 : global::ProtoBuf.IExtensible
{
public partial class Cs10026 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -146,8 +136,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"cs_10100")]
public partial class Cs10100 : global::ProtoBuf.IExtensible
{
public partial class Cs10100 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -158,8 +147,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"cs_10800")]
public partial class Cs10800 : global::ProtoBuf.IExtensible
{
public partial class Cs10800 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -172,9 +160,30 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"cs_10992")]
public partial class Cs10992 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
[global::ProtoBuf.ProtoMember(1, Name = @"track_type", IsRequired = true)]
public uint TrackType { get; set; }
[global::ProtoBuf.ProtoMember(2, Name = @"event_id", IsRequired = true)]
public uint EventId { get; set; }
[global::ProtoBuf.ProtoMember(3, Name = @"para1", IsRequired = true)]
public string Para1 { get; set; }
[global::ProtoBuf.ProtoMember(4, Name = @"para2", IsRequired = true)]
public string Para2 { get; set; }
[global::ProtoBuf.ProtoMember(5, Name = @"para3", IsRequired = true)]
public string Para3 { get; set; }
}
[global::ProtoBuf.ProtoContract(Name = @"cs_10993")]
public partial class Cs10993 : global::ProtoBuf.IExtensible
{
public partial class Cs10993 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -189,8 +198,7 @@ namespace BLHX.Server.Common.Proto.p10
public string ActionDes { get; set; }
[global::ProtoBuf.ProtoMember(4, Name = @"action_arg")]
public uint ActionArg
{
public uint ActionArg {
get => __pbn__ActionArg.GetValueOrDefault();
set => __pbn__ActionArg = value;
}
@@ -201,8 +209,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"cs_10994")]
public partial class Cs10994 : global::ProtoBuf.IExtensible
{
public partial class Cs10994 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -213,8 +220,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"cs_10996")]
public partial class Cs10996 : global::ProtoBuf.IExtensible
{
public partial class Cs10996 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -228,8 +234,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"noticeinfo")]
public partial class Noticeinfo : global::ProtoBuf.IExtensible
{
public partial class Noticeinfo : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -246,8 +251,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"sc_10002")]
public partial class Sc10002 : global::ProtoBuf.IExtensible
{
public partial class Sc10002 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -258,8 +262,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"sc_10021")]
public partial class Sc10021 : global::ProtoBuf.IExtensible
{
public partial class Sc10021 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -280,8 +283,7 @@ namespace BLHX.Server.Common.Proto.p10
public global::System.Collections.Generic.List<Noticeinfo> NoticeLists { get; set; } = new global::System.Collections.Generic.List<Noticeinfo>();
[global::ProtoBuf.ProtoMember(6, Name = @"device")]
public uint Device
{
public uint Device {
get => __pbn__Device.GetValueOrDefault();
set => __pbn__Device = value;
}
@@ -295,8 +297,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"sc_10023")]
public partial class Sc10023 : global::ProtoBuf.IExtensible
{
public partial class Sc10023 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -311,8 +312,7 @@ namespace BLHX.Server.Common.Proto.p10
public string ServerTicket { get; set; }
[global::ProtoBuf.ProtoMember(4, Name = @"server_load")]
public uint ServerLoad
{
public uint ServerLoad {
get => __pbn__ServerLoad.GetValueOrDefault();
set => __pbn__ServerLoad = value;
}
@@ -321,8 +321,7 @@ namespace BLHX.Server.Common.Proto.p10
private uint? __pbn__ServerLoad;
[global::ProtoBuf.ProtoMember(5, Name = @"db_load")]
public uint DbLoad
{
public uint DbLoad {
get => __pbn__DbLoad.GetValueOrDefault();
set => __pbn__DbLoad = value;
}
@@ -333,8 +332,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"sc_10025")]
public partial class Sc10025 : global::ProtoBuf.IExtensible
{
public partial class Sc10025 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -348,8 +346,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"sc_10027")]
public partial class Sc10027 : global::ProtoBuf.IExtensible
{
public partial class Sc10027 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -363,8 +360,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"sc_10101")]
public partial class Sc10101 : global::ProtoBuf.IExtensible
{
public partial class Sc10101 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -375,8 +371,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"sc_10801")]
public partial class Sc10801 : global::ProtoBuf.IExtensible
{
public partial class Sc10801 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -395,8 +390,7 @@ namespace BLHX.Server.Common.Proto.p10
[global::ProtoBuf.ProtoMember(5, Name = @"proxy_ip")]
[global::System.ComponentModel.DefaultValue("")]
public string ProxyIp
{
public string ProxyIp {
get => __pbn__ProxyIp ?? "";
set => __pbn__ProxyIp = value;
}
@@ -405,8 +399,7 @@ namespace BLHX.Server.Common.Proto.p10
private string __pbn__ProxyIp;
[global::ProtoBuf.ProtoMember(6, Name = @"proxy_port")]
public uint ProxyPort
{
public uint ProxyPort {
get => __pbn__ProxyPort.GetValueOrDefault();
set => __pbn__ProxyPort = value;
}
@@ -426,8 +419,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"sc_10995")]
public partial class Sc10995 : global::ProtoBuf.IExtensible
{
public partial class Sc10995 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -438,8 +430,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"sc_10997")]
public partial class Sc10997 : global::ProtoBuf.IExtensible
{
public partial class Sc10997 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -468,8 +459,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"sc_10998")]
public partial class Sc10998 : global::ProtoBuf.IExtensible
{
public partial class Sc10998 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -483,8 +473,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"sc_10999")]
public partial class Sc10999 : global::ProtoBuf.IExtensible
{
public partial class Sc10999 : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -495,8 +484,7 @@ namespace BLHX.Server.Common.Proto.p10
}
[global::ProtoBuf.ProtoContract(Name = @"serverinfo")]
public partial class Serverinfo : global::ProtoBuf.IExtensible
{
public partial class Serverinfo : global::ProtoBuf.IExtensible {
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
@@ -517,8 +505,7 @@ namespace BLHX.Server.Common.Proto.p10
public string Name { get; set; }
[global::ProtoBuf.ProtoMember(6, Name = @"tag_state")]
public uint TagState
{
public uint TagState {
get => __pbn__TagState.GetValueOrDefault();
set => __pbn__TagState = value;
}
@@ -527,8 +514,7 @@ namespace BLHX.Server.Common.Proto.p10
private uint? __pbn__TagState;
[global::ProtoBuf.ProtoMember(7, Name = @"sort")]
public uint Sort
{
public uint Sort {
get => __pbn__Sort.GetValueOrDefault();
set => __pbn__Sort = value;
}
@@ -538,8 +524,7 @@ namespace BLHX.Server.Common.Proto.p10
[global::ProtoBuf.ProtoMember(8, Name = @"proxy_ip")]
[global::System.ComponentModel.DefaultValue("")]
public string ProxyIp
{
public string ProxyIp {
get => __pbn__ProxyIp ?? "";
set => __pbn__ProxyIp = value;
}
@@ -548,8 +533,7 @@ namespace BLHX.Server.Common.Proto.p10
private string __pbn__ProxyIp;
[global::ProtoBuf.ProtoMember(9, Name = @"proxy_port")]
public uint ProxyPort
{
public uint ProxyPort {
get => __pbn__ProxyPort.GetValueOrDefault();
set => __pbn__ProxyPort = value;
}

View File

@@ -0,0 +1,272 @@
{
"1": {
"activity_id": 30877,
"create_id": 7,
"id": 1,
"pickup_list": [
101031,
101041,
101061,
101071,
101091,
101131,
101141,
101151,
101171,
101251,
101351,
101361,
101371,
101381,
101391,
101411,
101421,
101431,
101441,
101451,
101461,
101481,
101491,
102011,
102021,
102031,
102041,
102061,
102071,
102081,
102131,
102141,
102151,
102181,
102191,
102201,
102231,
102241,
102251,
102261,
102271,
201011,
201021,
201031,
201061,
201071,
201081,
201091,
201101,
201111,
201161,
201211,
201241,
201251,
202011,
202021,
202031,
202041,
202071,
202101,
202121,
202151,
202181,
202211,
202221,
202231,
202261,
202281,
202291,
202301,
301011,
301021,
301051,
301211,
301231,
301261,
301301,
301311,
301321,
301331,
301351,
301381,
301541,
301591,
301601,
301611,
301621,
301631,
301641,
301791,
301811,
301821,
301831,
301851,
301861,
302011,
302041,
302141,
302211,
401021,
401191,
401231,
402011,
402021,
402031,
502011,
502041,
502051,
601031,
701021,
701041,
701051,
701061,
702011,
702021,
702031,
801021,
801071,
801081,
802021,
901011,
901021,
901031
],
"pickup_num": 2,
"ratio_display": [
250,
250,
250,
200
]
},
"2": {
"activity_id": 30877,
"create_id": 8,
"id": 2,
"pickup_list": [
100021,
101514,
105174,
107104,
118024,
199044,
205134,
207074,
299044,
299054,
301294,
303194,
305104,
307084,
399044,
399054,
405034,
405054,
499024,
499054,
499094,
718014,
899034,
900302,
900314,
900315,
900351,
900365,
900377,
900378,
900379,
900392,
900404,
900910,
900911,
900914,
900919,
900920,
900923,
900927,
900928,
900931
],
"pickup_num": 2,
"ratio_display": [
250,
250,
250,
200
]
},
"3": {
"activity_id": 30877,
"create_id": 6,
"id": 3,
"pickup_list": [
103011,
103031,
103041,
103051,
103061,
103071,
106011,
106021,
107011,
107021,
107031,
107041,
107051,
107061,
107071,
107091,
107111,
107381,
108051,
108071,
112011,
203011,
203021,
203031,
203041,
203051,
203061,
206011,
206031,
206041,
207021,
207031,
207041,
207051,
306071,
307071,
307091,
307101,
307111,
308011,
308021,
308031,
308041,
308051,
308061,
317011,
407011,
407021,
408011,
408021,
408041,
408051,
408061,
408071,
408081,
408091,
506011,
808011
],
"pickup_num": 2,
"ratio_display": [
250,
250,
250,
200
]
},
"all": [
1,
2,
3
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,14 @@
public static class RNG
{
public enum Rarity {
Normal = 2,
Rare = 3,
Elite = 4,
SSR = 5,
UR = 6,
}
public static readonly SortedDictionary<int, float> ShipRarityRates = new()
{
{6, 1.2f}, // UR

View File

@@ -10,4 +10,8 @@
<ProjectReference Include="..\BLHX.Server.Common\BLHX.Server.Common.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="zlib.net" Version="1.0.4" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,59 @@
using BLHX.Server.Common.Data;
using BLHX.Server.Common.Database;
using BLHX.Server.Common.Proto.common;
using BLHX.Server.Game.Handlers;
using System.Numerics;
namespace BLHX.Server.Game.Commands {
[CommandHandler("item", "Unlock an item or all items", "item unlock=all amount=1")]
public class ItemCommand : Command {
[Argument("unlock")]
public string? Unlock { get; set; }
[Argument("amount")]
public string? Amount { get; set; }
public override void Execute(Dictionary<string, string> args, Connection connection) {
base.Execute(args);
//uint amount = 1;
//if (Amount is not null) {
// uint.TryParse(Amount, out uint parsedAmount);
// amount = parsedAmount;
//}
//if (Unlock is not null) {
// if (Unlock.Equals("all", StringComparison.CurrentCultureIgnoreCase)) {
// // ...
// } else if (uint.TryParse(Unlock, out uint itemId)) {
// //connection.player.DoResource(itemId, amount);
// PlayerResource? item = DBManager.PlayerContext.Resources.Where(res => res.Id == itemId).FirstOrDefault();
// if (item is null) {
// DBManager.PlayerContext.Resources.Add(new PlayerResource() { Id = itemId, PlayerUid = connection.player.Uid, Num = 1 });
// //connection.player.DoResource(itemId, 1);
// //item = DBManager.PlayerContext.Resources.Where(res => res.Id == itemId).FirstOrDefault();
// } else {
// item.Num += amount;
// connection.SendSystemMsg($"{amount} item of itemid: {itemId} added!");
// }
// } else {
// connection.SendSystemMsg($"Invalid ItemId: {itemId}");
// }
//}
// code above prob doesn't work yet too lazy to implement, for now this cmd just adds a lot of coins and gems, prob need a inventory manager or something in the future
connection.player.DoResource(1, 938493849);
connection.player.DoResource(4, 39843294);
DBManager.PlayerContext.Save();
connection.NotifyPlayerData();
connection.NotifyBagData();
base.NotifySuccess(connection);
}
}
}

View File

@@ -0,0 +1,40 @@
using BLHX.Server.Common.Database;
using BLHX.Server.Common.Utils;
namespace BLHX.Server.Game.Commands;
[CommandHandler("setlevel", "set a player's level", "setlevel uid=1 level=20")]
public class SetLevelCommand : Command {
[Argument("uid")]
public string? UID { get; set; }
[Argument("level")]
public string? Level { get; set; }
public override void Execute(Dictionary<string, string> args) {
base.Execute(args);
if (UID is null || Level is null) {
Logger.c.Log($"Usage: /setlevel uid=1 level=20");
return;
}
if (!uint.TryParse(UID, out uint targetUID) || !uint.TryParse(Level, out uint targetLevel)) {
Logger.c.Log($"Invalid UID or Level");
return;
}
Player? player = DBManager.PlayerContext.Players.Where(p => p.Uid == targetUID).FirstOrDefault();
if (player == null) {
Logger.c.Log($"Can not find player with UID: ${targetUID}");
return;
}
player.Level = targetLevel;
DBManager.PlayerContext.Save();
Logger.c.Log($"Set Player with UID {targetUID}'s level to {targetLevel}");
}
}

View File

@@ -0,0 +1,50 @@
using BLHX.Server.Common.Database;
using BLHX.Server.Common.Utils;
using BLHX.Server.Game.Handlers;
using System.ComponentModel;
using System.Globalization;
using System.Reflection;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
namespace BLHX.Server.Game.Commands;
// Chatbox has 40 character limit, original command is setplayerdata shortened -> spd
[CommandHandler("spd", "set a player's data", "spd property=level value=20")]
public class SetPlayerDataCommand : Command {
[Argument("property")]
public string? Property { get; set; }
[Argument("value")]
public string? Value { get; set; }
public override void Execute(Dictionary<string, string> args, Connection connection) {
base.Execute(args);
if (Property is null || Value is null) {
connection.SendSystemMsg($"Usage: /spd property=<Level|Name|Exp|ShipBagMax|...> value=1");
return;
}
PropertyInfo? targetProperty = typeof(Player).GetProperty(Property);
TypeConverter converter = TypeDescriptor.GetConverter(targetProperty.PropertyType);
if (converter != null && converter.CanConvertFrom(typeof(string))) {
try {
object targetValue = converter.ConvertFromInvariantString(Value);
targetProperty.SetValue(connection.player, targetValue);
} catch (Exception) {
connection.SendSystemMsg("Invalid Value");
return;
}
} else {
connection.SendSystemMsg($"Invalid Player Property!");
return;
}
DBManager.PlayerContext.Save();
connection.NotifyPlayerData();
connection.SendSystemMsg($"Set Player with UID {connection.player.Uid}'s {Property} to {Value}");
}
}

View File

@@ -0,0 +1,87 @@
using BLHX.Server.Common.Data;
using BLHX.Server.Common.Database;
using BLHX.Server.Common.Proto.common;
using BLHX.Server.Common.Utils;
using BLHX.Server.Game.Handlers;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
namespace BLHX.Server.Game.Commands {
[CommandHandler("ship", "Unlock a character or all characters", "ship unlock=all rarity=6")]
public class ShipCommand : Command {
[Argument("unlock")]
public string? Unlock { get; set; }
[Argument("rarity")]
public string? Rarity { get; set; }
public override void Execute(Dictionary<string, string> args, Connection connection) {
base.Execute(args);
if (Unlock is null) {
connection.SendSystemMsg($"Usage: /ship unlock=<all|clear|shipId> rarity=1-6");
return;
}
if (Unlock.Equals("all", StringComparison.CurrentCultureIgnoreCase)) {
int amount = 585; // adding more than this currently causes the client to crash since too much data is sent in a single packet
Dictionary<int, ShipDataTemplate> ship_ids_filter = Data.ShipDataTemplate.Where(x => x.Value.Star == x.Value.StarMax && x.Value.Star >= 5).ToDictionary();
List<int> all_ship_ids = ship_ids_filter.Keys.ToList();
if (Rarity is not null && int.TryParse(Rarity, out int rarity)) {
all_ship_ids = Data.ShipDataStatistics.Where(ship_data => all_ship_ids.Contains(ship_data.Key) && ship_data.Value.Rarity == rarity).ToDictionary().Keys.ToList();
}
List<PlayerShip> all_ships = all_ship_ids.Select(ship_id => CreateShipFromId((uint)ship_id, connection.player.Uid)).Take(amount).ToList();
all_ships.AddRange(GetDefaultShips(connection.player.Ships)); // add the defaults
connection.player.Ships = all_ships;
connection.SendSystemMsg($"Added {amount} ships!");
} else if (Unlock.Equals("clear", StringComparison.CurrentCultureIgnoreCase)) {
connection.player.Ships = GetDefaultShips(connection.player.Ships);
connection.SendSystemMsg($"Cleared all ships!");
} else if (uint.TryParse(Unlock, out uint shipId)) {
connection.player.AddShip(shipId);
} else {
connection.SendSystemMsg($"Invalid Ship Id: {shipId}");
return;
}
Rarity = null;
DBManager.PlayerContext.Save();
connection.NotifyShipData();
base.NotifySuccess(connection);
}
public static PlayerShip CreateShipFromId(uint shipId, uint playerUid) {
if (!Data.ShipDataTemplate.TryGetValue((int)shipId, out var shipTemplate))
throw new InvalidDataException($"Ship template {shipId} not found!");
var ship = new PlayerShip() {
TemplateId = shipId,
Level = 1,
EquipInfoLists = [
new EquipskinInfo() { Id = shipTemplate.EquipId1 },
new EquipskinInfo() { Id = shipTemplate.EquipId2 },
new EquipskinInfo() { Id = shipTemplate.EquipId3 },
new EquipskinInfo(),
new EquipskinInfo(),
],
Energy = shipTemplate.Energy,
SkillIdLists = shipTemplate.BuffList.Select(x => new Shipskill() { SkillId = x, SkillLv = 1 }).ToList(),
Intimacy = 5000,
PlayerUid = playerUid
};
return ship;
}
public static ICollection<PlayerShip> GetDefaultShips(ICollection<PlayerShip> playerShips) {
return playerShips.Where(ship => ship.TemplateId == 106011 || ship.TemplateId == 101171).ToList();
}
}
}

View File

@@ -22,7 +22,8 @@ namespace BLHX.Server.Game
readonly Task loopTask;
ushort packetIdx = 0;
private ushort NextPacketIdx => packetIdx;
public IPEndPoint EndPoint => (IPEndPoint?)tcpClient.Client.RemoteEndPoint ?? IPEndPoint.Parse("0.0.0.0:0");
public IPEndPoint EndPoint => tcpClient?.Client?.RemoteEndPoint as IPEndPoint ?? IPEndPoint.Parse("0.0.0.0:0");
public Connection(TcpClient tcpClient)
{

View File

@@ -2,18 +2,15 @@
using BLHX.Server.Common.Database;
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Data;
using BLHX.Server.Common.Utils;
namespace BLHX.Server.Game.Handlers
{
internal static class P10
{
namespace BLHX.Server.Game.Handlers {
internal static class P10 {
#region GateCommands
[PacketHandler(Command.Cs10800)]
static void VersionHandler(Connection connection, Packet packet)
{
static void VersionHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs10800>();
connection.Send(new Sc10801()
{
connection.Send(new Sc10801() {
GatewayIp = Config.Instance.Address,
GatewayPort = Config.Instance.Port,
Url = "http://" + Config.Instance.Address,
@@ -37,14 +34,12 @@ namespace BLHX.Server.Game.Handlers
}
[PacketHandler(Command.Cs10020)]
static void UserLoginHandler(Connection connection, Packet packet)
{
static void UserLoginHandler(Connection connection, Packet packet) {
// Arg2 uid
// Arg3 accessToken
// CheckKey md5(Arg1 + salt)
var req = packet.Decode<Cs10020>();
connection.Send(new Sc10021()
{
connection.Send(new Sc10021() {
Result = 0,
AccountId = uint.Parse(req.Arg2),
Serverlists = [
@@ -65,14 +60,12 @@ namespace BLHX.Server.Game.Handlers
#endregion
[PacketHandler(Command.Cs10022)]
static void ServerLoginHandler(Connection connection, Packet packet)
{
static void ServerLoginHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs10022>();
var rsp = new Sc10023();
var account = DBManager.AccountContext.Accounts.SingleOrDefault(x => x.Uid == req.AccountId);
if (account is null || account.Token != req.ServerTicket)
{
if (account is null || account.Token != req.ServerTicket) {
rsp.Result = 1;
connection.Send(rsp);
connection.EndProtocol();
@@ -83,8 +76,7 @@ namespace BLHX.Server.Game.Handlers
rsp.ServerTicket = req.ServerTicket;
var player = DBManager.PlayerContext.Players.SingleOrDefault(x => x.Token == req.ServerTicket);
if (player is null)
{
if (player is null) {
connection.Send(rsp);
return;
}
@@ -96,12 +88,10 @@ namespace BLHX.Server.Game.Handlers
}
[PacketHandler(Command.Cs10024)]
static void CreateNewPlayerHandler(Connection connection, Packet packet)
{
static void CreateNewPlayerHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs10024>();
var rsp = new Sc10025();
if (connection.player is not null)
{
if (connection.player is not null) {
rsp.Result = 1011;
connection.Send(rsp);
return;
@@ -114,10 +104,17 @@ namespace BLHX.Server.Game.Handlers
}
[PacketHandler(Command.Cs10100, IsNotifyHandler = true)]
static void HeartbeatHandler(Connection connection, Packet packet)
{
static void HeartbeatHandler(Connection connection, Packet packet) {
connection.Send(new Sc10101());
connection.Tick();
}
[PacketHandler(Command.Cs10992)]
static void LevelUpHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs10992>();
}
}
}

View File

@@ -2,16 +2,12 @@
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Proto.p11;
namespace BLHX.Server.Game.Handlers
{
internal static class P11
{
namespace BLHX.Server.Game.Handlers {
internal static class P11 {
[PacketHandler(Command.Cs11001)]
static void ServerTimeHandler(Connection connection, Packet packet)
{
static void ServerTimeHandler(Connection connection, Packet packet) {
connection.InitClientData();
connection.Send(new Sc11002()
{
connection.Send(new Sc11002() {
Timestamp = (uint)DateTimeOffset.Now.ToUnixTimeSeconds(),
Monday0oclockTimestamp = Connection.Monday0oclockTimestamp,
ShipCount = connection.player is null ? 0 : (uint)connection.player.Ships.Count
@@ -20,102 +16,127 @@ namespace BLHX.Server.Game.Handlers
}
[PacketHandler(Command.Cs11009, SaveDataAfterRun = true)]
static void ChangeManifestoHandler(Connection connection, Packet packet)
{
static void ChangeManifestoHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs11009>();
connection.player.Adv = req.Adv;
connection.Send(new Sc11010());
}
[PacketHandler(Command.Cs11011, SaveDataAfterRun = true)]
static void ChangePlayerIconHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs11011>();
connection.Send(new Sc11012());
}
[PacketHandler(Command.Cs11013, SaveDataAfterRun = true)]
static void HarvestResourceHandler(Connection connection, Packet packet)
{
static void HarvestResourceHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs11013>();
connection.player.HarvestResourceField((ResourceFieldType)req.Type);
connection.Send(new Sc11014());
}
[PacketHandler(Command.Cs11019, SaveDataAfterRun = true)]
static void UpdateCommonFlagHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs11019>();
connection.Send(new Sc11020());
}
[PacketHandler(Command.Cs11601)]
static void GetEmojiInfoHandler(Connection connection, Packet packet)
{
static void GetEmojiInfoHandler(Connection connection, Packet packet) {
connection.Send(new Sc11602());
}
[PacketHandler(Command.Cs11603)]
static void FetchSecondaryPasswordHandler(Connection connection, Packet packet)
{
static void FetchSecondaryPasswordHandler(Connection connection, Packet packet) {
connection.Send(new Sc11604());
}
[PacketHandler(Command.Cs11017)]
static void StageDropListHandler(Connection connection, Packet packet)
{
static void StageDropListHandler(Connection connection, Packet packet) {
connection.Send(new Sc11018());
}
[PacketHandler(Command.Cs11401)]
static void ChangeChatRoomHandler(Connection connection, Packet packet)
{
static void ChangeChatRoomHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs11401>();
connection.Send(new Sc11402()
{
connection.Send(new Sc11402() {
Result = 0,
RoomId = req.RoomId
});
}
}
static class P11ConnectionNotifyExtensions
{
public static void NotifyResourceList(this Connection connection)
{
if (connection.player is not null)
{
connection.Send(new Sc11004()
{
static class P11ConnectionNotifyExtensions {
public static void NotifyResourceList(this Connection connection) {
if (connection.player is not null) {
connection.Send(new Sc11004() {
ResourceLists = connection.player.Resources.Select(x => new Resource() { Num = x.Num, Type = x.Id }).ToList()
});
}
}
public static void NotifyPlayerData(this Connection connection)
{
if (connection.player is not null)
{
connection.Send(new Sc11003()
{
public static void NotifyPlayerData(this Connection connection) {
if (connection.player is not null) {
connection.Send(new Sc11003() {
Id = connection.player.Uid,
Name = connection.player.Name,
Level = connection.player.Level,
Exp = connection.player.Exp,
Adv = connection.player.Adv,
ResourceLists = connection.player.Resources.Select(x => new Resource() { Num = x.Num, Type = x.Id }).ToList(),
Characters = [1],
ShipBagMax = 150,
EquipBagMax = 350,
GmFlag = 1,
Rank = 1,
GuideIndex = 1000000,
ChatRoomId = 1,
Characters = connection.player.Characters,
WinCount = connection.player.WinCount,
AttackCount = connection.player.AttackCount,
ShipBagMax = connection.player.ShipBagMax,
EquipBagMax = connection.player.EquipBagMax,
GmFlag = connection.player.GmFlag,
Rank = connection.player.Rank,
PvpAttackCount = connection.player.PvpAttackCount,
PvpWinCount = connection.player.PvpWinCount,
CollectAttackCount = connection.player.CollectAttackCount,
GuideIndex = connection.player.GuideIndex,
BuyOilCount = connection.player.BuyOilCount,
ChatRoomId = connection.player.ChatRoomId,
MaxRank = connection.player.MaxRank,
AccPayLv = connection.player.AccPayLv,
GuildWaitTime = connection.player.GuildWaitTime,
ChatMsgBanTime = connection.player.ChatMsgBanTime,
ThemeUploadNotAllowedTime = connection.player.ThemeUploadNotAllowedTime,
RandomShipMode = connection.player.RandomShipMode,
MarryShip = connection.player.MarryShip,
ChildDisplay = connection.player.ChildDisplay,
StoryLists = connection.player.StoryLists,
FlagLists = connection.player.FlagLists,
MedalIds = connection.player.MedalIds,
CartoonReadMarks = connection.player.CartoonReadMarks,
CartoonCollectMarks = connection.player.CartoonCollectMarks,
RandomShipLists = connection.player.RandomShipLists,
Soundstories = connection.player.Soundstories,
CardLists = connection.player.CardLists,
CdLists = connection.player.CdLists,
IconFrameLists = connection.player.IconFrameLists,
ChatFrameLists = connection.player.ChatFrameLists,
RefundShopInfoLists = connection.player.RefundShopInfoLists,
TakingShipLists = connection.player.TakingShipLists,
RegisterTime = (uint)new DateTimeOffset(connection.player.CreatedAt).ToUnixTimeSeconds(),
ShipCount = (uint)connection.player.Ships.Count,
CommanderBagMax = 40,
ShipCount = connection.player.ShipCount,
CommanderBagMax = connection.player.CommanderBagMax,
Display = connection.player.DisplayInfo,
Appreciation = new()
Appreciation = connection.player.Appreciation,
});
}
}
public static void NotifyRefluxData(this Connection connection)
{
public static void NotifyRefluxData(this Connection connection) {
connection.Send(new Sc11752());
}
public static void NotifyActivityData(this Connection connection)
{
public static void NotifyActivityData(this Connection connection) {
connection.Send(new Sc11200());
}
}

View File

@@ -1,13 +1,16 @@
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Proto.p12;
using BLHX.Server.Common.Utils;
using BLHX.Server.Common.Proto.common;
using BLHX.Server.Common.Proto.p11;
using BLHX.Server.Common.Data;
using BLHX.Server.Common.Database;
using BLHX.Server.Game.Managers;
namespace BLHX.Server.Game.Handlers
{
internal static class P12
{
namespace BLHX.Server.Game.Handlers {
internal static class P12 {
[PacketHandler(Command.Cs12102, SaveDataAfterRun = true)]
static void UpdateFleetHandler(Connection connection, Packet packet)
{
static void UpdateFleetHandler(Connection connection, Packet packet) {
var fleet = packet.Decode<Cs12102>();
var toUpdate = connection.player.Fleets.Find(x => x.Id == fleet.Id);
@@ -20,48 +23,99 @@ namespace BLHX.Server.Game.Handlers
}
[PacketHandler(Command.Cs12202, SaveDataAfterRun = true)]
static void SetShipSkinHandler(Connection connection, Packet packet)
{
static void SetShipSkinHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs12202>();
if (connection.player.Ships.Any(x => x.Id == req.ShipId))
connection.player.Ships.First(x => x.Id == req.ShipId).SkinId = req.SkinId;
connection.Send(new Sc12203());
}
[PacketHandler(Command.Cs12002, SaveDataAfterRun = true)]
static void BuildShipHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs12002>();
// Id: gacha banner id
// Count: number of batch builds
// cost type: 1 wisdom cube + 1500 coin for each gacha i guess?
// TODO: remove the resources used from player resources
if (!BuildManager.Instance.BatchBuildShip(req.Id, req.Count))
Logger.c.Log("Build capacity is full or something went wrong");
connection.Send(new Sc12003() {
BuildInfoes = BuildManager.Instance.ToBuildInfoes()
});
}
static class P12ConnectionNotifyExtensions
{
public static void NotifyShipData(this Connection connection)
{
if (connection.player is not null)
{
connection.Send(new Sc12001()
{
[PacketHandler(Command.Cs12008, SaveDataAfterRun = true)]
static void BuildShipImmediatelyHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs12008>();
connection.Send(new Sc12009() { PosLists = req.PosLists });
}
[PacketHandler(Command.Cs12043, SaveDataAfterRun = true)]
static void GetShipHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs12043>();
// pos: position in build, Tid: banner id?
connection.Send(new Sc12044() {
infoLists = BuildManager.Instance.ToInfoLists()
});
}
[PacketHandler(Command.Cs12025, SaveDataAfterRun = true)]
static void GetShipAfterHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs12025>();
connection.Send(new Sc12026() {
ShipLists = BuildManager.Instance.GetBuildResults(req.PosLists, connection.player.Uid)
});
}
[PacketHandler(Command.Cs12045, SaveDataAfterRun = true)]
static void GetShipConfirmHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs12045>();
BuildManager.Instance.ClearBuilds();
connection.Send(new Sc12046());
}
}
static class P12ConnectionNotifyExtensions {
public static void NotifyShipData(this Connection connection) {
if (connection.player is not null) {
connection.Send(new Sc12001() {
Shiplists = connection.player.Ships.Select(x => x.ToProto()).ToList()
});
}
}
public static void NotifyShipSkinData(this Connection connection)
{
public static void NotifyShipSkinData(this Connection connection) {
connection.Send(new Sc12201() { SkinLists = connection.player.ShipSkins });
}
public static void NotifyFleetData(this Connection connection)
{
if (connection.player is not null)
{
connection.Send(new Sc12101()
{
public static void NotifyFleetData(this Connection connection) {
if (connection.player is not null) {
connection.Send(new Sc12101() {
GroupLists = connection.player.Fleets
});
}
}
public static void NotifyBuildShipData(this Connection connection)
{
connection.Send(new Sc12024());
public static void NotifyBuildShipData(this Connection connection) {
connection.Send(new Sc12024() {
WorklistCount = 1,
WorklistLists = BuildManager.Instance.ToBuildInfoes(),
DrawCount1 = 1,
DrawCount10 = 1,
ExchangeCount = 1,
});
}
}
}

View File

@@ -1,24 +1,38 @@
using BLHX.Server.Common.Proto.p15;
using BLHX.Server.Common.Data;
using BLHX.Server.Common.Utils;
using BLHX.Server.Common.Proto;
namespace BLHX.Server.Game.Handlers
{
internal static class P15
{
}
namespace BLHX.Server.Game.Handlers {
internal static class P15 {
[PacketHandler(Command.Cs15002, SaveDataAfterRun = true)]
static void UseFudaiItemHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs15002>();
static class P15ConnectionNotifyExtensions
{
public static void NotifyBagData(this Connection connection)
{
connection.Send(new Sc15001()
{
ItemLists = [
new Iteminfo() { Id = 20001, Count = 5 },
new Iteminfo() { Id = 15003, Count = 10 },
new Iteminfo() { Id = 50002, Count = 10 },
new Iteminfo() { Id = 50001, Count = 10 }
]
connection.Send(new Sc15003() {
DropLists = [],
});
}
}
static class P15ConnectionNotifyExtensions {
public static void NotifyBagData(this Connection connection) {
//List<int> AllItemsKeys = Data.ItemDataStatistics.Where(data => data.Value.Type == 2 && data.Value.Rarity >= 6).ToDictionary().Keys.ToList();
List<int> AllItemsKeys = Data.ItemDataStatistics.ToDictionary().Keys.ToList();
List<Iteminfo> ItemLists = AllItemsKeys.Select(item_id => new Iteminfo { Id = (uint)item_id, Count = 3954783433 }).ToList();
connection.Send(new Sc15001() { ItemLists = ItemLists });
//connection.Send(new Sc15001() {
// ItemLists = [
// new Iteminfo() { Id = 20001, Count = 8394785 },
// new Iteminfo() { Id = 15003, Count = 10 },
// new Iteminfo() { Id = 50002, Count = 10 },
// new Iteminfo() { Id = 50001, Count = 10 }
// ]
//});
}
}
}

View File

@@ -1,27 +1,29 @@
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Proto.p16;
using BLHX.Server.Common.Utils;
namespace BLHX.Server.Game.Handlers {
internal static class P16 {
[PacketHandler(Command.Cs16001, SaveDataAfterRun = true)]
static void DormTrainShoppingHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs16001>();
connection.Send(new Sc16002() { });
}
namespace BLHX.Server.Game.Handlers
{
internal static class P16
{
[PacketHandler(Command.Cs16104)]
static void GetChargeListHandler(Connection connection, Packet packet)
{
static void GetChargeListHandler(Connection connection, Packet packet) {
connection.Send(new Sc16105());
}
[PacketHandler(Command.Cs16106)]
static void GetExchangeItemHandler(Connection connection, Packet packet)
{
static void GetExchangeItemHandler(Connection connection, Packet packet) {
connection.Send(new Sc16107());
}
}
static class P16ConnectionNotifyExtensions
{
public static void NotifyShopMonthData(this Connection connection)
{
static class P16ConnectionNotifyExtensions {
public static void NotifyShopMonthData(this Connection connection) {
connection.Send(new Sc16200() { Month = (uint)DateTime.Now.Month });
}
}

View File

@@ -1,17 +1,40 @@
using BLHX.Server.Common.Proto.p19;
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Proto.p19;
using BLHX.Server.Common.Utils;
namespace BLHX.Server.Game.Handlers
{
internal static class P19
{
namespace BLHX.Server.Game.Handlers {
internal static class P19 {
[PacketHandler(Command.Cs19002, SaveDataAfterRun = true)]
static void AddShipHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs19002>();
connection.Send(new Sc19003() {});
connection.Send(new Sc19003() {});
}
static class P19ConnectionNotifyExtensions
{
public static void NotifyDormData(this Connection connection)
{
connection.Send(new Sc19001()
{
[PacketHandler(Command.Cs19004, SaveDataAfterRun = true)]
static void ShipExitHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs19004>();
connection.Send(new Sc19005() { });
}
[PacketHandler(Command.Cs19103, SaveDataAfterRun = true)]
static void GetOSSArgsHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs19103>();
connection.Send(new Sc19104() {
AccessId = "1",
AccessSecret = "1",
ExpireTime = (uint)new DateTimeOffset(DateTime.Now.AddDays(31)).ToUnixTimeSeconds(),
SecurityToken = "3874839" // idk what this is so i put a random as token
});
}
}
static class P19ConnectionNotifyExtensions {
public static void NotifyDormData(this Connection connection) {
connection.Send(new Sc19001() {
Lv = 1,
FloorNum = 1,
ExpPos = 2,

View File

@@ -1,16 +1,21 @@
using BLHX.Server.Common.Proto.p33;
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Proto.p33;
namespace BLHX.Server.Game.Handlers
{
internal class P33
{
namespace BLHX.Server.Game.Handlers {
internal class P33 {
[PacketHandler(Command.Cs33000, SaveDataAfterRun = true)]
static void ReqWorldCheckHandler(Connection connection, Packet packet) {
var req = packet.Decode<Cs33000>();
connection.Send(new Sc33001() {
IsWorldOpen = 0,
});
}
static class P33ConnectionNotifyExtensions
{
public static void NotifyWorldData(this Connection connection)
{
connection.Send(new Sc33114()
{
}
static class P33ConnectionNotifyExtensions {
public static void NotifyWorldData(this Connection connection) {
connection.Send(new Sc33114() {
IsWorldOpen = 1
});
}

View File

@@ -0,0 +1,149 @@
using BLHX.Server.Common.Proto.common;
using System;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using BLHX.Server.Common.Data;
using BLHX.Server.Common.Database;
using BLHX.Server.Common.Utils;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace BLHX.Server.Game.Managers {
public class BuildManager {
private static BuildManager instance = null;
private BuildManager() { }
public static BuildManager Instance {
get {
if (instance == null)
instance = new BuildManager();
return instance;
}
set => instance = value;
}
public uint BuildCapacity { get; set; } = 10;
public List<BuildData> BuildData { get; set; } = [];
public bool BuildShip(uint buildId) {
DateTime time = DateTime.Now;
DateTime finishTime = time.AddSeconds(10); // TODO: figure out which cfg is this stored at
if (BuildData.Count + 1 > BuildCapacity)
return false;
BuildData.Add(new BuildData() {
Pos = (uint)BuildData.Count + 1,
Tid = 1, // no idea whats this
BuildId = buildId,
FinishTime = (uint)new DateTimeOffset(finishTime).ToUnixTimeSeconds(),
Time = (uint)new DateTimeOffset(time).ToUnixTimeSeconds(),
});
return true;
}
public bool BatchBuildShip(uint buildId, uint count) {
if (BuildData.Count + count > BuildCapacity)
return false;
for (int i = 0; i < count; i++)
BuildShip(buildId);
return true;
}
public List<Shipinfo> GetBuildResults(List<uint> posList, uint playerUid) { // posList: build position list: so like 1, 2, 3, 4, 5
List<Shipinfo> buildResults = new List<Shipinfo>();
foreach (uint buildPosId in posList) {
BuildData buildData = BuildData[(int)buildPosId - 1];
Shipinfo receivedShip = CreateShipFromId(HandleGacha(buildData.BuildId), playerUid).ToProto();
buildResults.Add(receivedShip);
}
return buildResults;
}
public List<Shipinfo> GetAllBuildResults(uint playerUid) {
List<uint> posListAll = new List<uint>();
for (int i = 1; i <= BuildCapacity; i++)
posListAll.Add((uint)i);
return GetBuildResults(posListAll, playerUid);
}
public uint HandleGacha(uint bannerId) { // for now i changed the entire pool of bannerId = 2 to URs
uint[] characterPool = Data.ActivityShipCreate[bannerId].PickupList;
int resultRarity = RNG.NextShipRarity();
// handle gacha rates here
return characterPool[RNG.Next(characterPool.Length)];
}
// ayo who named these two :skull:
public List<BLHX.Server.Common.Proto.p12.BuildInfo> ToInfoLists() {
return BuildData.Select(data => new BLHX.Server.Common.Proto.p12.BuildInfo() { Pos = data.Pos, Tid = data.Tid }).ToList();
}
// this one is not capitalized Build(i)nfo
public List<BLHX.Server.Common.Proto.common.Buildinfo> ToBuildInfoes() {
return BuildData.Select(data => new BLHX.Server.Common.Proto.common.Buildinfo() { BuildId = data.BuildId, FinishTime = data.FinishTime, Time = data.Time,}).ToList();
}
public void ClearBuilds() {
BuildData.Clear();
}
public static ShipDataStatistics GetShipInfoFromId(uint shipId) {
return Data.ShipDataStatistics[(int)shipId];
}
public static PlayerShip CreateShipFromId(uint shipId, uint playerUid) {
if (!Data.ShipDataTemplate.TryGetValue((int)shipId, out var shipTemplate))
throw new InvalidDataException($"Ship template {shipId} not found!");
var ship = new PlayerShip() {
TemplateId = shipId,
Level = 1,
EquipInfoLists = [
new EquipskinInfo() { Id = shipTemplate.EquipId1 },
new EquipskinInfo() { Id = shipTemplate.EquipId2 },
new EquipskinInfo() { Id = shipTemplate.EquipId3 },
new EquipskinInfo(),
new EquipskinInfo(),
],
Energy = shipTemplate.Energy,
SkillIdLists = shipTemplate.BuffList.Select(x => new Shipskill() { SkillId = x, SkillLv = 1 }).ToList(),
Intimacy = 5000,
PlayerUid = playerUid
};
return ship;
}
}
[PrimaryKey(nameof(Pos))]
public class BuildData {
[Key]
public uint Pos { get; set; }
public uint Tid { get; set; }
public uint Time { get; set; }
public uint FinishTime { get; set; }
public uint BuildId { get; set; }
}
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

View File

@@ -8,7 +8,7 @@
<OutputType>Exe</OutputType>
<RootNamespace>BLHX.Server.PcapParser</RootNamespace>
<AssemblyName>BLHX.Server.PcapParser</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>