コード例 #1
0
ファイル: Decorate.cs プロジェクト: zerodowned/RunUO.T2A
        public int Generate( Map[] maps )
        {
            int count = 0;

            Item item = null;

            for ( int i = 0; i < m_Entries.Count; ++i )
            {
                DecorationEntry entry = (DecorationEntry)m_Entries[i];
                Point3D loc = entry.Location;
                string extra = entry.Extra;

                for ( int j = 0; j < maps.Length; ++j )
                {
                    if ( item == null )
                        item = Construct();

                    if ( item == null )
                        continue;

                    if ( FindItem( loc.X, loc.Y, loc.Z, maps[j], item ) )
                    {
                    }
                    else
                    {
                        item.MoveToWorld( loc, maps[j] );
                        ++count;

                        if ( item is BaseDoor )
                        {
                            IPooledEnumerable eable = maps[j].GetItemsInRange( loc, 1 );

                            Type itemType = item.GetType();

                            foreach ( Item link in eable )
                            {
                                if ( link != item && link.Z == item.Z && link.GetType() == itemType )
                                {
                                    ((BaseDoor)item).Link = (BaseDoor)link;
                                    ((BaseDoor)link).Link = (BaseDoor)item;
                                    break;
                                }
                            }

                            eable.Free();
                        }

                        item = null;
                    }
                }
            }

            if ( item != null )
                item.Delete();

            return count;
        }
コード例 #2
0
        public int Remove(Map[] maps)
        {
            int count = 0;

            Item item = null;

            for (int i = 0; i < m_Entries.Count; ++i)
            {
                DecorationEntry entry = (DecorationEntry)m_Entries[i];
                Point3D         loc   = entry.Location;
                string          extra = entry.Extra;

                for (int j = 0; j < maps.Length; ++j)
                {
                    if (item == null)
                    {
                        item = Construct();
                    }

                    #region Mondain's Legacy
                    m_Constructed = item;
                    #endregion

                    if (item == null)
                    {
                        continue;
                    }

                    if (FindItemDelete(loc.X, loc.Y, loc.Z, maps[j], item))
                    {
                        ++count;
                    }
                }
            }

            if (item != null)
            {
                item.Delete();
            }

            return(count);
        }
コード例 #3
0
ファイル: Decorate.cs プロジェクト: michaelwhelehan/zuluhotel
        public int Generate(Map[] maps)
        {
            int count = 0;

            Item item = null;

            for (int i = 0; i < m_Entries.Count; ++i)
            {
                DecorationEntry entry = m_Entries[i];
                Point3D         loc   = entry.Location;
                string          extra = entry.Extra;

                for (int j = 0; j < maps.Length; ++j)
                {
                    try
                    {
                        item ??= Construct();
                    }
                    catch (TypeInitializationException e)
                    {
                        Console.WriteLine($"{nameof(Generate)}() failed to load type: {e.TypeName}: {e.InnerException?.Message}");
                        continue;
                    }

                    if (item == null)
                    {
                        continue;
                    }

                    if (FindItem(loc.X, loc.Y, loc.Z, maps[j], item))
                    {
                    }
                    else
                    {
                        item.MoveToWorld(loc, maps[j]);
                        ++count;

                        if (item is BaseDoor door)
                        {
                            IPooledEnumerable <BaseDoor> eable = maps[j].GetItemsInRange <BaseDoor>(loc, 1);

                            Type itemType = door.GetType();

                            foreach (BaseDoor link in eable)
                            {
                                if (link != item && link.Z == door.Z && link.GetType() == itemType)
                                {
                                    door.Link = link;
                                    link.Link = door;
                                    break;
                                }
                            }

                            eable.Free();
                        }

                        item = null;
                    }
                }
            }

            item?.Delete();

            return(count);
        }
コード例 #4
0
ファイル: Decorate.cs プロジェクト: LavinasChange/ModernUO
        public int Generate(Map[] maps)
        {
            int count = 0;

            Item item = null;

            for (int i = 0; i < m_Entries.Count; ++i)
            {
                DecorationEntry entry = m_Entries[i];
                Point3D         loc   = entry.Location;
                string          extra = entry.Extra;

                for (int j = 0; j < maps.Length; ++j)
                {
                    item ??= Construct();

                    if (item == null)
                    {
                        continue;
                    }

                    if (FindItem(loc.X, loc.Y, loc.Z, maps[j], item))
                    {
                    }
                    else
                    {
                        item.MoveToWorld(loc, maps[j]);
                        ++count;

                        if (item is BaseDoor door)
                        {
                            IPooledEnumerable <BaseDoor> eable = maps[j].GetItemsInRange <BaseDoor>(loc, 1);

                            Type itemType = door.GetType();

                            foreach (BaseDoor link in eable)
                            {
                                if (link != item && link.Z == door.Z && link.GetType() == itemType)
                                {
                                    door.Link = link;
                                    link.Link = door;
                                    break;
                                }
                            }

                            eable.Free();
                        }
                        else if (item is MarkContainer markCont)
                        {
                            try
                            {
                                markCont.Target = Point3D.Parse(extra);
                            }
                            catch
                            {
                                // ignored
                            }
                        }

                        item = null;
                    }
                }
            }

            item?.Delete();

            return(count);
        }
コード例 #5
0
        public int Generate(Map[] maps)
        {
            int count = 0;

            Item item = null;

            for (int i = 0; i < m_Entries.Count; ++i)
            {
                DecorationEntry entry = (DecorationEntry)m_Entries[i];
                Point3D         loc   = entry.Location;
                string          extra = entry.Extra;

                for (int j = 0; j < maps.Length; ++j)
                {
                    if (item == null)
                    {
                        item = Construct();
                    }

                    // genova: support uo:ml.
                    #region Mondain's Legacy
                    m_Constructed = item;
                    #endregion

                    if (item == null)
                    {
                        continue;
                    }

                    if (FindItem(loc.X, loc.Y, loc.Z, maps[j], item))
                    {
                    }
                    else
                    {
                        item.MoveToWorld(loc, maps[j]);
                        ++count;

                        if (item is BaseDoor)
                        {
                            IPooledEnumerable eable = maps[j].GetItemsInRange(loc, 1);

                            Type itemType = item.GetType();

                            foreach (Item link in eable)
                            {
                                if (link != item && link.Z == item.Z && link.GetType() == itemType)
                                {
                                    ((BaseDoor)item).Link = (BaseDoor)link;
                                    ((BaseDoor)link).Link = (BaseDoor)item;
                                    break;
                                }
                            }

                            eable.Free();
                        }
                        else if (item is MarkContainer)
                        {
                            try{ ((MarkContainer)item).Target = Point3D.Parse(extra); }
                            catch {}
                        }

                        item = null;
                    }
                }
            }

            if (item != null)
            {
                item.Delete();
            }

            return(count);
        }
コード例 #6
0
ファイル: Decorate.cs プロジェクト: MythikGN/Mythik
        public int Generate(Map[] maps)
        {
            int count = 0;

            Item item = null;

            for (int i = 0; i < m_Entries.Count; ++i)
            {
                DecorationEntry entry = (DecorationEntry)m_Entries[i];
                Point3D         loc   = entry.Location;
                string          extra = entry.Extra;

                for (int j = 0; j < maps.Length; ++j)
                {
                    if (item == null)
                    {
                        item = Construct();
                    }

                    if (item == null)
                    {
                        continue;
                    }

                    if (FindItem(loc.X, loc.Y, loc.Z, maps[j], item))
                    {
                    }
                    else
                    {
                        var map = Map.Felucca;
                        if (!MythikStaticValues.UpdateLoc(ref loc, ref map))
                        {
                            continue;
                        }
                        if (map == Map.Ilshenar)
                        {
                            item.MoveToWorld(loc, Map.Felucca);
                        }
                        else
                        {
                            item.MoveToWorld(loc, maps[j]);
                        }
                        ++count;

                        if (item is BaseDoor)
                        {
                            IPooledEnumerable eable = maps[j].GetItemsInRange(loc, 1);

                            Type itemType = item.GetType();

                            foreach (Item link in eable)
                            {
                                if (link != item && link.Z == item.Z && link.GetType() == itemType)
                                {
                                    ((BaseDoor)item).Link = (BaseDoor)link;
                                    ((BaseDoor)link).Link = (BaseDoor)item;
                                    break;
                                }
                            }

                            eable.Free();
                        }
                        else if (item is MarkContainer)
                        {
                            try{ ((MarkContainer)item).Target = Point3D.Parse(extra); }
                            catch {}
                        }

                        item = null;
                    }
                }
            }

            if (item != null)
            {
                item.Delete();
            }

            return(count);
        }