RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Setting a flag for house deed or houseplacement tool

Status
Not open for further replies.

Enroq

Sorceror
Code:
if (m_House.IsAosRules && BaseHouse.UsedHouseTool == true)

BaseHouse. Should be m_House - and it shouldn't be in the same If Statement, honestly.
 

Justin Davis

Wanderer
You code works mostly, but you can't get money from the deed and you don't get the deed back in-game, I tested it, it says the house cannot be refunded. That's why I didn't want to offend you so please don't take offense again. I am working through it and again thanks.
 

daat99

Moderator
Staff member
Guys, lets get this thread back on topic.

Justin Davis:
I didn't see any code that you posted (maybe I missed it though) please post some code and the problems it's giving you so we can help you.
 

Justin Davis

Wanderer
Guys, lets get this thread back on topic.

Justin Davis:
I didn't see any code that you posted (maybe I missed it though) please post some code and the problems it's giving you so we can help you.



Hi Daat I pretty much abandoned what I was writing and went with this midway, this is the code that Enroq has made, yes it compiles, but when actually in-game and you place a small house then try and demolish it, a message pops up that says you cannot be refunded and the house does not delete. Thanks for looking at it.



Code:
Add this to BaseHouse.cs where the rest are declared.
Code (text):
 
private bool fromDeed = false;
 
public bool IsFromDeed
{
get { return fromDeed; }
set { fromDeed = value; }
}


Code:
Change this in Deeds.cs: FROM THIS
Code (text):
BaseHouse house = GetHouse( from );
house.MoveToWorld( center, from.Map );
Delete();

Code:
TO THIS
 
Code (text):
BaseHouse house = GetHouse( from );
house.MoveToWorld( center, from.Map );
 
house.IsFromDeed = true;
 
Delete();


Code:
This is in HouseDemolitiongump
Change this:
Code (text):
if ( m_House.IsAosRules )
{
if ( m_House.Price > 0 )
toGive = new BankCheck( m_House.Price );
else
toGive = m_House.GetDeed();
}
else
{
toGive = m_House.GetDeed();
 
if ( toGive == null && m_House.Price > 0 )
toGive = new BankCheck( m_House.Price );
}


Code:
To :
Code (text):
if ( m_House.IsAosRules )
{
if (m_House.Price > 0)
{
toGive = new BankCheck(m_House.Price);
 
if (m_House.IsFromDeed == true)
toGive = new BankCheck((int)(m_House.Price / 2));
else
toGive = m_House.GetDeed();
}
}
else
{
toGive = m_House.GetDeed();
 
if (toGive == null && m_House.Price > 0)
{
toGive = new BankCheck(m_House.Price);
 
if (m_House.IsFromDeed)
toGive = new BankCheck((int)(m_House.Price / 2));
}
}
 

Enroq

Sorceror
I'm not sure why you think you'd offend me, it works fine. I've tested it four times. Each time the bank check either goes into my bank or the deed does.

Anyway, good luck.
 

Justin Davis

Wanderer
Heya Daat, the House value is not being passed to the house upon creation, when I am in-game and about to demolish it says the house is worth 0 so when you try to demolish the house, the code see's it at 0 gold worth and does not let you demolish or refund. I'm trying to find where that value comes from, what method passes it to house, so it has some gold value instead of 0, then would work well.

Here are the exact files I am using, and I am using exactly Enroqs directions as you can see from the files below. The code compiles fine but I just tested this again and it is not working in-game, to show the problem I added screenshots below. Any help would be greatly appreciated.

Thanks
Justin

For anyone wanting to see the code I implemented just Ctrl F in the code block and type in seach box: Enroq code.



This is from HouseDemolish.cs
Code:
// this is from HouseDemolish.cs look for comment Enroq code
 
using System;
using Server;
using Server.Items;
using Server.Multis;
using Server.Multis.Deeds;
using Server.Network;
using Server.Mobiles;
using System.Collections;
using Server.Gumps;
using Server.Regions;
using Server.Targeting;
 
 
 
namespace Server.Gumps
{
        public class HouseDemolishGump : Gump
    {
        private Mobile m_Mobile;
        private BaseHouse m_House;
 
 
 
 
 
            public HouseDemolishGump( Mobile mobile, BaseHouse house ) : base( 110, 100 )
            {
            m_Mobile = mobile;
            m_House = house;
 
            mobile.CloseGump( typeof( HouseDemolishGump ) );
 
            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 );
 
            AddHtmlLocalized( 10, 40, 400, 200, 1061795, 32512, false, true ); /* You are about to demolish your house.
                                                                                * You will be refunded the house's value directly to your bank box.
                                                                                * All items in the house will remain behind and can be freely picked up by anyone.
                                                                                * Once the house is demolished, anyone can attempt to place a new house on the vacant land.
                                                                                * This action will not un-condemn any other houses on your account, nor will it end your 7-day waiting period (if it applies to you).
                                                                                * Are you sure you wish to continue?
                                                                                */
 
            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
        }
 
 
 
        public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
        { 
 
                if ( info.ButtonID == 1 && !m_House.Deleted )
            {
                if ( m_House.IsOwner( m_Mobile ) )
                {
                    if ( m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0 )
                    {
                        return;
                    }
                    else if( !Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null )
                    {
                        m_Mobile.SendLocalizedMessage( 501389 ); // You cannot redeed a house with a guildstone inside.
                        return;
                    }
                    else if ( m_House.PlayerVendors.Count > 0 )
                    {
                        m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving.
                        return;
                    }
                    else if ( m_House.HasRentedVendors && m_House.VendorInventories.Count > 0 )
                    {
                        m_Mobile.SendLocalizedMessage( 1062679 ); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
                        return;
                    }
                    else if ( m_House.HasRentedVendors )
                    {
                        m_Mobile.SendLocalizedMessage( 1062680 ); // You cannot do that that while you still have contract vendors in your house.
                        return;
                    }
                    else if ( m_House.VendorInventories.Count > 0 )
                    {
                        m_Mobile.SendLocalizedMessage( 1062681 ); // You cannot do that that while you still have unclaimed contract vendor inventory in your house.
                        return;
                    }
 
                     
 
 
                    if ( m_Mobile.AccessLevel >= AccessLevel.GameMaster )
                    {
 
                        m_Mobile.SendMessage( "You do not get a refund for your house as you are not a player" );
                        //m_Mobile.SendMessage("{0} gold would have been withdrawn from your bank if you
                          m_House.RemoveKeys(m_Mobile);
                        m_House.Delete();
                    }
                    else
                    {
                        Item toGive = null;
 
 
 
                        /*ORIGINAL CODE
 
                        if (m_House.IsAosRules)
                        {
                            if (m_House.Price > 0)
                                toGive = new BankCheck(m_House.Price);
                            else
                                toGive = m_House.GetDeed();
                        }
                        else
                        {
                            toGive = m_House.GetDeed();
 
                            if (toGive == null && m_House.Price > 0)
                                toGive = new BankCheck(m_House.Price);
                        }*/
 
 
 
 
 
                        //ENROQ CODE
                        if (m_House.IsAosRules)
                        {
                            if (m_House.Price > 0)
                            {
                                toGive = new BankCheck(m_House.Price);
 
                                if (m_House.IsFromDeed == true)
                                    toGive = new BankCheck((int)(m_House.Price / 2));
                                else
                                    toGive = m_House.GetDeed();
                            }
                        }
                        else
                        {
                            toGive = m_House.GetDeed();
 
                            if (toGive == null && m_House.Price > 0)
                            {
                                toGive = new BankCheck(m_House.Price);
 
                                if (m_House.IsFromDeed)
                                    toGive = new BankCheck((int)(m_House.Price / 2));
                            }
                        }
                        //END ENROQ CODE
 
 
 
 
                        if ( toGive != null )
                        {
 
                            // Container box = m_Mobile.Backpack;
                            BankBox box = m_Mobile.BankBox;
 
 
                            if ( box.TryDropItem( m_Mobile, toGive, false ) )
                            {
                                if ( toGive is BankCheck )
                                    m_Mobile.SendLocalizedMessage( 1060397, ( (BankCheck)toGive ).Worth.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
 
                                m_House.RemoveKeys( m_Mobile );
                                m_House.Delete();
                            }
                            else
                            {
                                toGive.Delete();
                                m_Mobile.SendLocalizedMessage( 500390 ); // Your bank box is full.
                            }
                        }
                        else
                        {
                            m_Mobile.SendMessage( "Unable to refund house." );
                        }
                    }
                }
                else
                {
                    m_Mobile.SendLocalizedMessage( 501320 ); // Only the house owner may do this.
                }
            }
        }
    }
}








This is from Deed.cs
Code:
// this is from Deed.cs look for comment Enroq code
 
using System;
using System.Collections;
using Server;
using Server.Multis;
using Server.Targeting;
using Server.Items;
using Server.Regions;
 
namespace Server.Multis.Deeds
{
    public class HousePlacementTarget : MultiTarget
    {
        private HouseDeed m_Deed;
 
        public HousePlacementTarget( HouseDeed deed ) : base( deed.MultiID, deed.Offset )
        {
            m_Deed = deed;
        }
 
        protected override void OnTarget( Mobile from, object o )
        {
            IPoint3D ip = o as IPoint3D;
 
            if ( ip != null )
            {
                if ( ip is Item )
                    ip = ((Item)ip).GetWorldTop();
 
                Point3D p = new Point3D( ip );
 
                Region reg = Region.Find( new Point3D( p ), from.Map );
 
                if ( from.AccessLevel >= AccessLevel.GameMaster || reg.AllowHousing( from, p ) )
                    m_Deed.OnPlacement( from, p );
                else if ( reg.IsPartOf( typeof( TempNoHousingRegion ) ) )
                    from.SendLocalizedMessage( 501270 ); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
                else if ( reg.IsPartOf( typeof( TreasureRegion ) ) || reg.IsPartOf( typeof( HouseRegion ) ) )
                    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.
                else if ( reg.IsPartOf( typeof( HouseRaffleRegion ) ) )
                    from.SendLocalizedMessage( 1150493 ); // You must have a deed for this plot of land in order to build here.
                else
                    from.SendLocalizedMessage( 501265 ); // Housing can not be created in this area.
            }
        }
    }
 
    public abstract class HouseDeed : Item
    {
        private int m_MultiID;
        private Point3D m_Offset;
 
        [CommandProperty( AccessLevel.GameMaster )]
        public int MultiID
        {
            get
            {
                return m_MultiID;
            }
            set
            {
                m_MultiID = value;
            }
        }
 
        [CommandProperty( AccessLevel.GameMaster )]
        public Point3D Offset
        {
            get
            {
                return m_Offset;
            }
            set
            {
                m_Offset = value;
            }
        }
 
        public HouseDeed( int id, Point3D offset ) : base( 0x14F0 )
        {
            Weight = 1.0;
            LootType = LootType.Newbied;
 
            m_MultiID = id;
            m_Offset = offset;
        }
 
        public HouseDeed( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 1 ); // version
 
            writer.Write( m_Offset );
 
            writer.Write( m_MultiID );
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
 
            switch ( version )
            {
                case 1:
                {
                    m_Offset = reader.ReadPoint3D();
 
                    goto case 0;
                }
                case 0:
                {
                    m_MultiID = reader.ReadInt();
 
                    break;
                }
            }
 
            if ( Weight == 0.0 )
                Weight = 1.0;
        }
 
        public override void OnDoubleClick( Mobile from )
        {
            if ( !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
            {
                from.SendLocalizedMessage( 1010433 ); /* House placement cancellation could result in a
                                                      * 60 second delay in the return of your deed.
                                                      */
 
                from.Target = new HousePlacementTarget( this );
            }
        }
 
        public abstract BaseHouse GetHouse( Mobile owner );
        public abstract Rectangle2D[] Area{ get; }
 
        public void OnPlacement( Mobile from, Point3D p )
        {
            if ( Deleted )
                return;
 
            if ( !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 - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
                HousePlacementResult res = HousePlacement.Check( from, m_MultiID, center, out toMove );
 
                switch ( res )
                {
                    case HousePlacementResult.Valid:
                    {
 
                        //ENROQ CODE
                        BaseHouse house = GetHouse(from);
                        house.MoveToWorld(center, from.Map);
 
                        house.IsFromDeed = true;
 
                        Delete();
                        //ENDENROQ CODE
 
 
                        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;
                    }
                }
            }
        }
    }
 
    public class StonePlasterHouseDeed : HouseDeed
    {
        [Constructable]
        public StonePlasterHouseDeed() : base( 0x64, new Point3D( 0, 4, 0 ) )
        {
        }
 
        public StonePlasterHouseDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new SmallOldHouse( owner, 0x64 );
        }
 
        public override int LabelNumber{ get{ return 1041211; } }
        public override Rectangle2D[] Area{ get{ return SmallOldHouse.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class FieldStoneHouseDeed : HouseDeed
    {
        [Constructable]
        public FieldStoneHouseDeed() : base( 0x66, new Point3D( 0, 4, 0 ) )
        {
        }
 
        public FieldStoneHouseDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new SmallOldHouse( owner, 0x66 );
        }
 
        public override int LabelNumber{ get{ return 1041212; } }
        public override Rectangle2D[] Area{ get{ return SmallOldHouse.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class SmallBrickHouseDeed : HouseDeed
    {
        [Constructable]
        public SmallBrickHouseDeed() : base( 0x68, new Point3D( 0, 4, 0 ) )
        {
        }
 
        public SmallBrickHouseDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new SmallOldHouse( owner, 0x68 );
        }
 
        public override int LabelNumber{ get{ return 1041213; } }
        public override Rectangle2D[] Area{ get{ return SmallOldHouse.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class WoodHouseDeed : HouseDeed
    {
        [Constructable]
        public WoodHouseDeed() : base( 0x6A, new Point3D( 0, 4, 0 ) )
        {
        }
 
        public WoodHouseDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new SmallOldHouse( owner, 0x6A );
        }
 
        public override int LabelNumber{ get{ return 1041214; } }
        public override Rectangle2D[] Area{ get{ return SmallOldHouse.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class WoodPlasterHouseDeed : HouseDeed
    {
        [Constructable]
        public WoodPlasterHouseDeed() : base( 0x6C, new Point3D( 0, 4, 0 ) )
        {
        }
 
        public WoodPlasterHouseDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new SmallOldHouse( owner, 0x6C );
        }
 
        public override int LabelNumber{ get{ return 1041215; } }
        public override Rectangle2D[] Area{ get{ return SmallOldHouse.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class ThatchedRoofCottageDeed : HouseDeed
    {
        [Constructable]
        public ThatchedRoofCottageDeed() : base( 0x6E, new Point3D( 0, 4, 0 ) )
        {
        }
 
        public ThatchedRoofCottageDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new SmallOldHouse( owner, 0x6E );
        }
 
        public override int LabelNumber{ get{ return 1041216; } }
        public override Rectangle2D[] Area{ get{ return SmallOldHouse.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class BrickHouseDeed : HouseDeed
    {
        [Constructable]
        public BrickHouseDeed() : base( 0x74, new Point3D( -1, 7, 0 ) )
        {
        }
 
        public BrickHouseDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new GuildHouse( owner );
        }
 
        public override int LabelNumber{ get{ return 1041219; } }
        public override Rectangle2D[] Area{ get{ return GuildHouse.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class TwoStoryWoodPlasterHouseDeed : HouseDeed
    {
        [Constructable]
        public TwoStoryWoodPlasterHouseDeed() : base( 0x76, new Point3D( -3, 7, 0 ) )
        {
        }
 
        public TwoStoryWoodPlasterHouseDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new TwoStoryHouse( owner, 0x76 );
        }
 
        public override int LabelNumber{ get{ return 1041220; } }
        public override Rectangle2D[] Area{ get{ return TwoStoryHouse.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class TwoStoryStonePlasterHouseDeed : HouseDeed
    {
        [Constructable]
        public TwoStoryStonePlasterHouseDeed() : base( 0x78, new Point3D( -3, 7, 0 ) )
        {
        }
 
        public TwoStoryStonePlasterHouseDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new TwoStoryHouse( owner, 0x78 );
        }
 
        public override int LabelNumber{ get{ return 1041221; } }
        public override Rectangle2D[] Area{ get{ return TwoStoryHouse.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class TowerDeed : HouseDeed
    {
        [Constructable]
        public TowerDeed() : base( 0x7A, new Point3D( 0, 7, 0 ) )
        {
        }
 
        public TowerDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new Tower( owner );
        }
 
        public override int LabelNumber{ get{ return 1041222; } }
        public override Rectangle2D[] Area{ get{ return Tower.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class KeepDeed : HouseDeed
    {
        [Constructable]
        public KeepDeed() : base( 0x7C, new Point3D( 0, 11, 0 ) )
        {
        }
 
        public KeepDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new Keep( owner );
        }
 
        public override int LabelNumber{ get{ return 1041223; } }
        public override Rectangle2D[] Area{ get{ return Keep.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class CastleDeed : HouseDeed
    {
        [Constructable]
        public CastleDeed() : base( 0x7E, new Point3D( 0, 16, 0 ) )
        {
        }
 
        public CastleDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new Castle( owner );
        }
 
        public override int LabelNumber{ get{ return 1041224; } }
        public override Rectangle2D[] Area{ get{ return Castle.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class LargePatioDeed : HouseDeed
    {
        [Constructable]
        public LargePatioDeed() : base( 0x8C, new Point3D( -4, 7, 0 ) )
        {
        }
 
        public LargePatioDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new LargePatioHouse( owner );
        }
 
        public override int LabelNumber{ get{ return 1041231; } }
        public override Rectangle2D[] Area{ get{ return LargePatioHouse.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class LargeMarbleDeed : HouseDeed
    {
        [Constructable]
        public LargeMarbleDeed() : base( 0x96, new Point3D( -4, 7, 0 ) )
        {
        }
 
        public LargeMarbleDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new LargeMarbleHouse( owner );
        }
 
        public override int LabelNumber{ get{ return 1041236; } }
        public override Rectangle2D[] Area{ get{ return LargeMarbleHouse.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class SmallTowerDeed : HouseDeed
    {
        [Constructable]
        public SmallTowerDeed() : base( 0x98, new Point3D( 3, 4, 0 ) )
        {
        }
 
        public SmallTowerDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new SmallTower( owner );
        }
 
        public override int LabelNumber{ get{ return 1041237; } }
        public override Rectangle2D[] Area{ get{ return SmallTower.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class LogCabinDeed : HouseDeed
    {
        [Constructable]
        public LogCabinDeed() : base( 0x9A, new Point3D( 1, 6, 0 ) )
        {
        }
 
        public LogCabinDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new LogCabin( owner );
        }
 
        public override int LabelNumber{ get{ return 1041238; } }
        public override Rectangle2D[] Area{ get{ return LogCabin.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class SandstonePatioDeed : HouseDeed
    {
        [Constructable]
        public SandstonePatioDeed() : base( 0x9C, new Point3D( -1, 4, 0 ) )
        {
        }
 
        public SandstonePatioDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new SandStonePatio( owner );
        }
 
        public override int LabelNumber{ get{ return 1041239; } }
        public override Rectangle2D[] Area{ get{ return SandStonePatio.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class VillaDeed : HouseDeed
    {
        [Constructable]
        public VillaDeed() : base( 0x9E, new Point3D( 3, 6, 0 ) )
        {
        }
 
        public VillaDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new TwoStoryVilla( owner );
        }
 
        public override int LabelNumber{ get{ return 1041240; } }
        public override Rectangle2D[] Area{ get{ return TwoStoryVilla.AreaArray; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class StoneWorkshopDeed : HouseDeed
    {
        [Constructable]
        public StoneWorkshopDeed() : base( 0xA0, new Point3D( -1, 4, 0 ) )
        {
        }
 
        public StoneWorkshopDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new SmallShop( owner, 0xA0 );
        }
 
        public override int LabelNumber{ get{ return 1041241; } }
        public override Rectangle2D[] Area{ get{ return SmallShop.AreaArray2; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
 
    public class MarbleWorkshopDeed : HouseDeed
    {
        [Constructable]
        public MarbleWorkshopDeed() : base( 0xA2, new Point3D( -1, 4, 0 ) )
        {
        }
 
        public MarbleWorkshopDeed( Serial serial ) : base( serial )
        {
        }
 
        public override BaseHouse GetHouse( Mobile owner )
        {
            return new SmallShop( owner, 0xA2 );
        }
 
        public override int LabelNumber{ get{ return 1041242; } }
        public override Rectangle2D[] Area{ get{ return SmallShop.AreaArray1; } }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
    }
}
 

Justin Davis

Wanderer
Had to start here again said 10000 Character limit to a post. And I can't post the whole BaseHouse.cs it's to long. But you can see where I put Enroq's code.



For anyone wanting to see the code I implemented just Ctrl F in the code block and type in seach box: Enroq code.







This is from Basehouse.cs
Code:
//This is from Basehouse.cs look for the comment Enroq
 
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Misc;
using Server.Mobiles;
using Server.Multis.Deeds;
using Server.Regions;
using Server.Network;
using Server.Targeting;
using Server.Accounting;
using Server.ContextMenus;
using Server.Gumps;
using Server.Guilds;
using Server.Engines.BulkOrders;
 
namespace Server.Multis
{
    public abstract class BaseHouse : BaseMulti
    {
        public static bool NewVendorSystem{ get{ return Core.AOS; } } // Is new player vendor system enabled?
        public const int MaxCoOwners = 15;
        public static int MaxFriends { get { return !Core.AOS ? 50 : 140; } }
        public static int MaxBans { get { return !Core.AOS ? 50 : 140; } }
 
        #region Dynamic decay system
        private DecayLevel m_CurrentStage;
        private DateTime m_NextDecayStage;
 
        [CommandProperty( AccessLevel.GameMaster )]
        public DateTime NextDecayStage
        {
            get { return m_NextDecayStage; }
            set { m_NextDecayStage = value; }
        }
 
 
 
 
        public void ResetDynamicDecay()
        {
            m_CurrentStage = DecayLevel.Ageless;
            m_NextDecayStage = DateTime.MinValue;
        }
 
        public void SetDynamicDecay( DecayLevel level )
        {
            m_CurrentStage = level;
 
            if ( DynamicDecay.Decays( level ) )
                m_NextDecayStage = DateTime.UtcNow + DynamicDecay.GetRandomDuration( level );
            else
                m_NextDecayStage = DateTime.MinValue;
        }
        #endregion
 
        public const bool DecayEnabled = true;
 
        public static void Decay_OnTick()
        {
            for ( int i = 0; i < m_AllHouses.Count; ++i )
                m_AllHouses[i].CheckDecay();
        }
 
        private DateTime m_LastRefreshed;
        private bool m_RestrictDecay;
 
        [CommandProperty( AccessLevel.GameMaster )]
        public DateTime LastRefreshed
        {
            get{ return m_LastRefreshed; }
            set{ m_LastRefreshed = value; }
        }
 
        [CommandProperty( AccessLevel.GameMaster )]
        public bool RestrictDecay
        {
            get{ return m_RestrictDecay; }
            set{ m_RestrictDecay = value; }
        }
 
 
        //ENROQ CODE
        private bool fromDeed = false;
 
        public bool IsFromDeed
        {
            get { return fromDeed; }
            set { fromDeed = value; }
        }
        //END ENROQ CODE
 
 
 
        public virtual TimeSpan DecayPeriod{ get{ return TimeSpan.FromDays( 5.0 ); } }






Click pictures below to see the error.
 

Attachments

  • deed1.jpg
    94.2 KB · Views: 2
  • deed2.jpg
    122 KB · Views: 1
  • deed3.jpg
    90.6 KB · Views: 1
  • deed4.jpg
    332.4 KB · Views: 2
  • deed5.jpg
    213.7 KB · Views: 2

daat99

Moderator
Staff member
As you suggested, there is no code that saves the house value.
You will have to save the house value next to the code which tells the house it was placed by a deed (from the deed file):
Code:
house.IsFromDeed = true;
 

Justin Davis

Wanderer
As you suggested, there is no code that saves the house value.
You will have to save the house value next to the code which tells the house it was placed by a deed (from the deed file):
Code:
house.IsFromDeed = true;


Thanks Daat for confirming why code doesn't work. Just wasn't sure if it existed. Going to make another getter setter in deed.cs and grab the DefaultPrice from House.cs, then ask the value in switch case like you said next to the isFromDeed flag in Deeds.cs, then pass it to the if else statement in housedemolish with some extra code and that should work. Very much appreciated.
 

daat99

Moderator
Staff member
Enroq: Allow me to take your advice and moderate more.
If you have nothing constructive to post than don't post at all, consider this as a warning (the starbucks forum isn't moderated so you can post whatever you want there).

Twlizer: consider yourself warned as well.

All I saw in this thread is Justing asking for help and you two trashing him for it.

Take your childish behavior to the starbucks forum and leave the script support forum for more constructive posts.



Justin Davis:
If you need more help than you should feel free to post your questions.
It's true that asking for stuff done for you isn't an accepted behavior in our forum, but I haven't seen you do so in this thread (so it doesn't matter if you did in other threads).


PS
For anyone else who reads this and has no idea what I'm talking about:
Consider yourself spared the punishment of going through 2 pages of childish posts...
 
Status
Not open for further replies.
Top