예제 #1
0
        public override bool AllowHousing(Mobile from, Point3D p)
        {
            MaginciaLottoSystem system = MaginciaLottoSystem.Instance;

            if (system != null && system.Enabled && from.Backpack != null)
            {
                List <Item> items = new List <Item>();

                Item[] packItems = from.Backpack.FindItemsByType(typeof(WritOfLease));
                Item[] bankItems = from.BankBox.FindItemsByType(typeof(WritOfLease));

                if (packItems != null && packItems.Length > 0)
                {
                    items.AddRange(packItems);
                }

                if (bankItems != null && bankItems.Length > 0)
                {
                    items.AddRange(bankItems);
                }

                foreach (Item item in items)
                {
                    WritOfLease lease = item as WritOfLease;

                    if (lease != null && !lease.Expired && lease.Plot != null && lease.Plot.Bounds.Contains(p) && from.Map == lease.Plot.Map)
                    {
                        return(true);
                    }
                }
            }

            return(MaginciaLottoSystem.IsFreeHousingZone(p, Map));
        }
예제 #2
0
            public WritNoteGump(WritOfLease lease)
                : base(100, 100)
            {
                m_Lease = lease;

                AddImage(0, 0, 9380);
                AddImage(114, 0, 9381);
                AddImage(171, 0, 9382);
                AddImage(0, 140, 9386);
                AddImage(114, 140, 9387);
                AddImage(171, 140, 9388);

                AddHtmlLocalized(90, 5, 200, 16, 1150484, 1, false, false); // WRIT OF LEASE

                string args;

                if (lease.Expired)
                {
                    args = string.Format("{0}\t{1}\t{2}\t{3}\t{4}", lease.Identifier, lease.Facet.ToString(), Server.Misc.ServerList.ServerName, "", string.Format("{0} {1}", lease.RecallLoc.X, lease.RecallLoc.Y));
                    AddHtmlLocalized(38, 55, 215, 178, 1150488, args, 1, false, true);
                    //This deed once entitled the bearer to build a house on the plot of land designated "~1_PLOT~" (located at ~5_SEXTANT~) in the City of New Magincia on the ~2_FACET~ facet of the ~3_SHARD~ shard.<br><br>The deed has expired, and now the indicated plot of land is subject to normal house construction rules.<br><br>This deed was won by lottery, and while it is no longer valid for land ownership it does serve to commemorate the winning of land during the Rebuilding of Magincia.<br><br>This deed functions as a recall rune marked for the location of the plot it represents.
                }
                else
                {
                    args = string.Format("{0}\t{1}\t{2}\t{3}\t{4}", lease.Identifier, lease.Facet.ToString(), Server.Misc.ServerList.ServerName, MaginciaLottoSystem.WritExpirePeriod.ToString(), string.Format("{0} {1}", lease.RecallLoc.X, lease.RecallLoc.Y));
                    AddHtmlLocalized(38, 55, 215, 178, 1150483, args, 1, false, true);
                    //This deed entitles the bearer to build a house on the plot of land designated "~1_PLOT~" (located at ~5_SEXTANT~) in the City of New Magincia on the ~2_FACET~ facet of the ~3_SHARD~ shard.<br><br>The deed will expire once it is used to construct a house, and thereafter the indicated plot of land will be subject to normal house construction rules. The deed will expire after ~4_DAYS~ more days have passed, and at that time the right to place a house reverts to normal house construction rules.<br><br>This deed functions as a recall rune marked for the location of the plot it represents.<br><br>To place a house on the deeded plot, you must simply have this deed in your backpack or bank box when using a House Placement Tool there.
                }
            }
예제 #3
0
        public static void CheckHousePlacement(Mobile from, Point3D center)
        {
            MaginciaLottoSystem system = MaginciaLottoSystem.Instance;

            if (system != null && system.Enabled && from.Backpack != null && IsInMagincia(center.X, center.Y, from.Map))
            {
                List <Item> items = new List <Item>();

                Item[] packItems = from.Backpack.FindItemsByType(typeof(WritOfLease));
                Item[] bankItems = from.BankBox.FindItemsByType(typeof(WritOfLease));

                if (packItems != null && packItems.Length > 0)
                {
                    items.AddRange(packItems);
                }

                if (bankItems != null && bankItems.Length > 0)
                {
                    items.AddRange(bankItems);
                }

                foreach (Item item in items)
                {
                    WritOfLease lease = item as WritOfLease;

                    if (lease != null && !lease.Expired && lease.Plot != null && lease.Plot.Bounds.Contains(center) && from.Map == lease.Plot.Map)
                    {
                        lease.OnExpired();
                        return;
                    }
                }
            }
        }
예제 #4
0
 public MaginciaHousingPlot(string identifier, Rectangle2D bounds, bool prime, Map map)
 {
     m_Identifier  = identifier;
     m_Bounds      = bounds;
     m_IsPrimeSpot = prime;
     m_Map         = map;
     m_Writ        = null;
     m_Complete    = false;
     m_Expires     = DateTime.MinValue;
 }
예제 #5
0
 public MaginciaHousingPlot(string identifier, Rectangle2D bounds, bool prime, Map map)
 {
     m_Identifier = identifier;
     m_Bounds = bounds;
     m_IsPrimeSpot = prime;
     m_Map = map;
     m_Writ = null;
     m_Complete = false;
     m_Expires = DateTime.MinValue;
 }
예제 #6
0
        public MaginciaHousingPlot(GenericReader reader)
        {
            int version = reader.ReadInt();

            m_Identifier  = reader.ReadString();
            m_Writ        = reader.ReadItem() as WritOfLease;
            m_Stone       = reader.ReadItem() as MaginciaPlotStone;
            m_LottoEnds   = reader.ReadDateTime();
            m_Bounds      = reader.ReadRect2D();
            m_Map         = reader.ReadMap();
            m_IsPrimeSpot = reader.ReadBool();
            m_Complete    = reader.ReadBool();
            m_Winner      = reader.ReadMobile();
            m_Expires     = reader.ReadDateTime();

            int c = reader.ReadInt();

            for (int i = 0; i < c; i++)
            {
                Mobile m      = reader.ReadMobile();
                int    amount = reader.ReadInt();

                if (m != null)
                {
                    m_Participants[m] = amount;
                }
            }

            if ((m_Stone == null || m_Stone.Deleted) && LottoOngoing && MaginciaLottoSystem.IsRegisteredPlot(this))
            {
                AddPlotStone();
            }
            else if (m_Stone != null)
            {
                m_Stone.Plot = this;
            }

            if (m_Writ != null)
            {
                m_Writ.Plot = this;
            }
        }
예제 #7
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile winner = state.Mobile;

            if (info.ButtonID == 1)
            {
                WritOfLease writ = new WritOfLease(m_Plot);
                m_Plot.Writ = writ;
                m_Plot.Winner = null;

                if (winner.Backpack == null || !winner.Backpack.TryDropItem(winner, writ, false))
                {
                    winner.SendLocalizedMessage(1150501); // Your backpack is full, so the deed has been placed in your bank box.
                    winner.BankBox.DropItem(writ);
                }
                else
                    winner.SendLocalizedMessage(1150500); // The deed has been placed in your backpack.

                MaginciaLottoSystem.GetWinnerGump(winner);
            }
        }
예제 #8
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile winner = state.Mobile;

            if (info.ButtonID == 1)
            {
                WritOfLease writ = new WritOfLease(m_Plot);
                m_Plot.Writ   = writ;
                m_Plot.Winner = null;

                if (winner.Backpack == null || !winner.Backpack.TryDropItem(winner, writ, false))
                {
                    winner.SendLocalizedMessage(1150501); // Your backpack is full, so the deed has been placed in your bank box.
                    winner.BankBox.DropItem(writ);
                }
                else
                {
                    winner.SendLocalizedMessage(1150500); // The deed has been placed in your backpack.
                }
                MaginciaLottoSystem.GetWinnerGump(winner);
            }
        }
예제 #9
0
            public WritNoteGump(WritOfLease lease)
                : base(100, 100)
            {
                m_Lease = lease;

                AddImage(0, 0, 9380);
                AddImage(114, 0, 9381);
                AddImage(171, 0, 9382);
                AddImage(0, 140, 9386);
                AddImage(114, 140, 9387);
                AddImage(171, 140, 9388);

                AddHtmlLocalized(90, 5, 200, 16, 1150484, 1, false, false); // WRIT OF LEASE

                string args;

                if (lease.Expired)
                {
                    args = String.Format("{0}\t{1}\t{2}\t{3}\t{4}", lease.Identifier, lease.Facet.ToString(), "Alexandria", "", String.Format("{0} {1}", lease.RecallLoc.X, lease.RecallLoc.Y));
                    AddHtmlLocalized(38, 55, 215, 178, 1150488, args, 1, false, true);
                    //This deed once entitled the bearer to build a house on the plot of land designated "~1_PLOT~" (located at ~5_SEXTANT~) in the City of New Magincia on the ~2_FACET~ facet of the ~3_SHARD~ shard.<br><br>The deed has expired, and now the indicated plot of land is subject to normal house construction rules.<br><br>This deed was won by lottery, and while it is no longer valid for land ownership it does serve to commemorate the winning of land during the Rebuilding of Magincia.<br><br>This deed functions as a recall rune marked for the location of the plot it represents.
                }
                else
                {
                    args = String.Format("{0}\t{1}\t{2}\t{3}\t{4}", lease.Identifier, lease.Facet.ToString(), "Alexandria", MaginciaLottoSystem.WritExpirePeriod.ToString(), String.Format("{0} {1}", lease.RecallLoc.X, lease.RecallLoc.Y));
                    AddHtmlLocalized(38, 55, 215, 178, 1150483, args, 1, false, true);
                    //This deed entitles the bearer to build a house on the plot of land designated "~1_PLOT~" (located at ~5_SEXTANT~) in the City of New Magincia on the ~2_FACET~ facet of the ~3_SHARD~ shard.<br><br>The deed will expire once it is used to construct a house, and thereafter the indicated plot of land will be subject to normal house construction rules. The deed will expire after ~4_DAYS~ more days have passed, and at that time the right to place a house reverts to normal house construction rules.<br><br>This deed functions as a recall rune marked for the location of the plot it represents.<br><br>To place a house on the deeded plot, you must simply have this deed in your backpack or bank box when using a House Placement Tool there.
                }
            }
예제 #10
0
        public MaginciaHousingPlot(GenericReader reader)
        {
            int version = reader.ReadInt();

            m_Identifier = reader.ReadString();
            m_Writ = reader.ReadItem() as WritOfLease;
            m_Stone = reader.ReadItem() as MaginciaPlotStone;
            m_LottoEnds = reader.ReadDateTime();
            m_Bounds = reader.ReadRect2D();
            m_Map = reader.ReadMap();
            m_IsPrimeSpot = reader.ReadBool();
            m_Complete = reader.ReadBool();
            m_Winner = reader.ReadMobile();
            m_Expires = reader.ReadDateTime();
            
            int c = reader.ReadInt();
            for (int i = 0; i < c; i++)
            {
                Mobile m = reader.ReadMobile();
                int amount = reader.ReadInt();

                if (m != null)
                    m_Participants[m] = amount;
            }

            if ((m_Stone == null || m_Stone.Deleted) && LottoOngoing && MaginciaLottoSystem.IsRegisteredPlot(this))
                AddPlotStone();
            else if (m_Stone != null)
                m_Stone.Plot = this;

            if (m_Writ != null)
                m_Writ.Plot = this;
        }