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!

[RunUO 2.0 RC1] Player Government System Version 2

Avelyn

Sorceror
Wow, I have been away for a while. This system is most definitely NOT compatible with the current SVN. I have been asked to get back into hosting a UO shard so I will take a look at RunUO 2.1 and retool my system to work with the current SVN's over the holiday.
 

pagan_302

Sorceror
Getting these errors.

 

Nockar

Sorceror
Wow, I have been away for a while. This system is most definitely NOT compatible with the current SVN. I have been asked to get back into hosting a UO shard so I will take a look at RunUO 2.1 and retool my system to work with the current SVN's over the holiday.

Any change you are getting close to release it?? ;o)
 

Tresdni

Squire
I have a current version ready with the newest SVN working. I will post it when I am able to pack it up with the generic distro files.

Any chance you're still working on packing this up? I'de like to check it out :)
 

Avelyn

Sorceror
Any chance you're still working on packing this up? I'de like to check it out :)

Yes, I have it updated and running on RunUo 2.1 latest SVN. I'm actually adding a few more features so it will also be an upgrade. I should be able to get it out in the next few days or so. Updated the docs is the most time consuming!
 
I need a little help here please. Can not seem to find the sweet spot.

Using: RunUO-2.1-R605

Following error

Scripts: Compiling C# scripts...failed (1 errors, 3 warnings)
Warnings:
+ Custom/Government System/Vendor/CityPlayerVendor.cs:
CS0108: Line 258: 'Server.Mobiles.CityPlayerVendor.Dismiss(Server.Mobile)' h
ides inherited member 'Server.Mobiles.PlayerVendor.Dismiss(Server.Mobile)'. Use
the new keyword if hiding was intended.
+ Custom/Government System/Vendor/CityContractOfEmployment.cs:
CS0642: Line 56: Possible mistaken empty statement
+ Custom/Government System/PlayerGovernmentSystem.cs:
CS0162: Line 612: Unreachable code detected
Errors:
+ Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs:
CS1502: Line 608: The best overloaded method match for 'Server.Items.BaseAdd
on.CheckHouse(Server.Mobile, Server.Point3D, Server.Map, int, ref System.Collect
ions.Generic.List<Server.Multis.BaseHouse>)' has some invalid arguments
CS1503: Line 608: Argument '5': cannot convert from 'ref Server.Multis.BaseH
ouse' to 'ref System.Collections.Generic.List<Server.Multis.BaseHouse>'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

CharacterStatue.cs
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Gumps;
using Server.Items;
using Server.Spells;
using Server.Multis;
using Server.Network;
using Server.Targeting;
using Server.Accounting;
using Server.ContextMenus;
using Server.Engines.VeteranRewards;

namespace Server.Mobiles
{
    public enum StatueType
    {
        Marble,
        Jade,
        Bronze
    }

    public enum StatuePose
    {
        Ready,
        Casting,
        Salute,
        AllPraiseMe,
        Fighting,
        HandsOnHips
    }

    public enum StatueMaterial
    {
        Antique,
        Dark,
        Medium,
        Light
    }

    public class CharacterStatue : Mobile, IRewardItem
    {
        private StatueType m_Type;
        private StatuePose m_Pose;
        private StatueMaterial m_Material;

        [CommandProperty( AccessLevel.GameMaster )]
        public StatueType StatueType
        {
            get { return m_Type; }
            set { m_Type = value; InvalidateHues(); InvalidatePose(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public StatuePose Pose
        {
            get { return m_Pose; }
            set { m_Pose = value; InvalidatePose(); }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public StatueMaterial Material
        {
            get { return m_Material; }
            set { m_Material = value; InvalidateHues(); InvalidatePose(); }
        }

        private Mobile m_SculptedBy;
        private DateTime m_SculptedOn;

        [CommandProperty( AccessLevel.GameMaster )]
        public Mobile SculptedBy
        {
            get{ return m_SculptedBy; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public DateTime SculptedOn
        {
            get{ return m_SculptedOn; }
        }

        private CharacterStatuePlinth m_Plinth;

        public CharacterStatuePlinth Plinth
        {
            get { return m_Plinth; }
            set { m_Plinth = value; }
        }

        private bool m_IsRewardItem;

        [CommandProperty( AccessLevel.GameMaster )]
        public bool IsRewardItem
        {
            get{ return m_IsRewardItem; }
            set{ m_IsRewardItem = value; }
        }

        public CharacterStatue( Mobile from, StatueType type ) : base()
        {
            m_Type = type;
            m_Pose = StatuePose.Ready;
            m_Material = StatueMaterial.Antique;

            Direction = Direction.South;
            AccessLevel = AccessLevel.Counselor;
            Hits = HitsMax;
            Blessed = true;
            Frozen = true;

            CloneBody( from );
            CloneClothes( from );
            InvalidateHues();
        }

        public CharacterStatue( Serial serial ) : base( serial )
        {
        }

        public override void OnDoubleClick( Mobile from )
        {
            DisplayPaperdollTo( from );
        }

        public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties( list );

            if ( m_SculptedBy != null )
            {
                if ( m_SculptedBy.Title != null )
                    list.Add( 1076202, m_SculptedBy.Title + " " + m_SculptedBy.Name ); // Sculpted by ~1_Name~
                else
                    list.Add( 1076202, m_SculptedBy.Name ); // Sculpted by ~1_Name~
            }
        }

        public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
        {
            base.GetContextMenuEntries( from, list );

            if ( from.Alive && m_SculptedBy != null )
            {
                BaseHouse house = BaseHouse.FindHouseAt( this );

                if ( ( house != null && house.IsCoOwner( from ) ) || (int) from.AccessLevel > (int) AccessLevel.Counselor )
                    list.Add( new DemolishEntry( this ) );
            }
        }

        public override void OnAfterDelete()
        {
            base.OnAfterDelete();

            if ( m_Plinth != null && !m_Plinth.Deleted )
                m_Plinth.Delete();
        }

        protected override void OnMapChange( Map oldMap )
        {
            InvalidatePose();

            if ( m_Plinth != null )
                m_Plinth.Map = Map;
        }

        protected override void OnLocationChange( Point3D oldLocation )
        {
            InvalidatePose();

            if ( m_Plinth != null )
                m_Plinth.Location = new Point3D( X, Y, Z - 5 );
        }

        public override bool CanBeRenamedBy( Mobile from )
        {
            return false;
        }

        public override bool CanBeDamaged()
        {
            return false;
        }

        public void OnRequestedAnimation( Mobile from )
        {
            from.Send( new UpdateStatueAnimation( this, 1, m_Animation, m_Frames ) );
        }

        public override void OnAosSingleClick( Mobile from )
        {
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.WriteEncodedInt( (int) 0 ); // version

            writer.Write( (int) m_Type );
            writer.Write( (int) m_Pose );
            writer.Write( (int) m_Material );

            writer.Write( (Mobile) m_SculptedBy );
            writer.Write( (DateTime) m_SculptedOn );

            writer.Write( (Item) m_Plinth );
            writer.Write( (bool) m_IsRewardItem );
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadEncodedInt();

            m_Type = (StatueType) reader.ReadInt();
            m_Pose = (StatuePose) reader.ReadInt();
            m_Material = (StatueMaterial) reader.ReadInt();

            m_SculptedBy = reader.ReadMobile();
            m_SculptedOn = reader.ReadDateTime();

            m_Plinth = reader.ReadItem() as CharacterStatuePlinth;
            m_IsRewardItem = reader.ReadBool();

            InvalidatePose();

            Frozen = true;

            if( m_SculptedBy == null || Map == Map.Internal )
            {
                Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Delete ) );
            }
        }

        public void Sculpt( Mobile by )
        {
            m_SculptedBy = by;
            m_SculptedOn = DateTime.Now;

            InvalidateProperties();
        }

        public void Demolish( Mobile by )
        {
            CharacterStatueDeed deed = new CharacterStatueDeed( null );

            if ( by.PlaceInBackpack( deed ) )
            {
                Delete();

                deed.Statue = this;
                deed.IsRewardItem = m_IsRewardItem;

                if ( m_Plinth != null )
                    m_Plinth.Delete();
            }
            else
            {
                by.SendLocalizedMessage( 500720 ); // You don't have enough room in your backpack!
                deed.Delete();
            }
        }

        public void Restore( CharacterStatue from )
        {
            m_Material = from.Material;
            m_Pose = from.Pose;

            Direction = from.Direction;

            CloneBody( from );
            CloneClothes( from );

            InvalidateHues();
            InvalidatePose();
        }

        public void CloneBody( Mobile from )
        {
            Name = from.Name;
            BodyValue = from.BodyValue;
            HairItemID = from.HairItemID;
            FacialHairItemID = from.FacialHairItemID;
        }

        public void CloneClothes( Mobile from )
        {
            for ( int i = Items.Count - 1; i >= 0; i -- )
                Items[ i ].Delete();

            for ( int i = from.Items.Count - 1; i >= 0; i -- )
            {
                Item item = from.Items[ i ];

                if ( item.Layer != Layer.Backpack && item.Layer != Layer.Mount && item.Layer != Layer.Bank )
                    AddItem( CloneItem( item ) );
            }
        }

        public Item CloneItem( Item item )
        {
            Item cloned = new Item( item.ItemID );
            cloned.Layer = item.Layer;
            cloned.Name = item.Name;
            cloned.Hue = item.Hue;
            cloned.Weight = item.Weight;
            cloned.Movable = false;

            return cloned;
        }

        public void InvalidateHues()
        {
            Hue = 0xB8F + (int) m_Type * 4 + (int) m_Material;

            HairHue = Hue;

            if ( FacialHairItemID > 0 )
                FacialHairHue = Hue;

            for ( int i = Items.Count - 1; i >= 0; i -- )
                Items[ i ].Hue = Hue;

            if ( m_Plinth != null )
                m_Plinth.InvalidateHue();
        }

        private int m_Animation;
        private int m_Frames;

        public void InvalidatePose()
        {
            switch ( m_Pose )
            {
                case StatuePose.Ready:
                        m_Animation = 4;
                        m_Frames = 0;
                        break;
                case StatuePose.Casting:
                        m_Animation = 16;
                        m_Frames = 2;
                        break;
                case StatuePose.Salute:
                        m_Animation = 33;
                        m_Frames = 1;
                        break;
                case StatuePose.AllPraiseMe:
                        m_Animation = 17;
                        m_Frames = 4;
                        break;
                case StatuePose.Fighting:
                        m_Animation = 31;
                        m_Frames = 5;
                        break;
                case StatuePose.HandsOnHips:
                        m_Animation = 6;
                        m_Frames = 1;
                        break;
            }

            if( Map != null )
            {
                ProcessDelta();

                Packet p = null;

                IPooledEnumerable eable = Map.GetClientsInRange( Location );

                foreach( NetState state in eable )
                {
                    state.Mobile.ProcessDelta();

                    if( p == null )
                        p = Packet.Acquire( new UpdateStatueAnimation( this, 1, m_Animation, m_Frames ) );

                    state.Send( p );
                }

                Packet.Release( p );

                eable.Free();
            }
        }

        private class DemolishEntry : ContextMenuEntry
        {
            private CharacterStatue m_Statue;

            public DemolishEntry( CharacterStatue statue ) : base( 6275, 2 )
            {
                m_Statue = statue;
            }

            public override void OnClick()
            {
                if ( m_Statue.Deleted )
                    return;

                m_Statue.Demolish( Owner.From );
            }
        }
    }

    public class CharacterStatueDeed : Item, IRewardItem
    {
        public override int LabelNumber
        {
            get
            {
                if ( m_Statue != null )
                {
                    switch ( m_Statue.StatueType )
                    {
                        case StatueType.Marble: return 1076189;
                        case StatueType.Jade: return 1076188;
                        case StatueType.Bronze: return 1076190;
                    }
                }

                return 1076173;
            }
        }

        private CharacterStatue m_Statue;
        private bool m_IsRewardItem;

        [CommandProperty( AccessLevel.GameMaster )]
        public CharacterStatue Statue
        {
            get { return m_Statue; }
            set { m_Statue = value; }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public StatueType StatueType
        {
            get
            {
                if ( m_Statue != null )
                    return m_Statue.StatueType;

                return StatueType.Marble;
            }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public bool IsRewardItem
        {
            get{ return m_IsRewardItem; }
            set{ m_IsRewardItem = value; InvalidateProperties(); }
        }

        public CharacterStatueDeed( CharacterStatue statue ) : base( 0x14F0 )
        {
            m_Statue = statue;

            LootType = LootType.Blessed;
            Weight = 1.0;
        }

        public CharacterStatueDeed( Serial serial ) : base( serial )
        {
        }

        public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties( list );

            if ( m_IsRewardItem )
                list.Add( 1076222 ); // 6th Year Veteran Reward

            if ( m_Statue != null )
                list.Add( 1076231, m_Statue.Name ); // Statue of ~1_Name~
        }

        public override void OnDoubleClick( Mobile from )
        {
            Account acct = from.Account as Account;

            if ( acct != null && from.AccessLevel == AccessLevel.Player )
            {
                TimeSpan time = TimeSpan.FromDays( RewardSystem.RewardInterval.TotalDays * 6 ) - ( DateTime.Now - acct.Created );

                if ( time > TimeSpan.Zero )
                {
                    from.SendLocalizedMessage( 1008126, true, Math.Ceiling( time.TotalDays / RewardSystem.RewardInterval.TotalDays ).ToString() ); // Your account is not old enough to use this item. Months until you can use this item :
                    return;
                }
            }

            if ( IsChildOf( from.Backpack ) )
            {
                if ( !from.IsBodyMod )
                {
                    from.SendLocalizedMessage( 1076194 ); // Select a place where you would like to put your statue.
                    from.Target = new CharacterStatueTarget( this, StatueType );
                }
                else
                    from.SendLocalizedMessage( 1073648 ); // You may only proceed while in your original state...
            }
            else
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
        }

        public override void OnDelete()
        {
            base.OnDelete();

            if ( m_Statue != null )
                m_Statue.Delete();
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.WriteEncodedInt( (int) 0 ); // version

            writer.Write( (Mobile) m_Statue );
            writer.Write( (bool) m_IsRewardItem );
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadEncodedInt();

            m_Statue = reader.ReadMobile() as CharacterStatue;
            m_IsRewardItem = reader.ReadBool();
        }
    }

    public class CharacterStatueTarget : Target
    {
        private Item m_Maker;
        private StatueType m_Type;

        public CharacterStatueTarget( Item maker, StatueType type ) : base( -1, true, TargetFlags.None )
        {
            m_Maker = maker;
            m_Type = type;
        }

        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();

                    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 static AddonFitResult CouldFit( Point3D p, Map map, Mobile from, ref BaseHouse house )
        {
            if ( !map.CanFit( p.X, p.Y, p.Z, 20, true, true, true ) )
                return AddonFitResult.Blocked;
            else if ( !BaseAddon.CheckHouse( from, p, map, 20, ref house ) ) //608
                return AddonFitResult.NotInHouse;
            else
                return CheckDoors( p, 20, house );
        }

        public static AddonFitResult CheckDoors( Point3D p, int height, BaseHouse house )
        {
            ArrayList doors = house.Doors;

            for ( int i = 0; i < doors.Count; i ++ )
            {
                BaseDoor door = doors[ i ] as BaseDoor;

                Point3D doorLoc = door.GetWorldLocation();
                int doorHeight = door.ItemData.CalcHeight;

                if ( Utility.InRange( doorLoc, p, 1 ) && (p.Z == doorLoc.Z || ((p.Z + height) > doorLoc.Z && (doorLoc.Z + doorHeight) > p.Z)) )
                    return AddonFitResult.DoorTooClose;
            }

            return AddonFitResult.Valid;
        }
    }
}

BaseAddon.cs
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Multis;
using Server.Regions;
using Server.Mobiles;

namespace Server.Items
{
    public enum AddonFitResult
    {
        Valid,
        Blocked,
        NotInHouse,
        DoorsNotClosed,
        DoorTooClose,
        NoWall
    }

    public interface IAddon
    {
        Item Deed{ get; }

        bool CouldFit( IPoint3D p, Map map );
    }

    public abstract class BaseAddon : Item, IChopable, IAddon
    {
        private List<AddonComponent> m_Components;

        public void AddComponent( AddonComponent c, int x, int y, int z )
        {
            if ( Deleted )
                return;

            m_Components.Add( c );

            c.Addon = this;
            c.Offset = new Point3D( x, y, z );
            c.MoveToWorld( new Point3D( X + x, Y + y, Z + z ), Map );
        }

        public BaseAddon() : base( 1 )
        {
            Movable = false;
            Visible = false;

            m_Components = new List<AddonComponent>();
        }

        public virtual bool RetainDeedHue{ get{ return false; } }

        public virtual void OnChop( Mobile from )
        {
            BaseHouse house = BaseHouse.FindHouseAt( this );

            PlayerMobile pm = (PlayerMobile)from; //NEW for Player city
            bool ismayor = false;
            if ( pm.City != null && pm.City.Mayor == pm && PlayerGovernmentSystem.IsAtCity( from ) )
                ismayor = true;

            if ( house != null && house.IsOwner( from ) && house.Addons.Contains( this ) || ismayor )
            {
                Effects.PlaySound( GetWorldLocation(), Map, 0x3B3 );
                from.SendLocalizedMessage( 500461 ); // You destroy the item.

                int hue = 0;

                if ( RetainDeedHue )
                {
                    for ( int i = 0; hue == 0 && i < m_Components.Count; ++i )
                    {
                        AddonComponent c = m_Components[i];

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

                Delete();

                if ( house != null )
                house.Addons.Remove( this );

                BaseAddonDeed deed = Deed;

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

                    from.AddToBackpack( deed );
                }
            }
        }

        public virtual BaseAddonDeed Deed{ get{ return null; } }

        Item IAddon.Deed
        {
            get{ return this.Deed; }
        }

        public List<AddonComponent> Components
        {
            get
            {
                return m_Components;
            }
        }

        public BaseAddon( Serial serial ) : base( serial )
        {
        }

        public bool CouldFit( IPoint3D p, Map map )
        {
            List<BaseHouse> houses = null;

            return ( CouldFit( p, map, null, ref houses ) == AddonFitResult.Valid );
        }

        public virtual AddonFitResult CouldFit( IPoint3D p, Map map, Mobile from, ref List<BaseHouse> houses )
        {
            if ( PlayerGovernmentSystem.IsAtCity( this ) )
                return AddonFitResult.Valid;

            if ( Deleted )
                return AddonFitResult.Blocked;

            if ( houses == null )
                houses = new List<BaseHouse>();

            foreach ( AddonComponent c in m_Components )
            {
                Point3D p3D = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );

                if ( !map.CanFit( p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, ( c.Z == 0 ) ) )
                {
                    //World.Broadcast(1154, true, "Blocked");
                    return AddonFitResult.Blocked;
                }
                else if ( !CheckHouse( from, p3D, map, c.ItemData.Height, ref houses ) )
                {
                    //World.Broadcast(1154, true, "Not in House");
                    return AddonFitResult.NotInHouse;
                }

                if ( c.NeedsWall )
                {
                    Point3D wall = c.WallPosition;

                    if ( !IsWall( p3D.X + wall.X, p3D.Y + wall.Y, p3D.Z + wall.Z, map ) )
                        return AddonFitResult.NoWall;
                }
            }

            foreach ( BaseHouse house in houses )
            {
                ArrayList doors = house.Doors;

                for ( int i = 0; i < doors.Count; ++i )
                {
                    BaseDoor door = doors[i] as BaseDoor;

                    if ( door != null && door.Open )
                        return AddonFitResult.DoorsNotClosed;

                    Point3D doorLoc = door.GetWorldLocation();
                    int doorHeight = door.ItemData.CalcHeight;

                    foreach ( AddonComponent c in m_Components )
                    {
                        Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );
                        int addonHeight = c.ItemData.CalcHeight;

                        if ( Utility.InRange( doorLoc, addonLoc, 1 ) && (addonLoc.Z == doorLoc.Z || ((addonLoc.Z + addonHeight) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLoc.Z)) )
                            return AddonFitResult.DoorTooClose;
                    }
                }
            }

            return AddonFitResult.Valid;
        }

        public static bool CheckHouse( Mobile from, Point3D p, Map map, int height, ref List<BaseHouse> list )
        {
            BaseHouse house = BaseHouse.FindHouseAt( p, map, height );

            if ( from == null )
                return true;
            if ( house == null )
                return false;
            if ( !house.IsOwner( from ) )
                return false;

            if ( !list.Contains( house ) )
                list.Add( house );

                return true;

        }

        public static bool IsWall( int x, int y, int z, Map map )
        {
            if ( map == null )
                return false;

            StaticTile[] tiles = map.Tiles.GetStaticTiles( x, y, true );

            for ( int i = 0; i < tiles.Length; ++i )
            {
                StaticTile t = tiles[i];
                ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue];

                if ( (id.Flags & TileFlag.Wall) != 0 && (z + 16) > t.Z && (t.Z + t.Height) > z )
                    return true;
            }

            return false;
        }

        public virtual void OnComponentLoaded( AddonComponent c )
        {
        }

        public virtual void OnComponentUsed( AddonComponent c, Mobile from )
        {
        }

        public override void OnLocationChange( Point3D oldLoc )
        {
            if ( Deleted )
                return;

            foreach ( AddonComponent c in m_Components )
                c.Location = new Point3D( X + c.Offset.X, Y + c.Offset.Y, Z + c.Offset.Z );
        }

        public override void OnMapChange()
        {
            if ( Deleted )
                return;

            foreach ( AddonComponent c in m_Components )
                c.Map = Map;
        }

        public override void OnAfterDelete()
        {
            base.OnAfterDelete();

            foreach ( AddonComponent c in m_Components )
                c.Delete();
        }

        public virtual bool ShareHue{ get{ return true; } }

        [Hue, CommandProperty( AccessLevel.GameMaster )]
        public override int Hue
        {
            get
            {
                return base.Hue;
            }
            set
            {
                if ( base.Hue != value )
                {
                    base.Hue = value;

                    if ( !Deleted && this.ShareHue && m_Components != null )
                    {
                        foreach ( AddonComponent c in m_Components )
                            c.Hue = value;
                    }
                }
            }
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 1 ); // version

            writer.WriteItemList<AddonComponent>( m_Components );
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 1:
                case 0:
                {
                    m_Components = reader.ReadStrongItemList<AddonComponent>();
                    break;
                }
            }

            if ( version < 1 && Weight == 0 )
                Weight = -1;
        }
    }
}

Any advice will be greatly appreciated.
 

Crod76

Sorceror
So I have this working, got past all the coding differences so the server compiled. Added 13 citizens, waited a few days and no size upgrade. Any ideas?
 
Top