Exemple #1
0
        public static void AddEntry(TownCryerGuildEntry entry)
        {
            GuildEntries.Add(entry);
            CheckTimer();

            entry.GetExpiration();
        }
Exemple #2
0
        public static void Load(GenericReader reader)
        {
            int version = reader.ReadInt();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                var entry = new TownCryerModeratorEntry(reader);

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

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

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

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                var 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;
                }
            }

            CheckTimer();
        }
        public CreateGuildEntryGump(PlayerMobile pm, TownCrier cryer, TownCryerGuildEntry entry = null)
            : base(pm, cryer)
        {
            Entry = entry;

            if (Entry != null)
            {
                Edit = true;
            }
        }
Exemple #4
0
        private void BuildGuildPage()
        {
            List <TownCryerGuildEntry> list = TownCryerSystem.GuildEntries.OrderBy(e => e.EventTime).ToList();

            int perPage = 20;
            int y       = 170;

            int   start = Page * perPage;
            Guild guild = User.Guild as Guild;

            Pages = (int)Math.Ceiling(list.Count / (double)perPage);

            for (int i = start; i < list.Count && i < perPage; i++)
            {
                TownCryerGuildEntry entry = TownCryerSystem.GuildEntries[i];

                AddButton(50, y, 0x5FB, 0x5FC, 400 + TownCryerSystem.GuildEntries.IndexOf(entry), GumpButtonType.Reply, 0);

                AddLabelCropped(87, y, 700, 20, 0, entry.FullTitle);

                if ((guild == entry.Guild && User.GuildRank != null && User.GuildRank.Rank >= 3) || User.AccessLevel >= AccessLevel.GameMaster) // Only warlords+
                {
                    int index = TownCryerSystem.GuildEntries.IndexOf(entry);
                    AddButton(735, y, 0x5FD, 0x5FE, 4000 + index, GumpButtonType.Reply, 0);
                    AddButton(760, y, 0x5FF, 0x600, 4500 + index, GumpButtonType.Reply, 0);
                }

                y += 23;
            }

            AddButton(350, 570, 0x605, 0x606, 5, GumpButtonType.Reply, 0);
            AddButton(380, 570, 0x609, 0x60A, 6, GumpButtonType.Reply, 0);
            AddButton(430, 570, 0x607, 0x608, 7, GumpButtonType.Reply, 0);
            AddButton(455, 570, 0x603, 0x604, 8, GumpButtonType.Reply, 0);

            AddHtml(395, 570, 35, 20, Center(String.Format("{0}/{1}", (Page + 1).ToString(), (Pages + 1).ToString())), false, false);
        }
Exemple #5
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();
        }
Exemple #6
0
 public TownCryerGuildGump(PlayerMobile pm, TownCrier cryer, TownCryerGuildEntry entry)
     : base(pm, cryer)
 {
     Entry = entry;
 }
        public override void OnResponse(RelayInfo info)
        {
            if (info.ButtonID == 1)
            {
                string headline = info.GetTextEntry(1).Text;
                string m        = info.GetTextEntry(2).Text;
                string d        = info.GetTextEntry(3).Text;
                string t        = info.GetTextEntry(4).Text;
                string desc     = info.GetTextEntry(5).Text;
                string meet     = info.GetTextEntry(6).Text;

                DateTime dt          = DateTime.Now;
                bool     illegalDate = false;

                int year = dt.Year;

                if (Utility.ToInt32(m) < DateTime.Now.Month)
                {
                    year++;
                }

                if (Entry == null)
                {
                    if (!DateTime.TryParse(string.Format("{0}/{1}/{2} {3}:00:00", m, d, year.ToString(), t), out dt)) // bad format
                    {
                        illegalDate = true;
                        dt          = DateTime.MinValue;
                    }

                    Entry = new TownCryerGuildEntry(User, dt, meet, headline, desc);
                }
                else
                {
                    Entry.Title         = headline;
                    Entry.Body          = desc;
                    Entry.EventLocation = meet;

                    if (DateTime.TryParse(string.Format("{0}/{1}/{2} {3}:00:00", m, d, year.ToString(), t), out dt))
                    {
                        Entry.EventTime = dt;
                    }
                }

                if (string.IsNullOrEmpty(headline) || string.IsNullOrEmpty(desc) || string.IsNullOrEmpty(meet))
                {
                    User.SendLocalizedMessage(1158062); // All fields must be populated.  Please check your entries and try again.
                }
                else if (illegalDate)
                {
                    User.SendLocalizedMessage(1158032); // You have made an illegal entry.  Check your entries and try again.
                }
                else
                {
                    if (!Edit)
                    {
                        TownCryerSystem.AddEntry(Entry);
                    }

                    User.SendLocalizedMessage(1158039); // Your entry has been submitted.

                    BaseGump.SendGump(new TownCryerGump(User, Cryer, 0, TownCryerGump.GumpCategory.Guild));
                    return;
                }

                Refresh();
            }
        }
Exemple #8
0
        public static void Save(GenericWriter writer)
        {
            writer.Write(1);

            writer.Write(GreetingsEntries.Count);

            writer.Write(TownCryerExempt.Count);

            for (var index = 0; index < TownCryerExempt.Count; index++)
            {
                PlayerMobile pm = TownCryerExempt[index];

                writer.Write(pm);
            }

            int count = 0;

            for (var index = 0; index < GreetingsEntries.Count; index++)
            {
                var x = GreetingsEntries[index];

                if (x.Saves)
                {
                    count++;
                }
            }

            writer.Write(count);

            for (var index = 0; index < GreetingsEntries.Count; index++)
            {
                TownCryerGreetingEntry e = GreetingsEntries[index];

                if (e.Saves)
                {
                    e.Serialize(writer);
                }
            }

            writer.Write(ModeratorEntries.Count);

            for (var index = 0; index < ModeratorEntries.Count; index++)
            {
                TownCryerModeratorEntry e = ModeratorEntries[index];

                e.Serialize(writer);
            }

            writer.Write(CityEntries.Count);

            for (var index = 0; index < CityEntries.Count; index++)
            {
                TownCryerCityEntry e = CityEntries[index];

                e.Serialize(writer);
            }

            writer.Write(GuildEntries.Count);

            for (var index = 0; index < GuildEntries.Count; index++)
            {
                TownCryerGuildEntry e = GuildEntries[index];

                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);
                }
            }
        }