예제 #1
0
파일: Gumps.cs 프로젝트: Tauriella/ServUO-1
        public override void OnResponse(RelayInfo info)
        {
            base.OnResponse(info);

            if (!CityLoyaltySystem.IsSetup())
            {
                return;
            }

            switch (info.ButtonID)
            {
            case 0: break;

            case 1:
                BaseGump.SendGump(new CityTitlesGump(User));
                break;

            case 2:
                BaseGump.SendGump(new RenounceCitizenshipGump(User));
                break;

            case 3:
            default:
                int id = info.ButtonID - 100;
                if (id >= 0 && id < CityLoyaltySystem.Cities.Count)
                {
                    if (Citizenship == null)
                    {
                        BaseGump.SendGump(new DeclareCitizenshipGump(CityLoyaltySystem.Cities[id], User));
                    }
                }
                break;
            }
        }
예제 #2
0
 public override void OnDoubleClick(Mobile from)
 {
     if (CityLoyaltySystem.Enabled && CityLoyaltySystem.IsSetup() && from is PlayerMobile pm && pm.InRange(pm.Location, 3))
     {
         BaseGump.SendGump(new CityStoneGump(pm, City));
     }
 }
예제 #3
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            base.OnResponse(state, info);

            if (!CityLoyaltySystem.IsSetup())
            {
                return;
            }
            Console.WriteLine(info.ButtonID.ToString());
            switch (info.ButtonID)
            {
            case 0: break;

            case 1:
                User.SendGump(new CityTitlesGump(User));
                break;

            case 2:
                User.SendGump(new RenounceCitizenshipGump(User));
                break;

            case 3:
            default:
                int id = info.ButtonID - 100;
                if (id >= 0 && id < CityLoyaltySystem.Cities.Count)
                {
                    if (Citizenship == null)
                    {
                        User.SendGump(new DeclareCitizenshipGump(CityLoyaltySystem.Cities[id], User));
                    }
                }
                break;
            }
        }
예제 #4
0
 public override void OnDoubleClick(Mobile from)
 {
     if (CityLoyaltySystem.Enabled && CityLoyaltySystem.IsSetup() && from is PlayerMobile && from.InRange(from.Location, 3))
     {
         if (from is PlayerMobile && City != null && City.IsCitizen(from))
         {
             BaseGump.SendGump(new CityStoneGump(from as PlayerMobile, City));
         }
         else
         {
             from.SendLocalizedMessage(1153888); // Only Citizens of this City may use the Election Stone.
         }
     }
 }
예제 #5
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!CityLoyaltySystem.IsSetup())
            {
                return;
            }

            if (Animals && Table != null && Table.Count > 0)
            {
                from.Target = new InternalTarget(this);
                from.SendLocalizedMessage(1152936);                 // Which animal do you wish to donate?
            }
            else if (!Animals)
            {
                SendMessageTo(from, 1152928); // If you wish to donate to the City simply drop the items into the crate.
            }
        }
예제 #6
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (!CityLoyaltySystem.IsSetup())
            {
                return(false);
            }

            if (!Animals && Table != null && Table.Count > 0)
            {
                int love = 0;

                if (dropped is Container)
                {
                    List <Item> items = new List <Item>(dropped.Items);

                    foreach (Item item in items)
                    {
                        love += CheckTurnin(item);
                    }

                    items.Clear();
                    items.TrimExcess();
                }
                else
                {
                    love = CheckTurnin(dropped);
                }

                if (love > 0)
                {
                    CityLoyaltySystem.GetCityInstance(City).AwardLove(from, love);
                    SendMessageTo(from, 1152926); // The City thanks you for your generosity!
                    return(!(dropped is Container));
                }
                else
                {
                    SendMessageTo(from, 1152927); // Your generosity is appreciated but the City does not require this item.
                    return(false);
                }
            }

            return(false);
        }
예제 #7
0
파일: Gumps.cs 프로젝트: Tauriella/ServUO-1
        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.*/
                }
            }
        }