コード例 #1
0
        public CustomMultiEntry(int ser, int rev, Multi baseMulti, int compressionType, byte[] buffer)
        {
            this.m_Serial   = ser;
            this.m_Revision = rev;
            int xMin;
            int yMin;
            int xMax;
            int yMax;

            baseMulti.GetBounds(out xMin, out yMin, out xMax, out yMax);
            ArrayList list = new ArrayList();

            try
            {
                switch (compressionType)
                {
                case 0:
                    CustomMultiEntry.LoadUncompressed(buffer, list);
                    break;

                case 3:
                    CustomMultiEntry.LoadDeflated(xMin, yMin, xMax, yMax, buffer, list);
                    break;
                }
            }
            catch (Exception ex)
            {
                Debug.Error(ex);
            }
            this.m_Multi = new Multi(list);
        }
コード例 #2
0
ファイル: Multis.cs プロジェクト: NaphalAXT/WarUOSallos
 public bool RunUO_IsInside(int px, int py, int pz)
 {
     for (int index = 0; index < this.m_Items.Count; ++index)
     {
         Item obj = (Item)this.m_Items[index];
         if (obj.InWorld && obj.IsMulti)
         {
             CustomMultiEntry customMulti = CustomMultiLoader.GetCustomMulti(obj.Serial, obj.Revision);
             Multi            m           = (Multi)null;
             if (customMulti != null)
             {
                 m = customMulti.Multi;
             }
             if (m == null)
             {
                 m = obj.Multi;
             }
             if (m != null && this.RunUO_IsInside(obj, m, px, py, pz))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #3
0
ファイル: Multis.cs プロジェクト: NaphalAXT/WarUOSallos
        public bool RunUO_IsInside(Item item, Multi m, int px, int py, int pz)
        {
            int xMin;
            int yMin;
            int xMax;
            int yMax;

            m.GetBounds(out xMin, out yMin, out xMax, out yMax);
            int num1 = px - item.X;
            int num2 = py - item.Y;

            if (num1 >= xMin && num1 <= xMax && (num2 >= yMin && num2 <= yMax))
            {
                if (item.Multi != m && num2 < yMax)
                {
                    return(true);
                }
                int index1 = num1 - xMin;
                int index2 = num2 - yMin;
                if (m.RunUO_Inside == null)
                {
                    m.UpdateRadar();
                }
                int num3 = (int)m.RunUO_Inside[index2][index1] + item.Z;
                if (pz == num3 || pz + 16 > num3)
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #4
0
        public static void SetCustomMulti(int serial, int revision, Multi baseMulti, int compressionType, byte[] buffer)
        {
            ArrayList arrayList = (ArrayList)CustomMultiLoader.m_Hashtable[(object)serial];

            if (arrayList == null)
            {
                CustomMultiLoader.m_Hashtable[(object)serial] = (object)(arrayList = new ArrayList());
            }
            CustomMultiEntry customMultiEntry = new CustomMultiEntry(serial, revision, baseMulti, compressionType, buffer);

            for (int index = 0; index < arrayList.Count; ++index)
            {
                if (((CustomMultiEntry)arrayList[index]).Revision == revision)
                {
                    arrayList[index] = (object)customMultiEntry;
                    return;
                }
            }
            arrayList.Add((object)customMultiEntry);
            Map.Invalidate();
            GRadar.Invalidate();
        }
コード例 #5
0
ファイル: GRadar.cs プロジェクト: NaphalAXT/WarUOSallos
        private static unsafe void Load(int x, int y, int w, int h, int world, Texture tex)
        {
            if (GRadar.m_Colors == null)
            {
                GRadar.LoadColors();
            }
            if (GRadar.m_StrongReferences == null || GRadar.m_StrongReferences.Length != w * h)
            {
                GRadar.m_StrongReferences = new MapBlock[w * h];
            }
            if (GRadar.m_Guarded == null || GRadar.m_Guarded.Length != w * h * 64)
            {
                GRadar.m_Guarded = new BitArray(w * h * 64);
            }
            else
            {
                GRadar.m_Guarded.SetAll(false);
            }
            Region[] guardedRegions = Region.GuardedRegions;
            int      num1           = x * 8;
            int      num2           = y * 8;
            int      num3           = w * 8;
            int      num4           = h * 8;

            for (int index1 = 0; index1 < guardedRegions.Length; ++index1)
            {
                Region      region = guardedRegions[index1];
                RegionWorld world1 = region.World;
                bool        flag   = false;
                switch (world1)
                {
                case RegionWorld.Britannia:
                    flag = world == 0 || world == 1;
                    break;

                case RegionWorld.Felucca:
                    flag = world == 0;
                    break;

                case RegionWorld.Trammel:
                    flag = world == 1;
                    break;

                case RegionWorld.Ilshenar:
                    flag = world == 2;
                    break;

                case RegionWorld.Malas:
                    flag = world == 3;
                    break;

                case RegionWorld.Tokuno:
                    flag = world == 4;
                    break;
                }
                if (flag)
                {
                    int num5 = region.X - num1;
                    int num6 = region.Y - num2;
                    if (num5 < num3 && num6 < num4 && (num5 > -region.Width && num6 > -region.Height))
                    {
                        int num7 = num5 + region.Width;
                        int num8 = num6 + region.Height;
                        if (num5 < 0)
                        {
                            num5 = 0;
                        }
                        if (num6 < 0)
                        {
                            num6 = 0;
                        }
                        for (int index2 = num5; index2 < num7 && index2 < num3; ++index2)
                        {
                            for (int index3 = num6; index3 < num8 && index3 < num4; ++index3)
                            {
                                GRadar.m_Guarded[index3 * num3 + index2] = true;
                            }
                        }
                    }
                }
            }
            TileMatrix matrix   = Map.GetMatrix(world);
            LockData   lockData = tex.Lock(LockFlags.WriteOnly);
            int        num9     = lockData.Pitch >> 1;

            fixed(short *numPtr1 = GRadar.m_Colors)
            {
                for (int index1 = 0; index1 < w; ++index1)
                {
                    short *numPtr2 = (short *)((IntPtr)lockData.pvSrc + (index1 << 3) * 2);
                    for (int index2 = 0; index2 < h; ++index2)
                    {
                        MapBlock block = matrix.GetBlock(x + index1, y + index2);
                        GRadar.m_StrongReferences[index2 * w + index1] = block;
                        HuedTile[][][] huedTileArray = block == null ? matrix.EmptyStaticBlock : block.m_StaticTiles;
                        Tile[]         tileArray     = block == null ? matrix.InvalidLandBlock : block.m_LandTiles;
                        int            index3        = 0;
                        int            num5          = 0;
                        while (index3 < 8)
                        {
                            for (int index4 = 0; index4 < 8; ++index4)
                            {
                                int num6   = -255;
                                int num7   = -255;
                                int index5 = 0;
                                int num8   = 0;
                                for (int index6 = 0; index6 < huedTileArray[index4][index3].Length; ++index6)
                                {
                                    HuedTile huedTile = huedTileArray[index4][index3][index6];
                                    int      num10    = 16384 + (int)huedTile.itemId;
                                    switch (num10)
                                    {
                                    case 16385:
                                    case 22422:
                                    case 24996:
                                    case 24984:
                                    case 25020:
                                    case 24985:
                                        goto case 16385;

                                    default:
                                        int num11 = (int)huedTile.z;
                                        int num12 = num11 + (int)Map.GetItemHeight(huedTile.itemId);
                                        if (num12 > num6 || num11 > num7 && num12 >= num6)
                                        {
                                            num6   = num12;
                                            num7   = num11;
                                            index5 = num10;
                                            num8   = (int)huedTile.hueId;
                                            goto case 16385;
                                        }
                                        else
                                        {
                                            goto case 16385;
                                        }
                                    }
                                }
                                if ((int)tileArray[num5 + index4].z > num6 && tileArray[num5 + index4].Visible)
                                {
                                    index5 = (int)tileArray[num5 + index4].landId;
                                    num8   = 0;
                                }
                                numPtr2[index4] = num8 != 0 ? (short)Hues.Load(num8 & 16383 | 32768).Pixel((ushort)numPtr1[index5]) : numPtr1[index5];
                            }
                            numPtr2 += num9;
                            ++index3;
                            num5 += 8;
                        }
                    }
                }
                ArrayList items = Engine.Multis.Items;

                for (int index1 = 0; index1 < items.Count; ++index1)
                {
                    Item obj = (Item)items[index1];
                    if (obj.InWorld)
                    {
                        CustomMultiEntry customMulti = CustomMultiLoader.GetCustomMulti(obj.Serial, obj.Revision);
                        Multi            multi       = (Multi)null;
                        if (customMulti != null)
                        {
                            multi = customMulti.Multi;
                        }
                        if (multi == null)
                        {
                            multi = obj.Multi;
                        }
                        if (multi != null)
                        {
                            short[][] radar = multi.Radar;
                            if (radar != null)
                            {
                                int xMin;
                                int yMin;
                                int xMax;
                                int yMax;
                                multi.GetBounds(out xMin, out yMin, out xMax, out yMax);
                                int index2 = 0;
                                int num5   = obj.Y - (y << 3) + yMin;
                                while (index2 < radar.Length)
                                {
                                    if (num5 >= 0 && num5 < h << 3)
                                    {
                                        short * numPtr2  = (short *)((IntPtr)lockData.pvSrc + (num5 * num9) * 2);
                                        short[] numArray = radar[index2];
                                        int     index3   = 0;
                                        int     index4   = obj.X - (x << 3) + xMin;
                                        while (index3 < numArray.Length)
                                        {
                                            if (index4 >= 0 && index4 < w << 3 && (int)numArray[index3] != 0)
                                            {
                                                numPtr2[index4] = numPtr1[16384 + (int)numArray[index3]];
                                            }
                                            ++index3;
                                            ++index4;
                                        }
                                    }
                                    ++index2;
                                    ++num5;
                                }
                            }
                        }
                    }
                }
            }

            tex.Unlock();
        }
コード例 #6
0
ファイル: Multis.cs プロジェクト: NaphalAXT/WarUOSallos
        public void Update(MapPackage map)
        {
            int count1 = this.m_Items.Count;

            if (count1 == 0)
            {
                return;
            }
            int length1    = map.cells.GetLength(0);
            int length2    = map.cells.GetLength(1);
            int num1       = map.CellX;
            int num2       = map.CellY;
            int num3       = num1 + length1;
            int num4       = num2 + length2;
            int houseLevel = Options.Current.HouseLevel;

            for (int index1 = 0; index1 < count1; ++index1)
            {
                Item obj = (Item)this.m_Items[index1];
                if (obj.InWorld)
                {
                    CustomMultiEntry customMulti = CustomMultiLoader.GetCustomMulti(obj.Serial, obj.Revision);
                    Multi            multi       = (Multi)null;
                    if (customMulti != null)
                    {
                        multi = customMulti.Multi;
                    }
                    if (multi == null)
                    {
                        multi = obj.Multi;
                    }
                    if (multi != null)
                    {
                        int xMin;
                        int yMin;
                        int xMax;
                        int yMax;
                        multi.GetBounds(out xMin, out yMin, out xMax, out yMax);
                        xMin += obj.X;
                        yMin += obj.Y;
                        xMax += obj.X;
                        yMax += obj.Y;
                        if (xMin < num3 && xMax >= num1 && (yMin < num4 && yMax >= num2))
                        {
                            ArrayList list   = multi.List;
                            int       count2 = list.Count;
                            int       num5   = int.MinValue | index1;
                            for (int index2 = 0; index2 < count2; ++index2)
                            {
                                MultiItem multiItem = (MultiItem)list[index2];
                                if (multiItem.Flags != 0 || index2 == 0)
                                {
                                    int num6   = obj.X + (int)multiItem.X;
                                    int num7   = obj.Y + (int)multiItem.Y;
                                    int index3 = num6 - num1;
                                    int index4 = num7 - num2;
                                    if (index3 >= 0 && index3 < length1 && (index4 >= 0 && index4 < length2))
                                    {
                                        bool flag = true;
                                        int  num8 = (int)multiItem.ItemID;
                                        if (flag)
                                        {
                                            map.cells[index3, index4].Add((object)StaticItem.Instantiate((short)num8, multiItem.ItemID, (sbyte)(obj.Z + (int)multiItem.Z), num5 | index2 << 16));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }