Exemplo n.º 1
0
            public ConfirmPlacementGump(Mobile from, Point3D location, TownshipDeed deed)
                : base(50, 50)
            {
                m_From     = from;
                m_Location = location;
                m_TSDeed   = deed;

                from.CloseGump(typeof(ConfirmPlacementGump));

                AddPage(0);

                AddBackground(10, 10, 190, 140, 0x242C);

                AddHtml(30, 30, 150, 75, String.Format("<div align=CENTER>{0}</div>", "The township can be placed here.  Continue?"), false, false);

                AddButton(40, 105, 0x81A, 0x81B, 0x1, GumpButtonType.Reply, 0);                   // Okay
                AddButton(110, 105, 0x819, 0x818, 0x2, GumpButtonType.Reply, 0);                  // Cancel
            }
Exemplo n.º 2
0
			public ConfirmPlacementGump(Mobile from, Point3D location, TownshipDeed deed)
				: base(50, 50)
			{
				m_From = from;
				m_Location = location;
				m_TSDeed = deed;

				from.CloseGump(typeof(ConfirmPlacementGump));

				AddPage( 0 );

				AddBackground( 10, 10, 190, 140, 0x242C );

				AddHtml( 30, 30, 150, 75, String.Format( "<div align=CENTER>{0}</div>", "The township can be placed here.  Continue?" ), false, false );

				AddButton( 40, 105, 0x81A, 0x81B, 0x1, GumpButtonType.Reply, 0 ); // Okay
				AddButton( 110, 105, 0x819, 0x818, 0x2, GumpButtonType.Reply, 0 ); // Cancel
			}
Exemplo n.º 3
0
        public static double GetPercentageOfGuildedHousesInArea(Point3D location, Map map, int radius, Guild guild, bool bIgnoreAlliedHouses)
        {
            double guildPercentage = 0.0;

            if (guild == null)
            {
                return(guildPercentage);                           //doublecheck this - return 0 if we're not guilded
            }
            if (location == Point3D.Zero)
            {
                return(guildPercentage); //might as well check that we're not the default point
            }
            try                          //safety
            {
                int x = location.X;
                int y = location.Y;
                int z = location.Z;

                int x_start = x - radius;
                int y_start = y - radius;
                int x_end   = x + radius;
                int y_end   = y + radius;

                Rectangle2D      rect      = new Rectangle2D(x_start, y_start, TownshipStone.INITIAL_RADIUS * 2, TownshipStone.INITIAL_RADIUS * 2);
                List <BaseHouse> houseList = TownshipDeed.GetHousesInRect(rect, map);

                int guildCount = 0;
                int allyCount  = 0;
                int otherCount = 0;

                int siegetentCount = 0;

                int countedHouses = 0;

                foreach (BaseHouse h in houseList)
                {
                    if (h != null && h.Owner != null)
                    {
                        countedHouses++;

                        Guild houseGuild = h.Owner.Guild as Guilds.Guild;

                        if (h is SiegeTent)
                        {
                            siegetentCount++;
                        }
                        else
                        {
                            if (houseGuild == null)
                            {
                                otherCount++;
                            }
                            else if (houseGuild == guild)
                            {
                                guildCount++;
                            }
                            else if (guild.IsAlly(houseGuild))
                            {
                                allyCount++;
                            }
                            else
                            {
                                otherCount++;
                            }
                        }
                    }
                }

                guildPercentage = ((double)guildCount) / ((double)(countedHouses - allyCount - siegetentCount));
            }
            catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
            return(guildPercentage);
        }