mirror of
https://github.com/rafi1212122/BLHX.Server.git
synced 2025-12-12 22:44:36 +01:00
ship skin comamnd and changing skin
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
using BLHX.Server.Common.Utils;
|
using BLHX.Server.Common.Utils;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace BLHX.Server.Common.Data;
|
namespace BLHX.Server.Common.Data;
|
||||||
|
|
||||||
@@ -14,6 +13,9 @@ public static class Data
|
|||||||
[LoadData("tradingport_template.json", LoadDataType.ShareCfg)]
|
[LoadData("tradingport_template.json", LoadDataType.ShareCfg)]
|
||||||
public static Dictionary<int, ResourceFieldTemplate> GoldFieldTemplate { get; private set; } = null!;
|
public static Dictionary<int, ResourceFieldTemplate> GoldFieldTemplate { get; private set; } = null!;
|
||||||
|
|
||||||
|
[LoadData("ship_skin_template.json", LoadDataType.ShareCfg)]
|
||||||
|
public static Dictionary<int, ShipSkinTemplate> ShipSkinTemplate { get; private set; } = null!;
|
||||||
|
|
||||||
[LoadData("chapter_template.json", LoadDataType.ShareCfgData)]
|
[LoadData("chapter_template.json", LoadDataType.ShareCfgData)]
|
||||||
public static Dictionary<int, ChapterTemplate> ChapterTemplate { get; private set; } = null!;
|
public static Dictionary<int, ChapterTemplate> ChapterTemplate { get; private set; } = null!;
|
||||||
|
|
||||||
|
|||||||
131
BLHX.Server.Common/Data/Model/ShipSkinTemplate.cs
Normal file
131
BLHX.Server.Common/Data/Model/ShipSkinTemplate.cs
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
namespace BLHX.Server.Common.Data
|
||||||
|
{
|
||||||
|
public class ShipSkinTemplate
|
||||||
|
{
|
||||||
|
[JsonPropertyName("bg")]
|
||||||
|
public string Bg { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("bg_sp")]
|
||||||
|
public string BgSp { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("bgm")]
|
||||||
|
public string Bgm { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("bound_bone")]
|
||||||
|
public dynamic BoundBone { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("desc")]
|
||||||
|
public string Desc { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("fx_container")]
|
||||||
|
public List<List<double>> FxContainer { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("group_index")]
|
||||||
|
public int GroupIndex { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("gyro")]
|
||||||
|
public int Gyro { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("hand_id")]
|
||||||
|
public int HandId { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("id")]
|
||||||
|
public uint Id { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("illustrator")]
|
||||||
|
public int Illustrator { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("illustrator2")]
|
||||||
|
public int Illustrator2 { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("l2d_animations")]
|
||||||
|
public dynamic L2DAnimations { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("l2d_drag_rate")]
|
||||||
|
public dynamic L2DDragRate { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("l2d_ignore_drag")]
|
||||||
|
public long L2DIgnoreDrag { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("l2d_para_range")]
|
||||||
|
public dynamic L2DParaRange { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("l2d_se")]
|
||||||
|
public dynamic L2DSe { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("l2d_voice_calibrate")]
|
||||||
|
public dynamic L2DVoiceCalibrate { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("lip_smoothing")]
|
||||||
|
public int LipSmoothing { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("lip_sync_gain")]
|
||||||
|
public int LipSyncGain { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("live2d_offset")]
|
||||||
|
public dynamic Live2DOffset { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("live2d_offset_profile")]
|
||||||
|
public dynamic Live2DOffsetProfile { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("main_UI_FX")]
|
||||||
|
public string MainUiFx { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("painting")]
|
||||||
|
public string Painting { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("prefab")]
|
||||||
|
public string Prefab { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("rarity_bg")]
|
||||||
|
public string RarityBg { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("ship_group")]
|
||||||
|
public uint ShipGroup { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("ship_l2d_id")]
|
||||||
|
public dynamic ShipL2DId { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("shop_id")]
|
||||||
|
public uint ShopId { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("shop_type_id")]
|
||||||
|
public int ShopTypeId { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("show_skin")]
|
||||||
|
public string ShowSkin { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("skin_type")]
|
||||||
|
public int SkinType { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("smoke")]
|
||||||
|
public dynamic Smoke { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("special_effects")]
|
||||||
|
public dynamic SpecialEffects { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("spine_action_offset")]
|
||||||
|
public dynamic SpineActionOffset { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("spine_offset")]
|
||||||
|
public dynamic SpineOffset { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("tag")]
|
||||||
|
public List<int> Tag { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("time")]
|
||||||
|
public dynamic Time { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("voice_actor")]
|
||||||
|
public int VoiceActor { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("voice_actor_2")]
|
||||||
|
public int VoiceActor2 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -90,6 +90,9 @@ namespace BLHX.Server.Common.Database
|
|||||||
new() { Id = 11 },
|
new() { Id = 11 },
|
||||||
new() { Id = 12 }
|
new() { Id = 12 }
|
||||||
});
|
});
|
||||||
|
e.Property(b => b.ShipSkins)
|
||||||
|
.HasJsonConversion()
|
||||||
|
.HasDefaultValue(new List<Idtimeinfo>() { });
|
||||||
e.Property(b => b.Adv)
|
e.Property(b => b.Adv)
|
||||||
.HasDefaultValue("");
|
.HasDefaultValue("");
|
||||||
e.HasMany(b => b.Resources)
|
e.HasMany(b => b.Resources)
|
||||||
@@ -149,6 +152,7 @@ namespace BLHX.Server.Common.Database
|
|||||||
public DateTime CreatedAt { get; set; }
|
public DateTime CreatedAt { get; set; }
|
||||||
|
|
||||||
public List<Groupinfo> Fleets { get; set; } = null!;
|
public List<Groupinfo> Fleets { get; set; } = null!;
|
||||||
|
public List<Idtimeinfo> ShipSkins { get; set; } = null!;
|
||||||
|
|
||||||
public virtual ICollection<PlayerResource> Resources { get; set; } = [];
|
public virtual ICollection<PlayerResource> Resources { get; set; } = [];
|
||||||
public virtual ICollection<ResourceField> ResourceFields { get; set; } = [];
|
public virtual ICollection<ResourceField> ResourceFields { get; set; } = [];
|
||||||
|
|||||||
258
BLHX.Server.Common/Migrations/Player/20240223041338_ShipSkins.Designer.cs
generated
Normal file
258
BLHX.Server.Common/Migrations/Player/20240223041338_ShipSkins.Designer.cs
generated
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
// <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("20240223041338_ShipSkins")]
|
||||||
|
partial class ShipSkins
|
||||||
|
{
|
||||||
|
/// <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.Player", b =>
|
||||||
|
{
|
||||||
|
b.Property<uint>("Uid")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Adv")
|
||||||
|
.IsRequired()
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("TEXT")
|
||||||
|
.HasDefaultValue("");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("DisplayInfo")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<uint>("Exp")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
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>("Level")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ShipSkins")
|
||||||
|
.IsRequired()
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("jsonb")
|
||||||
|
.HasDefaultValue("[]");
|
||||||
|
|
||||||
|
b.Property<string>("Token")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
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.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.Database.Player", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("ResourceFields");
|
||||||
|
|
||||||
|
b.Navigation("Resources");
|
||||||
|
|
||||||
|
b.Navigation("Ships");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BLHX.Server.Common.Migrations.Player
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class ShipSkins : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "ShipSkins",
|
||||||
|
table: "Players",
|
||||||
|
type: "jsonb",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "[]");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ShipSkins",
|
||||||
|
table: "Players");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,6 +56,12 @@ namespace BLHX.Server.Common.Migrations.Player
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("ShipSkins")
|
||||||
|
.IsRequired()
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("jsonb")
|
||||||
|
.HasDefaultValue("[]");
|
||||||
|
|
||||||
b.Property<string>("Token")
|
b.Property<string>("Token")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|||||||
231492
BLHX.Server.Common/Resources/ShareCfg/ship_skin_template.json
Normal file
231492
BLHX.Server.Common/Resources/ShareCfg/ship_skin_template.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
|||||||
using BLHX.Server.Common.Utils;
|
using BLHX.Server.Common.Utils;
|
||||||
|
using BLHX.Server.Game.Handlers;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace BLHX.Server.Game.Commands;
|
namespace BLHX.Server.Game.Commands;
|
||||||
@@ -77,6 +78,11 @@ public abstract class Command
|
|||||||
Execute(args);
|
Execute(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void NotifySuccess(Connection connection)
|
||||||
|
{
|
||||||
|
connection.SendSystemMsg($"{GetType().Name} success!");
|
||||||
|
}
|
||||||
|
|
||||||
protected T Parse<T>(string? value, T fallback = default!)
|
protected T Parse<T>(string? value, T fallback = default!)
|
||||||
{
|
{
|
||||||
var tryParseMethod = typeof(T).GetMethod("TryParse", [typeof(string), typeof(T).MakeByRefType()]);
|
var tryParseMethod = typeof(T).GetMethod("TryParse", [typeof(string), typeof(T).MakeByRefType()]);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class HelpCommand : Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (attr != null)
|
if (attr != null)
|
||||||
sb.AppendLine($" {attr.Name} - {attr.Description} (Example: {attr.Example}), Usage: {command.Usage}");
|
sb.AppendLine($" {attr.Name} - {attr.Description} (Example: {attr.Example})");
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.Write(sb.ToString());
|
Console.Write(sb.ToString());
|
||||||
|
|||||||
54
BLHX.Server.Game/Commands/SkinCommand.cs
Normal file
54
BLHX.Server.Game/Commands/SkinCommand.cs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
using BLHX.Server.Common.Data;
|
||||||
|
using BLHX.Server.Common.Database;
|
||||||
|
using BLHX.Server.Common.Proto.common;
|
||||||
|
using BLHX.Server.Game.Handlers;
|
||||||
|
|
||||||
|
namespace BLHX.Server.Game.Commands
|
||||||
|
{
|
||||||
|
[CommandHandler("skin", "Unlock skins of a character or all characters", "skin unlock=all")]
|
||||||
|
public class SkinCommand : Command
|
||||||
|
{
|
||||||
|
[Argument("unlock")]
|
||||||
|
public string? Unlock { get; set; }
|
||||||
|
|
||||||
|
public override void Execute(Dictionary<string, string> args, Connection connection)
|
||||||
|
{
|
||||||
|
base.Execute(args);
|
||||||
|
|
||||||
|
if (Unlock is not null)
|
||||||
|
{
|
||||||
|
if (Unlock.Equals("all", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
connection.player.ShipSkins = connection.player.Ships.SelectMany(x =>
|
||||||
|
{
|
||||||
|
ShipDataTemplate? template = Data.ShipDataTemplate.FirstOrDefault(y => y.Value.Id == x.TemplateId).Value;
|
||||||
|
return Data.ShipSkinTemplate.Where(x => x.Value.ShipGroup == template.GroupType).Select(x => new Idtimeinfo() { Id = x.Value.Id });
|
||||||
|
}).DistinctBy(x => x.Id).ToList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var shipId = Parse(Unlock, uint.MinValue);
|
||||||
|
if (connection.player.Ships.Any(x => x.TemplateId == shipId))
|
||||||
|
{
|
||||||
|
ShipDataTemplate? template = Data.ShipDataTemplate.FirstOrDefault(y => y.Value.Id == shipId).Value;
|
||||||
|
connection.player.ShipSkins.AddRange(Data.ShipSkinTemplate.Where(x => x.Value.ShipGroup == template.GroupType).Select(x => new Idtimeinfo() { Id = x.Value.Id }));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!Data.ShipSkinTemplate.Any(x => x.Value.ShipGroup == shipId))
|
||||||
|
{
|
||||||
|
connection.SendSystemMsg($"You don't own a ship with a template/group id of {shipId}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
connection.player.ShipSkins.AddRange(Data.ShipSkinTemplate.Where(x => x.Value.ShipGroup == shipId).Select(x => new Idtimeinfo() { Id = x.Value.Id }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
connection.NotifyShipSkinData();
|
||||||
|
}
|
||||||
|
|
||||||
|
base.NotifySuccess(connection);
|
||||||
|
DBManager.PlayerContext.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -139,16 +139,19 @@ namespace BLHX.Server.Game
|
|||||||
|
|
||||||
public void Tick()
|
public void Tick()
|
||||||
{
|
{
|
||||||
foreach (var resourceField in player.ResourceFields)
|
if (player is not null)
|
||||||
{
|
{
|
||||||
resourceField.CalculateYield();
|
foreach (var resourceField in player.ResourceFields)
|
||||||
}
|
{
|
||||||
|
resourceField.CalculateYield();
|
||||||
|
}
|
||||||
|
|
||||||
DBManager.PlayerContext.Save();
|
DBManager.PlayerContext.Save();
|
||||||
this.NotifyResourceList();
|
this.NotifyResourceList();
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
c.Log("Ticked!");
|
c.Log("Ticked!");
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitClientData()
|
public void InitClientData()
|
||||||
@@ -172,6 +175,7 @@ namespace BLHX.Server.Game
|
|||||||
this.NotifyActivityData();
|
this.NotifyActivityData();
|
||||||
this.NotifyDormData();
|
this.NotifyDormData();
|
||||||
this.NotifyNavalAcademy();
|
this.NotifyNavalAcademy();
|
||||||
|
this.NotifyWorldData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendHttpResponse(string rsp, string type = "text/plain")
|
public void SendHttpResponse(string rsp, string type = "text/plain")
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace BLHX.Server.Game.Handlers
|
|||||||
connection.Send(rsp);
|
connection.Send(rsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
[PacketHandler(Command.Cs10100)]
|
[PacketHandler(Command.Cs10100, IsNotifyHandler = true)]
|
||||||
static void HeartbeatHandler(Connection connection, Packet packet)
|
static void HeartbeatHandler(Connection connection, Packet packet)
|
||||||
{
|
{
|
||||||
connection.Send(new Sc10101() { State = 1 });
|
connection.Send(new Sc10101() { State = 1 });
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using BLHX.Server.Common.Proto;
|
using BLHX.Server.Common.Data;
|
||||||
|
using BLHX.Server.Common.Proto;
|
||||||
|
using BLHX.Server.Common.Proto.common;
|
||||||
using BLHX.Server.Common.Proto.p12;
|
using BLHX.Server.Common.Proto.p12;
|
||||||
|
|
||||||
namespace BLHX.Server.Game.Handlers
|
namespace BLHX.Server.Game.Handlers
|
||||||
@@ -18,6 +20,16 @@ namespace BLHX.Server.Game.Handlers
|
|||||||
|
|
||||||
connection.Send(new Sc12103());
|
connection.Send(new Sc12103());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[PacketHandler(Command.Cs12202, SaveDataAfterRun = true)]
|
||||||
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class P12ConnectionNotifyExtensions
|
static class P12ConnectionNotifyExtensions
|
||||||
@@ -35,7 +47,7 @@ namespace BLHX.Server.Game.Handlers
|
|||||||
|
|
||||||
public static void NotifyShipSkinData(this Connection connection)
|
public static void NotifyShipSkinData(this Connection connection)
|
||||||
{
|
{
|
||||||
connection.Send(new Sc12201());
|
connection.Send(new Sc12201() { SkinLists = connection.player.ShipSkins });
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void NotifyFleetData(this Connection connection)
|
public static void NotifyFleetData(this Connection connection)
|
||||||
|
|||||||
18
BLHX.Server.Game/Handlers/P33.cs
Normal file
18
BLHX.Server.Game/Handlers/P33.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using BLHX.Server.Common.Proto.p33;
|
||||||
|
|
||||||
|
namespace BLHX.Server.Game.Handlers
|
||||||
|
{
|
||||||
|
internal class P33
|
||||||
|
{
|
||||||
|
}
|
||||||
|
static class P33ConnectionNotifyExtensions
|
||||||
|
{
|
||||||
|
public static void NotifyWorldData(this Connection connection)
|
||||||
|
{
|
||||||
|
connection.Send(new Sc33114()
|
||||||
|
{
|
||||||
|
IsWorldOpen = 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,5 +14,11 @@ namespace BLHX.Server.Game.Handlers
|
|||||||
MetaShipLists = req.GroupIds.Select(x => new MetaShipInfo() { GroupId = x }).ToList()
|
MetaShipLists = req.GroupIds.Select(x => new MetaShipInfo() { GroupId = x }).ToList()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[PacketHandler(Command.Cs34501)]
|
||||||
|
static void GetWorldBossHandler(Connection connection, Packet packet)
|
||||||
|
{
|
||||||
|
connection.Send(new Sc34502());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user