Example #1
0
        public static void GetContextMenus(TownCrier tc, Mobile from, List <ContextMenuEntry> list)
        {
            if (from is PlayerMobile)
            {
                PlayerMobile pm = from as PlayerMobile;

                if (pm.AccessLevel >= EMAccess)
                {
                    list.Add(new AddGreetingEntry(tc));
                    list.Add(new UpdateEMEntry(tc));
                }

                CityLoyaltySystem system = CityLoyaltySystem.GetCitizenship(pm, false);

                if (IsGovernor(pm, system))
                {
                    list.Add(new UpdateCityEntry(tc, system.City));
                }

                Guild g = pm.Guild as Guild;

                if (g != null && pm.GuildRank != null && pm.GuildRank.Rank >= 3 && g.Leader == pm && (pm.AccessLevel > AccessLevel.Player || g.Members.Count >= MinGuildMemberCount))
                {
                    list.Add(new UpdateGuildEntry(from, tc));
                }
            }
        }
Example #2
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++)
            {
                var 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);

                var 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 #3
0
        public override string ToString()
        {
            var sys = CityLoyaltySystem.GetCitizenship(Player, false);

            if (sys != null)
            {
                return(String.Format("Citizenship: {0}", sys.City.ToString()));
            }

            return(base.ToString());
        }
Example #4
0
        private void SetDefaultCity()
        {
            if (LastCity == null || !LastCity.ContainsKey(User))
            {
                LastCity = new Dictionary <PlayerMobile, City>();

                var system = CityLoyaltySystem.GetCitizenship(User, false);

                if (system != null)
                {
                    LastCity[User] = system.City;
                }
            }
            else
            {
                LastCity[User] = _City;
            }
        }
Example #5
0
        public override void OnClick()
        {
            if (Owner.From is PlayerMobile pm)
            {
                CityLoyaltySystem system = CityLoyaltySystem.GetCitizenship(pm, false);

                if (TownCryerSystem.IsGovernor(pm, system))
                {
                    if (TownCryerSystem.CityEntryCount(system.City) < TownCryerSystem.MaxPerCityGoverrnorEntries)
                    {
                        BaseGump.SendGump(new CreateCityEntryGump(pm, Cryer, system.City));
                    }
                    else
                    {
                        pm.SendLocalizedMessage(1158038); // You have reached the maximum entry count.  Please remove some and try again.
                    }
                }
            }
        }
Example #6
0
            public override void OnClick()
            {
                CityLoyaltySystem thisSystem  = CityLoyaltySystem.GetCityInstance(Guard.City);
                CityLoyaltySystem theirSystem = CityLoyaltySystem.GetCitizenship(Player);

                Guard.CheckBannerCooldown();

                if (theirSystem != null && thisSystem != null && CityLoyaltySystem.HasCitizenship(Player, Guard.City))
                {
                    if (Guard.IsInBannerCooldown(Player))
                    {
                        Guard.SayTo(Player, 1152364, string.Format("#{0}", CityLoyaltySystem.BannerLocalization(thisSystem.City))); // I have quite a backlog of orders and I cannot satisfy your request for a ~1_ITEM~ right now.
                    }
                    if (theirSystem.GetLoyaltyRating(Player) < LoyaltyRating.Adored)
                    {
                        Guard.SayTo(Player, 1152363, string.Format("#{0}", CityLoyaltySystem.GetCityLocalization(thisSystem.City))); // I apologize, but you are not well-enough renowned in the city of ~1_CITY~ to make this purchase.
                    }
                    else
                    {
                        string args = string.Format("#{0}\t{1}", CityLoyaltySystem.BannerLocalization(thisSystem.City), CityLoyaltySystem.BannerCost.ToString("N0", CultureInfo.GetCultureInfo("en-US")));
                        Player.SendGump(new ConfirmCallbackGump(Player, 1049004, 1152365, Player, args, Guard.OnConfirm));
                    }
                }
            }
Example #7
0
        public override void OnResponse(RelayInfo info)
        {
            int id = info.ButtonID;

            switch (id)
            {
            case 0: break;

            case 1:
            case 2:
            case 3:
            case 4:
            {
                Category = (GumpCategory)id;
                Refresh();
                break;
            }

            case 5:     // <<
            {
                Page = 0;
                Refresh();
                break;
            }

            case 6:     // <
            {
                Page = Math.Max(0, Page - 1);
                Refresh();
                break;
            }

            case 7:     // >
            {
                Page = Math.Min(Pages, Page + 1);
                Refresh();
                break;
            }

            case 8:     // >>
            {
                Page = Pages;
                Refresh();
                break;
            }

            case 9:     // Learn More - EM Page
            {
                User.LaunchBrowser(TownCryerSystem.EMEventsPage);
                Refresh();
                break;
            }

            case 10:
            {
                City = City.Britain;
                Refresh();
                break;
            }

            case 11:
            {
                City = City.Jhelom;
                Refresh();
                break;
            }

            case 12:
            {
                City = City.Minoc;
                Refresh();
                break;
            }

            case 13:
            {
                City = City.Moonglow;
                Refresh();
                break;
            }

            case 14:
            {
                City = City.NewMagincia;
                Refresh();
                break;
            }

            case 15:
            {
                City = City.SkaraBrae;
                Refresh();
                break;
            }

            case 16:
            {
                City = City.Trinsic;
                Refresh();
                break;
            }

            case 17:
            {
                City = City.Vesper;
                Refresh();
                break;
            }

            case 18:
            {
                City = City.Yew;
                Refresh();
                break;
            }

            default:
            {
                if (id < 200)
                {
                    id -= 100;

                    if (id >= 0 && id < TownCryerSystem.NewsEntries.Count)
                    {
                        BaseGump.SendGump(new TownCryerNewsGump(User, Cryer, TownCryerSystem.NewsEntries[id]));
                    }
                }
                else if (id < 300)
                {
                    id -= 200;

                    if (id >= 0 && id < TownCryerSystem.ModeratorEntries.Count)
                    {
                        BaseGump.SendGump(new TownCryerEventModeratorGump(User, Cryer, TownCryerSystem.ModeratorEntries[id]));
                    }
                }
                else if (id < 400)
                {
                    id -= 300;

                    if (id >= 0 && id < TownCryerSystem.CityEntries.Count)
                    {
                        BaseGump.SendGump(new TownCryerCityGump(User, Cryer, TownCryerSystem.CityEntries[id]));
                    }
                }
                else if (id < 600)
                {
                    id -= 400;

                    if (id >= 0 && id < TownCryerSystem.GuildEntries.Count)
                    {
                        BaseGump.SendGump(new TownCryerGuildGump(User, Cryer, TownCryerSystem.GuildEntries[id]));
                    }
                }
                else if (id < 3000)
                {
                    if (id < 2500)
                    {
                        id -= 2000;

                        if (id >= 0 && id < TownCryerSystem.ModeratorEntries.Count)
                        {
                            BaseGump.SendGump(new CreateEMEntryGump(User, Cryer, TownCryerSystem.ModeratorEntries[id]));
                        }
                    }
                    else
                    {
                        id -= 2500;

                        if (id >= 0 && id < TownCryerSystem.ModeratorEntries.Count)
                        {
                            TownCryerSystem.ModeratorEntries.RemoveAt(id);
                        }

                        Refresh();
                    }
                }
                else if (id < 4000)
                {
                    var city = CityLoyaltySystem.GetCitizenship(User, false);

                    if ((city != null && city.Governor == User) || User.AccessLevel >= AccessLevel.GameMaster)         // Only Governors
                    {
                        if (id < 3500)
                        {
                            id -= 3000;

                            if (id >= 0 && id < TownCryerSystem.CityEntries.Count)
                            {
                                BaseGump.SendGump(new CreateCityEntryGump(User, Cryer, City, TownCryerSystem.CityEntries[id]));
                            }
                        }
                        else
                        {
                            id -= 3500;

                            if (id >= 0 && id < TownCryerSystem.CityEntries.Count)
                            {
                                TownCryerSystem.CityEntries.RemoveAt(id);
                            }
                        }
                    }

                    Refresh();
                }
                else if (id < 5000)
                {
                    if (id < 4500)
                    {
                        id -= 4000;

                        if (id >= 0 && id < TownCryerSystem.GuildEntries.Count)
                        {
                            BaseGump.SendGump(new CreateGuildEntryGump(User, Cryer, TownCryerSystem.GuildEntries[id]));
                        }
                    }
                    else
                    {
                        id -= 4500;

                        if (id >= 0 && id < TownCryerSystem.GuildEntries.Count)
                        {
                            TownCryerSystem.GuildEntries.RemoveAt(id);
                        }

                        Refresh();
                    }
                }
            }

            break;
            }
        }