Ejemplo n.º 1
0
        public StrongBox( Mobile owner, BaseHouse house )
            : base(0xE80)
        {
            m_Owner = owner;
            m_House = house;

            MaxItems = 25;
        }
Ejemplo n.º 2
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            /*int version = */
            reader.ReadInt();

            m_Parrot = reader.ReadMobile() as Parrot;
            m_MyHouse = reader.ReadItem() as BaseHouse;
        }
Ejemplo n.º 3
0
        public HouseTransferGump( Mobile from, Mobile to, BaseHouse house )
            : base(110, 100)
        {
            m_From = from;
            m_To = to;
            m_House = house;

            Closable = false;

            AddPage( 0 );

            AddBackground( 0, 0, 420, 280, 5054 );

            AddImageTiled( 10, 10, 400, 20, 2624 );
            AddAlphaRegion( 10, 10, 400, 20 );

            AddHtmlLocalized( 10, 10, 400, 20, 1060635, 30720, false, false ); // <CENTER>WARNING</CENTER>

            AddImageTiled( 10, 40, 400, 200, 2624 );
            AddAlphaRegion( 10, 40, 400, 200 );

            /* Another player is attempting to initiate a house trade with you.
             * In order for you to see this window, both you and the other person are standing within two paces of the house to be traded.
             * If you click OKAY below, a house trade scroll will appear in your trade window and you can complete the transaction.
             * This scroll is a distinctive blue color and will show the type of house, the name of the house, the name of the owner of the house, and the sextant coordinates of the center of the house, and the value of the house when you hover your mouse over it.
             * Please carefully verify that this information meets your expectations. In order for the transaction to be successful, you both must accept the trade and you both must remain within two paces of the house sign.
             * <BR><BR>Accepting this house in trade will <a href = "?ForceTopic97">condemn</a> any and all of your other houses that you may have.
             * All of your houses on <U>all shards</U> will be affected.
             * <BR><BR>In addition, you will not be able to place another house or have one transferred to you for one (1) real-life week.<BR><BR>
             * Once you accept these terms, these effects cannot be reversed.
             * Re-deeding or transferring your new house will <U>not</U> uncondemn your other house(s) nor will the one week timer be removed.<BR><BR>
             * If you are absolutely certain you wish to proceed, click the button next to OKAY below.
             * If you do not wish to trade for this house, click CANCEL.
             */
            AddHtmlLocalized( 10, 40, 400, 200, 1062086, 32512, false, true );

            AddImageTiled( 10, 250, 400, 20, 2624 );
            AddAlphaRegion( 10, 250, 400, 20 );

            AddButton( 10, 250, 4005, 4007, 1, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 40, 250, 170, 20, 1011036, 32767, false, false ); // OKAY

            AddButton( 210, 250, 4005, 4007, 0, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 240, 250, 170, 20, 1011012, 32767, false, false ); // CANCEL
        }
Ejemplo n.º 4
0
        public VendorInventoryGump( BaseHouse house, Mobile from )
            : base(50, 50)
        {
            m_House = house;
            m_Inventories = new ArrayList( house.VendorInventories );

            AddPage( 0 );

            AddBackground( 0, 0, 420, 50 + 20 * m_Inventories.Count, 0x13BE );

            AddImageTiled( 10, 10, 400, 20, 0xA40 );
            AddHtmlLocalized( 15, 10, 200, 20, 1062435, 0x7FFF, false, false ); // Reclaim Vendor Inventory
            AddHtmlLocalized( 330, 10, 50, 20, 1062465, 0x7FFF, false, false ); // Expires

            AddImageTiled( 10, 40, 400, 20 * m_Inventories.Count, 0xA40 );

            AddPage( 1 );

            for ( int i = 0; i < m_Inventories.Count; i++ )
            {
                VendorInventory inventory = (VendorInventory) m_Inventories[i];

                int y = 40 + 20 * i;

                if ( inventory.Owner.Account == from.Account )
                    AddButton( 10, y, 0xFA5, 0xFA7, i + 1, GumpButtonType.Reply, 0 );

                AddLabel( 45, y, 0x481, String.Format( "{0} ({1})", inventory.ShopName, inventory.VendorName ) );

                TimeSpan expire = inventory.ExpireTime - DateTime.Now;
                int hours = (int) expire.TotalHours;

                AddHtmlLocalized( 350, y, 50, 20, 1062466, 0x7FFF, false, false ); // hour(s)
                AddLabel( 320, y, 0x481, hours.ToString() );
            }
        }
Ejemplo n.º 5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                IPoint3D p   = targeted as IPoint3D;
                Map      map = from.Map;

                if (p == null || map == null || this.m_Deed.Deleted)
                {
                    return;
                }

                if (this.m_Deed.IsChildOf(from.Backpack))
                {
                    BaseAddon addon = this.m_Deed.Addon;

                    Server.Spells.SpellHelper.GetSurfaceTop(ref p);

                    BaseHouse house = null;

                    AddonFitResult res = addon.CouldFit(p, map, from, ref house);

                    if (res == AddonFitResult.Valid)
                    {
                        addon.MoveToWorld(new Point3D(p), map);
                    }
                    else if (res == AddonFitResult.Blocked)
                    {
                        from.SendLocalizedMessage(500269); // You cannot build that there.
                    }
                    else if (res == AddonFitResult.NotInHouse)
                    {
                        from.SendLocalizedMessage(500274); // You can only place this in a house that you own!
                    }
                    else if (res == AddonFitResult.DoorTooClose)
                    {
                        from.SendLocalizedMessage(500271); // You cannot build near the door.
                    }
                    else if (res == AddonFitResult.NoWall)
                    {
                        from.SendLocalizedMessage(500268); // This object needs to be mounted on something.
                    }
                    if (res == AddonFitResult.Valid)
                    {
                        if (addon != null)
                        {
                            addon.Resource = this.m_Deed.Resource;

                            if (addon.RetainDeedHue)
                            {
                                addon.Hue = this.m_Deed.Hue;
                            }
                        }

                        this.m_Deed.DeleteDeed();

                        house.Addons.Add(addon);
                    }
                    else
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                }
            }
Ejemplo n.º 6
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Banner == null || m_Banner.Deleted)
                {
                    return;
                }

                if (m_Banner.IsChildOf(from.Backpack))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);

                    if (house != null && house.IsOwner(from))
                    {
                        IPoint3D p   = targeted as IPoint3D;
                        Map      map = from.Map;

                        if (p == null || map == null)
                        {
                            return;
                        }

                        Point3D  p3d = new Point3D(p);
                        ItemData id  = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];

                        if (map.CanFit(p3d, id.Height))
                        {
                            house = BaseHouse.FindHouseAt(p3d, map, id.Height);

                            if (house != null && house.IsOwner(from))
                            {
                                bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
                                bool west  = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);

                                if (north && west)
                                {
                                    from.CloseGump(typeof(FacingGump));
                                    from.SendGump(new FacingGump(m_Banner, m_ItemID, p3d, house));
                                }
                                else if (north || west)
                                {
                                    Banner banner = null;

                                    if (north)
                                    {
                                        banner = new Banner(m_ItemID);
                                    }
                                    else if (west)
                                    {
                                        banner = new Banner(m_ItemID + 1);
                                    }

                                    house.Addons.Add(banner);

                                    banner.IsRewardItem = m_Banner.IsRewardItem;
                                    banner.MoveToWorld(p3d, map);

                                    m_Banner.Delete();
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1042039);                                       // The banner must be placed next to a wall.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042036);                                   // That location is not in your house.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500269);                               // You cannot build that there.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502092);                           // You must be in your house to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042038);                       // You must have the object in your backpack to use it.
                }
            }
Ejemplo n.º 7
0
            protected override void OnTarget(Mobile from, object targ)
            {
                int converted = 0;
                int deleted   = 0;

                if (targ is HouseSign)
                {
                    HouseSign sign = (HouseSign)targ;
                    if (sign.Owner != null)
                    {
                        if (sign.Owner is BaseHouse)
                        {                           // don't let staff convert original custom houses to static .. force them to make a copy first
                            if (sign.Owner is HouseFoundation == true && sign.Owner is StaticHouse == false)
                            {
                                from.SendMessage(0x22, "Please make a COPY of this house before converting it to static.");
                                from.SendMessage(0x22, "[housegen");
                            }
                            else
                            {
                                //ok, we got what we want :)
                                BaseHouse house = sign.Owner as BaseHouse;

                                //get a copy of the location
                                Point3D location = new Point3D(house.Location.X, house.Location.Y, house.Location.Z);

                                // make a copy of the doors - see comments below
                                // ArrayList Doors = new ArrayList(house.Doors);

                                //Now we need to iterate through the components and place their static equivalent while skipping doors and other fixtures
                                for (int i = 0; i < house.Components.List.Length; i++)
                                {
                                    string sz = location.X + house.Components.List[i].GetType().ToString();
                                    if (!IsFixture(house.Components.List[i].m_ItemID))
                                    {
                                        Point3D itemloc = new Point3D(
                                            location.X + house.Components.List[i].m_OffsetX,
                                            location.Y + house.Components.List[i].m_OffsetY,
                                            location.Z + house.Components.List[i].m_OffsetZ
                                            );
                                        Static item = new Static((int)(house.Components.List[i].m_ItemID & 0x3FFF));
                                        item.MoveToWorld(itemloc, from.Map);
                                        converted++;
                                    }
                                    else
                                    {
                                        deleted++;
                                    }
                                }

                                // not adding the doors back because we want players to have to purchase them

                                /*foreach (BaseDoor bd in Doors)
                                 * {
                                 *      if (bd == null)
                                 *              continue;
                                 *
                                 *      BaseDoor replacement = GetFixtureItem(bd.ItemID) as BaseDoor;
                                 *      if (replacement != null && replacement.Deleted == false)
                                 *      {
                                 *              Point3D itemloc = new Point3D(
                                 *                      location.X + bd.Offset.X,
                                 *                      location.Y + bd.Offset.Y,
                                 *                      location.Z + bd.Offset.Z
                                 *              );
                                 *
                                 *              replacement.MoveToWorld(itemloc, from.Map);
                                 *      }
                                 * }*/

                                //delete the house
                                house.Delete();
                            }
                        }
                    }
                    else
                    {
                        from.SendMessage(0x22, "That house sign does not point to a house");
                    }
                }
                else if (targ is AddonComponent)
                {
                    //ok, we got what we want :)
                    AddonComponent addon = targ as AddonComponent;

                    // use the players location as the addon's location is whacky
                    Point3D location = new Point3D(from.Location.X, from.Location.Y, from.Location.Z);
                    from.SendMessage("Using your location for the static location.");

                    //Now we need to iterate through the components and place their static equivalent while skipping doors and other fixtures
                    foreach (Item item in addon.Addon.Components)
                    {
                        if (item == null || item is AddonComponent == false)
                        {
                            continue;
                        }

                        AddonComponent ac = item as AddonComponent;

                        if (!IsFixture((short)ac.ItemID))
                        {
                            Point3D itemloc = new Point3D(
                                location.X + ac.Offset.X,
                                location.Y + ac.Offset.Y,
                                location.Z + ac.Offset.Z
                                );
                            Static sitem = new Static((int)(ac.ItemID & 0x3FFF));
                            sitem.MoveToWorld(itemloc, from.Map);
                            converted++;
                        }
                        else
                        {
                            deleted++;
                        }
                    }

                    //delete the addon
                    addon.Delete();
                }
                else
                {
                    from.SendMessage(0x22, "That is neither a house sign nor an addon");
                }

                from.SendMessage("Conversion complete with {0} tiles converted and {1} deleted.", converted, deleted);
            }
Ejemplo n.º 8
0
        public HouseBanTarget( bool ban, BaseHouse house )
            : base(-1, false, TargetFlags.None)
        {
            CheckLOS = false;

            m_House = house;
            m_Banning = ban;
        }
Ejemplo n.º 9
0
        public ViewHousesGump( Mobile from, ArrayList list, BaseHouse sel )
            : base(50, 40)
        {
            m_From = from;
            m_List = list;
            m_Selection = sel;

            from.CloseGump( typeof( ViewHousesGump ) );

            AddPage( 0 );

            AddBackground( 0, 0, 240, 360, 5054 );
            AddBlackAlpha( 10, 10, 220, 340 );

            if ( sel == null || sel.Deleted )
            {
                m_Selection = null;

                AddHtml( 35, 15, 120, 20, Color( "House Type", White ), false, false );

                if ( list.Count == 0 )
                {
                    AddHtml( 35, 40, 160, 40, Color( "There were no houses found for that player.", White ), false, false );
                }

                AddImage( 190, 17, 0x25EA );
                AddImage( 207, 17, 0x25E6 );

                int page = 0;

                for ( int i = 0; i < list.Count; ++i )
                {
                    if ( ( i % 15 ) == 0 )
                    {
                        if ( page > 0 )
                        {
                            AddButton( 207, 17, 0x15E1, 0x15E5, 0, GumpButtonType.Page, page + 1 );
                        }

                        AddPage( ++page );

                        if ( page > 1 )
                        {
                            AddButton( 190, 17, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page - 1 );
                        }
                    }

                    object name = FindHouseName( (BaseHouse) list[i] );

                    AddHtml( 15, 40 + ( ( i % 15 ) * 20 ), 20, 20, Color( String.Format( "{0}.", i + 1 ), White ), false, false );

                    if ( name is int )
                    {
                        AddHtmlLocalized( 35, 40 + ( ( i % 15 ) * 20 ), 160, 20, (int) name, White16, false, false );
                    }
                    else if ( name is string )
                    {
                        AddHtml( 35, 40 + ( ( i % 15 ) * 20 ), 160, 20, Color( (string) name, White ), false, false );
                    }

                    AddButton( 198, 39 + ( ( i % 15 ) * 20 ), 4005, 4007, i + 1, GumpButtonType.Reply, 0 );
                }
            }
            else
            {
                string houseName, owner, location;
                Map map = sel.Map;

                Item sign = sel.Sign;

                if ( sign == null || sign.Name == null || sign.Name == "a house sign" )
                {
                    houseName = "nothing";
                }
                else
                {
                    houseName = sign.Name;
                }

                Mobile houseOwner = sel.Owner;

                if ( houseOwner == null )
                {
                    owner = "nobody";
                }
                else
                {
                    owner = houseOwner.Name;
                }

                int xLong = 0, yLat = 0, xMins = 0, yMins = 0;
                bool xEast = false, ySouth = false;

                bool valid = Sextant.Format( sel.Location, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth );

                if ( valid )
                {
                    location = String.Format( "{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
                }
                else
                {
                    location = "????";
                }

                AddHtml( 10, 15, 220, 20, Color( Center( "House Properties" ), White ), false, false );

                AddHtml( 15, 40, 210, 20, Color( "Facet:", White ), false, false );
                AddHtml( 15, 40, 210, 20, Color( Right( map == null ? "(null)" : map.Name ), White ), false, false );

                AddHtml( 15, 60, 210, 20, Color( "Location:", White ), false, false );
                AddHtml( 15, 60, 210, 20, Color( Right( sel.Location.ToString() ), White ), false, false );

                AddHtml( 15, 80, 210, 20, Color( "Sextant:", White ), false, false );
                AddHtml( 15, 80, 210, 20, Color( Right( location ), White ), false, false );

                AddHtml( 15, 100, 210, 20, Color( "Owner:", White ), false, false );
                AddHtml( 15, 100, 210, 20, Color( Right( owner ), White ), false, false );

                AddHtml( 15, 120, 210, 20, Color( "Name:", White ), false, false );
                AddHtml( 15, 120, 210, 20, Color( Right( houseName ), White ), false, false );

                AddHtml( 15, 140, 210, 20, Color( "Friends:", White ), false, false );
                AddHtml( 15, 140, 210, 20, Color( Right( sel.Friends.Count.ToString() ), White ), false, false );

                AddHtml( 15, 160, 210, 20, Color( "Co-Owners:", White ), false, false );
                AddHtml( 15, 160, 210, 20, Color( Right( sel.CoOwners.Count.ToString() ), White ), false, false );

                AddHtml( 15, 180, 210, 20, Color( "Bans:", White ), false, false );
                AddHtml( 15, 180, 210, 20, Color( Right( sel.Bans.Count.ToString() ), White ), false, false );

                AddHtml( 15, 200, 210, 20, Color( "Decays:", White ), false, false );
                AddHtml( 15, 200, 210, 20, Color( Right( sel.CanDecay ? "Yes" : "No" ), White ), false, false );

                AddHtml( 15, 220, 210, 20, Color( "Decay Level:", White ), false, false );
                AddHtml( 15, 220, 210, 20, Color( Right( sel.DecayLevel.ToString() ), White ), false, false );

                AddButton( 15, 245, 4005, 4007, 1, GumpButtonType.Reply, 0 );
                AddHtml( 50, 245, 120, 20, Color( "Go to house", White ), false, false );

                AddButton( 15, 265, 4005, 4007, 2, GumpButtonType.Reply, 0 );
                AddHtml( 50, 265, 120, 20, Color( "Open house menu", White ), false, false );

                AddButton( 15, 285, 4005, 4007, 3, GumpButtonType.Reply, 0 );
                AddHtml( 50, 285, 120, 20, Color( "Demolish house", White ), false, false );

                AddButton( 15, 305, 4005, 4007, 4, GumpButtonType.Reply, 0 );
                AddHtml( 50, 305, 120, 20, Color( "Refresh house", White ), false, false );
            }
        }
Ejemplo n.º 10
0
            protected override void OnTarget(Mobile from, object target)
            {
                bool done = false;

                if (!(target is Item))
                {
                    from.SendMessage("You can only transmute items.");
                    return;
                }

                t_item = (Item)target;

                if (t_item is BaseArmor || t_item is BaseWeapon)
                {
                    from.SendMessage("Select transmutation resource.");
                }
                else if (t_item is TransmutationStone)
                {
                    BaseHouse house = BaseHouse.FindHouseAt(m_Stone);
                    if (house != null && (house.IsOwner(from) || from.AccessLevel >= AccessLevel.GameMaster))
                    {
                        from.CloseGump(typeof(TStoneGump));
                        from.SendGump(new TStoneGump(m_Stone));
                    }
                }
                else
                {
                    from.SendMessage("You can only transmute armor and weapons.");
                    return;
                }

                if (t_item.IsChildOf(from.Backpack, true))
                {
                    if (t_item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)t_item;

                        switch (armor.Resource)
                        {
                        case CraftResource.Iron:
                        {
                            resource        = armor.Resource;
                            priceAdjustment = IronAdjustment;
                            break;
                        }

                        case CraftResource.DullCopper:
                        {
                            resource        = armor.Resource;
                            priceAdjustment = DullCopperAdjustment;
                            break;
                        }

                        case CraftResource.ShadowIron:
                        {
                            resource        = armor.Resource;
                            priceAdjustment = ShadowIronAdjustment;
                            break;
                        }

                        case CraftResource.Copper:
                        {
                            resource        = armor.Resource;
                            priceAdjustment = CopperAdjustment;
                            break;
                        }

                        case CraftResource.Bronze:
                        {
                            resource        = armor.Resource;
                            priceAdjustment = BronzeAdjustment;
                            break;
                        }

                        case CraftResource.Gold:
                        {
                            resource        = armor.Resource;
                            priceAdjustment = GoldAdjustment;
                            break;
                        }

                        case CraftResource.Agapite:
                        {
                            resource        = armor.Resource;
                            priceAdjustment = AgapiteAdjustment;
                            break;
                        }

                        case CraftResource.Verite:
                        {
                            resource        = armor.Resource;
                            priceAdjustment = VeriteAdjustment;
                            break;
                        }

                        case CraftResource.Valorite:
                        {
                            resource        = armor.Resource;
                            priceAdjustment = ValoriteAdjustment;
                            break;
                        }

                        default:
                        {
                            from.SendMessage("You can not transmute armor made with that resource.");
                            return;
                        }
                        }
                    }
                    else
                    {
                        BaseWeapon weapon = (BaseWeapon)t_item;

                        switch (weapon.Resource)
                        {
                        case CraftResource.Iron:
                        {
                            resource        = weapon.Resource;
                            priceAdjustment = IronAdjustment;
                            break;
                        }

                        case CraftResource.DullCopper:
                        {
                            resource        = weapon.Resource;
                            priceAdjustment = DullCopperAdjustment;
                            break;
                        }

                        case CraftResource.ShadowIron:
                        {
                            resource        = weapon.Resource;
                            priceAdjustment = ShadowIronAdjustment;
                            break;
                        }

                        case CraftResource.Copper:
                        {
                            resource        = weapon.Resource;
                            priceAdjustment = CopperAdjustment;
                            break;
                        }

                        case CraftResource.Bronze:
                        {
                            resource        = weapon.Resource;
                            priceAdjustment = BronzeAdjustment;
                            break;
                        }

                        case CraftResource.Gold:
                        {
                            resource        = weapon.Resource;
                            priceAdjustment = GoldAdjustment;
                            break;
                        }

                        case CraftResource.Agapite:
                        {
                            resource        = weapon.Resource;
                            priceAdjustment = AgapiteAdjustment;
                            break;
                        }

                        case CraftResource.Verite:
                        {
                            resource        = weapon.Resource;
                            priceAdjustment = VeriteAdjustment;
                            break;
                        }

                        case CraftResource.Valorite:
                        {
                            resource        = weapon.Resource;
                            priceAdjustment = ValoriteAdjustment;
                            break;
                        }

                        default:
                        {
                            from.SendMessage("You can not transmute weapons made with that resource.");
                            return;
                        }
                        }
                    }
                    from.SendGump(new TransGump(from));
                }
                else
                {
                    from.SendMessage("The item must be in your backpack to transmute.");
                }
            }
Ejemplo n.º 11
0
        public HouseGump( HouseGumpPage page, Mobile from, BaseHouse house )
            : base(50, 40)
        {
            m_House = house;
            m_Page = page;

            from.CloseGump( typeof( HouseGump ) );
            //from.CloseGump( typeof( HouseListGump ) );
            //from.CloseGump( typeof( HouseRemoveGump ) );

            bool isCombatRestricted = house.IsCombatRestricted( from );

            bool isOwner = house.IsOwner( from );
            bool isCoOwner = isOwner || house.IsCoOwner( from );
            bool isFriend = isCoOwner || house.IsFriend( from );

            if ( isCombatRestricted )
            {
                isFriend = isCoOwner = isOwner = false;
            }

            AddPage( 0 );

            if ( isFriend || page == HouseGumpPage.Vendors )
            {
                AddBackground( 0, 0, 420, page != HouseGumpPage.Vendors ? 440 : 420, 5054 );

                AddImageTiled( 10, 10, 400, 100, 2624 );
                AddAlphaRegion( 10, 10, 400, 100 );

                AddImageTiled( 10, 120, 400, 260, 2624 );
                AddAlphaRegion( 10, 120, 400, 260 );

                AddImageTiled( 10, 390, 400, page != HouseGumpPage.Vendors ? 40 : 20, 2624 );
                AddAlphaRegion( 10, 390, 400, page != HouseGumpPage.Vendors ? 40 : 20 );

                AddButtonLabeled( 250, page != HouseGumpPage.Vendors ? 410 : 390, 0, 1060675 ); // CLOSE
            }

            AddImage( 10, 10, 100 );

            if ( m_House.Sign != null )
            {
                ArrayList lines = Wrap( m_House.Sign.Name );

                if ( lines != null )
                {
                    for ( int i = 0, y = ( 114 - ( lines.Count * 14 ) ) / 2; i < lines.Count; ++i, y += 14 )
                    {
                        string s = (string) lines[i];

                        AddLabel( 10 + ( ( 160 - ( s.Length * 8 ) ) / 2 ), y, 0, s );
                    }
                }
            }

            if ( page == HouseGumpPage.Vendors )
            {
                AddHtmlLocalized( 10, 120, 400, 20, 1062428, LabelColor, false, false ); // <CENTER>SHOPS</CENTER>

                AddList( house.AvailableVendorsFor( from ), 1, false, false, from );
                return;
            }

            if ( !isFriend )
            {
                return;
            }

            if ( house.Public )
            {
                AddButtonLabeled( 10, 390, GetButtonID( 0, 0 ), 1060674 ); // Banish
                AddButtonLabeled( 10, 410, GetButtonID( 0, 1 ), 1011261 ); // Lift a Ban
            }
            else
            {
                AddButtonLabeled( 10, 390, GetButtonID( 0, 2 ), 1060676 ); // Grant Access
                AddButtonLabeled( 10, 410, GetButtonID( 0, 3 ), 1060677 ); // Revoke Access
            }

            AddPageButton( 150, 10, GetButtonID( 1, 0 ), 1060668, HouseGumpPage.Information );
            AddPageButton( 150, 30, GetButtonID( 1, 1 ), 1060669, HouseGumpPage.Security );
            AddPageButton( 150, 50, GetButtonID( 1, 2 ), 1060670, HouseGumpPage.Storage );
            AddPageButton( 150, 70, GetButtonID( 1, 3 ), 1060671, HouseGumpPage.Customize );
            AddPageButton( 150, 90, GetButtonID( 1, 4 ), 1060672, HouseGumpPage.Ownership );

            switch ( page )
            {
                case HouseGumpPage.Information:
                    {
                        AddHtmlLocalized( 20, 130, 200, 20, 1011242, LabelColor, false, false ); // Owned By:
                        AddLabel( 210, 130, LabelHue, GetOwnerName() );

                        AddHtmlLocalized( 20, 170, 380, 20, 1018032, SelectedColor, false, false ); // This house is properly placed.
                        AddHtmlLocalized( 20, 190, 380, 20, 1018035, SelectedColor, false, false ); // This house is of modern design.
                        AddHtmlLocalized( 20, 210, 380, 20, ( house is HouseFoundation ) ? 1060681 : 1060680, SelectedColor, false, false ); // This is a (pre | custom)-built house.
                        AddHtmlLocalized( 20, 230, 380, 20, house.Public ? 1060678 : 1060679, SelectedColor, false, false ); // This house is (private | open to the public).

                        switch ( house.DecayType )
                        {
                            case DecayType.Ageless:
                            case DecayType.AutoRefresh:
                                {
                                    AddHtmlLocalized( 20, 250, 380, 20, 1062209, SelectedColor, false, false ); // This house is <a href = "?ForceTopic97">Automatically</a> refreshed.
                                    break;
                                }
                            case DecayType.ManualRefresh:
                                {
                                    AddHtmlLocalized( 20, 250, 380, 20, 1062208, SelectedColor, false, false ); // This house is <a href = "?ForceTopic97">Grandfathered</a>.
                                    break;
                                }
                            case DecayType.Condemned:
                                {
                                    AddHtmlLocalized( 20, 250, 380, 20, 1062207, SelectedColor, false, false ); // This house is <a href = "?ForceTopic97">Condemned</a>.
                                    break;
                                }
                        }

                        AddHtmlLocalized( 20, 290, 200, 20, 1060692, SelectedColor, false, false ); // Built On:
                        AddLabel( 250, 290, LabelHue, GetDateTime( house.BuiltOn ) );

                        AddHtmlLocalized( 20, 310, 200, 20, 1060693, SelectedColor, false, false ); // Last Traded:
                        AddLabel( 250, 310, LabelHue, GetDateTime( house.LastTraded ) );

                        AddHtmlLocalized( 20, 330, 200, 20, 1061793, SelectedColor, false, false ); // House Value
                        AddLabel( 250, 330, LabelHue, house.Price.ToString() );

                        AddHtmlLocalized( 20, 360, 300, 20, 1011241, SelectedColor, false, false ); // Number of visits this building has had:
                        AddLabel( 350, 360, LabelHue, house.Visits.ToString() );

                        break;
                    }
                case HouseGumpPage.Security:
                    {
                        AddButtonLabeled( 10, 130, GetButtonID( 3, 0 ), 1011266, isCoOwner ); // View Co-Owner List
                        AddButtonLabeled( 10, 150, GetButtonID( 3, 1 ), 1011267, isOwner ); // Add a Co-Owner
                        AddButtonLabeled( 10, 170, GetButtonID( 3, 2 ), 1018036, isOwner ); // Remove a Co-Owner
                        AddButtonLabeled( 10, 190, GetButtonID( 3, 3 ), 1011268, isOwner ); // Clear Co-Owner List

                        AddButtonLabeled( 10, 220, GetButtonID( 3, 4 ), 1011243 ); // View Friends List
                        AddButtonLabeled( 10, 240, GetButtonID( 3, 5 ), 1011244, isCoOwner ); // Add a Friend
                        AddButtonLabeled( 10, 260, GetButtonID( 3, 6 ), 1018037, isCoOwner ); // Remove a Friend
                        AddButtonLabeled( 10, 280, GetButtonID( 3, 7 ), 1011245, isCoOwner ); // Clear Friend List

                        if ( house.Public )
                        {
                            AddButtonLabeled( 10, 310, GetButtonID( 3, 8 ), 1011260 ); // View Ban List
                            AddButtonLabeled( 10, 330, GetButtonID( 3, 9 ), 1060698 ); // Clear Ban List

                            AddButtonLabeled( 210, 130, GetButtonID( 3, 12 ), 1060695, isOwner ); // Change to Private

                            AddHtmlLocalized( 245, 150, 240, 20, 1060694, SelectedColor, false, false ); // Change to Public
                        }
                        else
                        {
                            AddButtonLabeled( 10, 310, GetButtonID( 3, 10 ), 1060699 ); // View Access List
                            AddButtonLabeled( 10, 330, GetButtonID( 3, 11 ), 1060700 ); // Clear Access List

                            AddHtmlLocalized( 245, 130, 240, 20, 1060695, SelectedColor, false, false ); // Change to Private

                            AddButtonLabeled( 210, 150, GetButtonID( 3, 13 ), 1060694, isOwner ); // Change to Public
                        }

                        break;
                    }
                case HouseGumpPage.Storage:
                    {
                        AddHtmlLocalized( 10, 130, 400, 20, 1060682, LabelColor, false, false ); // <CENTER>HOUSE STORAGE SUMMARY</CENTER>

                        // This is not as OSI; storage changes not yet implemented

                        /*
                        AddHtmlLocalized( 10, 170, 275, 20, 1011237, LabelColor, false, false ); // Number of locked down items:
                        AddLabel( 310, 170, LabelHue, m_House.LockDownCount.ToString() );

                        AddHtmlLocalized( 10, 190, 275, 20, 1011238, LabelColor, false, false ); // Maximum locked down items:
                        AddLabel( 310, 190, LabelHue, m_House.MaxLockDowns.ToString() );

                        AddHtmlLocalized( 10, 210, 275, 20, 1011239, LabelColor, false, false ); // Number of secure containers:
                        AddLabel( 310, 210, LabelHue, m_House.SecureCount.ToString() );

                        AddHtmlLocalized( 10, 230, 275, 20, 1011240, LabelColor, false, false ); // Maximum number of secure containers:
                        AddLabel( 310, 230, LabelHue, m_House.MaxSecures.ToString() );
                        */

                        int fromSecures, fromVendors, fromLockdowns, fromMovingCrate;

                        int maxSecures = house.GetAosMaxSecures();
                        int curSecures = house.GetAosCurSecures( out fromSecures, out fromVendors, out fromLockdowns, out fromMovingCrate );

                        int maxLockdowns = house.GetAosMaxLockdowns();
                        int curLockdowns = house.GetAosCurLockdowns();

                        AddHtmlLocalized( 10, 170, 300, 20, 1060683, LabelColor, false, false ); // Maximum Secure Storage
                        AddLabel( 310, 170, LabelHue, maxSecures.ToString() );

                        AddHtmlLocalized( 10, 190, 300, 20, 1060685, LabelColor, false, false ); // Used by Moving Crate
                        AddLabel( 310, 190, LabelHue, fromMovingCrate.ToString() );

                        AddHtmlLocalized( 10, 210, 300, 20, 1060686, LabelColor, false, false ); // Used by Lockdowns
                        AddLabel( 310, 210, LabelHue, fromLockdowns.ToString() );

                        AddHtmlLocalized( 10, 230, 300, 20, 1060688, LabelColor, false, false ); // Used by Secure Containers
                        AddLabel( 310, 230, LabelHue, fromSecures.ToString() );

                        AddHtmlLocalized( 10, 250, 300, 20, 1060689, LabelColor, false, false ); // Available Storage
                        AddLabel( 310, 250, LabelHue, Math.Max( maxSecures - curSecures, 0 ).ToString() );

                        AddHtmlLocalized( 10, 290, 300, 20, 1060690, LabelColor, false, false ); // Maximum Lockdowns
                        AddLabel( 310, 290, LabelHue, maxLockdowns.ToString() );

                        AddHtmlLocalized( 10, 310, 300, 20, 1060691, LabelColor, false, false ); // Available Lockdowns
                        AddLabel( 310, 310, LabelHue, Math.Max( maxLockdowns - curLockdowns, 0 ).ToString() );

                        int maxVendors = house.GetNewVendorSystemMaxVendors();
                        int vendors = house.PlayerVendors.Count + house.VendorRentalContracts.Count;

                        AddHtmlLocalized( 10, 350, 300, 20, 1062391, LabelColor, false, false ); // Vendor Count
                        AddLabel( 310, 350, LabelHue, vendors.ToString() + " / " + maxVendors.ToString() );

                        break;
                    }
                case HouseGumpPage.Customize:
                    {
                        bool isCustomizable = isOwner && ( house is HouseFoundation );

                        AddButtonLabeled( 10, 120, GetButtonID( 5, 0 ), 1060759, isOwner && !isCustomizable && ( house.ConvertEntry != null ) ); // Convert Into Customizable House
                        AddButtonLabeled( 10, 160, GetButtonID( 5, 1 ), 1060765, isOwner && isCustomizable ); // Customize This House
                        AddButtonLabeled( 10, 180, GetButtonID( 5, 2 ), 1060760, isOwner && house.MovingCrate != null ); // Relocate Moving Crate
                        AddButtonLabeled( 10, 210, GetButtonID( 5, 3 ), 1060761, isOwner && house.Public ); // Change House Sign
                        AddButtonLabeled( 10, 230, GetButtonID( 5, 4 ), 1060762, isOwner && isCustomizable ); // Change House Sign Hanger
                        AddButtonLabeled( 10, 250, GetButtonID( 5, 5 ), 1060763, isOwner && isCustomizable && ( ( (HouseFoundation) house ).Signpost != null ) ); // Change Signpost
                        AddButtonLabeled( 10, 280, GetButtonID( 5, 6 ), 1062004, isOwner && isCustomizable ); // Change Foundation Style
                        AddButtonLabeled( 10, 310, GetButtonID( 5, 7 ), 1060764, isCoOwner ); // Rename House

                        break;
                    }
                case HouseGumpPage.Ownership:
                    {
                        bool isCustomizable = isOwner && ( house is HouseFoundation );

                        AddButtonLabeled( 10, 130, GetButtonID( 6, 0 ), 1061794, isOwner && house.MovingCrate == null ); // Demolish House
                        AddButtonLabeled( 10, 150, GetButtonID( 6, 1 ), 1061797, isOwner ); // Trade House
                        AddButtonLabeled( 10, 190, GetButtonID( 6, 2 ), 1061798, false ); // Make Primary

                        break;
                    }
                case HouseGumpPage.ChangeHanger:
                    {
                        for ( int i = 0; i < m_HangerNumbers.Length; ++i )
                        {
                            int x = 50 + ( ( i % 3 ) * 100 );
                            int y = 180 + ( ( i / 3 ) * 80 );

                            AddButton( x, y, 4005, 4007, GetButtonID( 7, i ), GumpButtonType.Reply, 0 );
                            AddItem( x + 20, y, m_HangerNumbers[i] );
                        }

                        break;
                    }
                case HouseGumpPage.ChangeFoundation:
                    {
                        int[] foundationNumbers = m_FoundationNumbers;

                        for ( int i = 0; i < foundationNumbers.Length; ++i )
                        {
                            int x = 15 + ( ( i % 5 ) * 80 );
                            int y = 150 + ( ( i / 5 ) * 80 );

                            AddButton( x, y, 4005, 4007, GetButtonID( 8, i ), GumpButtonType.Reply, 0 );
                            AddItem( x + 25, y, foundationNumbers[i] );
                        }

                        break;
                    }
                case HouseGumpPage.ChangeSign:
                    {
                        int index = 0;

                        for ( int i = 0; i < 3; ++i )
                        {
                            AddPage( i + 1 );

                            AddButton( 10, 360, 4005, 4007, 0, GumpButtonType.Page, ( ( i + 1 ) % 3 ) + 1 );

                            for ( int j = 0; j < 18; ++j )
                            {
                                int x = 30 + ( ( j % 6 ) * 60 );
                                int y = 130 + ( ( j / 6 ) * 60 );

                                AddButton( x, y, 4005, 4007, GetButtonID( 9, index ), GumpButtonType.Reply, 0 );
                                AddItem( x + 20, y, 2980 + ( index++ * 2 ) );
                            }
                        }

                        break;
                    }
                case HouseGumpPage.RemoveCoOwner:
                    {
                        AddHtmlLocalized( 10, 120, 400, 20, 1060730, LabelColor, false, false ); // <CENTER>CO-OWNER LIST</CENTER>
                        AddList( house.CoOwners, 10, false, true, from );
                        break;
                    }
                case HouseGumpPage.ListCoOwner:
                    {
                        AddHtmlLocalized( 10, 120, 400, 20, 1060730, LabelColor, false, false ); // <CENTER>CO-OWNER LIST</CENTER>
                        AddList( house.CoOwners, -1, false, true, from );
                        break;
                    }
                case HouseGumpPage.RemoveFriend:
                    {
                        AddHtmlLocalized( 10, 120, 400, 20, 1060731, LabelColor, false, false ); // <CENTER>FRIENDS LIST</CENTER>
                        AddList( house.Friends, 11, false, true, from );
                        break;
                    }
                case HouseGumpPage.ListFriend:
                    {
                        AddHtmlLocalized( 10, 120, 400, 20, 1060731, LabelColor, false, false ); // <CENTER>FRIENDS LIST</CENTER>
                        AddList( house.Friends, -1, false, true, from );
                        break;
                    }
                case HouseGumpPage.RemoveBan:
                    {
                        AddHtmlLocalized( 10, 120, 400, 20, 1060733, LabelColor, false, false ); // <CENTER>BAN LIST</CENTER>
                        AddList( house.Bans, 12, true, true, from );
                        break;
                    }
                case HouseGumpPage.ListBan:
                    {
                        AddHtmlLocalized( 10, 120, 400, 20, 1060733, LabelColor, false, false ); // <CENTER>BAN LIST</CENTER>
                        AddList( house.Bans, -1, true, true, from );
                        break;
                    }
                case HouseGumpPage.RemoveAccess:
                    {
                        AddHtmlLocalized( 10, 120, 400, 20, 1060732, LabelColor, false, false ); // <CENTER>ACCESS LIST</CENTER>
                        AddList( house.Access, 13, false, true, from );
                        break;
                    }
                case HouseGumpPage.ListAccess:
                    {
                        AddHtmlLocalized( 10, 120, 400, 20, 1060732, LabelColor, false, false ); // <CENTER>ACCESS LIST</CENTER>
                        AddList( house.Access, -1, false, true, from );
                        break;
                    }
                case HouseGumpPage.ChangePost:
                    {
                        int index = 0;

                        for ( int i = 0; i < 2; ++i )
                        {
                            AddPage( i + 1 );

                            AddButton( 10, 360, 4005, 4007, 0, GumpButtonType.Page, ( ( i + 1 ) % 2 ) + 1 );

                            for ( int j = 0; j < 16 && index < m_PostNumbers.Length; ++j )
                            {
                                int x = 15 + ( ( j % 8 ) * 50 );
                                int y = 130 + ( ( j / 8 ) * 110 );

                                AddButton( x, y, 4005, 4007, GetButtonID( 14, index ), GumpButtonType.Reply, 0 );
                                AddItem( x + 10, y, m_PostNumbers[index++] );
                            }
                        }

                        break;
                    }
            }
        }
Ejemplo n.º 12
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.HasAccountHouse(from))
            {
                from.SendLocalizedMessage(501271); // You already own a house, you may not place another!
            }
            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;
                }
                }
            }
        }
Ejemplo n.º 13
0
        public SecureTarget( bool release, BaseHouse house )
            : base(12, false, TargetFlags.None)
        {
            CheckLOS = false;

            m_Release = release;
            m_House = house;
        }
Ejemplo n.º 14
0
        public static HousePlacementEntry Find( BaseHouse house )
        {
            object obj = m_Table[house.GetType()];

            if ( obj is HousePlacementEntry )
            {
                return ( (HousePlacementEntry) obj );
            }
            else if ( obj is ArrayList )
            {
                ArrayList list = (ArrayList) obj;

                for ( int i = 0; i < list.Count; ++i )
                {
                    HousePlacementEntry e = (HousePlacementEntry) list[i];

                    if ( e.m_MultiID == ( house.ItemID & TileData.MaxItemValue ) )
                    {
                        return e;
                    }
                }
            }
            else if ( obj is Hashtable )
            {
                Hashtable table = (Hashtable) obj;

                obj = table[house.ItemID & TileData.MaxItemValue];

                if ( obj is HousePlacementEntry )
                {
                    return (HousePlacementEntry) obj;
                }
            }

            return null;
        }
Ejemplo n.º 15
0
        public HouseOwnerTarget( BaseHouse house )
            : base(12, false, TargetFlags.None)
        {
            CheckLOS = false;

            m_House = house;
        }
Ejemplo n.º 16
0
        public HouseKickTarget( BaseHouse house )
            : base(-1, false, TargetFlags.None)
        {
            CheckLOS = false;

            m_House = house;
        }
Ejemplo n.º 17
0
        public HouseFriendTarget( bool add, BaseHouse house )
            : base(12, false, TargetFlags.None)
        {
            CheckLOS = false;

            m_House = house;
            m_Add = add;
        }
Ejemplo n.º 18
0
        public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
        {
            if (!CheckHold(from, item, true, true))
            {
                return(false);
            }

            if (item.QuestItem && from.Backpack != this)
            {
                from.SendLocalizedMessage(1074769); // An item must be in your backpack (and not in a container within) to be toggled as a quest item.
                return(false);
            }

            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house != null && house.IsLockedDown(this))
            {
                if (item is VendorRentalContract || (item is Container && ((Container)item).FindItemByType(typeof(VendorRentalContract)) != null))
                {
                    from.SendLocalizedMessage(1062492); // You cannot place a rental contract in a locked down container.
                    return(false);
                }

                if (!house.LockDown(from, item, false))
                {
                    return(false);
                }
            }

            item.Location = new Point3D(p.X, p.Y, 0);

            AddItem(item);

            from.SendSound(GetDroppedSound(item), GetWorldLocation());

            ItemFlags.SetTaken(item, true);

            if (item.HonestyItem && item.HonestyPickup == DateTime.MinValue)
            {
                item.HonestyPickup = DateTime.UtcNow;
                item.StartHonestyTimer();

                if (item.HonestyOwner == null)
                {
                    Server.Services.Virtues.HonestyVirtue.AssignOwner(item);
                }

                from.SendLocalizedMessage(1151536); // You have three hours to turn this item in for Honesty credit, otherwise it will cease to be a quest item.
            }

            if (Siege.SiegeShard && this != from.Backpack && from is PlayerMobile && ((PlayerMobile)from).BlessedItem != null && ((PlayerMobile)from).BlessedItem == item)
            {
                ((PlayerMobile)from).BlessedItem = null;
                item.LootType = LootType.Regular;

                from.SendLocalizedMessage(1075292, item.Name != null ? item.Name : "#" + item.LabelNumber.ToString()); // ~1_NAME~ has been unblessed.
            }

            if (!EnchantedHotItem.CheckDrop(from, this, item))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 19
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                    {
                        m_Owner = reader.ReadMobile();
                        m_House = reader.ReadItem() as BaseHouse;

                        break;
                    }
            }

            Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( Validate ) );
        }
Ejemplo n.º 20
0
        public bool IsOwner(Mobile mob)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            return(house != null && house.IsOwner(mob));
        }
Ejemplo n.º 21
0
        public static void ProcessResponse( Mobile from, BaseHouse house, int type, int index, ArrayList vendorList, HouseGumpPage page )
        {
            if ( house.Deleted )
                return;

            bool isCombatRestricted = house.IsCombatRestricted( from );

            bool isOwner = house.IsOwner( from );
            bool isCoOwner = isOwner || house.IsCoOwner( from );
            bool isFriend = isCoOwner || house.IsFriend( from );

            if ( isCombatRestricted )
                isFriend = isCoOwner = isFriend = false;

            if ( !from.CheckAlive() )
                return;

            Item sign = house.Sign;

            if ( sign == null || from.Map != sign.Map || !from.InRange( sign.GetWorldLocation(), 18 ) )
                return;

            HouseFoundation foundation = house as HouseFoundation;
            bool isCustomizable = ( foundation != null );

            if ( page == HouseGumpPage.Vendors )
            {
                if ( index >= 0 && index < vendorList.Count )
                {
                    PlayerVendor vendor = (PlayerVendor) vendorList[index];

                    if ( !vendor.CanInteractWith( from, false ) )
                        return;

                    if ( from.Map != sign.Map || !from.InRange( sign, 5 ) )
                        from.SendLocalizedMessage( 1062429 ); // You must be within five paces of the house sign to use this option.
                    else if ( vendor.IsOwner( from ) )
                        vendor.SendOwnerGump( from );
                    else
                        vendor.OpenBackpack( from );
                }

                return;
            }

            if ( !isFriend )
                return;

            switch ( type )
            {
                case 0:
                    {
                        switch ( index )
                        {
                            case 0: // Banish
                                {
                                    if ( house.Public )
                                    {
                                        from.SendLocalizedMessage( 501325 ); // Target the individual to ban from this house.
                                        from.Target = new HouseBanTarget( true, house );
                                    }

                                    break;
                                }
                            case 1: // Lift Ban
                                {
                                    if ( house.Public )
                                        from.SendGump( new HouseGump( HouseGumpPage.RemoveBan, from, house ) );

                                    break;
                                }
                            case 2: // Grant Access
                                {
                                    if ( !house.Public )
                                    {
                                        from.SendLocalizedMessage( 1060711 ); // Target the person you would like to grant access to.
                                        from.Target = new HouseAccessTarget( house );
                                    }

                                    break;
                                }
                            case 3: // Revoke Access
                                {
                                    if ( !house.Public )
                                        from.SendGump( new HouseGump( HouseGumpPage.RemoveAccess, from, house ) );

                                    break;
                                }
                        }

                        break;
                    }
                case 1:
                    {
                        HouseGumpPage gpage;

                        switch ( index )
                        {
                            case 0:
                                gpage = HouseGumpPage.Information;
                                break;
                            case 1:
                                gpage = HouseGumpPage.Security;
                                break;
                            case 2:
                                gpage = HouseGumpPage.Storage;
                                break;
                            case 3:
                                gpage = HouseGumpPage.Customize;
                                break;
                            case 4:
                                gpage = HouseGumpPage.Ownership;
                                break;
                            default:
                                return;
                        }

                        from.SendGump( new HouseGump( gpage, from, house ) );
                        break;
                    }
                case 3:
                    {
                        switch ( index )
                        {
                            case 0: // View Co-Owner List
                                {
                                    if ( isCoOwner )
                                        from.SendGump( new HouseGump( HouseGumpPage.ListCoOwner, from, house ) );

                                    break;
                                }
                            case 1: // Add a Co-Owner
                                {
                                    if ( isOwner )
                                    {
                                        from.SendLocalizedMessage( 501328 ); // Target the person you wish to name a co-owner of your household.
                                        from.Target = new CoOwnerTarget( true, house );
                                    }

                                    break;
                                }
                            case 2: // Remove a Co-Owner
                                {
                                    if ( isOwner )
                                        from.SendGump( new HouseGump( HouseGumpPage.RemoveCoOwner, from, house ) );

                                    break;
                                }
                            case 3: // Clear Co-Owner List
                                {
                                    if ( isOwner )
                                        from.SendGump( new WarningGump( 1060635, 30720, 1060736, 32512, 420, 280, new WarningGumpCallback( ClearCoOwners_Callback ), house ) );

                                    break;
                                }
                            case 4: // View Friends List
                                {
                                    from.SendGump( new HouseGump( HouseGumpPage.ListFriend, from, house ) );

                                    break;
                                }
                            case 5: // Add a Friend
                                {
                                    if ( isCoOwner )
                                    {
                                        from.SendLocalizedMessage( 501317 ); // Target the person you wish to name a friend of your household.
                                        from.Target = new HouseFriendTarget( true, house );
                                    }

                                    break;
                                }
                            case 6: // Remove a Friend
                                {
                                    if ( isCoOwner )
                                        from.SendGump( new HouseGump( HouseGumpPage.RemoveFriend, from, house ) );

                                    break;
                                }
                            case 7: // Clear Friend List
                                {
                                    if ( isCoOwner )
                                        from.SendGump( new WarningGump( 1060635, 30720, 1018039, 32512, 420, 280, new WarningGumpCallback( ClearFriends_Callback ), house ) );

                                    break;
                                }
                            case 8: // View Ban List
                                {
                                    from.SendGump( new HouseGump( HouseGumpPage.ListBan, from, house ) );

                                    break;
                                }
                            case 9: // Clear Ban List
                                {
                                    from.SendGump( new WarningGump( 1060635, 30720, 1060753, 32512, 420, 280, new WarningGumpCallback( ClearBans_Callback ), house ) );

                                    break;
                                }
                            case 10: // View Access List
                                {
                                    from.SendGump( new HouseGump( HouseGumpPage.ListAccess, from, house ) );

                                    break;
                                }
                            case 11: // Clear Access List
                                {
                                    from.SendGump( new WarningGump( 1060635, 30720, 1061842, 32512, 420, 280, new WarningGumpCallback( ClearAccess_Callback ), house ) );

                                    break;
                                }
                            case 12: // Make Private
                                {
                                    if ( isOwner )
                                    {
                                        if ( house.PlayerVendors.Count > 0 )
                                        {
                                            // You have vendors working out of this building. It cannot be declared private until there are no vendors in place.
                                            from.SendGump( new NoticeGump( 1060637, 30720, 501887, 32512, 320, 180, new NoticeGumpCallback( PublicPrivateNotice_Callback ), house ) );
                                            break;
                                        }

                                        if ( house.VendorRentalContracts.Count > 0 )
                                        {
                                            // You cannot currently take this action because you have vendor contracts locked down in your home.  You must remove them first.
                                            from.SendGump( new NoticeGump( 1060637, 30720, 1062351, 32512, 320, 180, new NoticeGumpCallback( PublicPrivateNotice_Callback ), house ) );
                                            break;
                                        }

                                        house.Public = false;

                                        house.ChangeLocks( from );

                                        // This house is now private.
                                        from.SendGump( new NoticeGump( 1060637, 30720, 501888, 32512, 320, 180, new NoticeGumpCallback( PublicPrivateNotice_Callback ), house ) );

                                        Region r = house.Region;
                                        List<Mobile> list = r.GetMobiles();

                                        for ( int i = 0; i < list.Count; ++i )
                                        {
                                            Mobile m = list[i];

                                            if ( !house.HasAccess( m ) && house.IsInside( m ) )
                                                m.Location = house.BanLocation;
                                        }
                                    }

                                    break;
                                }
                            case 13: // Make Public
                                {
                                    if ( isOwner )
                                    {
                                        house.Public = true;

                                        house.RemoveKeys( from );
                                        house.RemoveLocks();

                                        // This house is now public. The owner may now place vendors and vendor rental contracts.
                                        from.SendGump( new NoticeGump( 1060637, 30720, 501886, 32512, 320, 180, new NoticeGumpCallback( PublicPrivateNotice_Callback ), house ) );

                                        Region r = house.Region;
                                        List<Mobile> list = r.GetMobiles();

                                        for ( int i = 0; i < list.Count; ++i )
                                        {
                                            Mobile m = list[i];

                                            if ( house.IsBanned( m ) && house.IsInside( m ) )
                                                m.Location = house.BanLocation;
                                        }
                                    }

                                    break;
                                }
                        }

                        break;
                    }
                case 5:
                    {
                        switch ( index )
                        {
                            case 0: // Convert Into Customizable House
                                {
                                    if ( isOwner && !isCustomizable )
                                    {
                                        if ( house.HasRentedVendors )
                                        {
                                            // You cannot perform this action while you still have vendors rented out in this house.
                                            from.SendGump( new NoticeGump( 1060637, 30720, 1062395, 32512, 320, 180, new NoticeGumpCallback( CustomizeNotice_Callback ), house ) );
                                        }
                                        else
                                        {
                                            HousePlacementEntry e = house.ConvertEntry;

                                            if ( e != null )
                                            {
                                                /* You are about to turn your house into a customizable house.
                                                * You will be refunded the value of this house, and then be charged the cost of the equivalent customizable dirt lot.
                                                * All of your possessions in the house will be transported to a Moving Crate.
                                                * Deed-based house add-ons will be converted back into deeds.
                                                * Vendors and barkeeps will also be stored in the Moving Crate.
                                                * Your house will be leveled to its foundation, and you will be able to build new walls, windows, doors, and stairs.
                                                * Are you sure you wish to continue?
                                                */
                                                from.SendGump( new WarningGump( 1060635, 30720, 1060013, 32512, 420, 280, new WarningGumpCallback( ConvertHouse_Callback ), house ) );
                                            }
                                        }
                                    }

                                    break;
                                }
                            case 1: // Customize This House
                                {
                                    if ( isOwner && isCustomizable )
                                    {
                                        if ( house.HasRentedVendors )
                                        {
                                            // You cannot perform this action while you still have vendors rented out in this house.
                                            from.SendGump( new NoticeGump( 1060637, 30720, 1062395, 32512, 320, 180, new NoticeGumpCallback( CustomizeNotice_Callback ), house ) );
                                        }
                                        else
                                        {
                                            foundation.BeginCustomize( from );
                                        }
                                    }

                                    break;
                                }
                            case 2: // Relocate Moving Crate
                                {
                                    MovingCrate crate = house.MovingCrate;

                                    if ( isOwner && crate != null )
                                    {
                                        if ( !house.IsInside( from ) )
                                        {
                                            from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
                                        }
                                        else
                                        {
                                            crate.MoveToWorld( from.Location, from.Map );
                                            crate.RestartTimer();
                                        }
                                    }

                                    break;
                                }
                            case 3: // Change House Sign
                                {
                                    if ( isOwner && house.Public )
                                        from.SendGump( new HouseGump( HouseGumpPage.ChangeSign, from, house ) );

                                    break;
                                }
                            case 4: // Change House Sign Hanger
                                {
                                    if ( isOwner && isCustomizable )
                                        from.SendGump( new HouseGump( HouseGumpPage.ChangeHanger, from, house ) );

                                    break;
                                }
                            case 5: // Change Signpost
                                {
                                    if ( isOwner && isCustomizable && foundation.Signpost != null )
                                        from.SendGump( new HouseGump( HouseGumpPage.ChangePost, from, house ) );

                                    break;
                                }
                            case 6: // Change Foundation Style
                                {
                                    if ( isOwner && isCustomizable )
                                        from.SendGump( new HouseGump( HouseGumpPage.ChangeFoundation, from, house ) );

                                    break;
                                }
                            case 7: // Rename House
                                {
                                    if ( isCoOwner )
                                        from.Prompt = new RenamePrompt( house );

                                    break;
                                }
                        }

                        break;
                    }
                case 6:
                    {
                        switch ( index )
                        {
                            case 0: // Demolish
                                {
                                    if ( isOwner && house.MovingCrate == null )
                                    {
                                        if ( house.FindGuildstone() != null )
                                            from.SendLocalizedMessage( 501389 ); // You cannot redeed a house with a guildstone inside.
                                        else
                                            from.SendGump( new HouseDemolishGump( from, house ) );
                                    }

                                    break;
                                }
                            case 1: // Trade House
                                {
                                    if ( isOwner )
                                    {
                                        if ( house.HasPersonalVendors )
                                        {
                                            from.SendLocalizedMessage( 1062467 ); // You cannot trade this house while you still have personal vendors inside.
                                        }
                                        else if ( house.DecayLevel == DecayLevel.DemolitionPending )
                                        {
                                            from.SendLocalizedMessage( 1005321 ); // This house has been marked for demolition, and it cannot be transferred.
                                        }
                                        else
                                        {
                                            from.SendLocalizedMessage( 501309 ); // Target the person to whom you wish to give this house.
                                            from.Target = new HouseOwnerTarget( house );
                                        }
                                    }

                                    break;
                                }
                            case 2: // Make Primary
                                {
                                    break;
                                }
                        }

                        break;
                    }
                case 7:
                    {
                        if ( isOwner && isCustomizable && index >= 0 && index < m_HangerNumbers.Length )
                        {
                            Item hanger = foundation.SignHanger;

                            if ( hanger != null )
                                hanger.ItemID = m_HangerNumbers[index];

                            from.SendGump( new HouseGump( HouseGumpPage.Customize, from, house ) );
                        }

                        break;
                    }
                case 8:
                    {
                        if ( isOwner && isCustomizable )
                        {
                            FoundationType newType;

                            switch ( index )
                            {
                                case 0:
                                    newType = FoundationType.DarkWood;
                                    break;
                                case 1:
                                    newType = FoundationType.LightWood;
                                    break;
                                case 2:
                                    newType = FoundationType.Dungeon;
                                    break;
                                case 3:
                                    newType = FoundationType.Brick;
                                    break;
                                case 4:
                                    newType = FoundationType.Stone;
                                    break;
                                case 5:
                                    newType = FoundationType.ElvenStone;
                                    break;
                                case 6:
                                    newType = FoundationType.ElvenWood;
                                    break;
                                case 7:
                                    newType = FoundationType.ElvenSimple;
                                    break;
                                case 8:
                                    newType = FoundationType.ElvenPlain;
                                    break;
                                case 9:
                                    newType = FoundationType.Crystal;
                                    break;
                                case 10:
                                    newType = FoundationType.Shadow;
                                    break;
                                case 11:
                                    newType = FoundationType.GargishGreenMarble;
                                    break;
                                case 12:
                                    newType = FoundationType.GargishTwoToneStone;
                                    break;
                                default:
                                    return;
                            }

                            foundation.Type = newType;

                            DesignState state = foundation.BackupState;
                            HouseFoundation.ApplyFoundation( newType, state.Components );
                            state.OnRevised();

                            state = foundation.DesignState;
                            HouseFoundation.ApplyFoundation( newType, state.Components );
                            state.OnRevised();

                            state = foundation.CurrentState;
                            HouseFoundation.ApplyFoundation( newType, state.Components );
                            state.OnRevised();

                            foundation.Delta( ItemDelta.Update );

                            from.SendGump( new HouseGump( HouseGumpPage.Customize, from, house ) );
                        }

                        break;
                    }
                case 9:
                    {
                        if ( isOwner && house.Public && index >= 0 && index < 54 )
                        {
                            house.ChangeSignType( 2980 + ( index * 2 ) );
                            from.SendGump( new HouseGump( HouseGumpPage.Customize, from, house ) );
                        }

                        break;
                    }
                case 10:
                    {
                        if ( isOwner && vendorList != null && index >= 0 && index < vendorList.Count )
                        {
                            house.RemoveCoOwner( from, (Mobile) vendorList[index] );

                            if ( house.CoOwners.Count > 0 )
                                from.SendGump( new HouseGump( HouseGumpPage.RemoveCoOwner, from, house ) );
                            else
                                from.SendGump( new HouseGump( HouseGumpPage.Security, from, house ) );
                        }

                        break;
                    }
                case 11:
                    {
                        if ( isCoOwner && vendorList != null && index >= 0 && index < vendorList.Count )
                        {
                            house.RemoveFriend( from, (Mobile) vendorList[index] );

                            if ( house.Friends.Count > 0 )
                                from.SendGump( new HouseGump( HouseGumpPage.RemoveFriend, from, house ) );
                            else
                                from.SendGump( new HouseGump( HouseGumpPage.Security, from, house ) );
                        }

                        break;
                    }
                case 12:
                    {
                        if ( vendorList != null && index >= 0 && index < vendorList.Count )
                        {
                            house.RemoveBan( from, (Mobile) vendorList[index] );

                            if ( house.Bans.Count > 0 )
                                from.SendGump( new HouseGump( HouseGumpPage.RemoveBan, from, house ) );
                            else
                                from.SendGump( new HouseGump( HouseGumpPage.Security, from, house ) );
                        }

                        break;
                    }
                case 13:
                    {
                        if ( vendorList != null && index >= 0 && index < vendorList.Count )
                        {
                            house.RemoveAccess( from, (Mobile) vendorList[index] );

                            if ( house.Access.Count > 0 )
                                from.SendGump( new HouseGump( HouseGumpPage.RemoveAccess, from, house ) );
                            else
                                from.SendGump( new HouseGump( HouseGumpPage.Security, from, house ) );
                        }

                        break;
                    }
                case 14:
                    {
                        if ( isOwner && isCustomizable && index >= 0 && index < m_PostNumbers.Length )
                        {
                            foundation.SignpostGraphic = m_PostNumbers[index];
                            foundation.CheckSignpost();

                            from.SendGump( new HouseGump( HouseGumpPage.Customize, from, house ) );
                        }

                        break;
                    }
            }
        }
Ejemplo n.º 22
0
        public static void PlayerWealth_OnCommand(CommandEventArgs e)
        {
            string             filename      = "playerwealth.html";
            List <AccountInfo> AccountWealth = new List <AccountInfo>();
            AccountInfo        A;

            A.GrandTotal = 0;
            WealthInfo backpack;
            WealthInfo bank;
            WealthInfo home;
            Mobile     m = null;

            if (e != null)
            {
                m = e.Mobile;
            }
            long   shardtotal          = 0;
            long   totalnotreportedamt = 0;
            uint   totalhomes          = 0;
            uint   totalnotreported    = 0;
            uint   totalaccounts       = 0;
            uint   totalchars          = 0;
            uint   totalvendors        = 0;
            double percent             = 0;

            foreach (Account a in Accounts.GetAccounts())
            {
                if (a != null && a.Username != null && a.AccessLevel == AccessLevel.Player)
                {
                    totalaccounts++;
                    A.acct               = a;
                    A.wealth.TotalGold   = 0;
                    A.wealth.TotalChecks = 0;
                    A.wealth.VendorGold  = 0;
                    backpack.TotalGold   = 0;
                    backpack.TotalChecks = 0;
                    bank.TotalGold       = 0;
                    bank.TotalChecks     = 0;
                    home.TotalGold       = 0;
                    home.TotalChecks     = 0;
                    home.VendorGold      = 0;
                    int money = 0;
                    for (int i = 0; i < a.Length; i++) // First record gold in player's bank/backpack
                    {
                        Mobile cm = a[i];

                        if (cm == null)
                        {
                            continue;
                        }
                        totalchars++;
                        if (cm.Backpack != null)
                        {
                            backpack = SearchContainer(cm.Backpack);
                        }
                        if (cm.BankBox != null)
                        {
                            bank = SearchContainer(cm.BankBox);
                        }
                        A.wealth.TotalGold   += backpack.TotalGold;
                        A.wealth.TotalChecks += backpack.TotalChecks;
                        A.wealth.TotalGold   += bank.TotalGold;
                        A.wealth.TotalChecks += bank.TotalChecks;

                        List <PlayerVendor> vendors = new List <PlayerVendor>();

                        foreach (Mobile mob in World.Mobiles.Values)
                        {
                            if (mob is PlayerVendor)
                            {
                                vendors.Add(mob as PlayerVendor);
                            }
                        }

                        for (int j = 0; j < vendors.Count; ++j)
                        {
                            if (vendors[j].Owner == cm)
                            {
                                money += vendors[j].HoldGold;
                                totalvendors++;
                            }
                        }
                    }
                    ArrayList allHouses = new ArrayList(2);
                    for (int i = 0; i < a.Length; ++i) // Now houses they own
                    {
                        Mobile mob = a[i];

                        if (mob != null)
                        {
                            allHouses.AddRange(BaseHouse.GetHouses(mob));
                        }
                    }
                    for (int i = 0; i < allHouses.Count; ++i)
                    {
                        BaseHouse house = (BaseHouse)allHouses[i];

                        totalhomes++;
                        foreach (IEntity entity in house.GetHouseEntities())
                        {
                            if (entity is Item && !((Item)entity).Deleted)
                            {
                                Item item = (Item)entity;
                                if (item is Gold)
                                {
                                    home.TotalGold += item.Amount;
                                }
                                else if (item is BankCheck)
                                {
                                    home.TotalChecks += ((BankCheck)item).Worth;
                                }
                                else if (item is Container)
                                {
                                    home = SearchContainer((Container)item, home);
                                }
                            }

                            /*else  // Vendors gold belongs to???? Let's skip this...
                             *                          {
                             *                          } */
                        }
                    }
                    A.wealth.TotalGold   += home.TotalGold;
                    A.wealth.TotalChecks += home.TotalChecks;
                    A.wealth.VendorGold  += money;
                    A.GrandTotal          = A.wealth.TotalGold + A.wealth.TotalChecks + A.wealth.VendorGold;
                    shardtotal           += A.GrandTotal;
                    if (A.GrandTotal < 10000)
                    {
                        totalnotreportedamt += A.GrandTotal;
                        totalnotreported++;
                    }
                    else
                    {
                        AccountWealth.Add(A);
                    }
                }
            }
            //AccountWealth.Sort(new SortArray());
            AccountWealth.Sort(delegate(AccountInfo a1, AccountInfo a2) { return(a2.GrandTotal.CompareTo(a1.GrandTotal)); });
            using (StreamWriter op = new StreamWriter(filename))
            {
                op.WriteLine("<html><body><strong>Player Wealth report generated on {0}</strong>", DateTime.Now);
                op.WriteLine("<br/><strong>Total Accounts: {0}</strong>", totalaccounts);
                op.WriteLine("<br/><strong>Total Characters: {0}</strong>", totalchars);
                op.WriteLine("<br/><strong>Total Houses: {0}</strong>", totalhomes);
                op.WriteLine("<br/><strong>Total Vendors: {0}</strong>", totalvendors);
                op.WriteLine("<br/><strong>Total Gold/Checks/Vendors: {0}</strong>", shardtotal.ToString("#,##0", new CultureInfo("en-US")));
                op.WriteLine("<br/><br/>");
                op.WriteLine("<table width=\"500\"  border=\"2\" bordercolor=\"#FFFFFF\" bgcolor=\"#DEB887\"<td colspan=\"5\"><div align=\"left\"><font color=\"#8B0000\" size=\"+2\"><strong>Player Wealth</strong></font></div></td>");
                op.WriteLine("<tr bgcolor=\"#667C3F\"><font color=\"#FFFFFF\" size=\"+1\"><td align=\"center\">Account</td><td width=\"100\" align=\"right\">Gold</td><td width=\"100\" align=\"right\">Checks</td><td width=\"100\" align=\"right\">Vendor(s)</td><td width=\"100\" align=\"right\">Total</td><td width=\"100\" align=\"right\">% of shard</td></tr></font>");
                int count = 0;
                foreach (AccountInfo ai in AccountWealth)
                {
                    count++;
                    percent = ai.GrandTotal / (double)shardtotal * 100.00f;
                    op.WriteLine("<tr bgcolor=\"#{6}\"><td align=\"left\"><pre>{7,-3} {0}</pre></td><td align=\"Right\">{1}</td><td align=\"Right\">{2}</td><td align=\"Right\">{3}</td><td align=\"Right\">{4}</td><td align=\"Right\">{5: ##0.00}%</td></tr></div>", ai.acct.Username, ai.wealth.TotalGold.ToString("#,##0", new CultureInfo("en-US")), ai.wealth.TotalChecks.ToString("#,##0", new CultureInfo("en-US")), ai.wealth.VendorGold.ToString("#,##0", new CultureInfo("en-US")), ai.GrandTotal.ToString("#,##0", new CultureInfo("en-US")), percent, percent > 0.70 ? (percent > 3.5 ? "DC143C" : (percent > 1.0 ? "B22222" : "F08080")) : (percent < 0.25 ? (percent < 0.01 ? "7FFFD4" : "90EE90") : "F0E68C"), count > 50 ? "   " : count + ".");
                }
                percent = totalnotreportedamt / (double)shardtotal * 100.00f;
                op.WriteLine("<tr bgcolor=\"#D3D3D3\"><td align=\"center\" colspan=\"3\">{0} accounts < 10000 not reported.</td><td align=\"Right\">{1: ##,###,###,##0}</td><td align=\"Right\">{2: ##0.00}%</td></tr>", totalnotreported, totalnotreportedamt, percent);
                op.WriteLine("</table></body></html>");
            }
            if (m != null)
            {
                m.SendMessage("Total accounts processed: {0}", totalaccounts);
            }
            else
            {
                Console.WriteLine("Player wealth report generated. Total accounts: {0}", totalaccounts);
            }
        }
Ejemplo n.º 23
0
            protected override void OnTarget(Mobile src, object targ)
            {
                bool foundAnyone = false;

                Point3D p;

                if (targ is Mobile)
                {
                    p = ((Mobile)targ).Location;
                }
                else if (targ is Item)
                {
                    p = ((Item)targ).Location;
                }
                else if (targ is IPoint3D)
                {
                    p = new Point3D((IPoint3D)targ);
                }
                else
                {
                    p = src.Location;
                }

                double srcSkill = src.Skills[SkillName.DetectHidden].Value;
                int    range    = Math.Max(2, (int)(srcSkill / 10.0));

                if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
                {
                    range /= 2;
                }

                BaseHouse house = BaseHouse.FindHouseAt(p, src.Map, 16);

                bool inHouse = house != null && house.IsFriend(src);

                if (inHouse)
                {
                    range = 22;
                }

                if (range > 0)
                {
                    IPooledEnumerable inRange = src.Map.GetMobilesInRange(p, range);

                    foreach (Mobile trg in inRange)
                    {
                        if (trg.Hidden && src != trg)
                        {
                            double ss         = srcSkill + Utility.Random(21) - 10;
                            double ts         = trg.Skills[SkillName.Hiding].Value + Utility.Random(21) - 10;
                            double shadow     = Server.Spells.SkillMasteries.ShadowSpell.GetDifficultyFactor(trg);
                            bool   houseCheck = inHouse && house.IsInside(trg);

                            if (src.AccessLevel >= trg.AccessLevel && (ss >= ts || houseCheck) && Utility.RandomDouble() > shadow)
                            {
                                if ((trg is ShadowKnight && (trg.X != p.X || trg.Y != p.Y)) ||
                                    (!houseCheck && !CanDetect(src, trg)))
                                {
                                    continue;
                                }

                                trg.RevealingAction();
                                trg.SendLocalizedMessage(500814); // You have been revealed!
                                trg.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500814, trg.NetState);
                                foundAnyone = true;
                            }
                        }
                    }

                    inRange.Free();

                    IPooledEnumerable itemsInRange = src.Map.GetItemsInRange(p, range);

                    foreach (Item item in itemsInRange)
                    {
                        if (item is LibraryBookcase && Server.Engines.Khaldun.GoingGumshoeQuest3.CheckBookcase(src, item))
                        {
                            foundAnyone = true;
                        }
                        else
                        {
                            if (!(item is IRevealableItem dItem) || (item.Visible && dItem.CheckWhenHidden))
                            {
                                continue;
                            }

                            if (dItem.CheckReveal(src))
                            {
                                dItem.OnRevealed(src);

                                foundAnyone = true;
                            }
                        }
                    }

                    itemsInRange.Free();
                }

                if (!foundAnyone)
                {
                    src.SendLocalizedMessage(500817); // You can see nothing hidden there.
                }
            }
Ejemplo n.º 24
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (!from.InRange(GetWorldLocation(), 2))
            {
                from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045);                   // I can't reach that.
            }
            else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends))
            {
                switch (m_CartType)
                {
                case MiningCartType.OreSouth:
                case MiningCartType.OreEast:
                    if (m_Ore > 0)
                    {
                        Item ingots = null;

                        switch (Utility.Random(9))
                        {
                        case 0: ingots = new IronIngot(); break;

                        case 1: ingots = new DullCopperIngot(); break;

                        case 2: ingots = new ShadowIronIngot(); break;

                        case 3: ingots = new CopperIngot(); break;

                        case 4: ingots = new BronzeIngot(); break;

                        case 5: ingots = new GoldIngot(); break;

                        case 6: ingots = new AgapiteIngot(); break;

                        case 7: ingots = new VeriteIngot(); break;

                        case 8: ingots = new ValoriteIngot(); break;
                        }

                        int amount = Math.Min(10, m_Ore);
                        ingots.Amount = amount;

                        if (!from.PlaceInBackpack(ingots))
                        {
                            ingots.Delete();
                            from.SendLocalizedMessage(1078837);                                       // Your backpack is full! Please make room and try again.
                        }
                        else
                        {
                            PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString());                                      // Ore: ~1_COUNT~
                            m_Ore -= amount;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1094725);                                   // There are no more resources available at this time.
                    }
                    break;

                case MiningCartType.GemSouth:
                case MiningCartType.GemEast:
                    if (m_Gems > 0)
                    {
                        Item gems = null;

                        switch (Utility.Random(15))
                        {
                        case 0: gems = new Amber(); break;

                        case 1: gems = new Amethyst(); break;

                        case 2: gems = new Citrine(); break;

                        case 3: gems = new Diamond(); break;

                        case 4: gems = new Emerald(); break;

                        case 5: gems = new Ruby(); break;

                        case 6: gems = new Sapphire(); break;

                        case 7: gems = new StarSapphire(); break;

                        case 8: gems = new Tourmaline(); break;

                        // Mondain's Legacy gems
                        case 9: gems = new PerfectEmerald(); break;

                        case 10: gems = new DarkSapphire(); break;

                        case 11: gems = new Turquoise(); break;

                        case 12: gems = new EcruCitrine(); break;

                        case 13: gems = new FireRuby(); break;

                        case 14: gems = new BlueDiamond(); break;
                        }

                        int amount = Math.Min(5, m_Gems);
                        gems.Amount = amount;

                        if (!from.PlaceInBackpack(gems))
                        {
                            gems.Delete();
                            from.SendLocalizedMessage(1078837);                                       // Your backpack is full! Please make room and try again.
                        }
                        else
                        {
                            PublicOverheadMessage(MessageType.Regular, 0, 1094723, amount.ToString());                                       // Gems: ~1_COUNT~
                            m_Gems -= amount;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1094725);                                   // There are no more resources available at this time.
                    }
                    break;
                }
            }
            else
            {
                from.SendLocalizedMessage(1061637);                   // You are not allowed to access this.
            }
        }
Ejemplo n.º 25
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int          page  = this.m_Page;
            Mobile       from  = this.m_From;
            BaseHouse    house = this.m_House;
            BasePlayerBB board = this.m_Board;

            if (house == null || !house.IsLockedDown(board))
            {
                from.SendLocalizedMessage(1062396); // This bulletin board must be locked down in a house to be usable.
                return;
            }
            else if (!from.InRange(board.GetWorldLocation(), 2) || !from.InLOS(board))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                return;
            }
            else if (!BasePlayerBB.CheckAccess(house, from))
            {
                from.SendLocalizedMessage(1062398); // You are not allowed to post to this bulletin board.
                return;
            }

            switch (info.ButtonID)
            {
            case 1:     // Post message
            {
                from.Prompt = new BasePlayerBB.PostPrompt(page, house, board, false);
                from.SendLocalizedMessage(1062397);         // Please enter your message:

                break;
            }

            case 2:     // Set title
            {
                if (house.IsOwner(from))
                {
                    from.Prompt = new BasePlayerBB.SetTitlePrompt(page, house, board);
                    from.SendLocalizedMessage(1062402);         // Enter new title:
                }

                break;
            }

            case 3:     // Post greeting
            {
                if (house.IsOwner(from))
                {
                    from.Prompt = new BasePlayerBB.PostPrompt(page, house, board, true);
                    from.SendLocalizedMessage(1062404);         // Enter new greeting (this will always be the first post):
                }

                break;
            }

            case 4:     // Scroll up
            {
                if (page == 0)
                {
                    page = board.Messages.Count;
                }
                else
                {
                    page -= 1;
                }

                from.SendGump(new PlayerBBGump(from, house, board, page));

                break;
            }

            case 5:     // Scroll down
            {
                page += 1;
                page %= board.Messages.Count + 1;

                from.SendGump(new PlayerBBGump(from, house, board, page));

                break;
            }

            case 6:     // Banish poster
            {
                if (house.IsOwner(from))
                {
                    if (page >= 1 && page <= board.Messages.Count)
                    {
                        PlayerBBMessage message = (PlayerBBMessage)board.Messages[page - 1];
                        Mobile          poster  = message.Poster;

                        if (poster == null)
                        {
                            from.SendGump(new PlayerBBGump(from, house, board, page));
                            return;
                        }

                        if (poster.IsStaff() && from.AccessLevel <= poster.AccessLevel)
                        {
                            from.SendLocalizedMessage(501354);         // Uh oh...a bigger boot may be required.
                        }
                        else if (house.IsFriend(poster))
                        {
                            from.SendLocalizedMessage(1060750);         // That person is a friend, co-owner, or owner of this house, and therefore cannot be banished!
                        }
                        else if (poster is PlayerVendor)
                        {
                            from.SendLocalizedMessage(501351);         // You cannot eject a vendor.
                        }
                        else if (house.Bans.Count >= BaseHouse.MaxBans)
                        {
                            from.SendLocalizedMessage(501355);         // The ban limit for this house has been reached!
                        }
                        else if (house.IsBanned(poster))
                        {
                            from.SendLocalizedMessage(501356);         // This person is already banned!
                        }
                        else if (poster is BaseCreature && ((BaseCreature)poster).NoHouseRestrictions)
                        {
                            from.SendLocalizedMessage(1062040);         // You cannot ban that.
                        }
                        else
                        {
                            if (!house.Bans.Contains(poster))
                            {
                                house.Bans.Add(poster);
                            }

                            from.SendLocalizedMessage(1062417);         // That person has been banned from this house.

                            if (house.IsInside(poster) && !BasePlayerBB.CheckAccess(house, poster))
                            {
                                poster.MoveToWorld(house.BanLocation, house.Map);
                            }
                        }
                    }

                    from.SendGump(new PlayerBBGump(from, house, board, page));
                }

                break;
            }

            case 7:     // Delete message
            {
                if (house.IsOwner(from))
                {
                    if (page >= 1 && page <= board.Messages.Count)
                    {
                        board.Messages.RemoveAt(page - 1);
                    }

                    from.SendGump(new PlayerBBGump(from, house, board, 0));
                }

                break;
            }

            case 8:     // Post props
            {
                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    PlayerBBMessage message = board.Greeting;

                    if (page >= 1 && page <= board.Messages.Count)
                    {
                        message = (PlayerBBMessage)board.Messages[page - 1];
                    }

                    from.SendGump(new PlayerBBGump(from, house, board, page));
                    from.SendGump(new PropertiesGump(from, message));
                }

                break;
            }
            }
        }
Ejemplo n.º 26
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendAsciiMessage("That must be in your pack for you to use it.");
            }
            else if (from.AccessLevel >= AccessLevel.GameMaster)
            {
                from.SendAsciiMessage("Your godly powers allow you to place this vendor whereever you wish.");

                Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from));

                v.Direction = from.Direction & Direction.Mask;
                v.MoveToWorld(from.Location, from.Map);

                v.SayTo(from, 503246);                   // Ah! it feels good to be working again.

                this.Delete();
            }
            else
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house == null)
                {
                    from.SendAsciiMessage("Vendors can only be placed in houses.");
                }
                else if (!BaseHouse.NewVendorSystem && !house.IsFriend(from))
                {
                    from.SendAsciiMessage("You must ask the owner of this building to name you a friend of the household in order to place a vendor here.");
                }
                else if (BaseHouse.NewVendorSystem && !house.IsOwner(from))
                {
                    from.SendAsciiMessage("Only the house owner can directly place vendors.  Please ask the house owner to offer you a vendor contract so that you may place a vendor in this house.");
                }
                else if (!house.Public || !house.CanPlaceNewVendor())
                {
                    from.SendAsciiMessage("You cannot place this vendor or barkeep.  Make sure the house is public and has sufficient storage available.");
                }
                else
                {
                    bool vendor, contract;
                    BaseHouse.IsThereVendor(from.Location, from.Map, out vendor, out contract);

                    if (vendor)
                    {
                        from.SendAsciiMessage("You cannot place a vendor or barkeep at this location.");
                    }
                    else if (contract)
                    {
                        from.SendAsciiMessage("You cannot place a vendor or barkeep on top of a rental contract!");
                    }
                    else
                    {
                        Mobile v = new PlayerVendor(from, house);

                        v.Direction = from.Direction & Direction.Mask;
                        v.MoveToWorld(from.Location, from.Map);

                        v.SayTo(from, 503246);                           // Ah! it feels good to be working again.

                        this.Delete();
                    }
                }
            }
        }
        public PlayerBBGump(Mobile from, BaseHouse house, BasePlayerBB board, int page) : base(50, 10)
        {
            from.CloseGump <PlayerBBGump>();

            m_Page  = page;
            m_From  = from;
            m_House = house;
            m_Board = board;

            AddPage(0);

            AddImage(30, 30, 5400);

            AddButton(393, 145, 2084, 2084, 4); // Scroll up
            AddButton(390, 371, 2085, 2085, 5); // Scroll down

            AddButton(32, 183, 5412, 5413, 1);  // Post message

            if (house.IsOwner(from))
            {
                AddButton(63, 90, 5601, 5605, 2);
                AddHtmlLocalized(81, 89, 230, 20, 1062400, LabelColor); // Set title

                AddButton(63, 109, 5601, 5605, 3);
                AddHtmlLocalized(81, 108, 230, 20, 1062401, LabelColor); // Post greeting
            }

            var title = board.Title;

            if (title != null)
            {
                AddHtml(183, 68, 180, 23, title);
            }

            AddHtmlLocalized(385, 89, 60, 20, 1062409, LabelColor); // Post

            AddLabel(440, 89, LabelHue, page.ToString());
            AddLabel(455, 89, LabelHue, "/");
            AddLabel(470, 89, LabelHue, board.Messages.Count.ToString());

            var message = board.Greeting;

            if (page >= 1 && page <= board.Messages.Count)
            {
                message = board.Messages[page - 1];
            }

            AddImageTiled(150, 220, 240, 1, 2700);               // Separator

            AddHtmlLocalized(150, 180, 100, 20, 1062405, 16715); // Posted On:
            AddHtmlLocalized(150, 200, 100, 20, 1062406, 16715); // Posted By:

            if (message != null)
            {
                AddHtml(255, 180, 150, 20, message.Time.ToString("yyyy-MM-dd HH:mm:ss"));

                var poster = message.Poster;
                var name   = (poster?.Name?.Trim()).DefaultIfNullOrEmpty("Someone");

                AddHtml(255, 200, 150, 20, name);

                AddHtml(150, 240, 250, 100, message.Message ?? "");

                if (message != board.Greeting && house.IsOwner(from))
                {
                    AddButton(130, 395, 1209, 1210, 6);
                    AddHtmlLocalized(150, 393, 150, 20, 1062410, LabelColor); // Banish Poster

                    AddButton(310, 395, 1209, 1210, 7);
                    AddHtmlLocalized(330, 393, 150, 20, 1062411, LabelColor); // Delete Message
                }

                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    AddButton(135, 242, 1209, 1210, 8); // Post props
                }
            }
        }
Ejemplo n.º 28
0
            public bool CheckAccess(Mobile m)
            {                   // Allow access if the player is owner of the house.
                BaseHouse house = BaseHouse.FindHouseAt(m);

                return(house != null && house.IsOwner(m));
            }
Ejemplo n.º 29
0
            public TransferItem( BaseHouse house )
                : base(0x14F0)
            {
                m_House = house;

                Hue = 0x480;
                Movable = false;
                Name = "a house transfer contract";
            }
Ejemplo n.º 30
0
        public PlayerBBGump(Mobile from, BaseHouse house, BasePlayerBB board, int page)
            : base(50, 10)
        {
            from.CloseGump(typeof(PlayerBBGump));

            this.m_Page  = page;
            this.m_From  = from;
            this.m_House = house;
            this.m_Board = board;

            this.AddPage(0);

            this.AddImage(30, 30, 5400);

            this.AddButton(393, 145, 2084, 2084, 4, GumpButtonType.Reply, 0); // Scroll up
            this.AddButton(390, 371, 2085, 2085, 5, GumpButtonType.Reply, 0); // Scroll down

            this.AddButton(32, 183, 5412, 5413, 1, GumpButtonType.Reply, 0);  // Post message

            if (house.IsOwner(from))
            {
                this.AddButton(63, 90, 5601, 5605, 2, GumpButtonType.Reply, 0);
                this.AddHtmlLocalized(81, 89, 230, 20, 1062400, LabelColor, false, false); // Set title

                this.AddButton(63, 109, 5601, 5605, 3, GumpButtonType.Reply, 0);
                this.AddHtmlLocalized(81, 108, 230, 20, 1062401, LabelColor, false, false); // Post greeting
            }

            string title = board.Title;

            if (title != null)
            {
                this.AddHtml(183, 68, 180, 23, title, false, false);
            }

            this.AddHtmlLocalized(385, 89, 60, 20, 1062409, LabelColor, false, false); // Post

            this.AddLabel(440, 89, LabelHue, page.ToString());
            this.AddLabel(455, 89, LabelHue, "/");
            this.AddLabel(470, 89, LabelHue, board.Messages.Count.ToString());

            PlayerBBMessage message = board.Greeting;

            if (page >= 1 && page <= board.Messages.Count)
            {
                message = (PlayerBBMessage)board.Messages[page - 1];
            }

            this.AddImageTiled(150, 220, 240, 1, 2700);                             // Separator

            this.AddHtmlLocalized(150, 180, 100, 20, 1062405, 16715, false, false); // Posted On:
            this.AddHtmlLocalized(150, 200, 100, 20, 1062406, 16715, false, false); // Posted By:

            if (message != null)
            {
                this.AddHtml(255, 180, 150, 20, message.Time.ToString("yyyy-MM-dd HH:mm:ss"), false, false);

                Mobile poster = message.Poster;
                string name   = (poster == null ? null : poster.Name);

                if (name == null || (name = name.Trim()).Length == 0)
                {
                    name = "Someone";
                }

                this.AddHtml(255, 200, 150, 20, name, false, false);

                string body = message.Message;

                if (body == null)
                {
                    body = "";
                }

                this.AddHtml(150, 240, 250, 100, body, false, false);

                if (message != board.Greeting && house.IsOwner(from))
                {
                    this.AddButton(130, 395, 1209, 1210, 6, GumpButtonType.Reply, 0);
                    this.AddHtmlLocalized(150, 393, 150, 20, 1062410, LabelColor, false, false); // Banish Poster

                    this.AddButton(310, 395, 1209, 1210, 7, GumpButtonType.Reply, 0);
                    this.AddHtmlLocalized(330, 393, 150, 20, 1062411, LabelColor, false, false); // Delete Message
                }

                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    this.AddButton(135, 242, 1209, 1210, 8, GumpButtonType.Reply, 0); // Post props
                }
            }
        }
Ejemplo n.º 31
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            IPoint3D p   = targeted as IPoint3D;
            Map      map = from.Map;

            if (p == null || map == null || m_Maker == null || m_Maker.Deleted)
            {
                return;
            }

            if (m_Maker.IsChildOf(from.Backpack))
            {
                SpellHelper.GetSurfaceTop(ref p);
                BaseHouse house = null;
                Point3D   loc   = new Point3D(p);

                if (targeted is Item && !((Item)targeted).IsLockedDown && !((Item)targeted).IsSecure && !(targeted is AddonComponent))
                {
                    from.SendLocalizedMessage(1076191); // Statues can only be placed in houses.
                    return;
                }
                else if (from.IsBodyMod)
                {
                    from.SendLocalizedMessage(1073648); // You may only proceed while in your original state...
                    return;
                }

                AddonFitResult result = CouldFit(loc, map, from, ref house);

                if (result == AddonFitResult.Valid)
                {
                    CharacterStatue       statue = new CharacterStatue(from, m_Type);
                    CharacterStatuePlinth plinth = new CharacterStatuePlinth(statue);

                    house.Addons.Add(plinth);

                    if (m_Maker is IRewardItem)
                    {
                        statue.IsRewardItem = ((IRewardItem)m_Maker).IsRewardItem;
                    }

                    statue.Plinth = plinth;
                    plinth.MoveToWorld(loc, map);
                    statue.InvalidatePose();

                    /*
                     * TODO: Previously the maker wasn't deleted until after statue
                     * customization, leading to redeeding issues. Exact OSI behavior
                     * needs looking into.
                     */
                    m_Maker.Delete();
                    statue.Sculpt(from);

                    from.CloseGump(typeof(CharacterStatueGump));
                    from.SendGump(new CharacterStatueGump(m_Maker, statue, from));
                }
                else if (result == AddonFitResult.Blocked)
                {
                    from.SendLocalizedMessage(500269); // You cannot build that there.
                }
                else if (result == AddonFitResult.NotInHouse)
                {
                    from.SendLocalizedMessage(1076192); // Statues can only be placed in houses where you are the owner or co-owner.
                }
                else if (result == AddonFitResult.DoorTooClose)
                {
                    from.SendLocalizedMessage(500271); // You cannot build near the door.
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
        }
 public SetTitlePrompt(int page, BaseHouse house, BasePlayerBB board)
 {
     m_Page  = page;
     m_House = house;
     m_Board = board;
 }
Ejemplo n.º 33
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Decorator.Command == DecorateCommand.GetHue)
                {
                    int hue;

                    if (targeted is Item item)
                        hue = item.Hue;
                    else if (targeted is Mobile mobile)
                        hue = mobile.Hue;
                    else
                    {
                        from.Target = new InternalTarget(m_Decorator);
                        return;
                    }

                    from.SendLocalizedMessage(1158862, $"{hue}"); // That object is hue ~1_HUE~
                }
                else if (targeted is Item item && CheckUse(from))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);

                    bool isDecorableComponent = false;

                    if (m_Decorator.Command == DecorateCommand.Turn && IsSpecialTypes(item))
                    {
                        isDecorableComponent = true;
                    }
                    else if (item is AddonComponent || item is AddonContainerComponent || item is BaseAddonContainer || item is TrophyAddon)
                    {
                        object addon = null;
                        int count = 0;

                        if (item is AddonComponent aComponent)
                        {
                            count = aComponent.Addon.Components.Count;
                            addon = aComponent.Addon;
                        }
                        else if (item is AddonContainerComponent component)
                        {
                            count = component.Addon.Components.Count;
                            addon = component.Addon;
                        }
                        else if (item is BaseAddonContainer container)
                        {
                            count = container.Components.Count;
                            addon = container;
                        }

                        if (count == 1)
                            isDecorableComponent = true;

                        if (item is TrophyAddon)
                            isDecorableComponent = true;

                        if (item is EnormousVenusFlytrapAddon)
                            isDecorableComponent = true;

                        if (m_Decorator.Command == DecorateCommand.Turn)
                        {
                            if (addon != null)
                            {
                                FlipableAddonAttribute[] attributes = (FlipableAddonAttribute[])addon.GetType().GetCustomAttributes(typeof(FlipableAddonAttribute), false);

                                if (attributes.Length > 0)
                                    isDecorableComponent = true;
                            }
                        }
                    }
                    else if ((item is Banner || item is DecorativeShardShield) && m_Decorator.Command != DecorateCommand.Turn)
                    {
                        isDecorableComponent = true;
                    }

                    if (house == null || !house.IsCoOwner(from))
                    {
                        from.SendLocalizedMessage(502092); // You must be in your house to do 
                    }
                    else if (item.Parent != null || !house.IsInside(item))
                    {
                        from.SendLocalizedMessage(1042270); // That is not in your house.
                    }
                    else if (!house.IsLockedDown(item) && !house.IsSecure(item) && !isDecorableComponent)
                    {
                        if (item is AddonComponent && m_Decorator.Command == DecorateCommand.Turn)
                        {
                            from.SendLocalizedMessage(1042273); // You cannot turn that.
                        }
                        else if (item is AddonComponent && m_Decorator.Command == DecorateCommand.Up)
                        {
                            from.SendLocalizedMessage(1042274); // You cannot raise it up any higher.
                        }
                        else if (item is AddonComponent && m_Decorator.Command == DecorateCommand.Down)
                        {
                            from.SendLocalizedMessage(1042275); // You cannot lower it down any further.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1042271); // That is not locked down.
                        }
                    }
                    else if (item is VendorRentalContract)
                    {
                        from.SendLocalizedMessage(1062491); // You cannot use the house decorator on that object.
                    }
                    else
                    {
                        switch (m_Decorator.Command)
                        {
                            case DecorateCommand.Up:
                                Up(item, from);
                                break;
                            case DecorateCommand.Down:
                                Down(item, from);
                                break;
                            case DecorateCommand.Turn:
                                Turn(item, from);
                                break;
                        }
                    }
                }

                from.Target = new InternalTarget(m_Decorator);
            }
Ejemplo n.º 34
0
        public bool CouldFit(IPoint3D p, Map map)
        {
            BaseHouse h = null;

            return(CouldFit(p, map, null, ref h) == AddonFitResult.Valid);
        }
Ejemplo n.º 35
0
        public static bool InHouse(Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(from);

            return house != null && house.IsCoOwner(from);
        }
Ejemplo n.º 36
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house != null && house.IsCoOwner(from))
                {
                    bool northWall = BaseAddon.IsWall(from.X, from.Y - 1, from.Z, from.Map);
                    bool westWall  = BaseAddon.IsWall(from.X - 1, from.Y, from.Z, from.Map);

                    if (northWall && westWall)
                    {
                        switch (from.Direction & Direction.Mask)
                        {
                        case Direction.North:
                        case Direction.South: northWall = true; westWall = false; break;

                        case Direction.East:
                        case Direction.West: northWall = false; westWall = true; break;

                        default: from.SendMessage("Turn to face the wall on which to hang this trophy."); return;
                        }
                    }

                    int itemID = 0;

                    if (northWall)
                    {
                        itemID = SouthID;
                    }
                    else if (westWall)
                    {
                        itemID = EastID;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042626); // The trophy must be placed next to a wall.
                    }
                    if (itemID > 0)
                    {
                        Item trophy;

                        if (Info.Complex)
                        {
                            trophy = new HuntTrophyAddon(m_Owner, Index, m_Measurement, m_DateKilled, m_Location);
                        }
                        else
                        {
                            trophy        = new HuntTrophy(m_Owner, Index, m_Measurement, m_DateKilled, m_Location);
                            trophy.ItemID = itemID;
                        }

                        trophy.MoveToWorld(from.Location, from.Map);

                        house.Addons[trophy] = from;
                        Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502092); // You must be in your house to do this.
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
        }
Ejemplo n.º 37
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            PageType type = (PageType)(-1);

            switch (info.ButtonID)
            {
            case 0:                                          // Close/Cancel
            {
                from.SendLocalizedMessage(501235, "", 0x35); // Help request aborted.

                break;
            }

            case 1:     // General question
            {
                type = PageType.Question;
                break;
            }

            case 2:     // Stuck
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house != null && house.IsAosRules)
                {
                    from.Location = house.BanLocation;
                }
                else if (from.Region.IsPartOf <Server.Regions.Jail>())
                {
                    from.SendLocalizedMessage(1114345, "", 0x35);         // You'll need a better jailbreak plan than that!
                }
                else if (Factions.Sigil.ExistsOn(from))
                {
                    from.SendLocalizedMessage(1061632);         // You can't do that while carrying the sigil.
                }
                else if (from.CanUseStuckMenu() && from.Region.CanUseStuckMenu(from) && !CheckCombat(from) && !from.Frozen && !from.Criminal && (Core.AOS || from.Kills < 5))
                {
                    StuckMenu menu = new StuckMenu(from, from, true);

                    menu.BeginClose();

                    from.SendGump(menu);
                }
                else
                {
                    type = PageType.Stuck;
                }

                break;
            }

            case 3:     // Report bug or contact Origin
            {
                type = PageType.Bug;
                break;
            }

            case 4:     // Game suggestion
            {
                type = PageType.Suggestion;
                break;
            }

            case 5:     // Account management
            {
                type = PageType.Account;
                break;
            }

            case 6:     // Other
            {
                type = PageType.Other;
                break;
            }

            case 7:     // Harassment: verbal/exploit
            {
                type = PageType.VerbalHarassment;
                break;
            }

            case 8:     // Harassment: physical
            {
                type = PageType.PhysicalHarassment;
                break;
            }

            case 9:     // Young player transport
            {
                if (IsYoung(from))
                {
                    if (from.Region.IsPartOf <Regions.Jail>())
                    {
                        from.SendLocalizedMessage(1114345, "", 0x35);         // You'll need a better jailbreak plan than that!
                    }
                    else if (from.Region.IsPartOf("Haven Island"))
                    {
                        from.SendLocalizedMessage(1041529);         // You're already in Haven
                    }
                    else
                    {
                        from.MoveToWorld(new Point3D(3503, 2574, 14), Map.Trammel);
                    }
                }

                break;
            }
            }

            if (type != (PageType)(-1) && PageQueue.CheckAllowedToPage(from))
            {
                from.SendGump(new PagePromptGump(from, type));
            }
        }
Ejemplo n.º 38
0
        public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage)
        {
            if (!CheckHold(from, dropped, sendFullMessage, !CheckStack(from, dropped)))
            {
                return(false);
            }

            if (dropped.QuestItem && from.Backpack != this)
            {
                from.SendLocalizedMessage(1074769); // An item must be in your backpack (and not in a container within) to be toggled as a quest item.
                return(false);
            }

            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house != null && house.IsLockedDown(this))
            {
                if (dropped is VendorRentalContract || (dropped is Container && ((Container)dropped).FindItemByType(typeof(VendorRentalContract)) != null))
                {
                    from.SendLocalizedMessage(1062492); // You cannot place a rental contract in a locked down container.
                    return(false);
                }

                if (!house.LockDown(from, dropped, false))
                {
                    return(false);
                }
            }

            List <Item> list = Items;

            for (int i = 0; i < list.Count; ++i)
            {
                Item item = list[i];

                if (!(item is Container) && item.StackWith(from, dropped, false))
                {
                    return(true);
                }
            }

            DropItem(dropped);

            ItemFlags.SetTaken(dropped, true);

            if (dropped.HonestyItem && dropped.HonestyPickup == DateTime.MinValue)
            {
                dropped.HonestyPickup = DateTime.UtcNow;
                dropped.StartHonestyTimer();

                if (dropped.HonestyOwner == null)
                {
                    Server.Services.Virtues.HonestyVirtue.AssignOwner(dropped);
                }

                from.SendLocalizedMessage(1151536); // You have three hours to turn this item in for Honesty credit, otherwise it will cease to be a quest item.
            }

            if (Siege.SiegeShard && this != from.Backpack && from is PlayerMobile && ((PlayerMobile)from).BlessedItem != null && ((PlayerMobile)from).BlessedItem == dropped)
            {
                ((PlayerMobile)from).BlessedItem = null;
                dropped.LootType = LootType.Regular;

                from.SendLocalizedMessage(1075292, dropped.Name != null ? dropped.Name : "#" + dropped.LabelNumber.ToString()); // ~1_NAME~ has been unblessed.
            }

            if (!EnchantedHotItem.CheckDrop(from, this, dropped))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 39
0
        public void DockBoat(BaseBoat boat, BaseHouse house)
        {
            foreach (var entity in boat.GetEntitiesOnBoard())
            {
                if (!(entity is Item) || entity == this || boat.IsComponentItem(entity) || entity is EffectItem || entity == boat.TillerMan)
                {
                    continue;
                }

                Item item = entity as Item;

                if (!item.Deleted && boat.Contains(item))
                {
                    if (item is AddonComponent || item is BaseAddon)
                    {
                        BaseAddon addon = item is AddonComponent ? ((AddonComponent)item).Addon : (BaseAddon)item;
                        Item      deed  = addon.Deed;

                        bool retainDeedHue = false;
                        int  hue           = 0;

                        if (addon != null && addon.RetainDeedHue)
                        {
                            retainDeedHue = true;

                            for (int j = 0; hue == 0 && j < addon.Components.Count; ++j)
                            {
                                AddonComponent c = addon.Components[j];

                                if (c.Hue != 0)
                                {
                                    hue = c.Hue;
                                }
                            }
                        }

                        if (deed != null)
                        {
                            if (retainDeedHue)
                            {
                                deed.Hue = hue;
                            }

                            house.DropToMovingCrate(deed);
                        }
                    }
                    else
                    {
                        item.Delete();
                    }
                }

                Container cont;

                if (boat is BaseGalleon)
                {
                    cont = ((BaseGalleon)boat).GalleonHold;
                }
                else
                {
                    cont = boat.Hold;
                }

                if (cont != null)
                {
                    cont.Items.ForEach(i =>
                    {
                        if (i is BaseWeapon)
                        {
                            house.DropToMovingCrate(i);
                        }
                        else
                        {
                            i.Delete();
                        }
                    });
                }
            }

            BaseDockedBoat model = boat.BoatItem;

            if (model == null || model.Deleted)
            {
                model = boat.DockedBoat;
            }

            if (model == null)
            {
                return;
            }

            model.BoatItem = boat;

            if (boat.IsClassicBoat && boat.Owner != null)
            {
                boat.RemoveKeys(boat.Owner);
            }

            house.DropToMovingCrate(model);

            boat.OnDryDock(null);

            boat.Refresh();
            boat.Internalize();
        }
Ejemplo n.º 40
0
        public ViewHousesGump(Mobile from, List <BaseHouse> list, BaseHouse sel) : base(50, 40)
        {
            m_From      = from;
            m_List      = list;
            m_Selection = sel;

            from.CloseGump <ViewHousesGump>();

            AddPage(0);

            AddBackground(0, 0, 240, 360, 5054);
            AddBlackAlpha(10, 10, 220, 340);

            if (sel?.Deleted != false)
            {
                m_Selection = null;

                AddHtml(35, 15, 120, 20, Color("House Type", White));

                if (list.Count == 0)
                {
                    AddHtml(35, 40, 160, 40, Color("There were no houses found for that player.", White));
                }

                AddImage(190, 17, 0x25EA);
                AddImage(207, 17, 0x25E6);

                var page = 0;

                for (var i = 0; i < list.Count; ++i)
                {
                    if (i % 15 == 0)
                    {
                        if (page > 0)
                        {
                            AddButton(207, 17, 0x15E1, 0x15E5, 0, GumpButtonType.Page, page + 1);
                        }

                        AddPage(++page);

                        if (page > 1)
                        {
                            AddButton(190, 17, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page - 1);
                        }
                    }

                    var name = FindHouseName(list[i]);

                    AddHtml(15, 40 + i % 15 * 20, 20, 20, Color($"{i + 1}.", White));

                    if (name.Number > 0)
                    {
                        AddHtmlLocalized(35, 40 + i % 15 * 20, 160, 20, name, White16);
                    }
                    else
                    {
                        AddHtml(35, 40 + i % 15 * 20, 160, 20, Color(name, White));
                    }

                    AddButton(198, 39 + i % 15 * 20, 4005, 4007, i + 1);
                }
            }
            else
            {
                string location;
                var    map = sel.Map;

                var houseName = sel.Sign == null ? "An Unnamed House" : sel.Sign.GetName();
                var owner     = sel.Owner == null ? "nobody" : sel.Owner.Name;

                int  xLong = 0, yLat = 0, xMins = 0, yMins = 0;
                bool xEast = false, ySouth = false;

                var valid = Sextant.Format(
                    sel.Location,
                    map,
                    ref xLong,
                    ref yLat,
                    ref xMins,
                    ref yMins,
                    ref xEast,
                    ref ySouth
                    );

                if (valid)
                {
                    location = $"{yLat}° {yMins}'{(ySouth ? "S" : "N")}, {xLong}° {xMins}'{(xEast ? "E" : "W")}";
                }
                else
                {
                    location = "unknown";
                }

                AddHtml(10, 15, 220, 20, Color(Center("House Properties"), White));

                AddHtml(15, 40, 210, 20, Color("Facet:", White));
                AddHtml(15, 40, 210, 20, Color(Right(map == null ? "(null)" : map.Name), White));

                AddHtml(15, 60, 210, 20, Color("Location:", White));
                AddHtml(15, 60, 210, 20, Color(Right(sel.Location.ToString()), White));

                AddHtml(15, 80, 210, 20, Color("Sextant:", White));
                AddHtml(15, 80, 210, 20, Color(Right(location), White));

                AddHtml(15, 100, 210, 20, Color("Owner:", White));
                AddHtml(15, 100, 210, 20, Color(Right(owner), White));

                AddHtml(15, 120, 210, 20, Color("Name:", White));
                AddHtml(15, 120, 210, 20, Color(Right(houseName), White));

                AddHtml(15, 140, 210, 20, Color("Friends:", White));
                AddHtml(15, 140, 210, 20, Color(Right(sel.Friends.Count.ToString()), White));

                AddHtml(15, 160, 210, 20, Color("Co-Owners:", White));
                AddHtml(15, 160, 210, 20, Color(Right(sel.CoOwners.Count.ToString()), White));

                AddHtml(15, 180, 210, 20, Color("Bans:", White));
                AddHtml(15, 180, 210, 20, Color(Right(sel.Bans.Count.ToString()), White));

                AddHtml(15, 200, 210, 20, Color("Decays:", White));
                AddHtml(15, 200, 210, 20, Color(Right(sel.CanDecay ? "Yes" : "No"), White));

                AddHtml(15, 220, 210, 20, Color("Decay Level:", White));
                AddHtml(15, 220, 210, 20, Color(Right(sel.DecayLevel.ToString()), White));

                AddButton(15, 245, 4005, 4007, 1);
                AddHtml(50, 245, 120, 20, Color("Go to house", White));

                AddButton(15, 265, 4005, 4007, 2);
                AddHtml(50, 265, 120, 20, Color("Open house menu", White));

                AddButton(15, 285, 4005, 4007, 3);
                AddHtml(50, 285, 120, 20, Color("Demolish house", White));

                AddButton(15, 305, 4005, 4007, 4);
                AddHtml(50, 305, 120, 20, Color("Refresh house", White));
            }
        }
Ejemplo n.º 41
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                IPoint3D p   = targeted as IPoint3D;
                Map      map = from.Map;

                if (p == null || map == null || m_Deed.Deleted)
                {
                    return;
                }

                if (m_Deed.IsChildOf(from.Backpack))
                {
                    BaseAddon addon = m_Deed.Addon;

                    Server.Spells.SpellHelper.GetSurfaceTop(ref p);

                    BaseHouse   house   = null;
                    BaseGalleon galleon = CheckGalleonPlacement(from, addon, new Point3D(p), map);

                    AddonFitResult res = galleon != null ? AddonFitResult.Valid : addon.CouldFit(p, map, from, ref house);

                    if (res == AddonFitResult.Valid)
                    {
                        addon.Resource = m_Deed.Resource;

                        if (!m_Deed.ExcludeDeedHue)
                        {
                            if (addon.RetainDeedHue || (m_Deed.Hue != 0 && CraftResources.GetHue(m_Deed.Resource) != m_Deed.Hue))
                            {
                                addon.Hue = m_Deed.Hue;
                            }
                        }

                        addon.MoveToWorld(new Point3D(p), map);

                        if (house != null)
                        {
                            house.Addons[addon] = from;
                        }

                        if (galleon != null)
                        {
                            galleon.AddAddon(addon);
                        }

                        m_Deed.DeleteDeed();
                    }
                    else if (res == AddonFitResult.Blocked)
                    {
                        from.SendLocalizedMessage(500269); // You cannot build that there.
                    }
                    else if (res == AddonFitResult.NotInHouse)
                    {
                        from.SendLocalizedMessage(500274); // You can only place this in a house that you own!
                    }
                    else if (res == AddonFitResult.DoorTooClose)
                    {
                        from.SendLocalizedMessage(500271); // You cannot build near the door.
                    }
                    else if (res == AddonFitResult.NoWall)
                    {
                        from.SendLocalizedMessage(500268); // This object needs to be mounted on something.
                    }
                    if (res != AddonFitResult.Valid)
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                }
            }
Ejemplo n.º 42
0
        private static void BuildRugBox_Callback(Mobile from, Map map, Point3D start, Point3D end, object state)
        {
            RedFloralCarpetDeed m_Deed = state as RedFloralCarpetDeed;

            if (m_Deed.Deleted)
            {
                return;
            }

            if (m_Deed.IsChildOf(from.Backpack))
            {
                Rectangle2D rect = new Rectangle2D(start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1);

                if (rect.Width < 3 || rect.Height < 3)
                {
                    from.SendMessage("The carpet is too small. It should be longer or wider than that.");
                    return;
                }

                BaseAddon addon = new RedFloralCarpetAddon(rect);

                BaseHouse house = null;

                AddonFitResult res = addon.CouldFit(start, map, from, ref house);

                if (res == AddonFitResult.Valid)
                {
                    addon.MoveToWorld(start, map);
                }
                else if (res == AddonFitResult.Blocked)
                {
                    from.SendLocalizedMessage(500269);                       // You cannot build that there.
                }
                else if (res == AddonFitResult.NotInHouse)
                {
                    from.SendLocalizedMessage(500274);                       // You can only place this in a house that you own!
                }
                else if (res == AddonFitResult.DoorsNotClosed)
                {
                    from.SendMessage("You must close all house doors before placing this.");
                }
                else if (res == AddonFitResult.DoorTooClose)
                {
                    from.SendLocalizedMessage(500271);                       // You cannot build near the door.
                }
                if (res == AddonFitResult.Valid)
                {
                    m_Deed.Delete();

                    //if ( house != null )
                    //{
                    //foreach ( Server.Multis.BaseHouse h in house )
                    house.Addons.Add(addon);
                    //}
                }
                else
                {
                    addon.Delete();
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
        }
        public static void CountGoldPerAccount_OnCommand(CommandEventArgs arg)
        {
            Mobile from = arg.Mobile;

            object       parent;
            Mobile       master = null;
            BaseHouse    house  = null;
            PlayerVendor vendor;
            int          value = 0;
            IAccount     account;
            uint         goldHeldByNPCs     = 0;
            uint         goldOnFloor        = 0;
            uint         goldInContainers   = 0;
            Hashtable    goldOnAccountTable = new Hashtable();
            ArrayList    itemList           = new ArrayList(World.Items.Values);
            ArrayList    mobileList         = new ArrayList(World.Mobiles.Values);

            foreach (Item item in itemList)
            {
                if (item.Deleted)
                {
                    continue;
                }

                if (item is Gold)
                {
                    value = item.Amount;
                }
                else if (item is BankCheck)
                {
                    value = ((BankCheck)item).Worth;
                }
                else
                {
                    continue;
                }

                if (value == 0)
                {
                    continue;
                }

                parent = item.RootParent;
                if (parent is Mobile)
                {
                    if (parent is PlayerVendor)
                    {
                        master = ((PlayerVendor)parent).Owner as PlayerMobile;
                    }
                    else if (parent is BaseCreature)
                    {
                        master = ((BaseCreature)parent).ControlMaster as PlayerMobile;
                    }
                    else
                    {
                        master = parent as PlayerMobile;
                    }

                    if (master == null)
                    {
                        goldHeldByNPCs += (uint)value;
                    }
                }
                else if (parent != null)                   // Containers
                {
                    if (((Item)parent).IsSecure || ((Item)parent).IsLockedDown)
                    {
                        house = BaseHouse.FindHouseAt(item);
                    }

                    if (house != null)
                    {
                        master = house.Owner;
                    }

                    if (master == null)
                    {
                        goldInContainers += (uint)value;
                    }
                }
                else
                {
                    if (item.IsSecure || item.IsLockedDown)
                    {
                        house = BaseHouse.FindHouseAt(item);
                    }

                    if (house != null)
                    {
                        master = house.Owner;
                    }

                    if (master == null)
                    {
                        goldOnFloor += (uint)value;
                    }
                }

                if (master != null)
                {
                    account = master.Account;
                    if (account != null)
                    {
                        if (goldOnAccountTable.Contains(account))
                        {
                            goldOnAccountTable[account] = (uint)goldOnAccountTable[account] + (uint)value;
                        }
                        else
                        {
                            goldOnAccountTable[account] = (uint)value;
                        }
                    }
                    else
                    {
                        from.SendMessage(master.ToString() + " has no account!");
                    }
                }
                parent = null;
                master = null;
                house  = null;
            }

            uint goldOnPlayervendors = 0;

            foreach (Mobile m in mobileList)
            {
                if (!(m is PlayerVendor))
                {
                    continue;
                }

                vendor = (PlayerVendor)m;
                master = vendor.Owner as PlayerMobile;
                if (master != null)
                {
                    account = master.Account;
                    if (account != null)
                    {
                        goldOnPlayervendors += (uint)(vendor.BankAccount + vendor.HoldGold);
                        if (goldOnAccountTable.Contains(account))
                        {
                            goldOnAccountTable[account] = (uint)goldOnAccountTable[account] + (uint)(vendor.BankAccount + vendor.HoldGold);
                        }
                        else
                        {
                            goldOnAccountTable[account] = (uint)value;
                        }
                    }
                    else
                    {
                        from.SendMessage(master.ToString() + " has no account!");
                    }
                }
            }

            uint totalGold = goldHeldByNPCs + goldOnFloor + goldInContainers;

            from.SendMessage("Gold on NPCs: " + goldHeldByNPCs.ToString());
            from.SendMessage("Gold on playervendors: " + goldOnPlayervendors.ToString());
            from.SendMessage("Gold in containers: " + goldInContainers.ToString());
            from.SendMessage("Gold on the floor: " + goldOnFloor.ToString());

            IDictionaryEnumerator en     = goldOnAccountTable.GetEnumerator();
            ArrayList             gaList = new ArrayList();
            GoldAccountEntry      gae;

            while (en.MoveNext())
            {
                gae         = new GoldAccountEntry();
                gae.Account = (IAccount)(en.Key);
                gae.Value   = (uint)(en.Value);
                gaList.Add(gae);
                totalGold += gae.Value;
            }

            from.SendMessage("Total gold: " + totalGold.ToString());
            from.SendMessage("-------------------------");
            from.SendMessage("Gold on Accounts by name:");

            gaList.Sort();
            for (int i = 0; i < Math.Min(gaList.Count, TOP_COUNT); ++i)
            {
                from.SendMessage(((GoldAccountEntry)gaList[i]).Account.ToString() + " : " + ((GoldAccountEntry)gaList[i]).Value.ToString());
            }
        }
Ejemplo n.º 44
0
        public bool CanUse(Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            return(house != null && house.HasSecureAccess(from, Level));
        }
Ejemplo n.º 45
0
        public ViewHousesGump(Mobile from, List <BaseHouse> list, BaseHouse sel)
            : base(50, 40)
        {
            m_From      = from;
            m_List      = list;
            m_Selection = sel;

            from.CloseGump(typeof(ViewHousesGump));

            AddPage(0);

            AddBackground(0, 0, 240, 360, 5054);
            AddBlackAlpha(10, 10, 220, 340);

            if (sel == null || sel.Deleted)
            {
                m_Selection = null;

                AddHtml(35, 15, 120, 20, Color("House Type", White), false, false);

                if (list.Count == 0)
                {
                    AddHtml(35, 40, 160, 40, Color("There were no houses found for that player.", White), false, false);
                }

                AddImage(190, 17, 0x25EA);
                AddImage(207, 17, 0x25E6);

                int page = 0;

                for (int i = 0; i < list.Count; ++i)
                {
                    if ((i % 15) == 0)
                    {
                        if (page > 0)
                        {
                            AddButton(207, 17, 0x15E1, 0x15E5, 0, GumpButtonType.Page, page + 1);
                        }

                        AddPage(++page);

                        if (page > 1)
                        {
                            AddButton(190, 17, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page - 1);
                        }
                    }

                    object name = FindHouseName(list[i]);

                    AddHtml(15, 40 + ((i % 15) * 20), 20, 20, Color(String.Format("{0}.", i + 1), White), false, false);

                    if (name is int)
                    {
                        AddHtmlLocalized(35, 40 + ((i % 15) * 20), 160, 20, (int)name, White16, false, false);
                    }
                    else if (name is string)
                    {
                        AddHtml(35, 40 + ((i % 15) * 20), 160, 20, Color((string)name, White), false, false);
                    }

                    AddButton(198, 39 + ((i % 15) * 20), 4005, 4007, i + 1, GumpButtonType.Reply, 0);
                }
            }
            else
            {
                string houseName, owner, location;
                Map    map = sel.Map;

                houseName = (sel.Sign == null) ? "An Unnamed House" : sel.Sign.GetName();
                owner     = (sel.Owner == null) ? "nobody" : sel.Owner.Name;

                int  xLong = 0, yLat = 0, xMins = 0, yMins = 0;
                bool xEast = false, ySouth = false;

                bool valid = Sextant.Format(sel.Location, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth);

                if (valid)
                {
                    location = String.Format("{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                }
                else
                {
                    location = "unknown";
                }

                AddHtml(10, 15, 220, 20, Color(Center("House Properties"), White), false, false);

                AddHtml(15, 40, 210, 20, Color("Facet:", White), false, false);
                AddHtml(15, 40, 210, 20, Color(Right(map == null ? "(null)" : map.Name), White), false, false);

                AddHtml(15, 60, 210, 20, Color("Location:", White), false, false);
                AddHtml(15, 60, 210, 20, Color(Right(sel.Location.ToString()), White), false, false);

                AddHtml(15, 80, 210, 20, Color("Sextant:", White), false, false);
                AddHtml(15, 80, 210, 20, Color(Right(location), White), false, false);

                AddHtml(15, 100, 210, 20, Color("Owner:", White), false, false);
                AddHtml(15, 100, 210, 20, Color(Right(owner), White), false, false);

                AddHtml(15, 120, 210, 20, Color("Name:", White), false, false);
                AddHtml(15, 120, 210, 20, Color(Right(houseName), White), false, false);

                AddHtml(15, 140, 210, 20, Color("Friends:", White), false, false);
                AddHtml(15, 140, 210, 20, Color(Right(sel.Friends.Count.ToString()), White), false, false);

                AddHtml(15, 160, 210, 20, Color("Co-Owners:", White), false, false);
                AddHtml(15, 160, 210, 20, Color(Right(sel.CoOwners.Count.ToString()), White), false, false);

                AddHtml(15, 180, 210, 20, Color("Bans:", White), false, false);
                AddHtml(15, 180, 210, 20, Color(Right(sel.Bans.Count.ToString()), White), false, false);

                AddHtml(15, 200, 210, 20, Color("Decays:", White), false, false);
                AddHtml(15, 200, 210, 20, Color(Right(sel.CanDecay ? "Yes" : "No"), White), false, false);

                AddHtml(15, 220, 210, 20, Color("Decay Level:", White), false, false);
                AddHtml(15, 220, 210, 20, Color(Right(sel.DecayLevel.ToString()), White), false, false);

                AddButton(15, 245, 4005, 4007, 1, GumpButtonType.Reply, 0);
                AddHtml(50, 245, 120, 20, Color("Go to house", White), false, false);

                AddButton(15, 265, 4005, 4007, 2, GumpButtonType.Reply, 0);
                AddHtml(50, 265, 120, 20, Color("Open house menu", White), false, false);

                AddButton(15, 285, 4005, 4007, 3, GumpButtonType.Reply, 0);
                AddHtml(50, 285, 120, 20, Color("Demolish house", White), false, false);

                AddButton(15, 305, 4005, 4007, 4, GumpButtonType.Reply, 0);
                AddHtml(50, 305, 120, 20, Color("Refresh house", White), false, false);
            }
        }
Ejemplo n.º 46
0
 public RenamePrompt( BaseHouse house )
 {
     m_House = house;
 }
Ejemplo n.º 47
0
        public object FindHouseName( BaseHouse house )
        {
            int multiID = house.ItemID & TileData.MaxItemValue;
            HousePlacementEntry[] entries;

            entries = HousePlacementEntry.ClassicHouses;

            for ( int i = 0; i < entries.Length; ++i )
            {
                if ( entries[i].MultiID == multiID )
                {
                    return entries[i].Description;
                }
            }

            entries = HousePlacementEntry.TwoStoryFoundations;

            for ( int i = 0; i < entries.Length; ++i )
            {
                if ( entries[i].MultiID == multiID )
                {
                    return entries[i].Description;
                }
            }

            entries = HousePlacementEntry.ThreeStoryFoundations;

            for ( int i = 0; i < entries.Length; ++i )
            {
                if ( entries[i].MultiID == multiID )
                {
                    return entries[i].Description;
                }
            }

            return house.GetType().Name;
        }