Beispiel #1
0
        public static bool SyncServerData(RTNoteData data)
        {
            try
            {
                if (data is not null)
                {
                    ExpeditionNotiManager manager = new();

                    manager.Notis.Clear();

                    foreach (var expedition in data.Expeditions)
                    {
                        ExpeditionNoti noti = new(expedition.RemainedTime, ExpeditionType.Sync)
                        {
                            SyncModeCharacter = expedition.AvatarName
                        };

                        manager.Notis.Add(noti);
                    }

                    manager.SaveNotis();
                    manager.UpdateScheduledNoti <ExpeditionNoti>();
                }
            }
            catch
            {
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        public static async Task <RTNoteData> GetRTNoteData()
        {
            GenshinInfoManager manager = new(Utils.UID, Utils.Ltuid, Utils.Ltoken);
            RTNoteData         data    = await manager.GetRealTimeNotes();

            return(data);
        }
Beispiel #3
0
        public static async Task <bool> Update(SyncTarget target)
        {
            RTNoteData data = await GetRTNoteData();

            return(target switch
            {
                SyncTarget.Resin => REnv.SyncServerData(data),
                SyncTarget.RealmCurrency => RCEnv.SyncServerData(data),
                SyncTarget.Expedition => ExpEnv.SyncServerData(data),
                _ => false
            });
Beispiel #4
0
        public static void SyncServerData(RTNoteData data)
        {
            try
            {
                if (data is not null)
                {
                    RemainCount = data.RemainResinDiscountNum;
                    TotalCount  = data.ResinDiscountNumLimit;
                }
                else
                {
                    IsSyncSuccess = false;
                }
            }
            catch
            {
                IsSyncSuccess = false;
            }

            IsSyncSuccess = true;
        }
Beispiel #5
0
        public static void SyncServerData(RTNoteData data)
        {
            try
            {
                if (data is not null)
                {
                    FinishedCount            = data.FinishedTaskNum;
                    TotalCount               = data.TotalTaskNum;
                    IsReceiveExtraTaskReward = data.IsExtraTaskRewardReceived;
                }
                else
                {
                    IsSyncSuccess = false;
                }
            }
            catch
            {
                IsSyncSuccess = false;
            }

            IsSyncSuccess = true;
        }
Beispiel #6
0
        public static bool SyncServerData(RTNoteData data)
        {
            try
            {
                if (data is not null)
                {
                    TimeSpan addInterval = data.HomeCoinRecoveryTime;

                    if (data.MaxHomeCoin > 0)
                    {
                        s_serverMaxRC = data.MaxHomeCoin;
                    }

                    if (data.CurrentHomeCoin >= s_serverMaxRC)
                    {
                        addInterval = TimeSpan.FromSeconds(0);
                    }

                    DateTime now = DateTime.Now;

                    Currency      = data.CurrentHomeCoin;
                    EndTime       = now.Add(addInterval);
                    LastInputTime = now.ToString(DTCulture);

                    CalcReaminTime();
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                return(false);
            }

            return(true);
        }