示例#1
0
        public PreviewHouse(int multiID)
            : base(multiID)
        {
            m_Components = new List <Item>();

            MultiComponentList mcl = Components;

            for (int i = 1; i < mcl.List.Length; ++i)
            {
                MultiTileEntry entry = mcl.List[i];

                if (entry.m_Flags == 0)
                {
                    Item item = new Static((int)entry.m_ItemID);

                    item.MoveToWorld(new Point3D(X + entry.m_OffsetX, Y + entry.m_OffsetY, Z + entry.m_OffsetZ), Map);

                    m_Components.Add(item);
                }
            }

            if (multiID >= 0x13ec && multiID <= 0x147d)
            {
                AddSignAndPost(mcl);
                AddExteriorStairs(mcl);
            }

            m_Timer = new DecayTimer(this);
            m_Timer.Start();
        }
示例#2
0
        public void OnDecayed()
        {
            Map map = this.Map;

            if (map == null)
            {
                return;
            }

            MultiComponentList mcl   = Components;
            IPooledEnumerable  eable = map.GetObjectsInBounds(new Rectangle2D(X + mcl.Min.X, Y + mcl.Min.Y, mcl.Width, mcl.Height));

            ArrayList del = new ArrayList();

            foreach (object o in eable)
            {
                if (o is Guildstone)
                {
                    if (Contains((Item)o))
                    {
                        del.Add(o);
                    }
                }
                else if (o is StrongBox)
                {
                    del.Add(o);
                }
                else if (o is PlayerVendor)
                {
                    if (Contains((Mobile)o))
                    {
                        del.Add(o);
                    }
                }
                else if (o is BaseHouse)
                {
                    ((BaseHouse)o).Z = this.Z;
                }
            }
            eable.Free();

            for (int i = 0; i < del.Count; i++)
            {
                object o = del[i];
                if (o is PlayerVendor)
                {
                    PlayerVendor v = (PlayerVendor)o;
                    v.Say(503235);                       // I regret nothing!postal
                    v.Blessed = false;
                    v.Kill();
                    v.Delete();
                }
                else if (o is Item)
                {
                    ((Item)o).Delete();
                }
            }
        }
示例#3
0
        private List <int> getAllStandableZ(MultiComponentList multi)
        {
            List <int> z_list = new List <int>();

            for (int x = 0; x < multi.Width; ++x)
            {
                for (int y = 0; y < multi.Height; ++y)
                {
                    MTile[] tiles = multi.Tiles[x][y];
                    int     lastz = -100;
                    foreach (MTile tile in tiles)
                    {
                        ItemData itemdata = TileData.ItemTable[tile.ID];
                        if ((itemdata.Flags & TileFlag.Surface) != 0)
                        {
                            if (Math.Abs(lastz - tile.Z) <= 2)
                            {
                                continue;
                            }
                            lastz = tile.Z;
                            int Start = tile.Z + itemdata.CalcHeight;

                            int  Top     = Start + 16; // Playerheight
                            bool add     = true;
                            bool highest = true;
                            foreach (MTile _tile in tiles)
                            {
                                ItemData _itemdata = TileData.ItemTable[_tile.ID];
                                if ((_itemdata.Flags & ImpassableOrSurface) != 0)
                                {
                                    if ((_itemdata.Flags & TileFlag.Door) != 0)
                                    {
                                        continue;
                                    }
                                    int checkTop = _tile.Z + _itemdata.CalcHeight;
                                    if ((checkTop > Start) && (_tile.Z < Top))
                                    {
                                        add = false;
                                        break;
                                    }
                                }
                                if (_tile.Z > tile.Z)
                                {
                                    highest = false;
                                }
                            }
                            if (!highest && add && !z_list.Contains(tile.Z))
                            {
                                z_list.Add(tile.Z);
                            }
                        }
                    }
                }
            }
            z_list.Sort();
            z_list.Reverse();
            return(z_list);
        }
示例#4
0
        public virtual bool Contains(int x, int y)
        {
            MultiComponentList mcl = Components;

            x -= X + mcl.Min.m_X;
            y -= Y + mcl.Min.m_Y;

            return(x >= 0 && x < mcl.Width && y >= 0 && y < mcl.Height && mcl.Tiles[x][y].Length > 0);
        }
示例#5
0
        public DryDockResult CheckDryDock(Mobile from)
        {
            if (CheckDecay())
            {
                return(DryDockResult.Decaying);
            }

            if (!from.Alive)
            {
                return(DryDockResult.Dead);
            }

            Container pack = from.Backpack;

            if ((Ropes == null || !Key.ContainsKey(pack, Ropes[0].KeyValue)))
            {
                return(DryDockResult.NoKey);
            }

            if (Hold != null && Hold.Items.Count > 0)
            {
                return(DryDockResult.Hold);
            }

            Map map = Map;

            if (map == null || map == Map.Internal)
            {
                return(DryDockResult.Items);
            }

            MultiComponentList mcl = Components;

            IPooledEnumerable eable = map.GetObjectsInBounds(new Rectangle2D(X + mcl.Min.X, Y + mcl.Min.Y, mcl.Width, mcl.Height));

            foreach (object o in eable)
            {
                if (o == this || o is BoatRope || o is TillerManHS || o is GalleonHold || o is SingleCannonPlace || o is SingleHelm || o is GalleonMultiComponent || o is MultiCannonPlace || o is MultiHelm || o is MainMast || o is BritainHull)
                {
                    continue;
                }

                if (o is Item && Contains((Item)o))
                {
                    eable.Free();
                    return(DryDockResult.Items);
                }
                else if (o is Mobile && Contains((Mobile)o))
                {
                    eable.Free();
                    return(DryDockResult.Mobiles);
                }
            }

            eable.Free();
            return(DryDockResult.Valid);
        }
示例#6
0
        private void OnClickCalculateAll(object sender, EventArgs e)
        {
            string contents = Path.Combine(FiddlerControls.Options.OutputPath, "multicalc_contents.txt");
            string cfg      = Path.Combine(FiddlerControls.Options.OutputPath, "multicalc_cfg.txt");
            string msg      = Path.Combine(FiddlerControls.Options.OutputPath, "multicalc_msgs.txt");

            richTextBoxCalc.SuspendLayout();
            richTextBoxContents.SuspendLayout();
            using (StreamWriter tex_contents = new StreamWriter(new FileStream(contents, FileMode.Create, FileAccess.Write), System.Text.Encoding.GetEncoding(1252)),
                   tex_cfg = new StreamWriter(new FileStream(cfg, FileMode.Create, FileAccess.Write), System.Text.Encoding.GetEncoding(1252)),
                   tex_msg = new StreamWriter(new FileStream(msg, FileMode.Create, FileAccess.Write), System.Text.Encoding.GetEncoding(1252)))
            {
                for (int i = 0; i < Multi_treeView.Nodes.Count; i++)
                {
                    MultiComponentList multi = (MultiComponentList)Multi_treeView.Nodes[i].Tag;
                    if (multi != null)
                    {
                        CalcStuff(multi, Int32.Parse(Multi_treeView.Nodes[i].Name));
                        tex_contents.WriteLine("MultiID - " + Multi_treeView.Nodes[i].Name);
                        tex_cfg.WriteLine("MultiID - " + Multi_treeView.Nodes[i].Name);
                        tex_msg.WriteLine("MultiID - " + Multi_treeView.Nodes[i].Name);
                        foreach (string str in richTextBoxContents.Lines)
                        {
                            tex_contents.WriteLine(str);
                        }
                        tex_contents.Write("\n");
                        tex_contents.Write("\n");
                        bool in_cfg = false;
                        foreach (string str in richTextBoxCalc.Lines)
                        {
                            if (str.StartsWith("Cfg Entry:"))
                            {
                                in_cfg = true;
                                continue;
                            }
                            if (in_cfg)
                            {
                                tex_cfg.WriteLine(str);
                            }
                            else
                            {
                                tex_msg.WriteLine(str);
                            }
                        }
                        tex_cfg.Write("\n");
                        tex_cfg.Write("\n");
                        tex_msg.Write("\n");
                        tex_msg.Write("\n");
                    }
                }
            }
            richTextBoxCalc.Clear();
            richTextBoxContents.Clear();
            richTextBoxCalc.ResumeLayout();
            richTextBoxContents.ResumeLayout();
            MessageBox.Show(String.Format("All calculations saved to {0}", FiddlerControls.Options.OutputPath), "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
        }
示例#7
0
        public static void TransferData(StaticHouse sh)
        {
            // now transfer over the data from the original blueprint house
            try
            {
                Misc.Diagnostics.Assert(sh != null, "sh == null");
                if (!IsBlueprintLoaded(sh.HouseBlueprintID))
                {
                    if (!LoadBlueprint(sh.HouseBlueprintID))
                    {
                        try { throw new ApplicationException(); }
                        catch (Exception ex) { LogHelper.LogException(ex, "Can't find/load blueprint from hashtable/xml."); }
                        return;
                    }
                }

                Misc.Diagnostics.Assert(m_BlueprintList[sh.HouseBlueprintID] is HouseBlueprint, "m_BlueprintList[sh.HouseBlueprintID] is HouseBlueprint == false");
                HouseBlueprint house = m_BlueprintList[sh.HouseBlueprintID] as HouseBlueprint;
                if (house == null)
                {
                    try { throw new ApplicationException(); }
                    catch (Exception ex) { LogHelper.LogException(ex, "Can't find/load blueprint from hashtable."); }
                    return;
                }

                // copy the data
                sh.DefaultPrice         = house.Price;
                sh.BlueprintVersion     = house.Version;
                sh.Description          = house.Description;
                sh.OriginalOwnerName    = house.OriginalOwnerName;
                sh.OriginalOwnerAccount = house.OriginalOwnerAccount;
                sh.OriginalOwnerSerial  = house.OriginalOwnerSerial;
                sh.SignHanger.ItemID    = house.SignHangerGraphic;
                sh.Signpost.ItemID      = house.SignpostGraphic;
                sh.SignpostGraphic      = house.SignpostGraphic;
                sh.RevisionDate         = house.Capture;

                Misc.Diagnostics.Assert(house.Region != null, "house.Region == null");
                if (house.Region != null && house.Region.Count > 0)
                {
                    Misc.Diagnostics.Assert(sh.Components != null, "sh.Components == null");
                    foreach (Rectangle2D rect in house.Region)
                    {                           // fixup offsets
                        MultiComponentList mcl = sh.Components;
                        int x = rect.X + sh.X + mcl.Min.X;
                        int y = rect.Y + sh.Y + mcl.Min.Y;
                        sh.AreaList.Add(new Rectangle2D(x, y, rect.Width, rect.Height));
                    }
                    sh.UpdateRegionArea();
                }
            }
            catch (Exception e)
            {
                Server.Commands.LogHelper.LogException(e, "Botched Static Housing xml.");
            }
        }
示例#8
0
            public FixColumnTimer(BaseMulti multi) : base(TimeSpan.Zero)
            {
                m_Map = multi.Map;

                MultiComponentList mcl = multi.Components;

                m_StartX = multi.X + mcl.Min.X;
                m_StartY = multi.Y + mcl.Min.Y;
                m_EndX   = multi.X + mcl.Max.X;
                m_EndY   = multi.Y + mcl.Max.Y;
            }
示例#9
0
        private void OnLoad(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            FiddlerControls.Options.LoadedUltimaClass["TileData"] = true;
            FiddlerControls.Options.LoadedUltimaClass["Art"]      = true;
            FiddlerControls.Options.LoadedUltimaClass["Multis"]   = true;
            FiddlerControls.Options.LoadedUltimaClass["Hues"]     = true;

            LoadXML();

            Multi_treeView.BeginUpdate();
            Multi_treeView.Nodes.Clear();
            List <TreeNode> cache = new List <TreeNode>();

            for (int i = 0; i < 0x2000; ++i)
            {
                MultiComponentList multi = Ultima.Multis.GetComponents(i);
                if (multi != MultiComponentList.Empty)
                {
                    TreeNode node = null;
                    if (xDom == null)
                    {
                        node = new TreeNode(String.Format("{0,5} (0x{0:X})", i));
                    }
                    else
                    {
                        XmlNodeList xMultiNodeList = xMultis.SelectNodes("/Multis/Multi[@id='" + i + "']");
                        string      j = "";
                        foreach (XmlNode xMultiNode in xMultiNodeList)
                        {
                            j = xMultiNode.Attributes["name"].Value;
                        }
                        node = new TreeNode(String.Format("{0,5} (0x{0:X}) {1}", i, j));
                    }
                    node.Tag  = multi;
                    node.Name = i.ToString();
                    cache.Add(node);
                }
            }
            Multi_treeView.Nodes.AddRange(cache.ToArray());
            Multi_treeView.EndUpdate();
            if (Multi_treeView.Nodes.Count > 0)
            {
                Multi_treeView.SelectedNode = Multi_treeView.Nodes[0];
            }
            if (!Loaded)
            {
                FiddlerControls.Events.FilePathChangeEvent += new FiddlerControls.Events.FilePathChangeHandler(OnFilePathChangeEvent);
                FiddlerControls.Events.MultiChangeEvent    += new FiddlerControls.Events.MultiChangeHandler(OnMultiChangeEvent);
            }
            Loaded         = true;
            Cursor.Current = Cursors.Default;
        }
示例#10
0
 private void OnClickImport(object sender, EventArgs e)
 {
     if (File.Exists(textBox1.Text))
     {
         Ultima.Multis.ImportType type  = (Ultima.Multis.ImportType)comboBox1.SelectedIndex;
         MultiComponentList       multi = Ultima.Multis.ImportFromFile(id, textBox1.Text, type);
         parent.ChangeMulti(id, multi);
         Options.ChangedUltimaClass["Multis"] = true;
         Close();
     }
 }
示例#11
0
        public virtual bool Inside(int x, int y)
        {
            MultiComponentList mcl = this.Components;

            x -= this.X + mcl.Min.m_X;
            y -= this.Y + mcl.Min.m_Y;

            return(x >= 0 &&
                   x < mcl.Width &&
                   y >= 0 &&
                   y < mcl.Height);
        }
示例#12
0
        public void AddMissingComponents()
        {
            if (this.Map == Map.Internal)
            {
                return;
            }
            if (dirSpawned == Facing)
            {
                return;
            }

            // On rend certains composants invisibles
            TillerMan.Visible = false;
            PPlank.Visible    = false;
            SPlank.Visible    = false;
            Hold.Visible      = false;

            int multiID = 0;

            switch (Facing)
            {
            case Direction.North: multiID = NorthID; break;

            case Direction.East: multiID = EastID; break;

            case Direction.South: multiID = SouthID; break;

            case Direction.West: multiID = WestID; break;
            }

            if (multiID == 0)
            {
                return;
            }
            dirSpawned = this.Facing;

            CleanStaticParts();

            MultiComponentList mcl = MultiData.GetComponents(multiID);

            MultiTileEntry[] mte = mcl.List;

            for (int i = 0; i < mte.Length; i++)
            {
                if (mte[i].m_Flags == 0)
                {
                    BoatStatic s = new BoatStatic((int)mte[i].m_ItemID);
                    s.MoveToWorld(new Point3D(this.X + mte[i].m_OffsetX, this.Y + mte[i].m_OffsetY, this.Z + mte[i].m_OffsetZ), this.Map);
                    s.Movable = false;
                    m_StaticParts.Add(s);
                }
            }
        }
示例#13
0
            protected override void OnTick()
            {
                if (m_Count == 5)
                {
                    List <Mobile>      tomove = new List <Mobile>();
                    MultiComponentList mcl    = m_Boat.Components;

                    IPooledEnumerable eable = m_Boat.Map.GetObjectsInBounds(new Rectangle2D(m_Boat.X + mcl.Min.X, m_Boat.Y + mcl.Min.Y, mcl.Width, mcl.Height));

                    foreach (object o in eable)
                    {
                        if (o is Mobile && m_Boat.Contains((Mobile)o))
                        {
                            var mobile = o as Mobile;
                            if (mobile.Alive && !mobile.Blessed)
                            {
                                mobile.SendMessage(61, "You have drowned.");
                                mobile.Kill();
                            }

                            if (!mobile.Blessed)
                            {
                                tomove.Add(mobile);
                            }
                        }
                    }
                    eable.Free();

                    foreach (var mobile in tomove)
                    {
                        Strandedness.MoveStrandedMobile(mobile);
                    }

                    m_Boat.Delete();
                    Stop();
                }
                else
                {
                    m_Boat.Location = new Point3D(m_Boat.X, m_Boat.Y, m_Boat.Z - 1);

                    if (m_Boat.TillerManMobile != null)
                    {
                        m_Boat.TillerManMobile.TillerManSay(1007168 + m_Count);
                    }
                    if (m_Boat.TillerManItem != null)
                    {
                        m_Boat.TillerManItem.Say(1007168 + m_Count);
                    }

                    ++m_Count;
                }
            }
示例#14
0
        public SmallFarm(Mobile owner, int id) : base(owner, id, 125, 2)
        {
            uint keyValue = CreateKeys(owner);

            AddSouthDoors(0, 3, 7, true);
            MultiComponentList mcl = MultiData.GetComponents(id);

            if (id >= 0x13EC && id < 0x1D00)
            {
                HouseFoundation.AddStairsTo(ref mcl); // this is a AOS house, add the stairs
            }
            // AddSouthDoor(0, 3, 7, keyValue);
            // SetSign(2, 4, 5);
        }
示例#15
0
        public virtual bool Contains(int x, int y)
        {
            MultiComponentList list1   = this.Components;
            Point2D            pointd1 = list1.Min;

            x      -= (this.X + pointd1.m_X);
            pointd1 = list1.Min;
            y      -= (this.Y + pointd1.m_Y);
            if (((x >= 0) && (x < list1.Width)) && ((y >= 0) && (y < list1.Height)))
            {
                return(list1.Tiles[x][y].Length > 0);
            }
            return(false);
        }
示例#16
0
        private static bool TryInsertIntoState(DesignState state, int itemID, int x, int y, int z)
        {
            MultiComponentList mcl = state.Components;

            if (x < mcl.Min.X || y < mcl.Min.Y || x > mcl.Max.X || y > mcl.Max.Y)
            {
                return(false);
            }

            mcl.Add(itemID, x, y, z);
            state.OnRevised();

            return(true);
        }
示例#17
0
        private static bool[][] FillFrom(MultiComponentList m)
        {
            var filled = new bool[m.Width][];

            for (int i = 0; i < m.Width; i++)
            {
                filled[i] = new bool[m.Height];
            }

            foreach (var c in m.List)
            {
                filled[c.m_OffsetX + m.Center.X][c.m_OffsetY + m.Center.Y] = true;
            }

            return(filled);
        }
示例#18
0
        private void OnMultiChangeEvent(object sender, int id)
        {
            if (!Loaded)
            {
                return;
            }
            if (sender.Equals(this))
            {
                return;
            }
            MultiComponentList multi = Ultima.Multis.GetComponents(id);

            if (multi != MultiComponentList.Empty)
            {
                bool done = false;
                for (int i = 0; i < TreeViewMulti.Nodes.Count; ++i)
                {
                    if (id == int.Parse(TreeViewMulti.Nodes[i].Name))
                    {
                        TreeViewMulti.Nodes[i].Tag       = multi;
                        TreeViewMulti.Nodes[i].ForeColor = Color.Black;
                        if (i == TreeViewMulti.SelectedNode.Index)
                        {
                            afterSelect_Multi(this, null);
                        }
                        done = true;
                        break;
                    }
                    else if (id < int.Parse(TreeViewMulti.Nodes[i].Name))
                    {
                        TreeNode node = new TreeNode(String.Format("{0,5} (0x{0:X})", id));
                        node.Tag  = multi;
                        node.Name = id.ToString();
                        TreeViewMulti.Nodes.Insert(i, node);
                        done = true;
                        break;
                    }
                }
                if (!done)
                {
                    TreeNode node = new TreeNode(String.Format("{0,5} (0x{0:X})", id));
                    node.Tag  = multi;
                    node.Name = id.ToString();
                    TreeViewMulti.Nodes.Add(node);
                }
            }
        }
示例#19
0
        public virtual bool IsInside(Point3D p, int height)
        {
            if (Deleted)
            {
                return(false);
            }

            MultiComponentList mcl = Components;

            int x = p.X - (X + mcl.Min.X);
            int y = p.Y - (Y + mcl.Min.Y);

            if (x < 0 || x >= mcl.Width || y < 0 || y >= mcl.Height)
            {
                return(false);
            }

            StaticTile[] tiles = mcl.Tiles[x][y];

            for (int j = 0; j < tiles.Length; ++j)
            {
                StaticTile tile = tiles[j];
                int        id   = tile.ID & 0x3FFF;
                ItemData   data = TileData.ItemTable[id];

                // Slanted roofs do not count; they overhang blocking south and east sides of the multi
                if ((data.Flags & TileFlag.Roof) != 0)
                {
                    continue;
                }

                // Signs and signposts are not considered part of the multi
                if ((id >= 0xB95 && id <= 0xC0E) || (id >= 0xC43 && id <= 0xC44))
                {
                    continue;
                }

                int tileZ = tile.Z + this.Z;

                if (p.Z == tileZ || (p.Z + height) > tileZ)
                {
                    return(true);
                }
            }

            return(false);
        }
		public void AddExteriorStairs( MultiComponentList mcl )
		{
			// this won't work correctly without declaring a new mcl so it can then be resized
			MultiComponentList mclNew = new MultiComponentList( MultiData.GetComponents( ItemID ) );
			
			mclNew.Resize( mclNew.Width, mclNew.Height + 1 );
			
			int xCenter = mcl.Center.X;
			int yCenter = mcl.Center.Y;
			int y = mcl.Height;
			
			for ( int x = 1; x < mclNew.Width; ++x ){
				Item stair = new Static((int)0x751);
				stair.MoveToWorld(new Point3D(x - xCenter, y - yCenter, 0), this.Map);
				this.m_Components.Add(stair);
			}
		}
示例#21
0
        public static List <Rectangle2D> Rects(this BaseMulti multi)
        {
            MultiComponentList m   = multi.Components;
            var         rects      = new List <Rectangle2D>();
            var         filledRect = FillFrom(m);
            Rectangle2D r;

            while (Area(r = GetLargestRect(filledRect)) > 0)
            {
                Subtract(filledRect, r);
                r = new Rectangle2D(
                    new Point2D(r.Start.X - m.Center.X, r.Start.Y - m.Center.Y),
                    new Point2D(r.End.X - m.Center.X, r.End.Y - m.Center.Y));
                rects.Add(r);
            }
            return(rects);
        }
示例#22
0
        public void AddExteriorStairs(MultiComponentList mcl)
        {
            // this won't work correctly without declaring a new mcl so it can then be resized
            MultiComponentList mclNew = new MultiComponentList(MultiData.GetComponents(ItemID));

            mclNew.Resize(mclNew.Width, mclNew.Height + 1);

            int xCenter = mcl.Center.X;
            int yCenter = mcl.Center.Y;
            int y       = mcl.Height;

            for (int x = 1; x < mclNew.Width; ++x)
            {
                Item stair = new Static(0x751);
                stair.MoveToWorld(new Point3D(x - xCenter, y - yCenter, 0), Map);
                m_Components.Add(stair);
            }
        }
示例#23
0
 private void ChangeComponentList(MultiComponentList multi)
 {
     MultiComponentBox.Clear();
     if (multi != MultiComponentList.Empty)
     {
         for (int x = 0; x < multi.Width; ++x)
         {
             for (int y = 0; y < multi.Height; ++y)
             {
                 MTile[] tiles = multi.Tiles[x][y];
                 for (int i = 0; i < tiles.Length; ++i)
                 {
                     MultiComponentBox.AppendText(String.Format("0x{0:X4} {1,3} {2,3} {3,2} {4,2}\n", tiles[i].ID, x, y, tiles[i].Z, tiles[i].Flag));
                 }
             }
         }
     }
 }
        public override void CheckSignpost()
        {
            MultiComponentList mcl = this.Components;

            int x = mcl.Min.X;
            int y = mcl.Height - 2 - mcl.Center.Y;

            if (m_Signpost == null)
            {
                m_Signpost = new Static(m_SignpostGraphic);
                m_Signpost.MoveToWorld(new Point3D(X + x, Y + y, Z + 7), Map);
            }
            else
            {
                m_Signpost.ItemID = m_SignpostGraphic;
                m_Signpost.MoveToWorld(new Point3D(X + x, Y + y, Z + 7), Map);
            }
        }
示例#25
0
            private static void North(Item item, Mobile from)
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                BaseMulti multi = (BaseMulti)house;

                MultiComponentList mcl = multi.Components;

                Point3D p = new Point3D(item.X, item.Y - 1, item.Z);

                if (!house.IsInside(p, item.Z))
                {
                    from.SendMessage("You cannot move it any further North.");
                }
                else
                {
                    item.Y = (item.Y - 1);
                }
            }
        // Adds sign post, sign hanger, and house sign
        public void AddSignAndPost(MultiComponentList mcl)
        {
            int xoffset = mcl.Min.X;
            int y = mcl.Height - 1 - mcl.Center.Y;

            Item signpost = new Static((int)9);
            signpost.MoveToWorld(new Point3D(X + xoffset, Y + y, Z + 7), this.Map);
            this.m_Components.Add(signpost);

            xoffset = Components.Min.X;
            y = Components.Height - Components.Center.Y;

            Item signhanger = new Static((int)0xB98);
            signhanger.MoveToWorld(new Point3D(X + xoffset, Y + y, Z + 7), this.Map);
            this.m_Components.Add(signhanger);

            Item housesign = new Static((int)0xBD2);
            housesign.MoveToWorld(new Point3D(X + xoffset, Y + y, Z + 7), this.Map);
            this.m_Components.Add(housesign);
        }
示例#27
0
            private static void West(Item item, Mobile from)
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                BaseMulti multi = (BaseMulti)house;

                MultiComponentList mcl = multi.Components;

                int max = (mcl.Width / 2);

                Point3D p = new Point3D(item.X - 1, item.Y, item.Z);

                if (!house.IsInside(p, item.Z))
                {
                    from.SendMessage("You cannot move it any further West.");
                }
                else
                {
                    item.X = (item.X - 1);
                }
            }
示例#28
0
        private void AfterSelect_Multi(object sender, TreeViewEventArgs e)
        {
            MultiComponentList multi = (MultiComponentList)TreeViewMulti.SelectedNode.Tag;

            if (multi == MultiComponentList.Empty)
            {
                HeightChangeMulti.Maximum = 0;
                toolTip.SetToolTip(HeightChangeMulti, "MaxHeight: 0");
                StatusMultiText.Text = "Size: 0,0 MaxHeight: 0 MultiRegion: 0,0,0,0";
            }
            else
            {
                HeightChangeMulti.Maximum = multi.maxHeight;
                toolTip.SetToolTip(HeightChangeMulti,
                                   $"MaxHeight: {HeightChangeMulti.Maximum - HeightChangeMulti.Value}");
                StatusMultiText.Text =
                    $"Size: {multi.Width},{multi.Height} MaxHeight: {multi.maxHeight} MultiRegion: {multi.Min.X},{multi.Min.Y},{multi.Max.X},{multi.Max.Y} Surface: {multi.Surface}";
            }
            ChangeComponentList(multi);
            MultiPictureBox.Invalidate();
        }
示例#29
0
        /// <summary>
        /// This must be overriden due to the tillerman not being in the MCL bounds
        /// </summary>
        /// <returns></returns>
        public override IEnumerable <IEntity> GetEntitiesOnBoard()
        {
            Map map = Map;

            if (map == null || map == Map.Internal)
            {
                yield break;
            }

            MultiComponentList mcl   = Components;
            IPooledEnumerable  eable = map.GetObjectsInBounds(new Rectangle2D(X + mcl.Min.X, Y + mcl.Min.Y, mcl.Width, mcl.Height));

            foreach (IEntity ent in eable)
            {
                if (Contains(ent) && CheckOnBoard(ent))
                {
                    yield return(ent);
                }
            }

            eable.Free();
            yield return(Rudder);
        }
 /// <summary>
 /// Create a ComponentList from UltimaSDK
 /// </summary>
 public MultiEditorComponentList(MultiComponentList list, MultiEditor parent)
 {
     Parent = parent;
     Width  = list.Width;
     Height = list.Height;
     Tiles  = new List <MultiTile>();
     for (int x = 0; x < Width; ++x)
     {
         for (int y = 0; y < Height; ++y)
         {
             for (int i = 0; i < list.Tiles[x][y].Length; ++i)
             {
                 Tiles.Add(new MultiTile(list.Tiles[x][y][i].ID, x, y, list.Tiles[x][y][i].Z, (int)list.Tiles[x][y][i].Flag));
             }
             Tiles.Add(new FloorTile(x, y, Parent.DrawFloorZ));
         }
     }
     CalcSolver();
     Tiles.Sort();
     UndoList = new UndoStruct[UndoListMaxSize];
     Modified = true;
     RecalcMinMax();
 }
示例#31
0
        public PreviewHouse(int multiID) : base(multiID)
        {
            m_Components = new List <Item>();

            MultiComponentList mcl = Components;

            for (int i = 1; i < mcl.List.Length; ++i)
            {
                MultiTileEntry entry = mcl.List[i];

                if (entry.Flags == 0)
                {
                    Item item = new Static((int)entry.ItemId);

                    item.MoveToWorld(new Point3D(X + entry.OffsetX, Y + entry.OffsetY, Z + entry.OffsetZ), Map);

                    m_Components.Add(item);
                }
            }

            m_Timer = new DecayTimer(this);
            m_Timer.Start();
        }
示例#32
0
        // Adds sign post, sign hanger, and house sign
        public void AddSignAndPost(MultiComponentList mcl)
        {
            int xoffset = mcl.Min.X;
            int y       = mcl.Height - 1 - mcl.Center.Y;

            Item signpost = new Static((int)9);

            signpost.MoveToWorld(new Point3D(X + xoffset, Y + y, Z + 7), this.Map);
            this.m_Components.Add(signpost);

            xoffset = Components.Min.X;
            y       = Components.Height - Components.Center.Y;

            Item signhanger = new Static((int)0xB98);

            signhanger.MoveToWorld(new Point3D(X + xoffset, Y + y, Z + 7), this.Map);
            this.m_Components.Add(signhanger);

            Item housesign = new Static((int)0xBD2);

            housesign.MoveToWorld(new Point3D(X + xoffset, Y + y, Z + 7), this.Map);
            this.m_Components.Add(housesign);
        }
示例#33
0
		public static bool DeleteStairs( MultiComponentList mcl, int id, int x, int y, int z )
		{
			int ax = x + mcl.Center.X;
			int ay = y + mcl.Center.Y;

			if( ax < 0 || ay < 0 || ax >= mcl.Width || ay >= (mcl.Height - 1) || z < 7 || ((z - 7) % 5) != 0 )
				return false;

			if( IsStairBlock( id ) )
			{
				StaticTile[] tiles = mcl.Tiles[ax][ay];

				for( int i = 0; i < tiles.Length; ++i )
				{
					StaticTile tile = tiles[i];

					if( tile.Z == (z + 5) )
					{
						id = tile.ID;
						z = tile.Z;

						if( !IsStairBlock( id ) )
							break;
					}
				}
			}

			int dir = 0;

			if( !IsStair( id, ref dir ) )
				return false;

			if ( AllowStairSectioning )
				return true; // skip deletion

			int height = ((z - 7) % 20) / 5;

			int xStart, yStart;
			int xInc, yInc;

			switch( dir )
			{
				default:
				case 0: // North
				{
					xStart = x;
					yStart = y + height;
					xInc = 0;
					yInc = -1;
					break;
				}
				case 1: // West
				{
					xStart = x + height;
					yStart = y;
					xInc = -1;
					yInc = 0;
					break;
				}
				case 2: // South
				{
					xStart = x;
					yStart = y - height;
					xInc = 0;
					yInc = 1;
					break;
				}
				case 3: // East
				{
					xStart = x - height;
					yStart = y;
					xInc = 1;
					yInc = 0;
					break;
				}
			}

			int zStart = z - (height * 5);

			for( int i = 0; i < 4; ++i )
			{
				x = xStart + (i * xInc);
				y = yStart + (i * yInc);

				for( int j = 0; j <= i; ++j )
					mcl.RemoveXYZH( x, y, zStart + (j * 5), 5 );

				ax = x + mcl.Center.X;
				ay = y + mcl.Center.Y;

				if( ax >= 1 && ax < mcl.Width && ay >= 1 && ay < mcl.Height - 1 )
				{
					StaticTile[] tiles = mcl.Tiles[ax][ay];

					bool hasBaseFloor = false;

					for( int j = 0; !hasBaseFloor && j < tiles.Length; ++j )
						hasBaseFloor = (tiles[j].Z == 7 && tiles[j].ID != 1);

					if( !hasBaseFloor )
						mcl.Add( 0x31F4, x, y, 7 );
				}
			}

			return true;
		}
示例#34
0
		public DesignState( DesignState toCopy )
		{
			m_Foundation = toCopy.m_Foundation;
			m_Components = new MultiComponentList( toCopy.m_Components );
			m_Revision = toCopy.m_Revision;
			m_Fixtures = new MultiTileEntry[toCopy.m_Fixtures.Length];

			for( int i = 0; i < m_Fixtures.Length; ++i )
				m_Fixtures[i] = toCopy.m_Fixtures[i];
		}
示例#35
0
		public MultiComponentList GetEmptyFoundation()
		{
			// Copy original foundation layout
			MultiComponentList mcl = new MultiComponentList( MultiData.GetComponents( ItemID ) );

			mcl.Resize( mcl.Width, mcl.Height + 1 );

			int xCenter = mcl.Center.X;
			int yCenter = mcl.Center.Y;
			int y = mcl.Height - 1;

			ApplyFoundation( m_Type, mcl );

			for( int x = 1; x < mcl.Width; ++x )
				mcl.Add( 0x751, x - xCenter, y - yCenter, 0 );

			return mcl;
		}
示例#36
0
		public static void ApplyFoundation( FoundationType type, MultiComponentList mcl )
		{
			int east, south, post, corner;

			GetFoundationGraphics( type, out east, out south, out post, out corner );

			int xCenter = mcl.Center.X;
			int yCenter = mcl.Center.Y;

			mcl.Add( post, 0 - xCenter, 0 - yCenter, 0 );
			mcl.Add( corner, mcl.Width - 1 - xCenter, mcl.Height - 2 - yCenter, 0 );

			for( int x = 1; x < mcl.Width; ++x )
			{
				mcl.Add( south, x - xCenter, 0 - yCenter, 0 );

				if( x < mcl.Width-1 )
					mcl.Add( south, x - xCenter, mcl.Height - 2 - yCenter, 0 );
			}

			for( int y = 1; y < mcl.Height - 1; ++y )
			{
				mcl.Add( east, 0 - xCenter, y - yCenter, 0 );

				if( y < mcl.Height - 2 )
					mcl.Add( east, mcl.Width - 1 - xCenter, y - yCenter, 0 );
			}
		}
        private static MultiComponentList GetComponentList(MultiTileEntry[] array)
        {
            MultiComponentList mcl = new MultiComponentList(BaseBuilding.EmptyList);
            foreach (MultiTileEntry entry in array)
                mcl.Add(entry.m_ItemID, entry.m_OffsetX, entry.m_OffsetY, entry.m_OffsetZ);

            return mcl;
        }
示例#38
0
		public DesignState( HouseFoundation foundation, MultiComponentList components )
		{
			m_Foundation = foundation;
			m_Components = components;
			m_Fixtures = new MultiTileEntry[0];
		}
 public ComponentEntry(MultiComponentList list, bool small, int xoff, int yoff)
     : base(1, list, small)
 {
     X_Offset = xoff;
     Y_Offset = yoff;
 }
示例#40
0
		public DesignState( HouseFoundation foundation, GenericReader reader )
		{
			m_Foundation = foundation;

			int version = reader.ReadInt();

			switch( version )
			{
				case 0:
				{
					m_Components = new MultiComponentList( reader );

					int length = reader.ReadInt();

					m_Fixtures = new MultiTileEntry[length];

					for( int i = 0; i < length; ++i )
					{
						m_Fixtures[i].m_ItemID = reader.ReadUShort();
						m_Fixtures[i].m_OffsetX = reader.ReadShort();
						m_Fixtures[i].m_OffsetY = reader.ReadShort();
						m_Fixtures[i].m_OffsetZ = reader.ReadShort();
						m_Fixtures[i].m_Flags = reader.ReadInt();
					}

					m_Revision = reader.ReadInt();

					break;
				}
			}
		}
 public AddonEntry(MultiComponentList list, List<string> components, bool small)
     : base(2, list, small)
 {
     Components = components;
 }
示例#42
0
		public static void AddStairsTo( ref MultiComponentList mcl )
		{
			// copy the original..
			mcl = new MultiComponentList( mcl );

			mcl.Resize( mcl.Width, mcl.Height + 1 );

			int xCenter = mcl.Center.X;
			int yCenter = mcl.Center.Y;
			int y = mcl.Height - 1;

			for( int x = 0; x < mcl.Width; ++x )
				mcl.Add( 0x63, x - xCenter, y - yCenter, 0 );
		}
 public BuildingEntry(int type, MultiComponentList list, bool small)
 {
     ComponentList = list;
     BuildType = type;
     IsSmall = small;
 }
示例#44
0
		public bool CheckWall( MultiComponentList mcl, int x, int y )
		{
			x += mcl.Center.X;
			y += mcl.Center.Y;

			if( x >= 0 && x < mcl.Width && y >= 0 && y < mcl.Height )
			{
				StaticTile[] tiles = mcl.Tiles[x][y];

				for( int i = 0; i < tiles.Length; ++i )
				{
					StaticTile tile = tiles[i];

					if( tile.Z == 7 && tile.Height == 20 )
						return true;
				}
			}

			return false;
		}
        public BuildingEntry(GenericReader reader, int type)
        {
            BuildType = type;

            int version = reader.ReadInt();
            ComponentList = new MultiComponentList(reader);
            IsSmall = reader.ReadBool();
            if (version == 0)
                for (int i = ComponentList.List.Length - 1; i >= 0; i--)
                    ComponentList.List[i].m_OffsetZ += 42;
        }