mirror of
https://github.com/rafi1212122/PemukulPaku
synced 2025-12-13 17:44:36 +01:00
at least you can end the stage
This commit is contained in:
@@ -13,4 +13,10 @@
|
|||||||
<PackageReference Include="protobuf-net" Version="3.2.16" />
|
<PackageReference Include="protobuf-net" Version="3.2.16" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Resources\ExcelOutputAsset\**">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
75
Common/Database/Avatar.cs
Normal file
75
Common/Database/Avatar.cs
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
using Common.Resources.Proto;
|
||||||
|
using Common.Utils.ExcelReader;
|
||||||
|
using MongoDB.Bson;
|
||||||
|
using MongoDB.Driver;
|
||||||
|
|
||||||
|
namespace Common.Database
|
||||||
|
{
|
||||||
|
public class Avatar
|
||||||
|
{
|
||||||
|
public static readonly IMongoCollection<AvatarScheme> collection = Global.db.GetCollection<AvatarScheme>("Avatars");
|
||||||
|
|
||||||
|
public static AvatarScheme[] AvatarsFromUid(uint uid)
|
||||||
|
{
|
||||||
|
return collection.AsQueryable().Where(collection=> collection.OwnerUid == uid).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AvatarScheme Create(int avatarId, uint uid, EquipmentScheme equipment)
|
||||||
|
{
|
||||||
|
AvatarScheme? tryAvatar = collection.AsQueryable().Where(collection => collection.AvatarId == avatarId && collection.OwnerUid == uid).FirstOrDefault();
|
||||||
|
if (tryAvatar != null) { return tryAvatar; }
|
||||||
|
|
||||||
|
AvatarDataExcel? avatarData = AvatarData.GetInstance().FromId(avatarId);
|
||||||
|
if(avatarData == null) { throw new ArgumentException("Invalid avatarId"); }
|
||||||
|
|
||||||
|
Weapon weapon = equipment.AddWeapon(avatarData.InitialWeapon);
|
||||||
|
|
||||||
|
AvatarScheme avatar = new()
|
||||||
|
{
|
||||||
|
OwnerUid = uid,
|
||||||
|
AvatarId = (uint)avatarData.AvatarId,
|
||||||
|
DressId = (uint)avatarData.DefaultDressId,
|
||||||
|
DressLists = new[] { (uint)avatarData.DefaultDressId },
|
||||||
|
Exp = 0,
|
||||||
|
Fragment = 0,
|
||||||
|
Level = 1,
|
||||||
|
Star = (uint)avatarData.UnlockStar,
|
||||||
|
StigmataUniqueId1 = 0,
|
||||||
|
StigmataUniqueId2 = 0,
|
||||||
|
StigmataUniqueId3 = 0,
|
||||||
|
SubStar = 0,
|
||||||
|
TouchGoodfeel = 0,
|
||||||
|
TodayHasAddGoodfeel = 0,
|
||||||
|
WeaponUniqueId = weapon.UniqueId
|
||||||
|
};
|
||||||
|
|
||||||
|
if(avatarData.AvatarId == 101)
|
||||||
|
{
|
||||||
|
Stigmata defaultStigmata1 = equipment.AddStigmata(30007);
|
||||||
|
Stigmata defaultStigmata2 = equipment.AddStigmata(30060);
|
||||||
|
Stigmata defaultStigmata3 = equipment.AddStigmata(30113);
|
||||||
|
|
||||||
|
avatar.StigmataUniqueId1 = defaultStigmata1.UniqueId;
|
||||||
|
avatar.StigmataUniqueId2 = defaultStigmata2.UniqueId;
|
||||||
|
avatar.StigmataUniqueId3 = defaultStigmata3.UniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
avatar.SkillLists.AddRange(avatarData.SkillList.Select(skillId => new AvatarSkill { SkillId = (uint)skillId }));
|
||||||
|
|
||||||
|
collection.InsertOne(avatar);
|
||||||
|
|
||||||
|
return avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public class AvatarScheme : Resources.Proto.Avatar
|
||||||
|
{
|
||||||
|
public ObjectId Id { get; set; }
|
||||||
|
public uint OwnerUid { get; set; }
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
Avatar.collection.ReplaceOne(Builders<AvatarScheme>.Filter.Eq(avatar => avatar.Id, Id), this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
116
Common/Database/Equipment.cs
Normal file
116
Common/Database/Equipment.cs
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
using Common.Resources.Proto;
|
||||||
|
using Common.Utils.ExcelReader;
|
||||||
|
using MongoDB.Bson;
|
||||||
|
using MongoDB.Driver;
|
||||||
|
|
||||||
|
namespace Common.Database
|
||||||
|
{
|
||||||
|
public class Equipment
|
||||||
|
{
|
||||||
|
public static readonly IMongoCollection<EquipmentScheme> collection = Global.db.GetCollection<EquipmentScheme>("Equipments");
|
||||||
|
|
||||||
|
public static EquipmentScheme FromUid(uint uid)
|
||||||
|
{
|
||||||
|
return collection.AsQueryable().Where(collection => collection.OwnerUid == uid).FirstOrDefault() ?? Create(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EquipmentScheme Create(uint uid)
|
||||||
|
{
|
||||||
|
EquipmentScheme? tryEquipment = collection.AsQueryable().Where(collection => collection.OwnerUid == uid).FirstOrDefault();
|
||||||
|
if (tryEquipment != null) { return tryEquipment; }
|
||||||
|
|
||||||
|
EquipmentScheme Equipment = new()
|
||||||
|
{
|
||||||
|
OwnerUid = uid,
|
||||||
|
MaterialList = Array.Empty<Resources.Proto.Material>(),
|
||||||
|
WeaponList = Array.Empty<Weapon>(),
|
||||||
|
StigmataList = Array.Empty<Stigmata>(),
|
||||||
|
MechaList = Array.Empty<Mecha>(),
|
||||||
|
};
|
||||||
|
|
||||||
|
collection.InsertOne(Equipment);
|
||||||
|
|
||||||
|
return Equipment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
public class EquipmentScheme
|
||||||
|
{
|
||||||
|
public ObjectId Id { get; set; }
|
||||||
|
public uint OwnerUid { get; set; }
|
||||||
|
public Resources.Proto.Material[] MaterialList { get; set; }
|
||||||
|
public Mecha[] MechaList { get; set; }
|
||||||
|
public Stigmata[] StigmataList { get; set; }
|
||||||
|
public Weapon[] WeaponList { get; set; }
|
||||||
|
|
||||||
|
public Weapon AddWeapon(int weaponId)
|
||||||
|
{
|
||||||
|
WeaponDataExcel? weaponData = WeaponData.GetInstance().FromId(weaponId);
|
||||||
|
if (weaponData == null) { throw new ArgumentException("Invalid weaponId"); }
|
||||||
|
|
||||||
|
Weapon weapon = new()
|
||||||
|
{
|
||||||
|
UniqueId = (uint)AutoIncrement.GetNextNumber("Weapon", 100),
|
||||||
|
Id = (uint)weaponData.Id,
|
||||||
|
Level = 1,
|
||||||
|
Exp = 0,
|
||||||
|
IsExtracted = false,
|
||||||
|
IsProtected = false
|
||||||
|
};
|
||||||
|
|
||||||
|
WeaponList = WeaponList.Append(weapon).ToArray();
|
||||||
|
return weapon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Stigmata AddStigmata(int stigmataId)
|
||||||
|
{
|
||||||
|
StigmataDataExcel? stigmataData = StigmataData.GetInstance().FromId(stigmataId);
|
||||||
|
if (stigmataData == null) { throw new ArgumentException("Invalid stigmataId"); }
|
||||||
|
|
||||||
|
Stigmata stigmata = new()
|
||||||
|
{
|
||||||
|
UniqueId = (uint)AutoIncrement.GetNextNumber("Stigmata", 100),
|
||||||
|
Id = (uint)stigmataData.Id,
|
||||||
|
Level = 1,
|
||||||
|
Exp = 0,
|
||||||
|
IsProtected = false,
|
||||||
|
SlotNum = 0,
|
||||||
|
RefineValue = 0,
|
||||||
|
PromoteTimes = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
StigmataList = StigmataList.Append(stigmata).ToArray();
|
||||||
|
return stigmata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Resources.Proto.Material AddMaterial(int materialId, int num = 1)
|
||||||
|
{
|
||||||
|
int MaterialIndex = Array.FindIndex(MaterialList, material => material.Id == materialId);
|
||||||
|
|
||||||
|
if(MaterialIndex == -1)
|
||||||
|
{
|
||||||
|
MaterialList = MaterialList.Append(new() { Id = (uint)materialId, Num = num < 0 ? 0 : (uint)num }).ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (num < 0)
|
||||||
|
{
|
||||||
|
MaterialList[MaterialIndex].Num -= (uint)Math.Abs(num);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MaterialList[MaterialIndex].Num += (uint)num;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return MaterialList.Where(material => material.Id == materialId).First();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
Equipment.collection.ReplaceOne(Builders<EquipmentScheme>.Filter.Eq(equipment => equipment.Id, Id), this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
}
|
||||||
@@ -8,8 +8,11 @@ namespace Common.Database
|
|||||||
{
|
{
|
||||||
public static readonly IMongoCollection<UserScheme> collection = Global.db.GetCollection<UserScheme>("Users");
|
public static readonly IMongoCollection<UserScheme> collection = Global.db.GetCollection<UserScheme>("Users");
|
||||||
|
|
||||||
public static UserScheme CreateUser(string name)
|
public static UserScheme Create(string name)
|
||||||
{
|
{
|
||||||
|
UserScheme? tryUser = collection.AsQueryable().Where(d => d.Name == name).FirstOrDefault();
|
||||||
|
if (tryUser != null) { return tryUser; }
|
||||||
|
|
||||||
UserScheme user = new()
|
UserScheme user = new()
|
||||||
{
|
{
|
||||||
Name = name,
|
Name = name,
|
||||||
@@ -41,7 +44,7 @@ namespace Common.Database
|
|||||||
public static UserScheme FromName(string name)
|
public static UserScheme FromName(string name)
|
||||||
{
|
{
|
||||||
UserScheme? user = collection.AsQueryable().Where(d => d.Name == name).FirstOrDefault();
|
UserScheme? user = collection.AsQueryable().Where(d => d.Name == name).FirstOrDefault();
|
||||||
return user ?? CreateUser(name);
|
return user ?? Create(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UserScheme? FromToken(string token)
|
public static UserScheme? FromToken(string token)
|
||||||
@@ -50,27 +53,33 @@ namespace Common.Database
|
|||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
|
||||||
public class UserScheme
|
|
||||||
{
|
|
||||||
public ObjectId Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public uint Uid { get; set; }
|
|
||||||
public string Nick { get; set; }
|
|
||||||
public int Exp { get; set; }
|
|
||||||
public int Hcoin { get; set; }
|
|
||||||
public int Stamina { get; set; }
|
|
||||||
public string SelfDesc { get; set; }
|
|
||||||
public bool IsFirstLogin { get; set; }
|
|
||||||
public string Token { get; set; }
|
|
||||||
public int WarshipId { get; set; }
|
|
||||||
public WarshipAvatarData WarshipAvatar { get; set; }
|
|
||||||
public int AssistantAvatarId { get; set; }
|
|
||||||
public int BirthDate { get; set; }
|
|
||||||
public List<AvatarTeam> AvatarTeamList { get; set; }
|
|
||||||
public List<CustomAvatarTeam> CustomAvatarTeamList { get; set; }
|
|
||||||
}
|
|
||||||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
public class UserScheme
|
||||||
|
{
|
||||||
|
public ObjectId Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public uint Uid { get; set; }
|
||||||
|
public string Nick { get; set; }
|
||||||
|
public int Exp { get; set; }
|
||||||
|
public int Hcoin { get; set; }
|
||||||
|
public int Stamina { get; set; }
|
||||||
|
public string SelfDesc { get; set; }
|
||||||
|
public bool IsFirstLogin { get; set; }
|
||||||
|
public string Token { get; set; }
|
||||||
|
public int WarshipId { get; set; }
|
||||||
|
public WarshipAvatarData WarshipAvatar { get; set; }
|
||||||
|
public int AssistantAvatarId { get; set; }
|
||||||
|
public int BirthDate { get; set; }
|
||||||
|
public List<AvatarTeam> AvatarTeamList { get; set; }
|
||||||
|
public List<CustomAvatarTeam> CustomAvatarTeamList { get; set; }
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
User.collection.ReplaceOne(Builders<UserScheme>.Filter.Eq(user => user.Id, Id), this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Common
|
|||||||
public interface IConfig
|
public interface IConfig
|
||||||
{
|
{
|
||||||
[Option(DefaultValue = VerboseLevel.Normal)]
|
[Option(DefaultValue = VerboseLevel.Normal)]
|
||||||
VerboseLevel VerboseLevel { get; }
|
VerboseLevel VerboseLevel { get; set; }
|
||||||
|
|
||||||
[Option(DefaultValue = false)]
|
[Option(DefaultValue = false)]
|
||||||
bool UseLocalCache { get; }
|
bool UseLocalCache { get; }
|
||||||
|
|||||||
187
Common/Utils/ExcelReader/AvatarData.cs
Normal file
187
Common/Utils/ExcelReader/AvatarData.cs
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Common.Utils.ExcelReader
|
||||||
|
{
|
||||||
|
public class AvatarData : BaseExcelReader<AvatarData, AvatarDataExcel>
|
||||||
|
{
|
||||||
|
public override string FileName { get { return "AvatarData.json"; } }
|
||||||
|
|
||||||
|
public AvatarDataExcel? FromId(int id)
|
||||||
|
{
|
||||||
|
return All.Where(avatar => avatar.AvatarId == id).FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
public partial class AvatarDataExcel
|
||||||
|
{
|
||||||
|
[JsonProperty("classID")]
|
||||||
|
public int ClassId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("roleID")]
|
||||||
|
public int RoleId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("avatarType")]
|
||||||
|
public int AvatarType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("fullName")]
|
||||||
|
public HashName FullName { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("shortName")]
|
||||||
|
public HashName ShortName { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("RomaName")]
|
||||||
|
public HashName RomaName { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("desc")]
|
||||||
|
public HashName Desc { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("avatarRegistryKey")]
|
||||||
|
public string AvatarRegistryKey { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("weaponBaseTypeList")]
|
||||||
|
public int[] WeaponBaseTypeList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("unlockStar")]
|
||||||
|
public int UnlockStar { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("skillList")]
|
||||||
|
public int[] SkillList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("attribute")]
|
||||||
|
public int Attribute { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("initialWeapon")]
|
||||||
|
public int InitialWeapon { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("avatarCardID")]
|
||||||
|
public int AvatarCardId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("avatarFragmentID")]
|
||||||
|
public int AvatarFragmentId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("artifactFragmentID")]
|
||||||
|
public int ArtifactFragmentId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("ultraSkillID")]
|
||||||
|
public int UltraSkillId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("captainSkillID")]
|
||||||
|
public int CaptainSkillId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL01SP")]
|
||||||
|
public double Skl01Sp { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL01SPNeed")]
|
||||||
|
public double Skl01SpNeed { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL01Charges")]
|
||||||
|
public double Skl01Charges { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL01CD")]
|
||||||
|
public double Skl01Cd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL02SP")]
|
||||||
|
public double Skl02Sp { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL02SPNeed")]
|
||||||
|
public double Skl02SpNeed { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL02Charges")]
|
||||||
|
public double Skl02Charges { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL02CD")]
|
||||||
|
public double Skl02Cd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL03SP")]
|
||||||
|
public double Skl03Sp { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL03SPNeed")]
|
||||||
|
public double Skl03SpNeed { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL03Charges")]
|
||||||
|
public double Skl03Charges { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL03CD")]
|
||||||
|
public double Skl03Cd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL02ArtifactCD")]
|
||||||
|
public double Skl02ArtifactCd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL02ArtifactSP")]
|
||||||
|
public double Skl02ArtifactSp { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SKL02ArtifactSPNeed")]
|
||||||
|
public double Skl02ArtifactSpNeed { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("baseAvatarID")]
|
||||||
|
public int BaseAvatarId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("firstName")]
|
||||||
|
public HashName FirstName { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("lastName")]
|
||||||
|
public HashName LastName { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("enFirstName")]
|
||||||
|
public HashName EnFirstName { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("enLastName")]
|
||||||
|
public HashName EnLastName { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("UISelectVoice")]
|
||||||
|
public string UiSelectVoice { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("UILevelUpVoice")]
|
||||||
|
public string UiLevelUpVoice { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("DA_Name")]
|
||||||
|
public string DaName { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("DA_Type")]
|
||||||
|
public string DaType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("ArtifactID")]
|
||||||
|
public int ArtifactId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("isEasterner")]
|
||||||
|
public bool IsEasterner { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("FaceAnimationGroupName")]
|
||||||
|
public string FaceAnimationGroupName { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("AvatarEffects")]
|
||||||
|
public object[] AvatarEffects { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("TagUnlockList")]
|
||||||
|
public int[] TagUnlockList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("DefaultDressId")]
|
||||||
|
public int DefaultDressId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("avatarStarUpType")]
|
||||||
|
public int AvatarStarUpType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("avatarStarSourceID")]
|
||||||
|
public object[] AvatarStarSourceId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("IsCollaboration")]
|
||||||
|
public bool IsCollaboration { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("StarUpBG")]
|
||||||
|
public string StarUpBg { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("DataImpl")]
|
||||||
|
public object DataImpl { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("avatarID")]
|
||||||
|
public int AvatarId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class HashName
|
||||||
|
{
|
||||||
|
[JsonProperty("hash")]
|
||||||
|
public long Hash { get; set; }
|
||||||
|
}
|
||||||
|
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
}
|
||||||
33
Common/Utils/ExcelReader/ExcelBase.cs
Normal file
33
Common/Utils/ExcelReader/ExcelBase.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Common.Utils.ExcelReader
|
||||||
|
{
|
||||||
|
#pragma warning disable CS8618, CS8602 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
public abstract class BaseExcelReader<Self, Scheme>
|
||||||
|
{
|
||||||
|
public Scheme[] All { get; set; }
|
||||||
|
private readonly Logger c = new("Factory", ConsoleColor.Yellow);
|
||||||
|
public abstract string FileName { get; }
|
||||||
|
private static Self Instance;
|
||||||
|
|
||||||
|
public static Self GetInstance()
|
||||||
|
{
|
||||||
|
Instance ??= Activator.CreateInstance<Self>();
|
||||||
|
|
||||||
|
if ((Instance as BaseExcelReader<Self, Scheme>).All == null)
|
||||||
|
{
|
||||||
|
(Instance as BaseExcelReader<Self, Scheme>).Load();
|
||||||
|
if((int)Global.config.VerboseLevel > 1)
|
||||||
|
(Instance as BaseExcelReader<Self, Scheme>).c.Log($"{typeof(Self).Name} Excel Loaded From {(Instance as BaseExcelReader<Self, Scheme>).FileName}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Load()
|
||||||
|
{
|
||||||
|
All = JsonConvert.DeserializeObject<Scheme[]>(File.ReadAllText($"Resources\\ExcelOutputAsset\\{FileName}")) ?? Array.Empty<Scheme>();
|
||||||
|
}
|
||||||
|
#pragma warning restore CS8618, CS8602 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
}
|
||||||
|
}
|
||||||
250
Common/Utils/ExcelReader/StageData.cs
Normal file
250
Common/Utils/ExcelReader/StageData.cs
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Common.Utils.ExcelReader
|
||||||
|
{
|
||||||
|
public class StageData : BaseExcelReader<StageData, StageDataExcel>
|
||||||
|
{
|
||||||
|
public override string FileName { get { return "StageData_Main.json"; } }
|
||||||
|
|
||||||
|
public StageDataExcel? FromId(int id)
|
||||||
|
{
|
||||||
|
return All.Where(stage => stage.LevelId == id).FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
public partial class StageDataExcel
|
||||||
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
|
public HashName Name { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("chapterId")]
|
||||||
|
public int ChapterId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("actId")]
|
||||||
|
public int ActId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("sectionId")]
|
||||||
|
public int SectionId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("difficulty")]
|
||||||
|
public int Difficulty { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("type")]
|
||||||
|
public int Type { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("tag")]
|
||||||
|
public int[] Tag { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("battleType")]
|
||||||
|
public int BattleType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("enterTimes")]
|
||||||
|
public int EnterTimes { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("resetType")]
|
||||||
|
public int ResetType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("resetCoinID")]
|
||||||
|
public int ResetCoinId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("resetCostType")]
|
||||||
|
public int ResetCostType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("resetTimes")]
|
||||||
|
public int ResetTimes { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("staminaCost")]
|
||||||
|
public int StaminaCost { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("avatarExpReward")]
|
||||||
|
public int AvatarExpReward { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("avatarExpInside")]
|
||||||
|
public int AvatarExpInside { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("scoinReward")]
|
||||||
|
public int ScoinReward { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("scoinInside")]
|
||||||
|
public double ScoinInside { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("maxScoinReward")]
|
||||||
|
public int MaxScoinReward { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("maxProgress")]
|
||||||
|
public int MaxProgress { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("HighlightDisplayDropIdList")]
|
||||||
|
public int[] HighlightDisplayDropIdList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("dropList")]
|
||||||
|
public int[] DropList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("recommendPlayerLevel")]
|
||||||
|
public int RecommendPlayerLevel { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("unlockPlayerLevel")]
|
||||||
|
public int UnlockPlayerLevel { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("unlockStarNum")]
|
||||||
|
public int UnlockStarNum { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("preLevelID")]
|
||||||
|
public int[] PreLevelId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("displayTitle")]
|
||||||
|
public HashName DisplayTitle { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("displayDetail")]
|
||||||
|
public HashName DisplayDetail { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("briefPicPath")]
|
||||||
|
public string BriefPicPath { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("detailPicPath")]
|
||||||
|
public string DetailPicPath { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("luaFile")]
|
||||||
|
public string LuaFile { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("challengeList")]
|
||||||
|
public ChallengeList[] ChallengeList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("IsActChallenge")]
|
||||||
|
public bool IsActChallenge { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("fastBonusTime")]
|
||||||
|
public int FastBonusTime { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("sonicBonusTime")]
|
||||||
|
public int SonicBonusTime { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("hardLevel")]
|
||||||
|
public int HardLevel { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("hardLevelGroup")]
|
||||||
|
public int HardLevelGroup { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("reviveTimes")]
|
||||||
|
public int ReviveTimes { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("reviveCostType")]
|
||||||
|
public int ReviveCostType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("ReviveUseTypeList")]
|
||||||
|
public int[] ReviveUseTypeList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("teamNum")]
|
||||||
|
public int TeamNum { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("maxNumList")]
|
||||||
|
public int[] MaxNumList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("restrictList")]
|
||||||
|
public int[] RestrictList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("loseDescList")]
|
||||||
|
public HashName[] LoseDescList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("RecordLevelType")]
|
||||||
|
public int RecordLevelType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("UseDynamicHardLv")]
|
||||||
|
public int UseDynamicHardLv { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("isTrunk")]
|
||||||
|
public bool IsTrunk { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("MonsterAttrShow")]
|
||||||
|
public int[] MonsterAttrShow { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("playerGetAllDrops")]
|
||||||
|
public bool PlayerGetAllDrops { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("HardCoeff")]
|
||||||
|
public int HardCoeff { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("enterTimesType")]
|
||||||
|
public int EnterTimesType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("isEnterWithElf")]
|
||||||
|
public int IsEnterWithElf { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("PreMissionList")]
|
||||||
|
public int[] PreMissionList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("LockedText")]
|
||||||
|
public HashName LockedText { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("PreMissionLink")]
|
||||||
|
public int PreMissionLink { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("PreMissionLinkParams")]
|
||||||
|
public int[] PreMissionLinkParams { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("PreMissionLinkParamStr")]
|
||||||
|
public string PreMissionLinkParamStr { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("UnlockedText")]
|
||||||
|
public HashName UnlockedText { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("UnlockedLink")]
|
||||||
|
public int UnlockedLink { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("UnlockedLinkParams")]
|
||||||
|
public int[] UnlockedLinkParams { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("UnlockedLinkParamStr")]
|
||||||
|
public string UnlockedLinkParamStr { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("costMaterialId")]
|
||||||
|
public int CostMaterialId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("costMaterialNum")]
|
||||||
|
public int CostMaterialNum { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("firstCostMaterialNum")]
|
||||||
|
public int FirstCostMaterialNum { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("BalanceModeType")]
|
||||||
|
public int BalanceModeType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("StageEntryNameList")]
|
||||||
|
public string[] StageEntryNameList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("FloatDrop")]
|
||||||
|
public FloatDrop[] FloatDrop { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("IsBattleYLevel")]
|
||||||
|
public bool IsBattleYLevel { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("DataImpl")]
|
||||||
|
public object DataImpl { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("levelId")]
|
||||||
|
public int LevelId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class ChallengeList
|
||||||
|
{
|
||||||
|
[JsonProperty("challengeId")]
|
||||||
|
public int ChallengeId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("rewardId")]
|
||||||
|
public int RewardId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class FloatDrop
|
||||||
|
{
|
||||||
|
[JsonProperty("materialId")]
|
||||||
|
public long MaterialId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("maxNum")]
|
||||||
|
public long MaxNum { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("minNum")]
|
||||||
|
public long MinNum { get; set; }
|
||||||
|
}
|
||||||
|
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
}
|
||||||
255
Common/Utils/ExcelReader/StigmataData.cs
Normal file
255
Common/Utils/ExcelReader/StigmataData.cs
Normal file
@@ -0,0 +1,255 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Common.Utils.ExcelReader
|
||||||
|
{
|
||||||
|
public class StigmataData : BaseExcelReader<StigmataData, StigmataDataExcel>
|
||||||
|
{
|
||||||
|
public override string FileName { get { return "StigmataData.json"; } }
|
||||||
|
public StigmataDataExcel? FromId(int id)
|
||||||
|
{
|
||||||
|
return All.Where(stigmata => stigmata.Id == id).FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
public partial class StigmataDataExcel
|
||||||
|
{
|
||||||
|
[JsonProperty("rarity")]
|
||||||
|
public int Rarity { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("maxRarity")]
|
||||||
|
public int MaxRarity { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("subRarity")]
|
||||||
|
public int SubRarity { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("subMaxRarity")]
|
||||||
|
public int SubMaxRarity { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("cost")]
|
||||||
|
public int Cost { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("powerType")]
|
||||||
|
public int PowerType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("maxLv")]
|
||||||
|
public int MaxLv { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("expType")]
|
||||||
|
public int ExpType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("sellPriceBase")]
|
||||||
|
public int SellPriceBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("sellPriceAdd")]
|
||||||
|
public int SellPriceAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("gearExpProvideBase")]
|
||||||
|
public int GearExpProvideBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("gearExpPorvideAdd")]
|
||||||
|
public int GearExpPorvideAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("baseType")]
|
||||||
|
public int BaseType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("LabelPath")]
|
||||||
|
public string LabelPath { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("displayTitle")]
|
||||||
|
public HashName DisplayTitle { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("displayDescription")]
|
||||||
|
public HashName DisplayDescription { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("displayNumber")]
|
||||||
|
public int DisplayNumber { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("iconPath")]
|
||||||
|
public string IconPath { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("imagePath")]
|
||||||
|
public string ImagePath { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("HPBase")]
|
||||||
|
public double HpBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("HPAdd")]
|
||||||
|
public double HpAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SPBase")]
|
||||||
|
public double SpBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SPAdd")]
|
||||||
|
public double SpAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("attackBase")]
|
||||||
|
public double AttackBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("attackAdd")]
|
||||||
|
public double AttackAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("defenceBase")]
|
||||||
|
public double DefenceBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("defenceAdd")]
|
||||||
|
public double DefenceAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("criticalBase")]
|
||||||
|
public double CriticalBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("criticalAdd")]
|
||||||
|
public double CriticalAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("durabilityMax")]
|
||||||
|
public int DurabilityMax { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("evoMaterial")]
|
||||||
|
public Material[] EvoMaterial { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("evoID")]
|
||||||
|
public int EvoId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1ID")]
|
||||||
|
public double Prop1Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1Param1")]
|
||||||
|
public double Prop1Param1 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1Param2")]
|
||||||
|
public double Prop1Param2 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1Param3")]
|
||||||
|
public double Prop1Param3 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1Param1Add")]
|
||||||
|
public double Prop1Param1Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1Param2Add")]
|
||||||
|
public double Prop1Param2Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1Param3Add")]
|
||||||
|
public double Prop1Param3Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2ID")]
|
||||||
|
public double Prop2Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2Param1")]
|
||||||
|
public double Prop2Param1 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2Param2")]
|
||||||
|
public double Prop2Param2 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2Param3")]
|
||||||
|
public double Prop2Param3 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2Param1Add")]
|
||||||
|
public double Prop2Param1Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2Param2Add")]
|
||||||
|
public double Prop2Param2Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2Param3Add")]
|
||||||
|
public double Prop2Param3Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3ID")]
|
||||||
|
public double Prop3Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3Param1")]
|
||||||
|
public double Prop3Param1 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3Param2")]
|
||||||
|
public double Prop3Param2 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3Param3")]
|
||||||
|
public double Prop3Param3 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3Param1Add")]
|
||||||
|
public double Prop3Param1Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3Param2Add")]
|
||||||
|
public double Prop3Param2Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3Param3Add")]
|
||||||
|
public double Prop3Param3Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("protect")]
|
||||||
|
public bool Protect { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("setID")]
|
||||||
|
public int SetId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("smallIcon")]
|
||||||
|
public string SmallIcon { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("tattooPath")]
|
||||||
|
public string TattooPath { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("offsetX")]
|
||||||
|
public int OffsetX { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("offsetY")]
|
||||||
|
public int OffsetY { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("scale")]
|
||||||
|
public double Scale { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("affixTreeId")]
|
||||||
|
public int AffixTreeId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("canRefine")]
|
||||||
|
public bool CanRefine { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("recycleID")]
|
||||||
|
public int RecycleId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("disjoinScoinCost")]
|
||||||
|
public int DisjoinScoinCost { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("disjoinAddMaterial")]
|
||||||
|
public Material[] DisjoinAddMaterial { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("LinkIDList")]
|
||||||
|
public int[] LinkIdList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("quality")]
|
||||||
|
public int Quality { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("stigmataMainID")]
|
||||||
|
public int StigmataMainId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("ShortName")]
|
||||||
|
public HashName ShortName { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SellPriceID")]
|
||||||
|
public int SellPriceId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("Transcendent")]
|
||||||
|
public bool Transcendent { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("Target")]
|
||||||
|
public int Target { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("isSecurityProtect")]
|
||||||
|
public bool IsSecurityProtect { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("GachaMainDropDisplayConfig")]
|
||||||
|
public double[] GachaMainDropDisplayConfig { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("GachaGiftDropDisplayConfig")]
|
||||||
|
public double[] GachaGiftDropDisplayConfig { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("StigmataFilterList")]
|
||||||
|
public int[] StigmataFilterList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("CollaborationSetID")]
|
||||||
|
public int CollaborationSetId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("DataImpl")]
|
||||||
|
public object DataImpl { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("ID")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
}
|
||||||
246
Common/Utils/ExcelReader/WeaponData.cs
Normal file
246
Common/Utils/ExcelReader/WeaponData.cs
Normal file
@@ -0,0 +1,246 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Common.Utils.ExcelReader
|
||||||
|
{
|
||||||
|
public class WeaponData : BaseExcelReader<WeaponData, WeaponDataExcel>
|
||||||
|
{
|
||||||
|
public override string FileName { get { return "WeaponData.json"; } }
|
||||||
|
public WeaponDataExcel? FromId(int id)
|
||||||
|
{
|
||||||
|
return All.Where(weapon => weapon.Id == id).FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
public partial class WeaponDataExcel
|
||||||
|
{
|
||||||
|
[JsonProperty("rarity")]
|
||||||
|
public int Rarity { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("maxRarity")]
|
||||||
|
public int MaxRarity { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("subRarity")]
|
||||||
|
public int SubRarity { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("subMaxRarity")]
|
||||||
|
public int SubMaxRarity { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("cost")]
|
||||||
|
public int Cost { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("powerType")]
|
||||||
|
public int PowerType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("maxLv")]
|
||||||
|
public int MaxLv { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("expType")]
|
||||||
|
public int ExpType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("sellPriceBase")]
|
||||||
|
public int SellPriceBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("sellPriceAdd")]
|
||||||
|
public int SellPriceAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("gearExpProvideBase")]
|
||||||
|
public int GearExpProvideBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("gearExpPorvideAdd")]
|
||||||
|
public int GearExpPorvideAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("baseType")]
|
||||||
|
public int BaseType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("bodyMod")]
|
||||||
|
public string BodyMod { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("displayTitle")]
|
||||||
|
public HashName DisplayTitle { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("displayDescription")]
|
||||||
|
public HashName DisplayDescription { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("iconPath")]
|
||||||
|
public string IconPath { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("imagePath")]
|
||||||
|
public string ImagePath { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("HPBase")]
|
||||||
|
public double HpBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("HPAdd")]
|
||||||
|
public double HpAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SPBase")]
|
||||||
|
public double SpBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SPAdd")]
|
||||||
|
public double SpAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("attackBase")]
|
||||||
|
public double AttackBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("attackAdd")]
|
||||||
|
public double AttackAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("defenceBase")]
|
||||||
|
public double DefenceBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("defenceAdd")]
|
||||||
|
public double DefenceAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("criticalBase")]
|
||||||
|
public double CriticalBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("criticalAdd")]
|
||||||
|
public double CriticalAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("ResistanceBase")]
|
||||||
|
public double ResistanceBase { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("ResistanceAdd")]
|
||||||
|
public double ResistanceAdd { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("evoMaterial")]
|
||||||
|
public Material[] EvoMaterial { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("evoPlayerLevel")]
|
||||||
|
public int EvoPlayerLevel { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("evoID")]
|
||||||
|
public int EvoId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1ID")]
|
||||||
|
public double Prop1Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1Param1")]
|
||||||
|
public double Prop1Param1 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1Param2")]
|
||||||
|
public double Prop1Param2 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1Param3")]
|
||||||
|
public double Prop1Param3 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1Param1Add")]
|
||||||
|
public double Prop1Param1Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1Param2Add")]
|
||||||
|
public double Prop1Param2Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop1Param3Add")]
|
||||||
|
public double Prop1Param3Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2ID")]
|
||||||
|
public double Prop2Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2Param1")]
|
||||||
|
public double Prop2Param1 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2Param2")]
|
||||||
|
public double Prop2Param2 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2Param3")]
|
||||||
|
public double Prop2Param3 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2Param1Add")]
|
||||||
|
public double Prop2Param1Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2Param2Add")]
|
||||||
|
public double Prop2Param2Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop2Param3Add")]
|
||||||
|
public double Prop2Param3Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3ID")]
|
||||||
|
public double Prop3Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3Param1")]
|
||||||
|
public double Prop3Param1 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3Param2")]
|
||||||
|
public double Prop3Param2 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3Param3")]
|
||||||
|
public double Prop3Param3 { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3Param1Add")]
|
||||||
|
public double Prop3Param1Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3Param2Add")]
|
||||||
|
public double Prop3Param2Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("prop3Param3Add")]
|
||||||
|
public double Prop3Param3Add { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("protect")]
|
||||||
|
public bool Protect { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("ExDisjoinCurrencyCost")]
|
||||||
|
public int ExDisjoinCurrencyCost { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("ExDisjoinAddMaterial")]
|
||||||
|
public object[] ExDisjoinAddMaterial { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("disjoinScoinCost")]
|
||||||
|
public int DisjoinScoinCost { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("disjoinAddMaterial")]
|
||||||
|
public Material[] DisjoinAddMaterial { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("weaponMainID")]
|
||||||
|
public int WeaponMainId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("LinkIDList")]
|
||||||
|
public int[] LinkIdList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("weaponQuality")]
|
||||||
|
public int WeaponQuality { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("SellPriceID")]
|
||||||
|
public int SellPriceId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("Transcendent")]
|
||||||
|
public bool Transcendent { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("Target")]
|
||||||
|
public int Target { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("GachaMainDropDisplayConfig")]
|
||||||
|
public double[] GachaMainDropDisplayConfig { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("GachaGiftDropDisplayConfig")]
|
||||||
|
public double[] GachaGiftDropDisplayConfig { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("PreloadEffectFolderPath")]
|
||||||
|
public string PreloadEffectFolderPath { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("WeaponFilterList")]
|
||||||
|
public int[] WeaponFilterList { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("CollaborationWeaponID")]
|
||||||
|
public int CollaborationWeaponId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("AvatarCustomDisplayID")]
|
||||||
|
public int AvatarCustomDisplayId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("DataImpl")]
|
||||||
|
public object DataImpl { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("ID")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class Material
|
||||||
|
{
|
||||||
|
[JsonProperty("ID")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("Num")]
|
||||||
|
public int Num { get; set; }
|
||||||
|
}
|
||||||
|
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
}
|
||||||
@@ -4,11 +4,26 @@ namespace PemukulPaku.GameServer.Game
|
|||||||
{
|
{
|
||||||
public class Player
|
public class Player
|
||||||
{
|
{
|
||||||
public User.UserScheme User;
|
public UserScheme User;
|
||||||
|
public AvatarScheme[] AvatarList;
|
||||||
|
public EquipmentScheme Equipment;
|
||||||
|
|
||||||
public Player(User.UserScheme user)
|
public Player(UserScheme user)
|
||||||
{
|
{
|
||||||
User = user;
|
User = user;
|
||||||
|
Equipment = Common.Database.Equipment.FromUid(user.Uid);
|
||||||
|
AvatarList = Avatar.AvatarsFromUid(user.Uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveAll()
|
||||||
|
{
|
||||||
|
User.Save();
|
||||||
|
Equipment.Save();
|
||||||
|
|
||||||
|
foreach (AvatarScheme Avatar in AvatarList)
|
||||||
|
{
|
||||||
|
Avatar.Save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
86
GameServer/Handlers/GetAvatarDataReqHandler.cs
Normal file
86
GameServer/Handlers/GetAvatarDataReqHandler.cs
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
using Common.Resources.Proto;
|
||||||
|
|
||||||
|
namespace PemukulPaku.GameServer.Handlers
|
||||||
|
{
|
||||||
|
[PacketCmdId(CmdId.GetAvatarDataReq)]
|
||||||
|
internal class GetAvatarDataReqHandler : IPacketHandler
|
||||||
|
{
|
||||||
|
public void Handle(Session session, Packet packet)
|
||||||
|
{
|
||||||
|
GetAvatarDataReq Packet = packet.GetDecodedBody<GetAvatarDataReq>();
|
||||||
|
|
||||||
|
GetAvatarDataRsp Rsp = new()
|
||||||
|
{
|
||||||
|
retcode = GetAvatarDataRsp.Retcode.Succ
|
||||||
|
};
|
||||||
|
|
||||||
|
if (Packet.AvatarIdLists.Contains((uint)0))
|
||||||
|
{
|
||||||
|
IEnumerable<Avatar> Avatars = session.Player.AvatarList.Select(avatar =>
|
||||||
|
{
|
||||||
|
Avatar a = new()
|
||||||
|
{
|
||||||
|
AvatarId = avatar.AvatarId,
|
||||||
|
AvatarArtifact = avatar.AvatarArtifact,
|
||||||
|
DressId = avatar.DressId,
|
||||||
|
DressLists = avatar.DressLists,
|
||||||
|
Level = avatar.Level,
|
||||||
|
Exp = avatar.Exp,
|
||||||
|
Fragment = avatar.Fragment,
|
||||||
|
Mode = avatar.Mode,
|
||||||
|
StageGoodfeel = avatar.StageGoodfeel,
|
||||||
|
Star = avatar.Star,
|
||||||
|
StigmataUniqueId1 = avatar.StigmataUniqueId1,
|
||||||
|
StigmataUniqueId2 = avatar.StigmataUniqueId2,
|
||||||
|
StigmataUniqueId3 = avatar.StigmataUniqueId3,
|
||||||
|
SubStar = avatar.SubStar,
|
||||||
|
TodayHasAddGoodfeel = avatar.TodayHasAddGoodfeel,
|
||||||
|
TouchGoodfeel = avatar.TouchGoodfeel,
|
||||||
|
WeaponUniqueId = avatar.WeaponUniqueId
|
||||||
|
};
|
||||||
|
a.SkillLists.AddRange(avatar.SkillLists);
|
||||||
|
|
||||||
|
return a;
|
||||||
|
});
|
||||||
|
|
||||||
|
Rsp.IsAll = true;
|
||||||
|
Rsp.AvatarLists.AddRange(Avatars);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IEnumerable<Avatar> Avatars = session.Player.AvatarList.Where(avatar => Packet.AvatarIdLists.Contains(avatar.AvatarId)).Select(avatar =>
|
||||||
|
{
|
||||||
|
Avatar a = new()
|
||||||
|
{
|
||||||
|
AvatarId = avatar.AvatarId,
|
||||||
|
AvatarArtifact = avatar.AvatarArtifact,
|
||||||
|
DressId = avatar.DressId,
|
||||||
|
DressLists = avatar.DressLists,
|
||||||
|
Level = avatar.Level,
|
||||||
|
Exp = avatar.Exp,
|
||||||
|
Fragment = avatar.Fragment,
|
||||||
|
Mode = avatar.Mode,
|
||||||
|
StageGoodfeel = avatar.StageGoodfeel,
|
||||||
|
Star = avatar.Star,
|
||||||
|
StigmataUniqueId1 = avatar.StigmataUniqueId1,
|
||||||
|
StigmataUniqueId2 = avatar.StigmataUniqueId2,
|
||||||
|
StigmataUniqueId3 = avatar.StigmataUniqueId3,
|
||||||
|
SubStar = avatar.SubStar,
|
||||||
|
TodayHasAddGoodfeel = avatar.TodayHasAddGoodfeel,
|
||||||
|
TouchGoodfeel = avatar.TouchGoodfeel,
|
||||||
|
WeaponUniqueId = avatar.WeaponUniqueId
|
||||||
|
};
|
||||||
|
a.SkillLists.AddRange(avatar.SkillLists);
|
||||||
|
|
||||||
|
return a;
|
||||||
|
});
|
||||||
|
|
||||||
|
Rsp.AvatarLists.AddRange(Avatars);
|
||||||
|
|
||||||
|
Rsp.IsAll = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
session.Send(GameServer.Packet.FromProto(Rsp, CmdId.GetAvatarDataRsp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using Common.Resources.Proto;
|
using Common.Resources.Proto;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace PemukulPaku.GameServer.Handlers
|
namespace PemukulPaku.GameServer.Handlers
|
||||||
{
|
{
|
||||||
|
|||||||
20
GameServer/Handlers/GetConfigReqHandler.cs
Normal file
20
GameServer/Handlers/GetConfigReqHandler.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Common;
|
||||||
|
using Common.Resources.Proto;
|
||||||
|
|
||||||
|
namespace PemukulPaku.GameServer.Handlers
|
||||||
|
{
|
||||||
|
[PacketCmdId(CmdId.GetConfigReq)]
|
||||||
|
internal class GetConfigReqHandler : IPacketHandler
|
||||||
|
{
|
||||||
|
public void Handle(Session session, Packet packet)
|
||||||
|
{
|
||||||
|
GetConfigRsp Rsp = new()
|
||||||
|
{
|
||||||
|
retcode = GetConfigRsp.Retcode.Succ,
|
||||||
|
ServerCurTime = (uint)Global.GetUnixInSeconds(),
|
||||||
|
};
|
||||||
|
|
||||||
|
session.Send(Packet.FromProto(Rsp, CmdId.GetConfigRsp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
29
GameServer/Handlers/GetEquipmentDataReqHandler.cs
Normal file
29
GameServer/Handlers/GetEquipmentDataReqHandler.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using Common.Database;
|
||||||
|
using Common.Resources.Proto;
|
||||||
|
using MongoDB.Driver;
|
||||||
|
|
||||||
|
namespace PemukulPaku.GameServer.Handlers
|
||||||
|
{
|
||||||
|
[PacketCmdId(CmdId.GetEquipmentDataReq)]
|
||||||
|
internal class GetEquipmentDataReqHandler : IPacketHandler
|
||||||
|
{
|
||||||
|
public void Handle(Session session, Packet packet)
|
||||||
|
{
|
||||||
|
EquipmentScheme Equipment = session.Player.Equipment;
|
||||||
|
|
||||||
|
GetEquipmentDataRsp Rsp = new()
|
||||||
|
{
|
||||||
|
retcode = GetEquipmentDataRsp.Retcode.Succ,
|
||||||
|
VitalityValue = 0,
|
||||||
|
IsAll = true
|
||||||
|
};
|
||||||
|
|
||||||
|
Rsp.MaterialLists.AddRange(Equipment.MaterialList.ToList());
|
||||||
|
Rsp.MechaLists.AddRange(Equipment.MechaList.ToList());
|
||||||
|
Rsp.StigmataLists.AddRange(Equipment.StigmataList.ToList());
|
||||||
|
Rsp.WeaponLists.AddRange(Equipment.WeaponList.ToList());
|
||||||
|
|
||||||
|
session.Send(Packet.FromProto(Rsp, CmdId.GetEquipmentDataRsp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
29
GameServer/Handlers/GetMainDataReqHandler.cs
Normal file
29
GameServer/Handlers/GetMainDataReqHandler.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using Common.Database;
|
||||||
|
using Common.Resources.Proto;
|
||||||
|
|
||||||
|
namespace PemukulPaku.GameServer.Handlers
|
||||||
|
{
|
||||||
|
[PacketCmdId(CmdId.GetMainDataReq)]
|
||||||
|
internal class GetMainDataReqHandler : IPacketHandler
|
||||||
|
{
|
||||||
|
public void Handle(Session session, Packet packet)
|
||||||
|
{
|
||||||
|
UserScheme User = session.Player.User;
|
||||||
|
|
||||||
|
GetMainDataRsp Rsp = new()
|
||||||
|
{
|
||||||
|
retcode = GetMainDataRsp.Retcode.Succ,
|
||||||
|
AssistantAvatarId = (uint)User.AssistantAvatarId,
|
||||||
|
Birthday = (uint)User.BirthDate,
|
||||||
|
Nickname = User.Nick,
|
||||||
|
Level = 4,
|
||||||
|
Exp = (uint)User.Exp,
|
||||||
|
FreeHcoin = (uint)User.Hcoin,
|
||||||
|
Hcoin = (uint)User.Hcoin,
|
||||||
|
CustomHeadId = 161001
|
||||||
|
};
|
||||||
|
|
||||||
|
session.Send(Packet.FromProto(Rsp, CmdId.GetMainDataRsp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using Common.Resources.Proto;
|
using Common.Resources.Proto;
|
||||||
using Common.Database;
|
using Common.Database;
|
||||||
|
using Common;
|
||||||
|
|
||||||
namespace PemukulPaku.GameServer.Handlers
|
namespace PemukulPaku.GameServer.Handlers
|
||||||
{
|
{
|
||||||
@@ -10,7 +11,7 @@ namespace PemukulPaku.GameServer.Handlers
|
|||||||
{
|
{
|
||||||
GetPlayerTokenReq Packet = _packet.GetDecodedBody<GetPlayerTokenReq>();
|
GetPlayerTokenReq Packet = _packet.GetDecodedBody<GetPlayerTokenReq>();
|
||||||
GetPlayerTokenRsp Rsp = new () { };
|
GetPlayerTokenRsp Rsp = new () { };
|
||||||
User.UserScheme? CurrentUser = User.FromToken(Packet.AccountToken);
|
UserScheme? CurrentUser = User.FromToken(Packet.AccountToken);
|
||||||
|
|
||||||
if (CurrentUser == null || CurrentUser.Uid != uint.Parse(Packet.AccountUid))
|
if (CurrentUser == null || CurrentUser.Uid != uint.Parse(Packet.AccountUid))
|
||||||
{
|
{
|
||||||
@@ -21,6 +22,13 @@ namespace PemukulPaku.GameServer.Handlers
|
|||||||
{
|
{
|
||||||
session.Player = new Game.Player(CurrentUser);
|
session.Player = new Game.Player(CurrentUser);
|
||||||
|
|
||||||
|
if(session.Player.User.IsFirstLogin)
|
||||||
|
{
|
||||||
|
AvatarScheme avatar = Common.Database.Avatar.Create(101, session.Player.User.Uid, session.Player.Equipment);
|
||||||
|
if ((int)Global.config.VerboseLevel > 0)
|
||||||
|
session.c.Log($"Automatically created avatar with id: {avatar.AvatarId}");
|
||||||
|
}
|
||||||
|
|
||||||
Rsp = new()
|
Rsp = new()
|
||||||
{
|
{
|
||||||
retcode = GetPlayerTokenRsp.Retcode.Succ,
|
retcode = GetPlayerTokenRsp.Retcode.Succ,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Common;
|
using Common;
|
||||||
using Common.Database;
|
using Common.Database;
|
||||||
using Common.Resources.Proto;
|
using Common.Resources.Proto;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace PemukulPaku.GameServer.Handlers
|
namespace PemukulPaku.GameServer.Handlers
|
||||||
{
|
{
|
||||||
@@ -10,7 +9,7 @@ namespace PemukulPaku.GameServer.Handlers
|
|||||||
{
|
{
|
||||||
public void Handle(Session session, Packet packet)
|
public void Handle(Session session, Packet packet)
|
||||||
{
|
{
|
||||||
User.UserScheme User = session.Player.User;
|
UserScheme User = session.Player.User;
|
||||||
|
|
||||||
PlayerLoginRsp Rsp = new()
|
PlayerLoginRsp Rsp = new()
|
||||||
{
|
{
|
||||||
|
|||||||
23
GameServer/Handlers/StageBeginReqHandler.cs
Normal file
23
GameServer/Handlers/StageBeginReqHandler.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using Common.Resources.Proto;
|
||||||
|
|
||||||
|
namespace PemukulPaku.GameServer.Handlers
|
||||||
|
{
|
||||||
|
[PacketCmdId(CmdId.StageBeginReq)]
|
||||||
|
internal class StageBeginReqHandler : IPacketHandler
|
||||||
|
{
|
||||||
|
public void Handle(Session session, Packet packet)
|
||||||
|
{
|
||||||
|
StageBeginReq Data = packet.GetDecodedBody<StageBeginReq>();
|
||||||
|
|
||||||
|
StageBeginRsp Rsp = new()
|
||||||
|
{
|
||||||
|
retcode = StageBeginRsp.Retcode.Succ,
|
||||||
|
StageId = Data.StageId,
|
||||||
|
Progress = 0,
|
||||||
|
IsCollectCheatData = false
|
||||||
|
};
|
||||||
|
|
||||||
|
session.Send(Packet.FromProto(Rsp, CmdId.StageBeginRsp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
59
GameServer/Handlers/StageEndReqHandler.cs
Normal file
59
GameServer/Handlers/StageEndReqHandler.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using Common.Database;
|
||||||
|
using Common.Resources.Proto;
|
||||||
|
using Common.Utils.ExcelReader;
|
||||||
|
using ProtoBuf;
|
||||||
|
|
||||||
|
namespace PemukulPaku.GameServer.Handlers
|
||||||
|
{
|
||||||
|
[PacketCmdId(CmdId.StageEndReq)]
|
||||||
|
internal class StageEndReqHandler : IPacketHandler
|
||||||
|
{
|
||||||
|
public void Handle(Session session, Packet packet)
|
||||||
|
{
|
||||||
|
StageEndReq Data = packet.GetDecodedBody<StageEndReq>();
|
||||||
|
StageEndReqBody DecodedBody = Serializer.Deserialize<StageEndReqBody>(Data.Body.AsSpan());
|
||||||
|
StageDataExcel? StageData = Common.Utils.ExcelReader.StageData.GetInstance().FromId((int)DecodedBody.StageId);
|
||||||
|
|
||||||
|
if(StageData == null)
|
||||||
|
{
|
||||||
|
session.c.Error("StageData Excel Is Bad Please Fix");
|
||||||
|
session.Send(Packet.FromProto(new StageEndRsp() { retcode = StageEndRsp.Retcode.StageError }, CmdId.StageEndRsp));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if(StageData.LevelId == 10101)
|
||||||
|
{
|
||||||
|
session.Player.User.IsFirstLogin = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
StageEndRsp Rsp = new()
|
||||||
|
{
|
||||||
|
retcode = StageEndRsp.Retcode.Succ,
|
||||||
|
StageId = DecodedBody.StageId,
|
||||||
|
EndStatus = DecodedBody.EndStatus
|
||||||
|
};
|
||||||
|
|
||||||
|
if(DecodedBody.EndStatus == StageEndStatus.StageWin)
|
||||||
|
{
|
||||||
|
EquipmentScheme Equipment = session.Player.Equipment;
|
||||||
|
|
||||||
|
foreach (DropItem DropItem in DecodedBody.DropItemLists)
|
||||||
|
{
|
||||||
|
Equipment.AddMaterial((int)DropItem.ItemId, (int)DropItem.Num);
|
||||||
|
}
|
||||||
|
|
||||||
|
session.Player.User.Hcoin += DecodedBody.ChallengeIndexLists.Length * 5;
|
||||||
|
|
||||||
|
session.ProcessPacket(Packet.FromProto(new GetEquipmentDataReq() { }, CmdId.GetEquipmentDataReq));
|
||||||
|
session.ProcessPacket(Packet.FromProto(new GetWorldMapDataReq() { }, CmdId.GetWorldMapDataReq));
|
||||||
|
session.ProcessPacket(Packet.FromProto(new ChapterGroupGetDataReq() { }, CmdId.ChapterGroupGetDataReq));
|
||||||
|
|
||||||
|
Rsp.PlayerExpReward = 100;
|
||||||
|
Rsp.AvatarExpReward = DecodedBody.AvatarExpReward;
|
||||||
|
Rsp.ScoinReward = DecodedBody.ScoinReward;
|
||||||
|
Rsp.ChallengeLists.AddRange(DecodedBody.ChallengeIndexLists.Select(challengeIndex => new StageChallengeData() { ChallengeIndex = challengeIndex, Reward = new() { Hcoin = 5 } }));
|
||||||
|
}
|
||||||
|
|
||||||
|
session.Send(Packet.FromProto(Rsp, CmdId.StageEndRsp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -123,8 +123,9 @@ namespace PemukulPaku.GameServer
|
|||||||
select (t, attr))
|
select (t, attr))
|
||||||
{
|
{
|
||||||
Handlers.Add(attr.Id, (IPacketHandler)Activator.CreateInstance(t)!);
|
Handlers.Add(attr.Id, (IPacketHandler)Activator.CreateInstance(t)!);
|
||||||
|
#if DEBUG
|
||||||
c.Log($"Loaded PacketHandler {t.Name} for Packet Type {attr.Id}");
|
c.Log($"Loaded PacketHandler {t.Name} for Packet Type {attr.Id}");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Log("Finished Loading Packet Handlers");
|
c.Log("Finished Loading Packet Handlers");
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
using System.Data.SqlTypes;
|
using System.Net.Sockets;
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
using Common;
|
using Common;
|
||||||
using Common.Resources.Proto;
|
using Common.Resources.Proto;
|
||||||
using Common.Utils;
|
using Common.Utils;
|
||||||
@@ -67,7 +64,7 @@ namespace PemukulPaku.GameServer
|
|||||||
{
|
{
|
||||||
if (Packet.IsValid(packet))
|
if (Packet.IsValid(packet))
|
||||||
{
|
{
|
||||||
ProcessPacket(packet);
|
ProcessPacket(new Packet(packet));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -77,16 +74,13 @@ namespace PemukulPaku.GameServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Debug("ClientLoop ends");
|
|
||||||
Server.GetInstance().LogClients();
|
|
||||||
|
|
||||||
c.Warn($"{Id} disconnected");
|
c.Warn($"{Id} disconnected");
|
||||||
Server.GetInstance().Sessions.Remove(Id);
|
Server.GetInstance().Sessions.Remove(Id);
|
||||||
|
Server.GetInstance().LogClients();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ProcessPacket(byte[] packet)
|
public void ProcessPacket(Packet _packet)
|
||||||
{
|
{
|
||||||
Packet _packet = new(packet);
|
|
||||||
string PacketName = Enum.GetName(typeof(CmdId), _packet.CmdId)!;
|
string PacketName = Enum.GetName(typeof(CmdId), _packet.CmdId)!;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace HttpServer.Controllers
|
|||||||
{
|
{
|
||||||
StreamReader Reader = new(ctx.Request.Body);
|
StreamReader Reader = new(ctx.Request.Body);
|
||||||
ShieldVerifyBody Data = JsonConvert.DeserializeObject<ShieldVerifyBody>(Reader.ReadToEndAsync().Result);
|
ShieldVerifyBody Data = JsonConvert.DeserializeObject<ShieldVerifyBody>(Reader.ReadToEndAsync().Result);
|
||||||
User.UserScheme? user = User.FromToken(Data.Token);
|
UserScheme? user = User.FromToken(Data.Token);
|
||||||
|
|
||||||
ShieldLoginResponse rsp = new()
|
ShieldLoginResponse rsp = new()
|
||||||
{
|
{
|
||||||
@@ -118,7 +118,7 @@ namespace HttpServer.Controllers
|
|||||||
StreamReader Reader = new(ctx.Request.Body);
|
StreamReader Reader = new(ctx.Request.Body);
|
||||||
ShieldLoginBody Data = JsonConvert.DeserializeObject<ShieldLoginBody>(Reader.ReadToEndAsync().Result);
|
ShieldLoginBody Data = JsonConvert.DeserializeObject<ShieldLoginBody>(Reader.ReadToEndAsync().Result);
|
||||||
|
|
||||||
User.UserScheme user = User.FromName(Data.Account);
|
UserScheme user = User.FromName(Data.Account);
|
||||||
|
|
||||||
ShieldLoginResponse rsp = new()
|
ShieldLoginResponse rsp = new()
|
||||||
{
|
{
|
||||||
|
|||||||
17
Program.cs
17
Program.cs
@@ -1,7 +1,8 @@
|
|||||||
using Common.Resources.Proto;
|
using Common;
|
||||||
using Common;
|
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using PemukulPaku.GameServer;
|
using PemukulPaku.GameServer;
|
||||||
|
using Common.Database;
|
||||||
|
using PemukulPaku.GameServer.Game;
|
||||||
|
|
||||||
namespace PemukulPaku
|
namespace PemukulPaku
|
||||||
{
|
{
|
||||||
@@ -9,19 +10,19 @@ namespace PemukulPaku
|
|||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Global.config.VerboseLevel = VerboseLevel.Debug;
|
||||||
|
#endif
|
||||||
Global.c.Log("Starting...");
|
Global.c.Log("Starting...");
|
||||||
|
|
||||||
Global.config.Gameserver.Host = NetworkInterface.GetAllNetworkInterfaces().Where(i => i.NetworkInterfaceType != NetworkInterfaceType.Loopback && i.OperationalStatus == OperationalStatus.Up).First().GetIPProperties().UnicastAddresses.Where(a => a.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).First().Address.ToString();
|
Global.config.Gameserver.Host = NetworkInterface.GetAllNetworkInterfaces().Where(i => i.NetworkInterfaceType != NetworkInterfaceType.Loopback && i.OperationalStatus == OperationalStatus.Up).First().GetIPProperties().UnicastAddresses.Where(a => a.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).First().Address.ToString();
|
||||||
|
|
||||||
GetPlayerTokenRsp getPlayerTokenRsp = new()
|
|
||||||
{
|
|
||||||
Msg = "Hello!"
|
|
||||||
};
|
|
||||||
|
|
||||||
new Thread(HttpServer.Program.Main).Start();
|
|
||||||
PacketFactory.LoadPacketHandlers();
|
PacketFactory.LoadPacketHandlers();
|
||||||
|
new Thread(HttpServer.Program.Main).Start();
|
||||||
_ = Server.GetInstance();
|
_ = Server.GetInstance();
|
||||||
|
|
||||||
|
Player Player = new(User.FromName("test"));
|
||||||
|
|
||||||
Console.Read();
|
Console.Read();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user