Ejemplo n.º 1
0
        public GVirtueItem(GServerGump owner, int x, int y, int gumpID, IHue hue)
            : base(owner, x, y, gumpID, hue)
        {
            this.m_QuickDrag = false;
            int num1   = hue.HueID() - 1;
            int num2   = -1;
            int num3   = 0;
            int index1 = 0;

            while (index1 < GVirtueItem.m_Table.Length)
            {
                if (GVirtueItem.m_Table[index1] == gumpID)
                {
                    num2 = index1 / 4;
                    for (int index2 = 1; index2 < 4; ++index2)
                    {
                        if (GVirtueItem.m_Table[index1 + index2] == num1)
                        {
                            num3 = index2;
                            goto label_9;
                        }
                    }
                }
                index1 += 4;
            }
label_9:
            if (num2 < 0)
            {
                return;
            }
            this.m_Title = new GAlphaBackground(30 - x, 40 - y, 0, 0);
            GLabel glabel = new GLabel(Localization.GetString(1051000 + num3 * 8 + num2), (IFont)Engine.GetUniFont(0), hue, 3, 3);

            this.m_Title.Children.Add((Gump)glabel);
            glabel.X           -= glabel.Image.xMin;
            glabel.Y           -= glabel.Image.yMin;
            this.m_Title.Width  = glabel.Image.xMax - glabel.Image.xMin + 7;
            this.m_Title.Height = glabel.Image.yMax - glabel.Image.yMin + 7;
            Size size = Engine.m_Gumps.Measure(104);

            this.m_Title.X      += (size.Width - this.m_Title.Width) / 2;
            this.m_Title.Y      += (size.Height - this.m_Title.Height) / 2;
            this.m_Title.Visible = false;
            this.m_Children.Add((Gump)this.m_Title);
        }
Ejemplo n.º 2
0
        private int GetFlags(IHue hue)
        {
            int num = 0;

            if (this.m_Underline)
            {
                num |= 1;
            }
            if (this.m_Bold)
            {
                num |= 2;
            }
            if (this.m_Italic)
            {
                num |= 4;
            }
            if (!(hue is Hues.ColorFillHue) && (hue.HueID() & 16383) != 1)
            {
                num |= 8;
            }
            return(num);
        }
Ejemplo n.º 3
0
        public GVirtueItem(GServerGump owner, int x, int y, int gumpID, IHue hue) : base(owner, x, y, gumpID, hue)
        {
            base.m_QuickDrag = false;
            int num  = hue.HueID() - 1;
            int num2 = -1;
            int num3 = 0;

            for (int i = 0; i < m_Table.Length; i += 4)
            {
                if (m_Table[i] == gumpID)
                {
                    num2 = i / 4;
                    for (int j = 1; j < 4; j++)
                    {
                        if (m_Table[i + j] == num)
                        {
                            num3 = j;
                            break;
                        }
                    }
                }
            }
            if (num2 >= 0)
            {
                this.m_Title = new GAlphaBackground(30 - x, 40 - y, 0, 0);
                GLabel toAdd = new GLabel(Localization.GetString((0x100978 + (num3 * 8)) + num2), Engine.GetUniFont(0), hue, 3, 3);
                this.m_Title.Children.Add(toAdd);
                toAdd.X            -= toAdd.Image.xMin;
                toAdd.Y            -= toAdd.Image.yMin;
                this.m_Title.Width  = (toAdd.Image.xMax - toAdd.Image.xMin) + 7;
                this.m_Title.Height = (toAdd.Image.yMax - toAdd.Image.yMin) + 7;
                Size size = Engine.m_Gumps.Measure(0x68);
                this.m_Title.X      += (size.Width - this.m_Title.Width) / 2;
                this.m_Title.Y      += (size.Height - this.m_Title.Height) / 2;
                this.m_Title.Visible = false;
                base.m_Children.Add(this.m_Title);
            }
        }
Ejemplo n.º 4
0
 public GVirtueItem(GServerGump owner, int x, int y, int gumpID, IHue hue)
     : base(owner, x, y, gumpID, hue)
 {
     base.m_QuickDrag = false;
     int num = hue.HueID() - 1;
     int num2 = -1;
     int num3 = 0;
     for (int i = 0; i < m_Table.Length; i += 4)
     {
         if (m_Table[i] == gumpID)
         {
             num2 = i / 4;
             for (int j = 1; j < 4; j++)
             {
                 if (m_Table[i + j] == num)
                 {
                     num3 = j;
                     break;
                 }
             }
         }
     }
     if (num2 >= 0)
     {
         this.m_Title = new GAlphaBackground(30 - x, 40 - y, 0, 0);
         GLabel toAdd = new GLabel(Localization.GetString((0x100978 + (num3 * 8)) + num2), Engine.GetUniFont(0), hue, 3, 3);
         this.m_Title.Children.Add(toAdd);
         toAdd.X -= toAdd.Image.xMin;
         toAdd.Y -= toAdd.Image.yMin;
         this.m_Title.Width = (toAdd.Image.xMax - toAdd.Image.xMin) + 7;
         this.m_Title.Height = (toAdd.Image.yMax - toAdd.Image.yMin) + 7;
         Size size = Engine.m_Gumps.Measure(0x68);
         this.m_Title.X += (size.Width - this.m_Title.Width) / 2;
         this.m_Title.Y += (size.Height - this.m_Title.Height) / 2;
         this.m_Title.Visible = false;
         base.m_Children.Add(this.m_Title);
     }
 }
Ejemplo n.º 5
0
        public unsafe object Create(int realID, IHue hue)
        {
            int length;
            int lookup;
            int num3;
            Stream stream;
            switch (this.ConvertRealID(ref realID))
            {
                case 1:
                {
                    if (((realID < 0) || (realID >= this.m_Count)) || (realID >= this.m_Index.Length))
                    {
                        return Frames.Empty;
                    }
                    Entry3D entryd = this.m_Index[realID];
                    length = entryd.m_Length;
                    lookup = entryd.m_Lookup;
                    num3 = entryd.m_Extra & 0xff;
                    stream = m_Stream;
                    break;
                }
                case 2:
                {
                    if (((realID < 0) || (realID >= this.m_Count2)) || (realID >= this.m_Index2.Length))
                    {
                        return Frames.Empty;
                    }
                    Entry3D entryd2 = this.m_Index2[realID];
                    length = entryd2.m_Length;
                    lookup = entryd2.m_Lookup;
                    num3 = entryd2.m_Extra & 0xff;
                    stream = m_Stream2;
                    break;
                }
                case 3:
                {
                    if (((realID < 0) || (realID >= this.m_Count3)) || (realID >= this.m_Index3.Length))
                    {
                        return Frames.Empty;
                    }
                    Entry3D entryd3 = this.m_Index3[realID];
                    length = entryd3.m_Length;
                    lookup = entryd3.m_Lookup;
                    num3 = entryd3.m_Extra & 0xff;
                    stream = m_Stream3;
                    break;
                }
                default:
                {
                    if (((realID < 0) || (realID >= this.m_Count4)) || (realID >= this.m_Index4.Length))
                    {
                        return Frames.Empty;
                    }
                    Entry3D entryd4 = this.m_Index4[realID];
                    length = entryd4.m_Length;
                    lookup = entryd4.m_Lookup;
                    num3 = entryd4.m_Extra & 0xff;
                    stream = m_Stream4;
                    break;
                }
            }
            if (((lookup < 0) || (length <= 0)) || ((num3 <= 0) || (stream == null)))
            {
                return Frames.Empty;
            }
            if ((this.m_Data == null) || (length > this.m_Data.Length))
            {
                this.m_Data = new byte[length];
            }
            stream.Seek((long) lookup, SeekOrigin.Begin);
            stream.Read(this.m_Data, 0, length);
            fixed (short* numRef = this.m_Palette)
            {
                short* numPtr = numRef;
                fixed (byte* numRef2 = this.m_Data)
                {
                    if (hue.HueID() == 0)
                    {
                        numPtr = (short*) numRef2;
                        int* numPtr2 = (int*) numPtr;
                        int* numPtr3 = numPtr2 + 0x80;
                        while (numPtr2 < numPtr3)
                        {
                            numPtr2[0] |= -2147450880;
                            int* numPtr1 = numPtr2 + 1;
                            numPtr1[0] |= -2147450880;
                            int* numPtr9 = numPtr2 + 2;
                            numPtr9[0] |= -2147450880;
                            int* numPtr10 = numPtr2 + 3;
                            numPtr10[0] |= -2147450880;
                            numPtr2 += 4;
                        }
                    }
                    else
                    {
                        hue.CopyPixels((void*) numRef2, (void*) numPtr, 0x100);
                    }
                    Frames frames = new Frames {
                        FrameCount = num3,
                        FrameList = new Frame[num3]
                    };
                    for (int i = 0; i < num3; i++)
                    {
                        int num6 = (numRef2 + 0x204)[i << 2];
                        byte* numPtr4 = (numRef2 + 0x200) + num6;
                        short* numPtr5 = (short*) numPtr4;
                        int num7 = numPtr5[0];
                        int num8 = numPtr5[1];
                        int width = numPtr5[2];
                        int height = numPtr5[3];
                        numPtr4 += 8;
                        frames.FrameList[i] = new Frame();
                        frames.FrameList[i].CenterX = num7;
                        frames.FrameList[i].CenterY = num8;
                        if ((width <= 0) || (height <= 0))
                        {
                            frames.FrameList[i].Image = Texture.Empty;
                        }
                        else
                        {
                            Texture texture = new Texture(width, height, true);
                            if (texture.IsEmpty())
                            {
                                frames.FrameList[i].Image = Texture.Empty;
                            }
                            else
                            {
                                int num11 = 0;
                                short* numPtr6 = null;
                                int num12 = num7 - 0x200;
                                int num13 = (num8 + height) - 0x200;
                                LockData data = texture.Lock(LockFlags.WriteOnly);
                                short* pvSrc = (short*) data.pvSrc;
                                int num14 = data.Pitch >> 1;
                                pvSrc += num12;
                                pvSrc += num13 * num14;
                                while ((num11 = *((int*) numPtr4)) != 0x7fff7fff)
                                {
                                    numPtr4 += 4;
                                    num11 ^= -2145386496;
                                    numPtr6 = pvSrc + ((((num11 >> 12) & 0x3ff) * num14) + ((num11 >> 0x16) & 0x3ff));
                                    short* numPtr8 = numPtr6 + (num11 & 0xffc);
                                    while (numPtr6 < numPtr8)
                                    {
                                        numPtr6[0] = numPtr[numPtr4[0]];
                                        numPtr6[1] = numPtr[numPtr4[1]];
                                        numPtr6[2] = numPtr[numPtr4[2]];
                                        numPtr6[3] = numPtr[numPtr4[3]];
                                        numPtr6 += 4;
                                        numPtr4 += 4;
                                    }
                                    switch ((num11 & 3))
                                    {
                                        case 1:
                                            goto Label_04A6;

                                        case 2:
                                            break;

                                        case 3:
                                            numPtr6[2] = numPtr[numPtr4[2]];
                                            break;

                                        default:
                                            goto Label_04B5;
                                    }
                                    numPtr6[1] = numPtr[numPtr4[1]];
                                Label_04A6:
                                    numPtr6[0] = numPtr[numPtr4[0]];
                                Label_04B5:
                                    numPtr4 += num11 & 3;
                                }
                                texture.Unlock();
                                texture.SetPriority(0);
                                frames.FrameList[i].Image = texture;
                            }
                        }
                    }
                    this.m_Frames.Add(frames);
                    return frames;
                }
            }
        }
Ejemplo n.º 6
0
        public unsafe object Create(int realID, IHue hue)
        {
            int    length;
            int    lookup;
            int    num3;
            Stream stream;

            switch (this.ConvertRealID(ref realID))
            {
            case 1:
            {
                if (((realID < 0) || (realID >= this.m_Count)) || (realID >= this.m_Index.Length))
                {
                    return(Frames.Empty);
                }
                Entry3D entryd = this.m_Index[realID];
                length = entryd.m_Length;
                lookup = entryd.m_Lookup;
                num3   = entryd.m_Extra & 0xff;
                stream = m_Stream;
                break;
            }

            case 2:
            {
                if (((realID < 0) || (realID >= this.m_Count2)) || (realID >= this.m_Index2.Length))
                {
                    return(Frames.Empty);
                }
                Entry3D entryd2 = this.m_Index2[realID];
                length = entryd2.m_Length;
                lookup = entryd2.m_Lookup;
                num3   = entryd2.m_Extra & 0xff;
                stream = m_Stream2;
                break;
            }

            case 3:
            {
                if (((realID < 0) || (realID >= this.m_Count3)) || (realID >= this.m_Index3.Length))
                {
                    return(Frames.Empty);
                }
                Entry3D entryd3 = this.m_Index3[realID];
                length = entryd3.m_Length;
                lookup = entryd3.m_Lookup;
                num3   = entryd3.m_Extra & 0xff;
                stream = m_Stream3;
                break;
            }

            default:
            {
                if (((realID < 0) || (realID >= this.m_Count4)) || (realID >= this.m_Index4.Length))
                {
                    return(Frames.Empty);
                }
                Entry3D entryd4 = this.m_Index4[realID];
                length = entryd4.m_Length;
                lookup = entryd4.m_Lookup;
                num3   = entryd4.m_Extra & 0xff;
                stream = m_Stream4;
                break;
            }
            }
            if (((lookup < 0) || (length <= 0)) || ((num3 <= 0) || (stream == null)))
            {
                return(Frames.Empty);
            }
            if ((this.m_Data == null) || (length > this.m_Data.Length))
            {
                this.m_Data = new byte[length];
            }
            stream.Seek((long)lookup, SeekOrigin.Begin);
            stream.Read(this.m_Data, 0, length);
            fixed(short *numRef = this.m_Palette)
            {
                short *numPtr = numRef;

                fixed(byte *numRef2 = this.m_Data)
                {
                    if (hue.HueID() == 0)
                    {
                        numPtr = (short *)numRef2;
                        int *numPtr2 = (int *)numPtr;
                        int *numPtr3 = numPtr2 + 0x80;
                        while (numPtr2 < numPtr3)
                        {
                            numPtr2[0] |= -2147450880;
                            int *numPtr1 = numPtr2 + 1;
                            numPtr1[0] |= -2147450880;
                            int *numPtr9 = numPtr2 + 2;
                            numPtr9[0] |= -2147450880;
                            int *numPtr10 = numPtr2 + 3;
                            numPtr10[0] |= -2147450880;
                            numPtr2     += 4;
                        }
                    }
                    else
                    {
                        hue.CopyPixels((void *)numRef2, (void *)numPtr, 0x100);
                    }
                    Frames frames = new Frames {
                        FrameCount = num3,
                        FrameList  = new Frame[num3]
                    };

                    for (int i = 0; i < num3; i++)
                    {
                        int    num6    = (numRef2 + 0x204)[i << 2];
                        byte * numPtr4 = (numRef2 + 0x200) + num6;
                        short *numPtr5 = (short *)numPtr4;
                        int    num7    = numPtr5[0];
                        int    num8    = numPtr5[1];
                        int    width   = numPtr5[2];
                        int    height  = numPtr5[3];
                        numPtr4                    += 8;
                        frames.FrameList[i]         = new Frame();
                        frames.FrameList[i].CenterX = num7;
                        frames.FrameList[i].CenterY = num8;
                        if ((width <= 0) || (height <= 0))
                        {
                            frames.FrameList[i].Image = Texture.Empty;
                        }
                        else
                        {
                            Texture texture = new Texture(width, height, true);
                            if (texture.IsEmpty())
                            {
                                frames.FrameList[i].Image = Texture.Empty;
                            }
                            else
                            {
                                int      num11   = 0;
                                short *  numPtr6 = null;
                                int      num12   = num7 - 0x200;
                                int      num13   = (num8 + height) - 0x200;
                                LockData data    = texture.Lock(LockFlags.WriteOnly);
                                short *  pvSrc   = (short *)data.pvSrc;
                                int      num14   = data.Pitch >> 1;
                                pvSrc += num12;
                                pvSrc += num13 * num14;
                                while ((num11 = *((int *)numPtr4)) != 0x7fff7fff)
                                {
                                    numPtr4 += 4;
                                    num11   ^= -2145386496;
                                    numPtr6  = pvSrc + ((((num11 >> 12) & 0x3ff) * num14) + ((num11 >> 0x16) & 0x3ff));
                                    short *numPtr8 = numPtr6 + (num11 & 0xffc);
                                    while (numPtr6 < numPtr8)
                                    {
                                        numPtr6[0] = numPtr[numPtr4[0]];
                                        numPtr6[1] = numPtr[numPtr4[1]];
                                        numPtr6[2] = numPtr[numPtr4[2]];
                                        numPtr6[3] = numPtr[numPtr4[3]];
                                        numPtr6   += 4;
                                        numPtr4   += 4;
                                    }
                                    switch ((num11 & 3))
                                    {
                                    case 1:
                                        goto Label_04A6;

                                    case 2:
                                        break;

                                    case 3:
                                        numPtr6[2] = numPtr[numPtr4[2]];
                                        break;

                                    default:
                                        goto Label_04B5;
                                    }
                                    numPtr6[1] = numPtr[numPtr4[1]];
Label_04A6:
                                    numPtr6[0] = numPtr[numPtr4[0]];
Label_04B5:
                                    numPtr4 += num11 & 3;
                                }
                                texture.Unlock();
                                texture.SetPriority(0);
                                frames.FrameList[i].Image = texture;
                            }
                        }
                    }
                    this.m_Frames.Add(frames);
                    return(frames);
                }
            }
        }