예제 #1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!this.IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.AtAccountHouseLimit(from))
            {
                if (BaseHouse.AccountHouseLimit == 1)
                {
                    from.SendLocalizedMessage(501271); // You already own a house, you may not place another!
                }
                else
                {
                    from.SendMessage("You already own {0} houses, you may not place any more!", BaseHouse.AccountHouseLimit.ToString());
                }
            }
            else
            {
                from.SendLocalizedMessage(1010433); /* House placement cancellation could result in a
                                                     * 60 second delay in the return of your deed.
                                                     */

                from.Target = new HousePlacementTarget(this);
            }
        }
예제 #2
0
 public override void OnDoubleClick(Mobile m)
 {
     if (m.AccessLevel != AccessLevel.Player)
     {
         new TownHouseSetupGump(m, this);
     }
     else if (!Visible)
     {
         return;
     }
     else if (CanBuyHouse(m) && !BaseHouse.AtAccountHouseLimit(m))                   //UOSI: Changed to AtAccountHouseLimit as function HasAccountHouse does not exist.
     {
         new TownHouseConfirmGump(m, this);
     }
     else
     {
         m.SendMessage("You cannot purchase this house.");
     }
 }
예제 #3
0
        public void OnPlacement(Mobile from, Point3D p)
        {
            if (this.Deleted)
            {
                return;
            }

            if (!this.IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.AtAccountHouseLimit(from))
            {
                if (BaseHouse.AccountHouseLimit == 1)
                {
                    from.SendLocalizedMessage(501271); // You already own a house, you may not place another!
                }
                else
                {
                    from.SendMessage("You already own {0} houses, you may not place any more!", BaseHouse.AccountHouseLimit.ToString());
                }
            }
            else
            {
                ArrayList            toMove;
                Point3D              center = new Point3D(p.X - this.m_Offset.X, p.Y - this.m_Offset.Y, p.Z - this.m_Offset.Z);
                HousePlacementResult res    = HousePlacement.Check(from, this.m_MultiID, center, out toMove);

                switch (res)
                {
                case HousePlacementResult.Valid:
                {
                    BaseHouse house = this.GetHouse(from);
                    house.MoveToWorld(center, from.Map);
                    this.Delete();

                    for (int i = 0; i < toMove.Count; ++i)
                    {
                        object o = toMove[i];

                        if (o is Mobile)
                        {
                            ((Mobile)o).Location = house.BanLocation;
                        }
                        else if (o is Item)
                        {
                            ((Item)o).Location = house.BanLocation;
                        }
                    }

                    break;
                }

                case HousePlacementResult.BadItem:
                case HousePlacementResult.BadLand:
                case HousePlacementResult.BadStatic:
                case HousePlacementResult.BadRegionHidden:
                {
                    from.SendLocalizedMessage(1043287);         // The house could not be created here.  Either something is blocking the house, or the house would not be on valid terrain.
                    break;
                }

                case HousePlacementResult.NoSurface:
                {
                    from.SendMessage("The house could not be created here.  Part of the foundation would not be on any surface.");
                    break;
                }

                case HousePlacementResult.BadRegion:
                {
                    from.SendLocalizedMessage(501265);         // Housing cannot be created in this area.
                    break;
                }

                case HousePlacementResult.BadRegionTemp:
                {
                    from.SendLocalizedMessage(501270);         //Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
                    break;
                }

                case HousePlacementResult.BadRegionRaffle:
                {
                    from.SendLocalizedMessage(1150493);         // You must have a deed for this plot of land in order to build here.
                    break;
                }

                case HousePlacementResult.NoQueenLoyalty:
                {
                    from.SendLocalizedMessage(1113707, "10000");     // You must have at lease ~1_MIN~ loyalty to the Gargoyle Queen to place a house in Ter Mur.
                    break;
                }
                }
            }
        }
예제 #4
0
        public void PlacementWarning_Callback(Mobile from, bool okay, object state)
        {
            if (!from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType(typeof(HousePlacementTool)) == null)
            {
                return;
            }

            PreviewHouse prevHouse = (PreviewHouse)state;

            if (!okay)
            {
                prevHouse.Delete();
                return;
            }

            if (prevHouse.Deleted)
            {
                /* Too much time has passed and the test house you created has been deleted.
                 * Please try again!
                 */
                from.SendGump(new NoticeGump(1060637, 30720, 1060647, 32512, 320, 180, null, null));

                return;
            }

            Point3D center = prevHouse.Location;
            Map     map    = prevHouse.Map;

            prevHouse.Delete();

            ArrayList toMove;
            //Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
            HousePlacementResult res = HousePlacement.Check(from, m_MultiID, center, out toMove);

            switch (res)
            {
            case HousePlacementResult.Valid:
            {
                if (from.AccessLevel < AccessLevel.GameMaster && BaseHouse.AtAccountHouseLimit(from))
                {
                    if (BaseHouse.AccountHouseLimit == 1)
                    {
                        from.SendLocalizedMessage(501271);         // You already own a house, you may not place another!
                    }
                    else
                    {
                        from.SendMessage("You already own {0} houses, you may not place any more!", BaseHouse.AccountHouseLimit.ToString());
                    }
                }
                else
                {
                    BaseHouse house = ConstructHouse(from);

                    if (house == null)
                    {
                        return;
                    }

                    house.Price = m_Cost;

                    if (from.AccessLevel >= AccessLevel.GameMaster)
                    {
                        from.SendMessage("{0} gold would have been withdrawn from your bank if you were not a GM.", m_Cost.ToString());
                    }
                    else
                    {
                        if (Banker.Withdraw(from, m_Cost))
                        {
                            from.SendLocalizedMessage(1060398, m_Cost.ToString());         // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                        }
                        else
                        {
                            house.RemoveKeys(from);
                            house.Delete();
                            from.SendLocalizedMessage(1060646);         // You do not have the funds available in your bank box to purchase this house.  Try placing a smaller house, or adding gold or checks to your bank box.
                            return;
                        }
                    }

                    house.MoveToWorld(center, from.Map);

                    if (house is HouseFoundation)
                    {
                        ((HouseFoundation)house).OnPlacement();
                    }

                    for (int i = 0; i < toMove.Count; ++i)
                    {
                        object o = toMove[i];

                        if (o is Mobile)
                        {
                            ((Mobile)o).Location = house.BanLocation;
                        }
                        else if (o is Item)
                        {
                            ((Item)o).Location = house.BanLocation;
                        }
                    }
                }

                break;
            }

            case HousePlacementResult.BadItem:
            case HousePlacementResult.BadLand:
            case HousePlacementResult.BadStatic:
            case HousePlacementResult.BadRegionHidden:
            case HousePlacementResult.NoSurface:
            {
                from.SendLocalizedMessage(1043287);         // The house could not be created here.  Either something is blocking the house, or the house would not be on valid terrain.
                break;
            }

            case HousePlacementResult.BadRegion:
            {
                from.SendLocalizedMessage(501265);         // Housing cannot be created in this area.
                break;
            }

            case HousePlacementResult.BadRegionTemp:
            {
                from.SendLocalizedMessage(501270);         // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
                break;
            }

            case HousePlacementResult.BadRegionRaffle:
            {
                from.SendLocalizedMessage(1150493);         // You must have a deed for this plot of land in order to build here.
                break;
            }

            case HousePlacementResult.InvalidCastleKeep:
            {
                from.SendLocalizedMessage(1061122);         // Castles and keeps cannot be created here.
                break;
            }

            case HousePlacementResult.NoQueenLoyalty:
            {
                from.SendLocalizedMessage(1113707, "10000");         // You must have at lease ~1_MIN~ loyalty to the Gargoyle Queen to place a house in Ter Mur.
                break;
            }
            }
        }