Ejemplo n.º 1
0
 public void HandleEnterWorld()
 {
     this.GarrisonDataResetFinishedAction -= this.HandleEnterWorld;
     this.PrecacheMissionChances();
     LocalNotifications.RegisterForNotifications();
     SceneManager.LoadSceneAsync(Scenes.MainSceneName);
 }
Ejemplo n.º 2
0
        public void ScheduleNotifications()
        {
            this.ClearPendingNotifications();
            if (!Main.instance.m_enableNotifications)
            {
                return;
            }
            List <NotificationData> list = new List <NotificationData>();
            ICollection <WrapperGarrisonMission> values = PersistentMissionData.missionDictionary.Values;

            foreach (WrapperGarrisonMission wrapperGarrisonMission in values)
            {
                GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(wrapperGarrisonMission.MissionRecID);
                if (record != null && (GARR_FOLLOWER_TYPE)record.GarrFollowerTypeID == GarrisonStatus.GarrisonFollowerType)
                {
                    if (wrapperGarrisonMission.MissionState == 1)
                    {
                        if ((record.Flags & 16u) == 0u)
                        {
                            TimeSpan t             = GarrisonStatus.CurrentTime() - wrapperGarrisonMission.StartTime;
                            TimeSpan timeRemaining = wrapperGarrisonMission.MissionDuration - t;
                            list.Add(new NotificationData
                            {
                                notificationText = record.Name,
                                timeRemaining    = timeRemaining,
                                notificationType = NotificationType.missionCompete
                            });
                        }
                    }
                }
            }
            foreach (WrapperCharacterShipment wrapperCharacterShipment in PersistentShipmentData.shipmentDictionary.Values)
            {
                CharShipmentRec record2 = StaticDB.charShipmentDB.GetRecord(wrapperCharacterShipment.ShipmentRecID);
                if (record2 == null)
                {
                    Debug.LogError("Invalid Shipment ID: " + wrapperCharacterShipment.ShipmentRecID);
                }
                else
                {
                    string notificationText = "Invalid";
                    if (record2.GarrFollowerID > 0)
                    {
                        GarrFollowerRec record3 = StaticDB.garrFollowerDB.GetRecord((int)record2.GarrFollowerID);
                        if (record3 == null)
                        {
                            Debug.LogError("Invalid Follower ID: " + record2.GarrFollowerID);
                            continue;
                        }
                        int         num     = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record3.AllianceCreatureID : record3.HordeCreatureID;
                        CreatureRec record4 = StaticDB.creatureDB.GetRecord(num);
                        if (record4 == null)
                        {
                            Debug.LogError("Invalid Creature ID: " + num);
                            continue;
                        }
                        notificationText = record4.Name;
                    }
                    if (record2.DummyItemID > 0)
                    {
                        ItemRec record5 = StaticDB.itemDB.GetRecord(record2.DummyItemID);
                        if (record5 == null)
                        {
                            Debug.LogError("Invalid Item ID: " + record2.DummyItemID);
                            continue;
                        }
                        notificationText = record5.Display;
                    }
                    TimeSpan t2             = GarrisonStatus.CurrentTime() - wrapperCharacterShipment.CreationTime;
                    TimeSpan timeRemaining2 = wrapperCharacterShipment.ShipmentDuration - t2;
                    list.Add(new NotificationData
                    {
                        notificationText = notificationText,
                        timeRemaining    = timeRemaining2,
                        notificationType = NotificationType.workOrderReady
                    });
                }
            }
            foreach (WrapperGarrisonTalent wrapperGarrisonTalent in PersistentTalentData.talentDictionary.Values)
            {
                if ((wrapperGarrisonTalent.Flags & 1) == 0)
                {
                    if (!(wrapperGarrisonTalent.StartTime <= DateTime.UtcNow))
                    {
                        GarrTalentRec record6 = StaticDB.garrTalentDB.GetRecord(wrapperGarrisonTalent.GarrTalentID);
                        if (record6 != null)
                        {
                            TimeSpan timeRemaining3 = TimeSpan.Zero;
                            if ((wrapperGarrisonTalent.Flags & 2) == 0)
                            {
                                timeRemaining3 = TimeSpan.FromSeconds((double)record6.ResearchDurationSecs) - (GarrisonStatus.CurrentTime() - wrapperGarrisonTalent.StartTime);
                            }
                            else
                            {
                                timeRemaining3 = TimeSpan.FromSeconds((double)record6.RespecDurationSecs) - (GarrisonStatus.CurrentTime() - wrapperGarrisonTalent.StartTime);
                            }
                            list.Add(new NotificationData
                            {
                                notificationText = record6.Name,
                                timeRemaining    = timeRemaining3,
                                notificationType = NotificationType.talentReady
                            });
                        }
                    }
                }
            }
            int num2 = 0;

            foreach (NotificationData notificationData in from n in list
                     orderby n.timeRemaining
                     select n)
            {
                if (notificationData.notificationType == NotificationType.missionCompete)
                {
                    LocalNotifications.ScheduleMissionCompleteNotification(notificationData.notificationText, ++num2, Convert.ToInt64(notificationData.timeRemaining.TotalSeconds));
                }
                if (notificationData.notificationType == NotificationType.workOrderReady)
                {
                    LocalNotifications.ScheduleWorkOrderReadyNotification(notificationData.notificationText, ++num2, Convert.ToInt64(notificationData.timeRemaining.TotalSeconds));
                }
                if (notificationData.notificationType == NotificationType.talentReady)
                {
                    LocalNotifications.ScheduleTalentResearchCompleteNotification(notificationData.notificationText, ++num2, Convert.ToInt64(notificationData.timeRemaining.TotalSeconds));
                }
                Debug.Log(string.Concat(new object[]
                {
                    "Scheduling Notification for [",
                    notificationData.notificationType,
                    "] ",
                    notificationData.notificationText,
                    " (",
                    num2,
                    ") in ",
                    notificationData.timeRemaining.TotalSeconds,
                    " seconds"
                }));
            }
        }
Ejemplo n.º 3
0
 public void ClearPendingNotifications()
 {
     LocalNotifications.ClearPending();
 }