Beispiel #1
0
        public static void Reload_OnCommand(CommandEventArgs e)
        {
            bool clear = false;

            GreetingsEntries.IterateReverse(entry =>
            {
                if (entry.PreLoaded)
                {
                    GreetingsEntries.Remove(entry);

                    if (!clear)
                    {
                        clear = true;
                    }
                }
            });

            LoadPreloadedMessages();

            if (clear)
            {
                TownCryerExempt.Clear();
            }

            e.Mobile.SendMessage("Pre-Loaded TC messages re-loaded from {0}!", PreLoadedPath);
        }
Beispiel #2
0
        public static void Initialize()
        {
            if (Enabled)
            {
                EventSink.Login += OnLogin;

                GreetingsEntries.Add(1158388);

                /*Greetings, Avatar!<br><br>Welcome to Britannia! Whether these are your first steps or you are a
                 * seasoned veteran King Blackthorn welcomes you! The realm is bustling with opportunities for adventure!
                 * TownCryers can be visited at all banks and points of interest to learn about the latest goings on in
                 * the realm. Many guilds are actively recruiting members, so be sure to check the Town Cryer guild
                 * section for the latest recruitment events. <br><br>We wish you the best of luck in your
                 * <A HREF="https://uo.com/endless-journey/">Endless Journey</A>*/

                NewsEntries.Add(new TownCryerNewsEntry(1158083, 1158085, 0x617, typeof(TamingPetQuest), "https://uo.com/wiki/ultima-online-wiki/skills/animal-taming/animal-training/"));              // Animal Training
                NewsEntries.Add(new TownCryerNewsEntry(1158086, 1158088, 0x61D, typeof(ExploringTheDeepQuest), null));
                NewsEntries.Add(new TownCryerNewsEntry(1158089, 1158091, 0x60F, null, "https://uo.com/wiki/ultima-online-wiki/gameplay/npc-commercial-transactions/clean-up-britannia/"));             // Cleanup Britannia
                NewsEntries.Add(new TownCryerNewsEntry(1158092, 1158094, 0x651, typeof(HuntmastersChallengeQuest), "https://uo.com/wiki/ultima-online-wiki/gameplay/huntmasters-challenge/"));         // Huntsmaster Challenge TODO: Quest
                NewsEntries.Add(new TownCryerNewsEntry(1158098, 1158100, 0x615, null, "https://uo.com/wiki/ultima-online-wiki/gameplay/crafting/bulk-orders/"));                                       // New Bulk Orders
                NewsEntries.Add(new TownCryerNewsEntry(1158101, 1158103, 0x616, null, "https://uo.com/wiki/ultima-online-wiki/a-summary-for-returning-players/weapons-armor-and-loot-revamps-2016/")); // 2016 Loot Revamps
                NewsEntries.Add(new TownCryerNewsEntry(1158104, 1158106, 0x61C, typeof(PaladinsOfTrinsic), "https://uo.com/wiki/ultima-online-wiki/world/dungeons/dungeon-shame/"));                   //  New Shame TODO:Paladins of Trinsics QUEST?
                NewsEntries.Add(new TownCryerNewsEntry(1158107, 1158109, 0x61A, typeof(RightingWrongQuest), "https://uo.com/wiki/ultima-online-wiki/world/dungeons/dungeon-wrong/"));                  // New Wrong  TODO: Righting Wrong Quest
                NewsEntries.Add(new TownCryerNewsEntry(1158110, 1158112, 0x64E, typeof(AVisitToCastleBlackthornQuest), "https://uo.com/wiki/ultima-online-wiki/items/artifacts-castle-blackthorn/"));  // Castle Blackthorn TODO: A Visit to Castle Blackthorn Quest
                NewsEntries.Add(new TownCryerNewsEntry(1158113, 1158115, 0x64C, typeof(BuriedRichesQuest), "https://uo.com/wiki/ultima-online-wiki/gameplay/treasure-maps/"));                         // New TMaps TODO: Buried Riches Quest
                NewsEntries.Add(new TownCryerNewsEntry(1158116, 1158118, 0x64F, null, "https://uo.com/wiki/ultima-online-wiki/gameplay/the-virtues/"));                                                // Virues
                NewsEntries.Add(new TownCryerNewsEntry(1158119, 1158121, 0x64D, typeof(APleaFromMinocQuest), "https://uo.com/wiki/ultima-online-wiki/world/dungeons/dungeon-covetous/"));              // New Covetous TODO: A Plea From Minoc Quest
                NewsEntries.Add(new TownCryerNewsEntry(1158122, 1158124, 0x650, typeof(WishesOfTheWispQuest), "https://uo.com/wiki/ultima-online-wiki/world/dungeons/dungeon-despise-trammel/"));      // New Despise TODO: Wishes of the Wisp Quest
            }
        }
Beispiel #3
0
        public static void CheckExpiredEntries()
        {
            for (int i = GreetingsEntries.Count - 1; i >= 0; i--)
            {
                if (GreetingsEntries[i].Expires != DateTime.MinValue && GreetingsEntries[i].Expired)
                {
                    GreetingsEntries.RemoveAt(i);
                }
            }

            for (int i = ModeratorEntries.Count - 1; i >= 0; i--)
            {
                if (ModeratorEntries[i].Expired)
                {
                    ModeratorEntries.RemoveAt(i);
                }
            }

            for (int i = CityEntries.Count - 1; i >= 0; i--)
            {
                if (CityEntries[i].Expired)
                {
                    CityEntries.RemoveAt(i);
                }
            }

            for (int i = GuildEntries.Count - 1; i >= 0; i--)
            {
                if (GuildEntries[i].Expired)
                {
                    GuildEntries.RemoveAt(i);
                }
            }

            if (MysteriousPotionEffects != null)
            {
                List <Mobile> list = new List <Mobile>(MysteriousPotionEffects.Keys);

                for (var index = 0; index < list.Count; index++)
                {
                    Mobile m = list[index];

                    if (MysteriousPotionEffects != null && MysteriousPotionEffects.ContainsKey(m) && MysteriousPotionEffects[m] < DateTime.UtcNow)
                    {
                        MysteriousPotionEffects.Remove(m);

                        if (MysteriousPotionEffects.Count == 0)
                        {
                            MysteriousPotionEffects = null;
                        }
                    }
                }

                ColUtility.Free(list);
            }

            CheckTimer();
        }
Beispiel #4
0
        public static void Save(GenericWriter writer)
        {
            writer.Write(1);

            writer.Write(GreetingsEntries.Count);

            writer.Write(TownCryerExempt.Count);
            foreach (PlayerMobile pm in TownCryerExempt)
            {
                writer.Write(pm);
            }

            writer.Write(GreetingsEntries.Where(x => x.Saves).Count());
            foreach (TownCryerGreetingEntry e in GreetingsEntries.Where(x => x.Saves))
            {
                e.Serialize(writer);
            }

            writer.Write(ModeratorEntries.Count);
            foreach (TownCryerModeratorEntry e in ModeratorEntries)
            {
                e.Serialize(writer);
            }

            writer.Write(CityEntries.Count);
            foreach (TownCryerCityEntry e in CityEntries)
            {
                e.Serialize(writer);
            }

            writer.Write(GuildEntries.Count);
            foreach (TownCryerGuildEntry e in GuildEntries)
            {
                e.Serialize(writer);
            }

            writer.Write(MysteriousPotionEffects != null ? MysteriousPotionEffects.Count : 0);

            if (MysteriousPotionEffects != null)
            {
                foreach (KeyValuePair <Mobile, DateTime> kvp in MysteriousPotionEffects)
                {
                    writer.Write(kvp.Key);
                    writer.Write(kvp.Value);
                }
            }
        }
Beispiel #5
0
 public static void CheckTimer()
 {
     if (ModeratorEntries.Count > 0 ||
         CityEntries.Count > 0 ||
         GuildEntries.Count > 0 ||
         GreetingsEntries.Any(e => e.Expires != DateTime.MinValue) ||
         MysteriousPotionEffects != null)
     {
         if (Timer == null || !Timer.Running)
         {
             Timer          = Timer.DelayCall(TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5), CheckExpiredEntries);
             Timer.Priority = TimerPriority.OneMinute;
         }
     }
     else if (Timer != null)
     {
         Timer.Stop();
         Timer = null;
     }
 }
Beispiel #6
0
        public static void Load(GenericReader reader)
        {
            int version = reader.ReadInt();

            int greetingsCount = 0;

            switch (version)
            {
            case 1:
                greetingsCount = reader.ReadInt();

                int count = reader.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    PlayerMobile pm = reader.ReadMobile() as PlayerMobile;

                    if (pm != null)
                    {
                        AddExempt(pm);
                    }
                }

                count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    TownCryerGreetingEntry entry = new TownCryerGreetingEntry(reader);

                    if (!entry.Expired)
                    {
                        GreetingsEntries.Add(entry);
                    }
                }
                goto case 0;

            case 0:
                count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    TownCryerModeratorEntry entry = new TownCryerModeratorEntry(reader);

                    if (!entry.Expired)
                    {
                        ModeratorEntries.Add(entry);
                    }
                }

                count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    TownCryerCityEntry entry = new TownCryerCityEntry(reader);

                    if (!entry.Expired)
                    {
                        CityEntries.Add(entry);
                    }
                }

                count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    TownCryerGuildEntry entry = new TownCryerGuildEntry(reader);

                    if (!entry.Expired)
                    {
                        GuildEntries.Add(entry);
                    }
                }

                count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Mobile   m  = reader.ReadMobile();
                    DateTime dt = reader.ReadDateTime();

                    if (m != null)
                    {
                        if (MysteriousPotionEffects == null)
                        {
                            MysteriousPotionEffects = new Dictionary <Mobile, DateTime>();
                        }

                        MysteriousPotionEffects[m] = dt;
                    }
                }
                break;
            }

            if (greetingsCount < GreetingsEntries.Count)
            {
                NewGreeting = true;
            }

            CheckTimer();
        }
Beispiel #7
0
 public static bool HasCustomEntries()
 {
     return(GreetingsEntries.Any(x => x.Saves || x.Expires != DateTime.MinValue));
 }
Beispiel #8
0
 public static void AddEntry(TownCryerGreetingEntry entry)
 {
     GreetingsEntries.Add(entry);
     CheckTimer();
 }