Esempio n. 1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                CityLoyaltySystem sys = CityLoyaltySystem.GetCityInstance(City);

                if (CityLoyaltySystem.HasCitizenship(from, City) && sys.GetLoyaltyRating(from) >= LoyaltyRating.Commended)
                {
                    base.OnDoubleClick(from);
                }
                else
                {
                    from.SendLocalizedMessage(1152361, String.Format("#{0}", CityLoyaltySystem.GetCityLocalization(City))); // You are not sufficiently loyal to ~1_CITY~ to use this.
                }
            }
        }
Esempio n. 2
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));
                    }
                }
            }
Esempio n. 3
0
        public override void AddGumpLayout()
        {
            if (!CityLoyaltySystem.Enabled || CityLoyaltySystem.Cities == null)
            {
                return;
            }

            base.AddGumpLayout();
            int y = 40;

            for (int i = 0; i < CityLoyaltySystem.Cities.Count; i++)
            {
                CityLoyaltySystem city = CityLoyaltySystem.Cities[i];

                if (city.CanUtilize && Citizenship == null && CityLoyaltySystem.CanAddCitizen(User))
                {
                    AddButton(30, y + 3, 2103, 2104, 100 + i, GumpButtonType.Reply, 0);
                }

                AddHtmlLocalized(50, y, 200, 16, CityLoyaltySystem.CityLocalization(city.City), false, false);
                AddHtmlLocalized(200, y, 200, 16, CityLoyaltySystem.RatingLocalization(city.GetLoyaltyRating(User)), false, false);

                y += 20;
            }

            y += 20;

            AddHtmlLocalized(70, y, 250, 16, 1152883, false, false);             // Citizenship:
            AddHtmlLocalized(200, y, 100, 16, Citizenship != null ? CityLoyaltySystem.CityLocalization(Citizenship.City) : 1152884, false, false);

            y += 40;

            if (!CityLoyaltySystem.IsSetup())
            {
                AddHtml(70, y, 250, 60, "City Loyalty System has not been enabled by your server owner yet.", false, false);
            }
            else if (Citizenship != null)
            {
                AddHtmlLocalized(115, y - 5, 150, 16, 1152890, false, false); // Citizenship Titles
                AddButton(100, y, 2103, 2104, 1, GumpButtonType.Reply, 0);

                y += 20;

                AddHtmlLocalized(115, y - 5, 150, 16, 1152888, false, false); // Renounce Citizenship
                AddButton(100, y, 2103, 2104, 2, GumpButtonType.Reply, 0);
            }
            else
            {
                if (CityLoyaltySystem.CanAddCitizen(User))
                {
                    AddHtmlLocalized(30, y, 280, 90, 1152885, false, false);

                    /*Click the gem next to the name of a city to declare your
                     * citizenship. You may renounce citizenship, but afterwards
                     * you may not declare new citizenship for one week.*/
                }
                else
                {
                    AddHtmlLocalized(30, y, 285, 80, 1152886, CityLoyaltySystem.NextJoinCity(User).ToString(), 0, false, false);

                    /*You recently renounced citizenship, so you must wait ~1_COUNT~
                     * more days before you may declare citizenship again.*/
                }
            }
        }