Example #1
0
        private void BuildCityPage()
        {
            AddButton(233, 150, City == City.Britain ? 0x5E5 : 0x5E4, City == City.Britain ? 0x5E5 : 0x5E4, 10, GumpButtonType.Reply, 0);
            AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Britain));

            AddButton(280, 150, City == City.Jhelom ? 0x5E7 : 0x5E6, City == City.Jhelom ? 0x5E7 : 0x5E6, 11, GumpButtonType.Reply, 0);
            AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Jhelom));

            AddButton(327, 150, City == City.Minoc ? 0x5E5 : 0x5E4, City == City.Minoc ? 0x5E5 : 0x5E4, 12, GumpButtonType.Reply, 0);
            AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Minoc));

            AddButton(374, 150, City == City.Moonglow ? 0x5E3 : 0x5E2, City == City.Moonglow ? 0x5E3 : 0x5E2, 13, GumpButtonType.Reply, 0);
            AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Moonglow));

            AddButton(418, 150, City == City.NewMagincia ? 0x5DD : 0x5DC, City == City.NewMagincia ? 0x5DD : 0x5DC, 14, GumpButtonType.Reply, 0);
            AddTooltip(CityLoyaltySystem.GetCityLocalization(City.NewMagincia));

            AddButton(463, 150, City == City.SkaraBrae ? 0x5DF : 0x5DE, City == City.SkaraBrae ? 0x5DF : 0x5DE, 15, GumpButtonType.Reply, 0);
            AddTooltip(CityLoyaltySystem.GetCityLocalization(City.SkaraBrae));

            AddButton(509, 150, City == City.Trinsic ? 0x5E1 : 0x5E0, City == City.Trinsic ? 0x5E1 : 0x5E0, 16, GumpButtonType.Reply, 0);
            AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Trinsic));

            AddButton(555, 150, City == City.Vesper ? 0x5ED : 0x5ED, City == City.Vesper ? 0x5ED : 0x5EC, 17, GumpButtonType.Reply, 0);
            AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Vesper));

            AddButton(601, 150, City == City.Yew ? 0x5E9 : 0x5E8, City == City.Yew ? 0x5E9 : 0x5E8, 18, GumpButtonType.Reply, 0);
            AddTooltip(CityLoyaltySystem.GetCityLocalization(City.Yew));

            AddHtmlLocalized(0, 260, 854, 20, CenterLoc, String.Format("#{0}", TownCryerSystem.GetCityLoc(City)), 0, false, false); // The Latest News from the City of ~1_CITY~

            int y = 300;

            for (int i = 0; i < TownCryerSystem.CityEntries.Count && i < TownCryerSystem.MaxPerCityGoverrnorEntries; i++)
            {
                TownCryerCityEntry entry = TownCryerSystem.CityEntries[i];

                if (entry.City != City)
                {
                    continue;
                }

                AddButton(50, y, 0x5FB, 0x5FC, 300 + i, GumpButtonType.Reply, 0);
                AddLabelCropped(87, y, 700, 20, 0, entry.Title);

                CityLoyaltySystem city = CityLoyaltySystem.GetCitizenship(User, false);

                if ((city != null && city.Governor == User) || User.AccessLevel >= AccessLevel.GameMaster) // Only Governors
                {
                    AddButton(735, y, 0x5FD, 0x5FE, 3000 + i, GumpButtonType.Reply, 0);
                    AddButton(760, y, 0x5FF, 0x600, 3500 + i, GumpButtonType.Reply, 0);
                }

                y += 23;
            }

            AddImage(230, 460, 0x5F0);
        }
Example #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();
        }
Example #3
0
        public CreateCityEntryGump(PlayerMobile pm, TownCrier cryer, City city, TownCryerCityEntry entry = null)
            : base(pm, cryer)
        {
            Entry = entry;
            City  = city;

            if (Entry != null)
            {
                Edit = true;
            }
        }
Example #4
0
        public override void OnResponse(RelayInfo info)
        {
            if (info.ButtonID == 1)
            {
                string headline = info.GetTextEntry(1).Text;
                string body     = info.GetTextEntry(2).Text;
                string exp      = info.GetTextEntry(3).Text;

                int expires = Utility.ToInt32(exp);

                if (Entry == null)
                {
                    Entry = new TownCryerCityEntry(User, City, expires, headline, body);
                }
                else
                {
                    Entry.Title = headline;
                    Entry.Body  = body;

                    if (expires >= 1 && expires <= 14)
                    {
                        Entry.Expires = DateTime.Now + TimeSpan.FromDays(expires);
                    }
                }

                if (expires < 1 || expires > 14)
                {
                    User.SendLocalizedMessage(1158042); // The expiry can be between 1 and 14 days. Please check your entry and try again.
                }
                else if (string.IsNullOrEmpty(headline) || string.IsNullOrEmpty(body) || headline.Length < 3 || body.Length < 5)
                {
                    User.SendLocalizedMessage(1158032); // The expiry can be between 1 and 30 days. Please check your entry 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.City));
                    return;
                }

                Refresh();
            }
        }
Example #5
0
 public TownCryerCityGump(PlayerMobile pm, TownCrier cryer, TownCryerCityEntry entry)
     : base(pm, cryer)
 {
     Entry = entry;
 }
Example #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();
        }
Example #7
0
 public static void AddEntry(TownCryerCityEntry entry)
 {
     CityEntries.Add(entry);
     CheckTimer();
 }
Example #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);
                }
            }
        }