using Activity; using cfg; using Newtonsoft.Json; using asap.core; using GameCore; using System; namespace EventBoostPack.Data { public class EventBoostPackData : AEventData { [JsonIgnore] public EventPackManager PackConfig => Tables.TbEventPackManager.GetOrDefault(FishingEvent?.RedirectID ?? 0); [JsonIgnore] public override bool IsActive => EventID > 0 && RemainingTime.TotalSeconds > 0 && GetRemainingBuyCount() > 0; public string GetDailyBuyCountKey() { return $"EventBoostPack_{EventID}"; } public int GetRemainingBuyCount() { var maxCount = PackConfig?.MaxCount ?? 0; return Math.Max(0, maxCount - GContext.container.Resolve() .GetShopPackBuyCount(GetDailyBuyCountKey())); } } }