示例#1
0
        public PaperDollGump(Mobile parent)
            : base(0, 0)
        {
            m_Parent = parent;

            IsMovable = true;
            AddControl(new GumpPic(this, 0, 0, 0, 0x07d0, 0));
            LastControl.MakeDragger(this);
            LastControl.MakeCloseTarget(this);

            // HELP
            AddControl(new Button(this, 0, 185, 44 + 27 * 0, 0x07ef, 0x07f0, ButtonTypes.Activate, 0, (int)Buttons.Help));
            ((Button)LastControl).GumpOverID = 0x07f1;
            // OPTIONS
            AddControl(new Button(this, 0, 185, 44 + 27 * 1, 0x07d6, 0x07d7, ButtonTypes.Activate, 0, (int)Buttons.Options));
            ((Button)LastControl).GumpOverID = 0x07d8;
            // LOG OUT
            AddControl(new Button(this, 0, 185, 44 + 27 * 2, 0x07d9, 0x07da, ButtonTypes.Activate, 0, (int)Buttons.LogOut));
            ((Button)LastControl).GumpOverID = 0x07db;
            // QUESTS
            AddControl(new Button(this, 0, 185, 44 + 27 * 3, 0x57b5, 0x57b7, ButtonTypes.Activate, 0, (int)Buttons.Quests));
            ((Button)LastControl).GumpOverID = 0x57b6;
            // SKILLS
            AddControl(new Button(this, 0, 185, 44 + 27 * 4, 0x07df, 0x07e0, ButtonTypes.Activate, 0, (int)Buttons.Skills));
            ((Button)LastControl).GumpOverID = 0x07e1;
            // GUILD
            AddControl(new Button(this, 0, 185, 44 + 27 * 5, 0x57b2, 0x57b4, ButtonTypes.Activate, 0, (int)Buttons.Guild));
            ((Button)LastControl).GumpOverID = 0x57b3;
            // PEACE / WAR
            AddControl(new Button(this, 0, 185, 44 + 27 * 6, 0x07e5, 0x07e6, ButtonTypes.Activate, 0, (int)Buttons.PeaceWarToggle));
            ((Button)LastControl).GumpOverID = 0x07e7;
            // STATUS
            AddControl(new Button(this, 0, 185, 44 + 27 * 7, 0x07eb, 0x07ec, ButtonTypes.Activate, 0, (int)Buttons.Status));
            ((Button)LastControl).GumpOverID = 0x07ed;

            // Paperdoll
            AddControl(new PaperDollInteractable(this, 0, 8, 21));
            ((PaperDollInteractable)LastControl).SourceEntity = m_Parent;
        }
示例#2
0
 public MobileEquipment(Mobile nOwner)
 {
     m_Equipment = new Item[(int)EquipLayer.LastValid + 1];
     m_Owner = nOwner;
 }
示例#3
0
        public static bool CheckMovement(Mobile m, Map map, Vector3 loc, Direction d, out int newZ)
        {
            if (map == null)
            {
                newZ = 0;
                return true;
            }

            int xStart = (int)loc.X;
            int yStart = (int)loc.Y;
            int xForward = xStart, yForward = yStart;
            int xRight = xStart, yRight = yStart;
            int xLeft = xStart, yLeft = yStart;

            bool checkDiagonals = ((int)d & 0x1) == 0x1;

            offsetXY(d, ref xForward, ref yForward);
            offsetXY((Direction)(((int)d - 1) & 0x7), ref xLeft, ref yLeft);
            offsetXY((Direction)(((int)d + 1) & 0x7), ref xRight, ref yRight);

            if (xForward < 0 || yForward < 0 || xForward >= map.Width || yForward >= map.Height)
            {
                newZ = 0;
                return false;
            }

            int startZ, startTop;

            List<Item> itemsStart = m_Pools[0];
            List<Item> itemsForward = m_Pools[1];
            List<Item> itemsLeft = m_Pools[2];
            List<Item> itemsRight = m_Pools[3];

            TileFlag reqFlags = ImpassableSurface;

            // if (m.CanSwim)
            //     reqFlags |= TileFlag.Wet;

            if (checkDiagonals)
            {
                MapTile sectorStart = map.GetMapTile(xStart, yStart, false);
                MapTile sectorForward = map.GetMapTile(xForward, yForward, false);
                MapTile sectorLeft = map.GetMapTile(xLeft, yLeft, false);
                MapTile sectorRight = map.GetMapTile(xRight, yRight, false);
                if ((sectorForward == null) || (sectorStart == null) || (sectorLeft == null) || (sectorRight == null))
                {
                    newZ = (int)loc.Z;
                    return false;
                }

                List<MapTile> sectors = new List<MapTile>(); //m_Sectors;

                sectors.Add(sectorStart);
                sectors.Add(sectorForward);
                sectors.Add(sectorLeft);
                sectors.Add(sectorRight);

                for (int i = 0; i < sectors.Count; ++i)
                {
                    MapTile sector = sectors[i];

                    for (int j = 0; j < sector.Items.Count; ++j)
                    {
                        BaseEntity entity = sector.Items[j].OwnerEntity; //Item item = sector.Items[j];

                        // if (ignoreMovableImpassables && item.Movable && item.ItemData.Impassable)
                        //     continue;

                        if (entity is Item)
                        {
                            Item item = (Item)entity;

                            if ((item.ItemData.Flags & reqFlags) == 0)
                                continue;

                            if (sector == sectorStart && item.AtWorldPoint(xStart, yStart) && item.ItemID < 0x4000)
                                itemsStart.Add(item);
                            else if (sector == sectorForward && item.AtWorldPoint(xForward, yForward) && item.ItemID < 0x4000)
                                itemsForward.Add(item);
                            else if (sector == sectorLeft && item.AtWorldPoint(xLeft, yLeft) && item.ItemID < 0x4000)
                                itemsLeft.Add(item);
                            else if (sector == sectorRight && item.AtWorldPoint(xRight, yRight) && item.ItemID < 0x4000)
                                itemsRight.Add(item);
                        }
                    }
                }
            }
            else
            {
                MapTile sectorStart = map.GetMapTile(xStart, yStart, false);
                MapTile sectorForward = map.GetMapTile(xForward, yForward, false);
                if ((sectorForward == null) || (sectorStart == null))
                {
                    newZ = (int)loc.Z;
                    return false;
                }

                if (sectorStart == sectorForward)
                {
                    for (int i = 0; i < sectorStart.Items.Count; ++i)
                    {
                        BaseEntity entity = sectorStart.Items[i].OwnerEntity; // Item item = sectorStart.Items[i];

                        if (entity is Item)
                        {
                            Item item = (Item)entity;

                            // if (ignoreMovableImpassables && item.Movable && item.ItemData.Impassable)
                            //     continue;

                            if ((item.ItemData.Flags & reqFlags) == 0)
                                continue;

                            if (item.AtWorldPoint(xStart, yStart) && item.ItemID < 0x4000)
                                itemsStart.Add(item);
                            else if (item.AtWorldPoint(xForward, yForward) && item.ItemID < 0x4000)
                                itemsForward.Add(item);
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < sectorForward.Items.Count; ++i)
                    {
                        BaseEntity entity = sectorForward.Items[i].OwnerEntity; // Item item = sectorForward.Items[i];

                        if (entity is Item)
                        {
                            Item item = (Item)entity;

                            // if (ignoreMovableImpassables && item.Movable && item.ItemData.Impassable)
                            //     continue;

                            if ((item.ItemData.Flags & reqFlags) == 0)
                                continue;

                            if (item.AtWorldPoint(xForward, yForward) && item.ItemID < 0x4000)
                                itemsForward.Add(item);
                        }
                    }

                    for (int i = 0; i < sectorStart.Items.Count; ++i)
                    {
                        BaseEntity entity = sectorStart.Items[i].OwnerEntity; // Item item = sectorStart.Items[i];

                        if (entity is Item)
                        {
                            Item item = (Item)entity;

                            // if (ignoreMovableImpassables && item.Movable && item.ItemData.Impassable)
                            //     continue;

                            if ((item.ItemData.Flags & reqFlags) == 0)
                                continue;

                            if (item.AtWorldPoint(xStart, yStart) && item.ItemID < 0x4000)
                                itemsStart.Add(item);
                        }
                    }
                }
            }

            getStartZ(m, map, loc, itemsStart, out startZ, out startTop);

            bool moveIsOk = check(map, m, itemsForward, xForward, yForward, startTop, startZ, out newZ);

            if (moveIsOk && checkDiagonals)
            {
                int hold;

                if (!check(map, m, itemsLeft, xLeft, yLeft, startTop, startZ, out hold) && !check(map, m, itemsRight, xRight, yRight, startTop, startZ, out hold))
                    moveIsOk = false;
            }

            for (int i = 0; i < (checkDiagonals ? 4 : 2); ++i)
            {
                if (m_Pools[i].Count > 0)
                    m_Pools[i].Clear();
            }

            if (!moveIsOk)
                newZ = startZ;

            return moveIsOk;
        }
示例#4
0
 public MobileAnimation(Mobile parent)
 {
     Parent = parent;
 }
示例#5
0
        private static bool check(Map map, Mobile m, List<Item> items, int x, int y, int startTop, int startZ, out int newZ)
        {
            newZ = 0;

            MapTile mapTile = map.GetMapTile(x, y, false);
            if (mapTile == null)
                return false;

            MapObjectStatic[] tiles = mapTile.GetStatics().ToArray();
            MapObjectGround landTile = mapTile.GroundTile;
            UltimaData.LandData landData = UltimaData.TileData.LandData[landTile.ItemID & 0x3FFF];

            bool landBlocks = (landData.Flags & TileFlag.Impassable) != 0;
            bool considerLand = !landTile.Ignored;

            //if (landBlocks && canSwim && (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Wet) != 0)	//Impassable, Can Swim, and Is water.  Don't block it.
            //    landBlocks = false;
            // else
            // if (cantWalk && (TileData.LandTable[landTile.ID & 0x3FFF].Flags & TileFlag.Wet) == 0)	//Can't walk and it's not water
            //     landBlocks = true;

            int landLow = 0, landCenter = 0, landTop = 0;
            landCenter = map.GetAverageZ(x, y, ref landLow, ref landTop);

            bool moveIsOk = false;

            int stepTop = startTop + StepHeight;
            int checkTop = startZ + PersonHeight;

            bool ignoreDoors = (!m.Alive || m.BodyID == 0x3DB);

            #region Tiles
            for (int i = 0; i < tiles.Length; ++i)
            {
                MapObjectStatic tile = tiles[i];
                UltimaData.ItemData itemData = UltimaData.TileData.ItemData[tile.ItemID & 0x3FFF];
                TileFlag flags = itemData.Flags;

                if ((flags & ImpassableSurface) == TileFlag.Surface) //  || (canSwim && (flags & TileFlag.Wet) != 0) Surface && !Impassable
                {
                    // if (cantWalk && (flags & TileFlag.Wet) == 0)
                    //     continue;

                    int itemZ = (int)tile.Z;
                    int itemTop = itemZ;
                    int ourZ = itemZ + itemData.CalcHeight;
                    int ourTop = ourZ + PersonHeight;
                    int testTop = checkTop;

                    if (moveIsOk)
                    {
                        int cmp = Math.Abs(ourZ - m.Z) - Math.Abs(newZ - m.Z);

                        if (cmp > 0 || (cmp == 0 && ourZ > newZ))
                            continue;
                    }

                    if (ourZ + PersonHeight > testTop)
                        testTop = ourZ + PersonHeight;

                    if (!itemData.IsBridge)
                        itemTop += itemData.Height;

                    if (stepTop >= itemTop)
                    {
                        int landCheck = itemZ;

                        if (itemData.Height >= StepHeight)
                            landCheck += StepHeight;
                        else
                            landCheck += itemData.Height;

                        if (considerLand && landCheck < landCenter && landCenter > ourZ && testTop > landLow)
                            continue;

                        if (IsOk(ignoreDoors, ourZ, testTop, tiles, items))
                        {
                            newZ = ourZ;
                            moveIsOk = true;
                        }
                    }
                }
            }
            #endregion

            #region Items
            for (int i = 0; i < items.Count; ++i)
            {
                Item item = items[i];
                UltimaData.ItemData itemData = item.ItemData;
                TileFlag flags = itemData.Flags;

                if ((flags & ImpassableSurface) == TileFlag.Surface) // Surface && !Impassable && !Movable
                {
                    //  || (m.CanSwim && (flags & TileFlag.Wet) != 0))
                    // !item.Movable &&
                    // if (cantWalk && (flags & TileFlag.Wet) == 0)
                    //     continue;

                    int itemZ = item.Z;
                    int itemTop = itemZ;
                    int ourZ = itemZ + itemData.CalcHeight;
                    int ourTop = ourZ + PersonHeight;
                    int testTop = checkTop;

                    if (moveIsOk)
                    {
                        int cmp = Math.Abs(ourZ - m.Z) - Math.Abs(newZ - m.Z);

                        if (cmp > 0 || (cmp == 0 && ourZ > newZ))
                            continue;
                    }

                    if (ourZ + PersonHeight > testTop)
                        testTop = ourZ + PersonHeight;

                    if (!itemData.IsBridge)
                        itemTop += itemData.Height;

                    if (stepTop >= itemTop)
                    {
                        int landCheck = itemZ;

                        if (itemData.Height >= StepHeight)
                            landCheck += StepHeight;
                        else
                            landCheck += itemData.Height;

                        if (considerLand && landCheck < landCenter && landCenter > ourZ && testTop > landLow)
                            continue;

                        if (IsOk(ignoreDoors, ourZ, testTop, tiles, items))
                        {
                            newZ = ourZ;
                            moveIsOk = true;
                        }
                    }
                }
            }

            #endregion

            if (considerLand && !landBlocks && (stepTop) >= landLow)
            {
                int ourZ = landCenter;
                int ourTop = ourZ + PersonHeight;
                int testTop = checkTop;

                if (ourZ + PersonHeight > testTop)
                    testTop = ourZ + PersonHeight;

                bool shouldCheck = true;

                if (moveIsOk)
                {
                    int cmp = Math.Abs(ourZ - m.Z) - Math.Abs(newZ - m.Z);

                    if (cmp > 0 || (cmp == 0 && ourZ > newZ))
                        shouldCheck = false;
                }

                if (shouldCheck && IsOk(ignoreDoors, ourZ, testTop, tiles, items))
                {
                    newZ = ourZ;
                    moveIsOk = true;
                }
            }

            return moveIsOk;
        }