Ejemplo n.º 1
0
        protected override unsafe bool OnTarget(StaticTarget staticTarget)
        {
            ItemData *itemDataPointer = Map.GetItemDataPointer((ItemId)(int)(ushort)staticTarget.RealID);
            int       z = staticTarget.Z;

            if ((itemDataPointer->Flags & (TileFlag)512L) != 0L)
            {
                z += (int)itemDataPointer->Height;
            }
            this.Dispatch(1, 0, staticTarget.X, staticTarget.Y, z, staticTarget.RealID);
            return(true);
        }
Ejemplo n.º 2
0
        private static unsafe void GetStartZ(int xStart, int yStart, int zStart, out int zLow, out int zTop)
        {
            MapPackage cache = Map.GetCache();
            int        X     = xStart - cache.CellX;
            int        Y     = yStart - cache.CellY;

            if (!Map.IsValid(X, Y))
            {
                zLow = zStart;
                zTop = zStart;
            }
            else
            {
                LandTile  landTile   = World.Viewport.GetLandTile(xStart, yStart, Engine.m_World);
                ArrayList arrayList  = cache.cells[X, Y];
                bool      impassable = landTile.Impassable;
                bool      flag1      = (int)landTile.m_ID != 2 && (int)landTile.m_ID != 475 && ((int)landTile.m_ID < 430 || (int)landTile.m_ID > 437);
                int       z          = 0;
                int       avg        = 0;
                int       top        = 0;
                Map.GetAverageZ(xStart, yStart, ref z, ref avg, ref top);
                int  num1  = zLow = zTop = 0;
                bool flag2 = false;
                if (flag1 && !impassable && zStart >= avg && (!flag2 || avg >= num1))
                {
                    zLow = z;
                    num1 = avg;
                    if (!flag2 || top > zTop)
                    {
                        zTop = top;
                    }
                    flag2 = true;
                }
                for (int index = 0; index < arrayList.Count; ++index)
                {
                    IItem obj = arrayList[index] as IItem;
                    if (obj != null)
                    {
                        ItemData *itemDataPointer = Map.GetItemDataPointer(obj.ItemId);
                        TileFlag  tileFlag        = (TileFlag)itemDataPointer->Flags;
                        if ((tileFlag & (TileFlag)512L) != 0L)
                        {
                            bool flag3 = (tileFlag & (TileFlag)1024L) != 0L;
                            byte num2  = (byte)itemDataPointer->Height;
                            int  num3  = (int)obj.Z;
                            int  num4  = num3 + (flag3 ? (int)num2 / 2 : (int)num2);
                            int  num5  = num3 + itemDataPointer->Height;
                            if (zStart >= num4 && (!flag2 || num4 >= num1))
                            {
                                num1 = num4;
                                if (!flag2 || num5 > zTop)
                                {
                                    zTop = num5;
                                }
                                zLow  = num3;
                                flag2 = true;
                            }
                        }
                    }
                }
                if (!flag2)
                {
                    zLow = zTop = zStart;
                }
                else
                {
                    if (zStart <= zTop)
                    {
                        return;
                    }
                    zTop = zStart;
                }
            }
        }