temp tutorial and gacha handlers

This commit is contained in:
raphaeIl 2024-04-28 19:13:49 -04:00
parent 7aa5b297d0
commit b85bb6f6aa
15 changed files with 690 additions and 251 deletions

View File

@ -440,13 +440,7 @@ namespace SCHALE.Common.Database
public class CafeProductionParcelInfo public class CafeProductionParcelInfo
{ {
public ParcelKeyPair Key { get; set; } public ParcelKeyPair Key { get; set; } = new() { Id = 1, Type = ParcelType.Currency };
// new ParcelKeyPair()
//{
// Id = 1,
// Type = ParcelType.Currency
//};
public long Amount { get; set; } public long Amount { get; set; }
} }
@ -491,7 +485,7 @@ namespace SCHALE.Common.Database
} }
public class CampaignMainStageSaveDB public class CampaignMainStageSaveDB : ContentSaveDB
{ {
public ContentType ContentType { get; set; } public ContentType ContentType { get; set; }
public CampaignState CampaignState { get; set; } public CampaignState CampaignState { get; set; }
@ -564,10 +558,13 @@ namespace SCHALE.Common.Database
} }
public class CharacterDB public class CharacterDB : ParcelBase
{ {
public ParcelType Type { get; set; } public override ParcelType Type { get => ParcelType.Character; }
public IEnumerable<ParcelInfo> ParcelInfos { get; set; }
[JsonIgnore]
public override IEnumerable<ParcelInfo> ParcelInfos { get; }
public long ServerId { get; set; } public long ServerId { get; set; }
public long UniqueId { get; set; } public long UniqueId { get; set; }
public int StarGrade { get; set; } public int StarGrade { get; set; }
@ -656,7 +653,7 @@ namespace SCHALE.Common.Database
public long RepresentCharacterUniqueId { get; set; } public long RepresentCharacterUniqueId { get; set; }
public long RepresentCharacterCostumeId { get; set; } public long RepresentCharacterCostumeId { get; set; }
public long AttendanceCount { get; set; } public long AttendanceCount { get; set; }
//public ClanSocialGrade ClanSocialGrade { get; set; } public ClanSocialGrade ClanSocialGrade { get; set; }
public DateTime JoinDate { get; set; } public DateTime JoinDate { get; set; }
public DateTime SocialGradeUpdateTime { get; set; } public DateTime SocialGradeUpdateTime { get; set; }
public DateTime LastLoginDate { get; set; } public DateTime LastLoginDate { get; set; }
@ -683,7 +680,7 @@ namespace SCHALE.Common.Database
public int Level { get; set; } public int Level { get; set; }
public int SlotNumber { get; set; } public int SlotNumber { get; set; }
public bool HasWeapon { get; set; } public bool HasWeapon { get; set; }
//public SquadType SquadType { get; set; } public SquadType SquadType { get; set; }
public int WeaponStarGrade { get; set; } public int WeaponStarGrade { get; set; }
} }
@ -832,13 +829,19 @@ namespace SCHALE.Common.Database
} }
public class ConsumableItemBaseDB : ParcelBase public abstract class ConsumableItemBaseDB : ParcelBase
{ {
public ParcelKeyPair Key { get; set; } [JsonIgnore]
public abstract bool CanConsume { get; }
[JsonIgnore]
public ParcelKeyPair Key { get; }
public long ServerId { get; set; } public long ServerId { get; set; }
public long UniqueId { get; set; } public long UniqueId { get; set; }
public long StackCount { get; set; } public long StackCount { get; set; }
public bool CanConsume { get; set; }
} }
@ -892,10 +895,14 @@ namespace SCHALE.Common.Database
public class CostumeDB : ParcelBase public class CostumeDB : ParcelBase
{ {
public ParcelType Type { get; set; } [JsonIgnore]
public IEnumerable<ParcelInfo> ParcelInfos { get; set; } public override IEnumerable<ParcelInfo> ParcelInfos { get; }
public long UniqueId { get; set; }
public override ParcelType Type { get => ParcelType.Costume; }
public long BoundCharacterServerId { get; set; } public long BoundCharacterServerId { get; set; }
public long UniqueId { get; set; }
} }
@ -1069,15 +1076,20 @@ namespace SCHALE.Common.Database
public class EquipmentDB : ConsumableItemBaseDB public class EquipmentDB : ConsumableItemBaseDB
{ {
public ParcelType Type { get; set; } public override ParcelType Type { get => ParcelType.Equipment; }
public IEnumerable<ParcelInfo> ParcelInfos { get; set; }
[JsonIgnore]
public override IEnumerable<ParcelInfo> ParcelInfos { get; }
[JsonIgnore]
public override bool CanConsume { get => false; }
public int Level { get; set; } public int Level { get; set; }
public long Exp { get; set; } public long Exp { get; set; }
public int Tier { get; set; } public int Tier { get; set; }
public long BoundCharacterServerId { get; set; } public long BoundCharacterServerId { get; set; }
public bool IsNew { get; set; } public bool IsNew { get; set; }
public bool IsLocked { get; set; } public bool IsLocked { get; set; }
public bool CanConsume { get; set; }
} }
@ -1298,7 +1310,7 @@ namespace SCHALE.Common.Database
public class EventRewardIncreaseDB public class EventRewardIncreaseDB
{ {
public EventTargetType EventTargetType { get; set; } public EventTargetType EventTargetType { get; set; }
//public BasisPoint Multiplier { get; set; } public BasisPoint Multiplier { get; set; }
public DateTime BeginDate { get; set; } public DateTime BeginDate { get; set; }
public DateTime EndDate { get; set; } public DateTime EndDate { get; set; }
} }
@ -1355,15 +1367,20 @@ namespace SCHALE.Common.Database
public class FurnitureDB : ConsumableItemBaseDB public class FurnitureDB : ConsumableItemBaseDB
{ {
public ParcelType Type { get; set; } public override ParcelType Type { get => ParcelType.Furniture; }
public IEnumerable<ParcelInfo> ParcelInfos { get; set; }
[JsonIgnore]
public override IEnumerable<ParcelInfo> ParcelInfos { get; }
[JsonIgnore]
public override bool CanConsume { get => false; }
public FurnitureLocation Location { get; set; } public FurnitureLocation Location { get; set; }
public long CafeDBId { get; set; } public long CafeDBId { get; set; }
public float PositionX { get; set; } public float PositionX { get; set; }
public float PositionY { get; set; } public float PositionY { get; set; }
public float Rotation { get; set; } public float Rotation { get; set; }
public long ItemDeploySequence { get; set; } public long ItemDeploySequence { get; set; }
public bool CanConsume { get; set; }
} }
@ -1388,8 +1405,11 @@ namespace SCHALE.Common.Database
public class GearDB : ParcelBase public class GearDB : ParcelBase
{ {
public ParcelType Type { get; set; } public override ParcelType Type { get => ParcelType.CharacterGear; }
public IEnumerable<ParcelInfo> ParcelInfos { get; set; }
[JsonIgnore]
public override IEnumerable<ParcelInfo> ParcelInfos { get; }
public long ServerId { get; set; } public long ServerId { get; set; }
public long UniqueId { get; set; } public long UniqueId { get; set; }
public int Level { get; set; } public int Level { get; set; }
@ -1444,11 +1464,16 @@ namespace SCHALE.Common.Database
public class ItemDB : ConsumableItemBaseDB public class ItemDB : ConsumableItemBaseDB
{ {
public ParcelType Type { get; set; } public override ParcelType Type { get => ParcelType.Item; }
public IEnumerable<ParcelInfo> ParcelInfos { get; set; }
[JsonIgnore]
public override IEnumerable<ParcelInfo> ParcelInfos { get; }
[JsonIgnore]
public override bool CanConsume { get; }
public bool IsNew { get; set; } public bool IsNew { get; set; }
public bool IsLocked { get; set; } public bool IsLocked { get; set; }
public bool CanConsume { get; set; }
} }
@ -1469,7 +1494,7 @@ namespace SCHALE.Common.Database
{ {
public long ServerId { get; set; } public long ServerId { get; set; }
public long AccountServerId { get; set; } public long AccountServerId { get; set; }
//public MailType Type { get; set; } public MailType Type { get; set; }
public long UniqueId { get; set; } public long UniqueId { get; set; }
public string Sender { get; set; } public string Sender { get; set; }
public string Comment { get; set; } public string Comment { get; set; }
@ -1483,13 +1508,15 @@ namespace SCHALE.Common.Database
public class MemoryLobbyDB : ParcelBase public class MemoryLobbyDB : ParcelBase
{ {
public ParcelType Type { get; set; } public override ParcelType Type { get => ParcelType.MemoryLobby; }
public IEnumerable<ParcelInfo> ParcelInfos { get; set; }
[JsonIgnore]
public override IEnumerable<ParcelInfo> ParcelInfos { get; }
public long AccountServerId { get; set; } public long AccountServerId { get; set; }
public long MemoryLobbyUniqueId { get; set; } public long MemoryLobbyUniqueId { get; set; }
} }
public class MiniGameHistoryDB public class MiniGameHistoryDB
{ {
public long EventContentId { get; set; } public long EventContentId { get; set; }
@ -2023,7 +2050,7 @@ namespace SCHALE.Common.Database
public class ShopInfoDB public class ShopInfoDB
{ {
public long EventContentId { get; set; } public long EventContentId { get; set; }
//public ShopCategoryType Category { get; set; } public ShopCategoryType Category { get; set; }
public long? ManualRefreshCount { get; set; } public long? ManualRefreshCount { get; set; }
public bool IsRefresh { get; set; } public bool IsRefresh { get; set; }
public DateTime? NextAutoRefreshDate { get; set; } public DateTime? NextAutoRefreshDate { get; set; }
@ -2036,7 +2063,7 @@ namespace SCHALE.Common.Database
{ {
public long EventContentId { get; set; } public long EventContentId { get; set; }
public long ShopExcelId { get; set; } public long ShopExcelId { get; set; }
//public ShopCategoryType Category { get; set; } public ShopCategoryType Category { get; set; }
public long DisplayOrder { get; set; } public long DisplayOrder { get; set; }
public long PurchaseCount { get; set; } public long PurchaseCount { get; set; }
public bool SoldOut { get; set; } public bool SoldOut { get; set; }
@ -2087,9 +2114,12 @@ namespace SCHALE.Common.Database
public class StickerDB : ParcelBase, IEquatable<StickerDB> public class StickerDB : ParcelBase, IEquatable<StickerDB>
{ {
public ParcelType Type { get; set; } public override ParcelType Type { get => ParcelType.Sticker; }
[JsonIgnore]
public override IEnumerable<ParcelInfo> ParcelInfos { get; }
public long StickerUniqueId { get; set; } public long StickerUniqueId { get; set; }
public IEnumerable<ParcelInfo> ParcelInfos { get; set; }
public bool Equals(StickerDB? other) public bool Equals(StickerDB? other)
{ {
@ -2185,8 +2215,11 @@ namespace SCHALE.Common.Database
public class WeaponDB : ParcelBase public class WeaponDB : ParcelBase
{ {
public ParcelType Type { get; set; } public override ParcelType Type { get => ParcelType.CharacterWeapon; }
public IEnumerable<ParcelInfo> ParcelInfos { get; set; }
[JsonIgnore]
public override IEnumerable<ParcelInfo> ParcelInfos { get; }
public long UniqueId { get; set; } public long UniqueId { get; set; }
public int Level { get; set; } public int Level { get; set; }
public long Exp { get; set; } public long Exp { get; set; }
@ -2199,7 +2232,7 @@ namespace SCHALE.Common.Database
public class WeekDungeonSaveDB public class WeekDungeonSaveDB
{ {
public ContentType ContentType { get; set; } public ContentType ContentType { get; set; }
//public WeekDungeonType WeekDungeonType { get; set; } public WeekDungeonType WeekDungeonType { get; set; }
public int Seed { get; set; } public int Seed { get; set; }
public int Sequence { get; set; } public int Sequence { get; set; }
} }
@ -2209,21 +2242,21 @@ namespace SCHALE.Common.Database
{ {
public long AccountServerId { get; set; } public long AccountServerId { get; set; }
public long StageUniqueId { get; set; } public long StageUniqueId { get; set; }
//public Dictionary<StarGoalType, long> StarGoalRecord { get; set; } public Dictionary<StarGoalType, long> StarGoalRecord { get; set; }
public bool IsCleardEver { get; set; } public bool IsCleardEver { get; set; }
} }
public class WorldRaidBossDamageRatio public class WorldRaidBossDamageRatio
{ {
//public ContentsChangeType ContentsChangeType { get; set; } public ContentsChangeType ContentsChangeType { get; set; }
//public BasisPoint DamageRatio { get; set; } public BasisPoint DamageRatio { get; set; }
} }
public class WorldRaidBossGroup public class WorldRaidBossGroup
{ {
//public ContentsChangeType ContentsChangeType { get; set; } public ContentsChangeType ContentsChangeType { get; set; }
public long GroupId { get; set; } public long GroupId { get; set; }
public DateTime BossSpawnTime { get; set; } public DateTime BossSpawnTime { get; set; }
public DateTime EliminateTime { get; set; } public DateTime EliminateTime { get; set; }

View File

@ -34,7 +34,8 @@ public enum CurrencyTypes : int
EliminateTicketA = 24, EliminateTicketA = 24,
EliminateTicketB = 25, EliminateTicketB = 25,
EliminateTicketC = 26, EliminateTicketC = 26,
Max = 27, EliminateTicketD = 27,
Max = 28,
}; };

View File

@ -24,7 +24,7 @@ namespace SCHALE.Common.NetworkProtocol
public bool UpdateRequired { get; set; } public bool UpdateRequired { get; set; }
public string TTSCdnUri { get; set; } public string TTSCdnUri { get; set; }
public AccountDB AccountDB { get; set; } public AccountDB AccountDB { get; set; }
//public IEnumerable<AttendanceBookReward> AttendanceBookRewards { get; set; } public IEnumerable<AttendanceBookReward> AttendanceBookRewards { get; set; }
public IEnumerable<AttendanceHistoryDB> AttendanceHistoryDBs { get; set; } public IEnumerable<AttendanceHistoryDB> AttendanceHistoryDBs { get; set; }
public IEnumerable<OpenConditionDB> OpenConditions { get; set; } public IEnumerable<OpenConditionDB> OpenConditions { get; set; }
public IEnumerable<PurchaseCountDB> RepurchasableMonthlyProductCountDBs { get; set; } public IEnumerable<PurchaseCountDB> RepurchasableMonthlyProductCountDBs { get; set; }
@ -987,7 +987,7 @@ namespace SCHALE.Common.NetworkProtocol
return NetworkProtocol.Protocol.Attendance_Reward; return NetworkProtocol.Protocol.Attendance_Reward;
} }
} }
//public List<AttendanceBookReward> AttendanceBookRewards { get; set; } public List<AttendanceBookReward> AttendanceBookRewards { get; set; }
public List<AttendanceHistoryDB> AttendanceHistoryDBs { get; set; } public List<AttendanceHistoryDB> AttendanceHistoryDBs { get; set; }
public ParcelResultDB ParcelResultDB { get; set; } public ParcelResultDB ParcelResultDB { get; set; }
} }
@ -1084,7 +1084,7 @@ namespace SCHALE.Common.NetworkProtocol
} }
} }
public long PurchaseOrderId { get; set; } public long PurchaseOrderId { get; set; }
//public BillingTransactionEndType EndType { get; set; } = BillingTransactionEndType.Success; public BillingTransactionEndType EndType { get; set; } = BillingTransactionEndType.Success;
} }
@ -1290,7 +1290,7 @@ namespace SCHALE.Common.NetworkProtocol
public DateTime PurchaseResetDate { get; set; } public DateTime PurchaseResetDate { get; set; }
public long PurchaseOrderId { get; set; } public long PurchaseOrderId { get; set; }
public string MXSeedKey { get; set; } public string MXSeedKey { get; set; }
//public PurchaseServerTag PurchaseServerTag { get; set; } public PurchaseServerTag PurchaseServerTag { get; set; }
} }
@ -2683,7 +2683,7 @@ namespace SCHALE.Common.NetworkProtocol
} }
} }
public long MemberAccountId { get; set; } public long MemberAccountId { get; set; }
//public ClanSocialGrade ConferingGrade { get; set; } public ClanSocialGrade ConferingGrade { get; set; }
} }
@ -3025,7 +3025,7 @@ namespace SCHALE.Common.NetworkProtocol
} }
} }
public string ClanNickName { get; set; } public string ClanNickName { get; set; }
//public ClanJoinOption ClanJoinOption { get; set; } public ClanJoinOption ClanJoinOption { get; set; }
} }
@ -3181,7 +3181,7 @@ namespace SCHALE.Common.NetworkProtocol
} }
public string ChangedClanName { get; set; } public string ChangedClanName { get; set; }
public string ChangedNotice { get; set; } public string ChangedNotice { get; set; }
//public ClanJoinOption ClanJoinOption { get; set; } public ClanJoinOption ClanJoinOption { get; set; }
} }
@ -3755,7 +3755,7 @@ namespace SCHALE.Common.NetworkProtocol
public List<ScenarioHistoryDB> ScenarioHistoryDBs { get; set; } public List<ScenarioHistoryDB> ScenarioHistoryDBs { get; set; }
public List<ScenarioGroupHistoryDB> ScenarioGroupHistoryDBs { get; set; } public List<ScenarioGroupHistoryDB> ScenarioGroupHistoryDBs { get; set; }
public List<EmblemDB> EmblemDBs { get; set; } public List<EmblemDB> EmblemDBs { get; set; }
//public List<AttendanceBookReward> AttendanceBookRewards { get; set; } public List<AttendanceBookReward> AttendanceBookRewards { get; set; }
public List<AttendanceHistoryDB> AttendanceHistoryDBs { get; set; } public List<AttendanceHistoryDB> AttendanceHistoryDBs { get; set; }
public List<StickerDB> StickerDBs { get; set; } public List<StickerDB> StickerDBs { get; set; }
public List<MemoryLobbyDB> MemoryLobbyDBs { get; set; } public List<MemoryLobbyDB> MemoryLobbyDBs { get; set; }
@ -4669,7 +4669,7 @@ namespace SCHALE.Common.NetworkProtocol
public ConsumeRequestDB ConsumeRequestDB { get; set; } public ConsumeRequestDB ConsumeRequestDB { get; set; }
public long ConsumeGoldAmount { get; set; } public long ConsumeGoldAmount { get; set; }
public long SlotId { get; set; } public long SlotId { get; set; }
//public CraftNodeTier CraftNodeType { get; set; } public CraftNodeTier CraftNodeType { get; set; }
} }
@ -4723,7 +4723,7 @@ namespace SCHALE.Common.NetworkProtocol
return NetworkProtocol.Protocol.EliminateRaid_Lobby; return NetworkProtocol.Protocol.EliminateRaid_Lobby;
} }
} }
//public RaidSeasonType SeasonType { get; set; } public RaidSeasonType SeasonType { get; set; }
public RaidGiveUpDB RaidGiveUpDB { get; set; } public RaidGiveUpDB RaidGiveUpDB { get; set; }
public EliminateRaidLobbyInfoDB RaidLobbyInfoDB { get; set; } public EliminateRaidLobbyInfoDB RaidLobbyInfoDB { get; set; }
public AccountCurrencyDB AccountCurrencyDB { get; set; } public AccountCurrencyDB AccountCurrencyDB { get; set; }
@ -5258,7 +5258,7 @@ namespace SCHALE.Common.NetworkProtocol
return NetworkProtocol.Protocol.EliminateRaid_Login; return NetworkProtocol.Protocol.EliminateRaid_Login;
} }
} }
//public RaidSeasonType SeasonType { get; set; } public RaidSeasonType SeasonType { get; set; }
public bool CanReceiveRankingReward { get; set; } public bool CanReceiveRankingReward { get; set; }
public List<long> ReceiveLimitedRewardIds { get; set; } public List<long> ReceiveLimitedRewardIds { get; set; }
public Dictionary<long, long> SweepPointByRaidUniqueId { get; set; } public Dictionary<long, long> SweepPointByRaidUniqueId { get; set; }
@ -5690,7 +5690,7 @@ namespace SCHALE.Common.NetworkProtocol
public long? Score { get; set; } public long? Score { get; set; }
public bool IsUpper { get; set; } public bool IsUpper { get; set; }
public bool IsFirstRequest { get; set; } public bool IsFirstRequest { get; set; }
//public RankingSearchType SearchType { get; set; } public RankingSearchType SearchType { get; set; }
} }
@ -5867,7 +5867,7 @@ namespace SCHALE.Common.NetworkProtocol
} }
} }
public long EventContentId { get; set; } public long EventContentId { get; set; }
//public List<ShopCategoryType> CategoryList { get; set; } public List<ShopCategoryType> CategoryList { get; set; }
} }
@ -6421,7 +6421,7 @@ namespace SCHALE.Common.NetworkProtocol
} }
} }
public long EventContentId { get; set; } public long EventContentId { get; set; }
//public ShopCategoryType ShopCategoryType { get; set; } public ShopCategoryType ShopCategoryType { get; set; }
} }
@ -6628,7 +6628,7 @@ namespace SCHALE.Common.NetworkProtocol
return NetworkProtocol.Protocol.MiniGame_MissionMultipleReward; return NetworkProtocol.Protocol.MiniGame_MissionMultipleReward;
} }
} }
//public MissionCategory MissionCategory { get; set; } public MissionCategory MissionCategory { get; set; }
public long EventContentId { get; set; } public long EventContentId { get; set; }
} }
@ -6896,7 +6896,7 @@ namespace SCHALE.Common.NetworkProtocol
} }
} }
public long EventContentId { get; set; } public long EventContentId { get; set; }
//public EventContentDiceRaceResultType DiceRaceResultType { get; set; } public EventContentDiceRaceResultType DiceRaceResultType { get; set; }
} }
@ -6935,7 +6935,7 @@ namespace SCHALE.Common.NetworkProtocol
{ {
get get
{ {
return NetworkProtocol.Protocol.None; return NetworkProtocol.Protocol.Event_RewardIncrease;
} }
} }
} }
@ -7956,7 +7956,7 @@ namespace SCHALE.Common.NetworkProtocol
return NetworkProtocol.Protocol.Notification_EventContentReddotCheck; return NetworkProtocol.Protocol.Notification_EventContentReddotCheck;
} }
} }
//public Dictionary<long, List<NotificationEventReddot>> Reddots { get; set; } public Dictionary<long, List<NotificationEventReddot>> Reddots { get; set; }
public Dictionary<long, List<EventContentCollectionDB>> EventContentUnlockCGDBs { get; set; } public Dictionary<long, List<EventContentCollectionDB>> EventContentUnlockCGDBs { get; set; }
} }
@ -8050,7 +8050,7 @@ namespace SCHALE.Common.NetworkProtocol
} }
} }
public string FriendCode { get; set; } public string FriendCode { get; set; }
//public FriendSearchLevelOption LevelOption { get; set; } public FriendSearchLevelOption LevelOption { get; set; }
} }
@ -8145,7 +8145,7 @@ namespace SCHALE.Common.NetworkProtocol
return NetworkProtocol.Protocol.Raid_Login; return NetworkProtocol.Protocol.Raid_Login;
} }
} }
//public RaidSeasonType SeasonType { get; set; } public RaidSeasonType SeasonType { get; set; }
public bool CanReceiveRankingReward { get; set; } public bool CanReceiveRankingReward { get; set; }
public long LastSettledRanking { get; set; } public long LastSettledRanking { get; set; }
public int? LastSettledTier { get; set; } public int? LastSettledTier { get; set; }
@ -8445,7 +8445,7 @@ namespace SCHALE.Common.NetworkProtocol
return NetworkProtocol.Protocol.OpenCondition_List; return NetworkProtocol.Protocol.OpenCondition_List;
} }
} }
//public List<OpenConditionContent> ConditionContents { get; set; } public List<OpenConditionContent> ConditionContents { get; set; }
} }
@ -8710,7 +8710,7 @@ namespace SCHALE.Common.NetworkProtocol
return NetworkProtocol.Protocol.Raid_Lobby; return NetworkProtocol.Protocol.Raid_Lobby;
} }
} }
//public RaidSeasonType SeasonType { get; set; } public RaidSeasonType SeasonType { get; set; }
public RaidGiveUpDB RaidGiveUpDB { get; set; } public RaidGiveUpDB RaidGiveUpDB { get; set; }
//public SingleRaidLobbyInfoDB RaidLobbyInfoDB { get; set; } //public SingleRaidLobbyInfoDB RaidLobbyInfoDB { get; set; }
public AccountCurrencyDB AccountCurrencyDB { get; set; } public AccountCurrencyDB AccountCurrencyDB { get; set; }
@ -8928,7 +8928,7 @@ namespace SCHALE.Common.NetworkProtocol
public virtual bool CanReceiveReward(DateTime serverTime) public virtual bool CanReceiveReward(DateTime serverTime)
{ {
return false; return true;
} }
} }
@ -9831,7 +9831,7 @@ namespace SCHALE.Common.NetworkProtocol
return NetworkProtocol.Protocol.Mission_MultipleReward; return NetworkProtocol.Protocol.Mission_MultipleReward;
} }
} }
//public MissionCategory MissionCategory { get; set; } public MissionCategory MissionCategory { get; set; }
public long? GuideMissionSeasonId { get; set; } public long? GuideMissionSeasonId { get; set; }
public long? EventContentId { get; set; } public long? EventContentId { get; set; }
} }
@ -10157,7 +10157,7 @@ namespace SCHALE.Common.NetworkProtocol
return NetworkProtocol.Protocol.Shop_List; return NetworkProtocol.Protocol.Shop_List;
} }
} }
//public List<ShopCategoryType> CategoryList { get; set; } public List<ShopCategoryType> CategoryList { get; set; }
} }
@ -10174,7 +10174,7 @@ namespace SCHALE.Common.NetworkProtocol
public long? Score { get; set; } public long? Score { get; set; }
public bool IsUpper { get; set; } public bool IsUpper { get; set; }
public bool IsFirstRequest { get; set; } public bool IsFirstRequest { get; set; }
//public RankingSearchType SearchType { get; set; } public RankingSearchType SearchType { get; set; }
} }
@ -10659,7 +10659,7 @@ namespace SCHALE.Common.NetworkProtocol
return NetworkProtocol.Protocol.None; return NetworkProtocol.Protocol.None;
} }
} }
//public ShopCategoryType ShopCategoryType { get; set; } public ShopCategoryType ShopCategoryType { get; set; }
} }

View File

@ -1,6 +1,8 @@
 
using Newtonsoft.Json;
using SCHALE.Common.Database; using SCHALE.Common.Database;
using SCHALE.Common.FlatData; using SCHALE.Common.FlatData;
using System.Net.NetworkInformation;
namespace SCHALE.Common.Parcel namespace SCHALE.Common.Parcel
{ {
@ -68,10 +70,12 @@ namespace SCHALE.Common.Parcel
} }
public class ParcelBase public abstract class ParcelBase
{ {
public ParcelType Type { get; set; } public abstract ParcelType Type { get; }
public IEnumerable<ParcelInfo> ParcelInfos { get; set; }
[JsonIgnore]
public abstract IEnumerable<ParcelInfo> ParcelInfos { get; }
} }
@ -85,7 +89,7 @@ namespace SCHALE.Common.Parcel
public bool HasCurrency { get; set; } public bool HasCurrency { get; set; }
public bool HasItem { get; set; } public bool HasItem { get; set; }
public IEnumerable<ConsumableItemBaseDB> ConsumableItemBaseDBs { get; set; } public IEnumerable<ConsumableItemBaseDB> ConsumableItemBaseDBs { get; set; }
//public ConsumeCondition ConsumeCondition { get; set; } public ConsumeCondition ConsumeCondition { get; set; }
} }
@ -97,45 +101,79 @@ namespace SCHALE.Common.Parcel
public ParcelChangeType ParcelChangeType { get; set; } public ParcelChangeType ParcelChangeType { get; set; }
} }
[Serializable]
public struct BasisPoint : IEquatable<BasisPoint>, IComparable<BasisPoint> public struct BasisPoint : IEquatable<BasisPoint>, IComparable<BasisPoint>
{ {
public long RawValue { get; set; } [JsonIgnore]
public long RawValue
public static readonly double DoubleEpsilon; {
get
public static readonly BasisPoint Epsilon; {
return this.rawValue;
}
}
private static readonly long Multiplier; private static readonly long Multiplier;
public static readonly BasisPoint One; private static readonly double OneOver10_4 = 1.0 / 10000.0;
private static readonly double OneOver10_4;
private long rawValue;
public static readonly BasisPoint Zero; public static readonly BasisPoint Zero;
public static readonly BasisPoint One;
public static readonly BasisPoint Epsilon;
public static readonly double DoubleEpsilon;
[JsonProperty]
private long rawValue;
public BasisPoint(long rawValue)
{
this.rawValue = rawValue;
}
public bool Equals(BasisPoint other) public bool Equals(BasisPoint other)
{ {
throw new NotImplementedException(); return this.rawValue == other.rawValue;
} }
public int CompareTo(BasisPoint other) public int CompareTo(BasisPoint other)
{ {
throw new NotImplementedException(); return rawValue.CompareTo(other.rawValue);
}
} }
public static long operator *(long value, BasisPoint other)
{
return MultiplyLong(value, other);
}
public static long MultiplyLong(long value, BasisPoint other)
{
double result = OneOver10_4 * ((double)other.rawValue * value);
if (double.IsInfinity(result))
return long.MaxValue;
return (long)result;
}
}
public class ParcelInfo : IEquatable<ParcelInfo> public class ParcelInfo : IEquatable<ParcelInfo>
{ {
public ParcelKeyPair Key { get; set; }
public long Amount { get; set; } public long Amount { get; set; }
public ParcelKeyPair Key { get; set; }
public BasisPoint Multiplier { get; set; } public BasisPoint Multiplier { get; set; }
public long MultipliedAmount { get; set; } public long MultipliedAmount
{
get
{
return Amount * Multiplier;
}
}
public BasisPoint Probability { get; set; } public BasisPoint Probability { get; set; }
@ -145,10 +183,23 @@ namespace SCHALE.Common.Parcel
} }
} }
public class ParcelKeyPair public class ParcelKeyPair : IEquatable<ParcelKeyPair>, IComparable<ParcelKeyPair>
{ {
public static readonly ParcelKeyPair Empty;
public ParcelType Type { get; set; } public ParcelType Type { get; set; }
public long Id { get; set; } public long Id { get; set; }
public int CompareTo(ParcelKeyPair? other)
{
return Id.CompareTo(other.Id);
}
public bool Equals(ParcelKeyPair? other)
{
return Id.Equals(other.Id);
}
} }

View File

@ -7,6 +7,7 @@ using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using Serilog; using Serilog;
using System.Text.Json.Serialization;
namespace SCHALE.GameServer.Controllers.Api namespace SCHALE.GameServer.Controllers.Api
{ {
@ -83,7 +84,11 @@ namespace SCHALE.GameServer.Controllers.Api
return Results.Json(new return Results.Json(new
{ {
packet = JsonSerializer.Serialize(rsp), packet = JsonSerializer.Serialize(rsp, new JsonSerializerOptions() // ignore null or fields not set, if this breaks anything, remove it, idk if it does but it makes the pcap logs look more readable
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault,
}),
protocol = ((BasePacket)rsp).Protocol.ToString() protocol = ((BasePacket)rsp).Protocol.ToString()
}); });

View File

@ -2,6 +2,8 @@
using SCHALE.Common.NetworkProtocol; using SCHALE.Common.NetworkProtocol;
using SCHALE.GameServer.Services; using SCHALE.GameServer.Services;
using MongoDB.Driver.Linq; using MongoDB.Driver.Linq;
using SCHALE.Common.FlatData;
using Serilog;
namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
{ {
@ -58,6 +60,7 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
{ {
CurrentVersion = req.Version, CurrentVersion = req.Version,
AccountDB = account, AccountDB = account,
MissionProgressDBs = [.. context.MissionProgresses.Where(x => x.AccountServerId == account.ServerId)] MissionProgressDBs = [.. context.MissionProgresses.Where(x => x.AccountServerId == account.ServerId)]
}; };
@ -77,124 +80,8 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
string[] uidToken = req.SessionKey.MxToken.Split(':'); string[] uidToken = req.SessionKey.MxToken.Split(':');
var account = new AccountDB(long.Parse(uidToken[0])); var account = new AccountDB(long.Parse(uidToken[0]));
context.Accounts.Add(account); context.Accounts.Add(account);
context.MissionProgresses.AddRange([
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 1501,
Complete = true,
StartTime = DateTime.Parse("2024-04-26T20:46:44")
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 1700,
StartTime = DateTime.Parse("2024-04-26T20:46:44"),
ProgressParameters = new Dictionary<long, long> { { 0, 1 } }
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 1500,
Complete = true,
StartTime = DateTime.Parse("2024-04-26T20:46:44")
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 2200,
StartTime = DateTime.Parse("2024-04-26T20:46:44"),
ProgressParameters = new Dictionary<long, long> { { 0, 1 }, { 1, 5 } }
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 300000,
StartTime = DateTime.Parse("2024-04-26T20:46:44"),
ProgressParameters = new Dictionary<long, long> { { 0, 1 } }
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 1000210,
Complete = true,
StartTime = DateTime.Parse("2024-04-26T20:46:44"),
ProgressParameters = new Dictionary<long, long> { { 0, 1 } }
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 1000220,
Complete = true,
StartTime = DateTime.Parse("2024-04-26T20:46:44"),
ProgressParameters = new Dictionary<long, long> { { 0, 1 } }
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 1000230,
Complete = true,
StartTime = DateTime.Parse("2024-04-26T20:46:44"),
ProgressParameters = new Dictionary<long, long> { { 0, 1 } }
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 1000240,
Complete = true,
StartTime = DateTime.Parse("2024-04-26T20:46:44"),
ProgressParameters = new Dictionary<long, long> { { 0, 1 } }
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 1000250,
Complete = true,
StartTime = DateTime.Parse("2024-04-26T20:46:44"),
ProgressParameters = new Dictionary<long, long> { { 0, 1 } }
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 1000260,
Complete = true,
StartTime = DateTime.Parse("2024-04-26T20:46:44"),
ProgressParameters = new Dictionary<long, long> { { 0, 1 } }
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 1000270,
Complete = true,
StartTime = DateTime.Parse("2024-04-26T20:46:44"),
ProgressParameters = new Dictionary<long, long> { { 0, 1 } }
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 1001327,
Complete = true,
StartTime = DateTime.Parse("2024-04-26T20:46:44"),
ProgressParameters = new Dictionary<long, long> { { 0, 1 } }
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 1001357,
Complete = true,
StartTime = DateTime.Parse("2024-04-26T20:46:44"),
ProgressParameters = new Dictionary<long, long> { { 0, 1 } }
},
new MissionProgressDB
{
AccountServerId = account.ServerId,
MissionUniqueId = 1001377,
Complete = true,
StartTime = DateTime.Parse("2024-04-26T20:46:44"),
ProgressParameters = new Dictionary<long, long> { { 0, 1 } }
}
]);
context.SaveChanges(); context.SaveChanges();
return new AccountCreateResponse() return new AccountCreateResponse()
@ -223,17 +110,196 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
{ {
return new AccountLoginSyncResponse() return new AccountLoginSyncResponse()
{ {
AccountCurrencySyncResponse = new AccountCurrencySyncResponse()
{
AccountCurrencyDB = new AccountCurrencyDB
{
AccountLevel = 1,
AcademyLocationRankSum = 1,
CurrencyDict = new Dictionary<CurrencyTypes, long>
{
{ CurrencyTypes.Gem, long.MaxValue }, // gacha currency 600
{ CurrencyTypes.GemPaid, 0 },
{ CurrencyTypes.GemBonus, 89473598435 }, // default blue gem?
{ CurrencyTypes.Gold, long.MaxValue }, // credit 10,000
{ CurrencyTypes.ActionPoint, long.MaxValue }, // energy 24
{ CurrencyTypes.AcademyTicket, 3 },
{ CurrencyTypes.ArenaTicket, 5 },
{ CurrencyTypes.RaidTicket, 3 },
{ CurrencyTypes.WeekDungeonChaserATicket, 0 },
{ CurrencyTypes.WeekDungeonChaserBTicket, 0 },
{ CurrencyTypes.WeekDungeonChaserCTicket, 0 },
{ CurrencyTypes.SchoolDungeonATicket, 0 },
{ CurrencyTypes.SchoolDungeonBTicket, 0 },
{ CurrencyTypes.SchoolDungeonCTicket, 0 },
{ CurrencyTypes.TimeAttackDungeonTicket, 3 },
{ CurrencyTypes.MasterCoin, 0 },
{ CurrencyTypes.WorldRaidTicketA, 40 },
{ CurrencyTypes.WorldRaidTicketB, 40 },
{ CurrencyTypes.WorldRaidTicketC, 40 },
{ CurrencyTypes.ChaserTotalTicket, 6 },
{ CurrencyTypes.SchoolDungeonTotalTicket, 6 },
{ CurrencyTypes.EliminateTicketA, 1 },
{ CurrencyTypes.EliminateTicketB, 1 },
{ CurrencyTypes.EliminateTicketC, 1 },
{ CurrencyTypes.EliminateTicketD, 1 }
},
UpdateTimeDict = new Dictionary<CurrencyTypes, DateTime>
{
{ CurrencyTypes.ActionPoint, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.AcademyTicket, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.ArenaTicket, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.RaidTicket, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.WeekDungeonChaserATicket, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.WeekDungeonChaserBTicket, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.WeekDungeonChaserCTicket, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.SchoolDungeonATicket, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.SchoolDungeonBTicket, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.SchoolDungeonCTicket, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.TimeAttackDungeonTicket, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.MasterCoin, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.WorldRaidTicketA, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.WorldRaidTicketB, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.WorldRaidTicketC, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.ChaserTotalTicket, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.SchoolDungeonTotalTicket, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.EliminateTicketA, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.EliminateTicketB, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.EliminateTicketC, DateTime.Parse("2024-04-26T19:29:12") },
{ CurrencyTypes.EliminateTicketD, DateTime.Parse("2024-04-26T19:29:12") }
}
}
},
CharacterListResponse = new CharacterListResponse()
{
CharacterDBs = new List<CharacterDB>
{
new CharacterDB
{
ServerId = 1043998219,
UniqueId = 13003,
StarGrade = 2,
Level = 1,
FavorRank = 1,
PublicSkillLevel = 1,
ExSkillLevel = 1,
PassiveSkillLevel = 1,
ExtraPassiveSkillLevel = 1,
LeaderSkillLevel = 1,
IsNew = true,
IsLocked = true,
EquipmentServerIds = new List<long> { 0, 0, 0 },
PotentialStats = new Dictionary<int, int> { { 1, 0 }, { 2, 0 }, { 3, 0 } }
},
new CharacterDB
{
ServerId = 1043998217,
UniqueId = 13010,
StarGrade = 2,
Level = 1,
FavorRank = 1,
PublicSkillLevel = 1,
ExSkillLevel = 1,
PassiveSkillLevel = 1,
ExtraPassiveSkillLevel = 1,
LeaderSkillLevel = 1,
IsNew = true,
IsLocked = true,
EquipmentServerIds = new List<long> { 0, 0, 0 },
PotentialStats = new Dictionary<int, int> { { 1, 0 }, { 2, 0 }, { 3, 0 } }
},
new CharacterDB
{
ServerId = 1043998218,
UniqueId = 16003,
StarGrade = 1,
Level = 1,
FavorRank = 1,
PublicSkillLevel = 1,
ExSkillLevel = 1,
PassiveSkillLevel = 1,
ExtraPassiveSkillLevel = 1,
LeaderSkillLevel = 1,
IsNew = true,
IsLocked = true,
EquipmentServerIds = new List<long> { 0, 0, 0 },
PotentialStats = new Dictionary<int, int> { { 1, 0 }, { 2, 0 }, { 3, 0 } }
},
new CharacterDB
{
ServerId = 1043998220,
UniqueId = 26000,
StarGrade = 1,
Level = 1,
FavorRank = 1,
PublicSkillLevel = 1,
ExSkillLevel = 1,
PassiveSkillLevel = 1,
ExtraPassiveSkillLevel = 1,
LeaderSkillLevel = 1,
IsNew = true,
IsLocked = true,
EquipmentServerIds = new List<long> { 0, 0, 0 },
PotentialStats = new Dictionary<int, int> { { 1, 0 }, { 2, 0 }, { 3, 0 } }
}
},
TSSCharacterDBs = [],
WeaponDBs = [],
CostumeDBs = [],
},
EchelonListResponse = new EchelonListResponse()
{
EchelonDBs = [
new EchelonDB()
{
AccountServerId = req.AccountId,
EchelonType = EchelonType.Adventure,
EchelonNumber = 1,
LeaderServerId = 123,
MainSlotServerIds = [1043998217, 1043998218, 1043998219, 0 ],
SupportSlotServerIds = [ 444, 0],
SkillCardMulliganCharacterIds = []
}
]
},
EventContentPermanentListResponse = new EventContentPermanentListResponse()
{
PermanentDBs = [
new() { EventContentId = 900801 },
new() { EventContentId = 900802 },
new() { EventContentId = 900803 },
new() { EventContentId = 900804 },
new() { EventContentId = 900805 },
new() { EventContentId = 900806 },
new() { EventContentId = 900808 },
new() { EventContentId = 900809 },
new() { EventContentId = 900810 },
new() { EventContentId = 900812 },
new() { EventContentId = 900813 },
new() { EventContentId = 900816 },
new() { EventContentId = 900701 },
],
},
FriendCode = "SCHALEPS",
ServerNotification = ServerNotificationFlag.HasUnreadMail,
SessionKey = new()
{
AccountServerId = req.AccountId,
MxToken = req.SessionKey.MxToken,
},
}; };
} }
[ProtocolHandler(Protocol.Account_GetTutorial)] [ProtocolHandler(Protocol.Account_GetTutorial)]
public ResponsePacket GetTutorialHandler(AccountGetTutorialRequest req) public ResponsePacket GetTutorialHandler(AccountGetTutorialRequest req)
{ {
return new AccountGetTutorialResponse() return new AccountGetTutorialResponse()
{ {
#if DEBUG
TutorialIds = [1, 2]
#endif
}; };
} }
@ -248,19 +314,8 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
} }
// others handlers, move to different handler group later // others handlers, move to different handler group later
[ProtocolHandler(Protocol.Item_List)]
public ResponsePacket Item_ListRequestHandler(ItemListRequest req)
{
return new ItemListResponse()
{
ItemDBs = [],
ExpiryItemDBs = [],
ServerNotification = ServerNotificationFlag.HasUnreadMail,
};
}
[ProtocolHandler(Protocol.NetworkTime_Sync)] [ProtocolHandler(Protocol.NetworkTime_Sync)]
public ResponsePacket NetworkTime_Sync(NetworkTimeSyncRequest req) public ResponsePacket NetworkTime_SyncHandler(NetworkTimeSyncRequest req)
{ {
long received_tick = DateTimeOffset.Now.Ticks; long received_tick = DateTimeOffset.Now.Ticks;
@ -272,7 +327,7 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
} }
[ProtocolHandler(Protocol.ContentSave_Get)] [ProtocolHandler(Protocol.ContentSave_Get)]
public ResponsePacket ContentSave_Get(ContentSaveGetRequest req) public ResponsePacket ContentSave_GetHandler(ContentSaveGetRequest req)
{ {
return new ContentSaveGetResponse() return new ContentSaveGetResponse()
{ {
@ -280,19 +335,6 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
}; };
} }
[ProtocolHandler(Protocol.Shop_BeforehandGachaGet)]
public ResponsePacket Shop_BeforehandGachaGet(ShopBeforehandGachaGetRequest req)
{
return new ShopBeforehandGachaGetResponse()
{
SessionKey = new()
{
MxToken = req.SessionKey.MxToken,
AccountServerId = req.SessionKey.AccountServerId,
}
};
}
[ProtocolHandler(Protocol.Toast_List)] [ProtocolHandler(Protocol.Toast_List)]
public ResponsePacket ToastListHandler(ToastListRequest req) public ResponsePacket ToastListHandler(ToastListRequest req)
{ {
@ -303,11 +345,51 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
}; };
} }
[ProtocolHandler(Protocol.EventContent_CollectionList)] [ProtocolHandler(Protocol.ContentLog_UIOpenStatistics)]
public ResponsePacket EventContent_CollectionListHandler(EventContentCollectionListRequest req) public ResponsePacket ContentLog_UIOpenStatisticsHandler(ContentLogUIOpenStatisticsRequest req)
{ {
return new EventContentCollectionListResponse() return new ContentLogUIOpenStatisticsResponse()
{
};
}
[ProtocolHandler(Protocol.Event_RewardIncrease)]
public ResponsePacket Event_RewardIncreaseHandler(EventRewardIncreaseRequest req)
{
return new EventRewardIncreaseResponse()
{
};
}
[ProtocolHandler(Protocol.OpenCondition_EventList)]
public ResponsePacket OpenCondition_EventListHandler(OpenConditionEventListRequest req)
{
return new OpenConditionEventListResponse()
{
};
}
[ProtocolHandler(Protocol.Notification_EventContentReddotCheck)]
public ResponsePacket Notification_EventContentReddotCheckHandler(NotificationEventContentReddotRequest req)
{
return new NotificationEventContentReddotResponse()
{
};
}
[ProtocolHandler(Protocol.Billing_PurchaseListByYostar)]
public ResponsePacket Billing_PurchaseListByYostarHandler(BillingPurchaseListByYostarRequest req)
{
return new BillingPurchaseListByYostarResponse()
{ {
}; };

View File

@ -0,0 +1,49 @@
using SCHALE.Common.Database;
using SCHALE.Common.FlatData;
using SCHALE.Common.NetworkProtocol;
using SCHALE.GameServer.Services;
namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
{
public class Campaign : ProtocolHandlerBase
{
private ISessionKeyService sessionKeyService;
private SCHALEContext context;
public Campaign(IProtocolHandlerFactory protocolHandlerFactory, ISessionKeyService _sessionKeyService, SCHALEContext _context) : base(protocolHandlerFactory)
{
sessionKeyService = _sessionKeyService;
context = _context;
}
[ProtocolHandler(Protocol.Campaign_List)]
public ResponsePacket ListHandler(CampaignListRequest req)
{
return new CampaignListResponse()
{
};
}
[ProtocolHandler(Protocol.Campaign_EnterMainStage)]
public ResponsePacket EnterMainStageHandler(CampaignEnterMainStageRequest req)
{
return new CampaignEnterMainStageResponse()
{
SaveDataDB = new CampaignMainStageSaveDB()
{
ContentType = ContentType.CampaignMainStage,
LastEnemyEntityId = 10010,
ActivatedHexaEventsAndConditions = new() { { 0, [0] } },
HexaEventDelayedExecutions = [],
CreateTime = DateTime.Parse("2024-04-22T18:33:21"),
StageUniqueId = 1011101,
StageEntranceFee = [],
EnemyKillCountByUniqueId = []
}
};
}
}
}

View File

@ -0,0 +1,19 @@
using SCHALE.Common.NetworkProtocol;
namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
{
public class Clan : ProtocolHandlerBase
{
public Clan(IProtocolHandlerFactory protocolHandlerFactory) : base(protocolHandlerFactory) { }
[ProtocolHandler(Protocol.Clan_Check)]
public ResponsePacket CheckHandler(ClanCheckRequest req)
{
return new ClanCheckResponse()
{
};
}
}
}

View File

@ -0,0 +1,28 @@
using SCHALE.Common.Database;
using SCHALE.Common.NetworkProtocol;
using SCHALE.GameServer.Services;
namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
{
public class EventContent : ProtocolHandlerBase
{
private ISessionKeyService sessionKeyService;
private SCHALEContext context;
public EventContent(IProtocolHandlerFactory protocolHandlerFactory, ISessionKeyService _sessionKeyService, SCHALEContext _context) : base(protocolHandlerFactory)
{
sessionKeyService = _sessionKeyService;
context = _context;
}
[ProtocolHandler(Protocol.EventContent_CollectionList)]
public ResponsePacket CollectionListHandler(EventContentCollectionListRequest req)
{
return new EventContentCollectionListResponse()
{
};
}
}
}

View File

@ -0,0 +1,19 @@
using SCHALE.Common.NetworkProtocol;
namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
{
public class Friend : ProtocolHandlerBase
{
public Friend(IProtocolHandlerFactory protocolHandlerFactory) : base(protocolHandlerFactory) { }
[ProtocolHandler(Protocol.Friend_Check)]
public ResponsePacket CheckHandler(FriendCheckRequest req)
{
return new FriendCheckResponse()
{
};
}
}
}

View File

@ -0,0 +1,29 @@
using SCHALE.Common.Database;
using SCHALE.Common.NetworkProtocol;
using SCHALE.GameServer.Services;
namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
{
public class Item : ProtocolHandlerBase
{
private ISessionKeyService sessionKeyService;
private SCHALEContext context;
public Item(IProtocolHandlerFactory protocolHandlerFactory, ISessionKeyService _sessionKeyService, SCHALEContext _context) : base(protocolHandlerFactory)
{
sessionKeyService = _sessionKeyService;
context = _context;
}
[ProtocolHandler(Protocol.Item_List)]
public ResponsePacket ListHandler(ItemListRequest req)
{
return new ItemListResponse()
{
ItemDBs = [],
ExpiryItemDBs = [],
ServerNotification = ServerNotificationFlag.HasUnreadMail,
};
}
}
}

View File

@ -0,0 +1,21 @@
using SCHALE.Common.NetworkProtocol;
namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
{
public class Mail : ProtocolHandlerBase
{
public Mail(IProtocolHandlerFactory protocolHandlerFactory) : base(protocolHandlerFactory) { }
[ProtocolHandler(Protocol.Mail_Check)]
public ResponsePacket CheckHandler(MailCheckRequest req)
{
return new MailCheckResponse()
{
};
}
}
}

View File

@ -119,5 +119,10 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
{ {
services.AddHostedService<T>(); services.AddHostedService<T>();
} }
public static void AddProtocolHandlerGroupByType(this IServiceCollection services, Type type)
{
services.AddTransient(typeof(IHostedService), type);
}
} }
} }

View File

@ -0,0 +1,97 @@
using SCHALE.Common.Database;
using SCHALE.Common.NetworkProtocol;
using SCHALE.GameServer.Services;
using Serilog;
namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers
{
public class Shop : ProtocolHandlerBase
{
private ISessionKeyService sessionKeyService;
private SCHALEContext context;
public List<long> SavedGachaResults { get; set; } // temp storage until gacha management
public Shop(IProtocolHandlerFactory protocolHandlerFactory, ISessionKeyService _sessionKeyService, SCHALEContext _context) : base(protocolHandlerFactory)
{
sessionKeyService = _sessionKeyService;
context = _context;
}
[ProtocolHandler(Protocol.Shop_BeforehandGachaGet)]
public ResponsePacket BeforehandGachaGetHandler(ShopBeforehandGachaGetRequest req)
{
return new ShopBeforehandGachaGetResponse()
{
SessionKey = new()
{
MxToken = req.SessionKey.MxToken,
AccountServerId = req.SessionKey.AccountServerId,
}
};
}
[ProtocolHandler(Protocol.Shop_BeforehandGachaRun)]
public ResponsePacket BeforehandGachaRunHandler(ShopBeforehandGachaRunRequest req)
{
// character ids here, just some limited 3 stars for now for fun
SavedGachaResults = [10059, 20007, 10033, 10074, 10045, 10053, 10054, 10021, 20022, 10057];
return new ShopBeforehandGachaRunResponse()
{
SelectGachaSnapshot = new BeforehandGachaSnapshotDB()
{
ShopUniqueId = 3,
GoodsId = 1,
LastResults = SavedGachaResults
}
};
}
[ProtocolHandler(Protocol.Shop_BeforehandGachaSave)]
public ResponsePacket BeforehandGachaPickHandler(ShopBeforehandGachaSaveRequest req)
{
return new ShopBeforehandGachaSaveResponse()
{
};
}
[ProtocolHandler(Protocol.Shop_BeforehandGachaPick)]
public ResponsePacket BeforehandGachaPickHandler(ShopBeforehandGachaPickRequest req)
{
var account = sessionKeyService.GetAccount(req.SessionKey);
var GachaResults = new List<GachaResult>();
foreach (var charId in SavedGachaResults)
{
GachaResults.Add(new GachaResult(charId) // hardcode until table
{
Character = new()
{
ServerId = account.ServerId,
UniqueId = charId,
StarGrade = 3,
Level = 1,
FavorRank = 1,
PublicSkillLevel = 1,
ExSkillLevel = 1,
PassiveSkillLevel = 1,
ExtraPassiveSkillLevel = 1,
LeaderSkillLevel = 1,
IsNew = true,
IsLocked = true
}
});
}
return new ShopBeforehandGachaPickResponse()
{
GachaResults = GachaResults
};
}
}
}

View File

@ -48,12 +48,12 @@ namespace SCHALE.GameServer
builder.Services.AddMongoDBProvider(config.GetConnectionString("MongoDB") ?? throw new ArgumentNullException("ConnectionStrings/MongoDB in appsettings is missing")); builder.Services.AddMongoDBProvider(config.GetConnectionString("MongoDB") ?? throw new ArgumentNullException("ConnectionStrings/MongoDB in appsettings is missing"));
builder.Services.AddProtocolHandlerFactory(); builder.Services.AddProtocolHandlerFactory();
builder.Services.AddMemorySessionKeyService(); builder.Services.AddMemorySessionKeyService();
builder.Services.AddProtocolHandlerGroup<Account>();
builder.Services.AddProtocolHandlerGroup<Queuing>(); // Add all Handler Groups
builder.Services.AddProtocolHandlerGroup<Academy>(); var handlerGroups = Assembly.GetExecutingAssembly().GetTypes().Where(t => t.IsSubclassOf(typeof(ProtocolHandlerBase)));
builder.Services.AddProtocolHandlerGroup<Mission>();
builder.Services.AddProtocolHandlerGroup<ProofToken>(); foreach (var handlerGroup in handlerGroups)
builder.Services.AddProtocolHandlerGroup<Scenario>(); builder.Services.AddProtocolHandlerGroupByType(handlerGroup);
var app = builder.Build(); var app = builder.Build();