Beispiel #1
0
 public static unsafe StaticItem Instantiate(byte *pSrc, int sortInfluence, int serial)
 {
     if (m_InstancePool.Count > 0)
     {
         StaticItem item = (StaticItem)m_InstancePool.Dequeue();
         item.m_RealID        = (short)((*(((short *)pSrc)) & 0x3fff) | 0x4000);
         item.m_ID            = *((short *)pSrc);
         item.m_ID            = (short)(item.m_ID & 0x3fff);
         item.m_ID            = (short)(item.m_ID + 0x4000);
         item.m_Z             = *((sbyte *)(pSrc + 4));
         item.m_Hue           = Hues.GetItemHue(item.m_ID, *((ushort *)(pSrc + 5)));
         item.m_Height        = Map.GetHeight(item.m_ID);
         item.m_SortInfluence = sortInfluence;
         item.Serial          = serial;
         item.m_LastImage     = null;
         item.m_LastImageHue  = null;
         item.m_LastImageID   = 0;
         item.m_vAlpha        = 0;
         item.m_bAlpha        = false;
         item.m_bDraw         = false;
         item.m_bInit         = false;
         return(item);
     }
     return(new StaticItem(pSrc, sortInfluence, serial));
 }
Beispiel #2
0
 public override void Update()
 {
     this.m_ID     = (short)this.m_Item.ID;
     this.m_Z      = (sbyte)this.m_Item.Z;
     this.m_Hue    = Hues.GetItemHue((int)this.m_ID, (int)this.m_Item.Hue);
     this.m_Height = (byte)this.m_Item.Height;
 }
Beispiel #3
0
 public static StaticItem Instantiate(HuedTile tile, int influence, int serial)
 {
     if (m_InstancePool.Count > 0)
     {
         StaticItem item = (StaticItem)m_InstancePool.Dequeue();
         item.m_RealID        = (short)((tile.ID & 0x3fff) | 0x4000);
         item.m_ID            = (short)tile.ID;
         item.m_ID            = (short)(item.m_ID & 0x3fff);
         item.m_ID            = (short)(item.m_ID + 0x4000);
         item.m_Z             = (sbyte)tile.Z;
         item.m_Hue           = Hues.GetItemHue(item.m_ID, tile.Hue);
         item.m_Height        = Map.GetHeight(item.m_ID);
         item.m_SortInfluence = influence;
         item.Serial          = serial;
         item.m_LastImage     = null;
         item.m_LastImageHue  = null;
         item.m_LastImageID   = 0;
         item.m_vAlpha        = 0;
         item.m_bAlpha        = false;
         item.m_bDraw         = false;
         item.m_bInit         = false;
         return(item);
     }
     return(new StaticItem(tile, influence, serial));
 }
Beispiel #4
0
        public GItemListEntry(int x, AnswerEntry entry, GItemList owner)
            : base(x, 45)
        {
            this.m_Entry = entry;
            this.m_Owner = owner;
            int hue = entry.Hue;

            if (hue > 0)
            {
                ++hue;
            }
            this.m_Hue   = Hues.GetItemHue(entry.ItemID, hue);
            this.m_Image = this.m_Hue.GetItem(entry.ItemID);
            if (this.m_Image == null || this.m_Image.IsEmpty())
            {
                return;
            }
            this.m_Draw   = true;
            this.m_Height = 47;
            int num = this.m_Image.xMax - this.m_Image.xMin + 1;

            this.m_Width = 47;
            if (num > this.m_Width)
            {
                this.m_Width = num;
            }
            this.m_ImageOffsetX = (this.m_Width - (this.m_Image.xMax - this.m_Image.xMin + 1)) / 2 - this.m_Image.xMin;
            this.m_ImageOffsetY = (this.m_Height - (this.m_Image.yMax - this.m_Image.yMin + 1)) / 2 - this.m_Image.yMin;
        }
Beispiel #5
0
        public GItemListEntry(int x, AnswerEntry entry, GItemList owner) : base(x, 0x2d)
        {
            this.m_Entry = entry;
            this.m_Owner = owner;
            int hue = entry.Hue;

            if (hue > 0)
            {
                hue++;
            }
            this.m_Hue   = Hues.GetItemHue(entry.ItemID, hue);
            this.m_Image = this.m_Hue.GetItem(entry.ItemID);
            if ((this.m_Image != null) && !this.m_Image.IsEmpty())
            {
                this.m_Draw   = true;
                this.m_Height = 0x2f;
                int num2 = (this.m_Image.xMax - this.m_Image.xMin) + 1;
                this.m_Width = 0x2f;
                if (num2 > this.m_Width)
                {
                    this.m_Width = num2;
                }
                this.m_ImageOffsetX = ((this.m_Width - ((this.m_Image.xMax - this.m_Image.xMin) + 1)) / 2) - this.m_Image.xMin;
                this.m_ImageOffsetY = ((this.m_Height - ((this.m_Image.yMax - this.m_Image.yMin) + 1)) / 2) - this.m_Image.yMin;
            }
        }
Beispiel #6
0
 private DynamicItem(Item i)
 {
     this.m_Item   = i;
     this.m_ID     = i.ID;
     this.m_ID     = (short)(this.m_ID & 0x3fff);
     this.m_ID     = (short)(this.m_ID + 0x4000);
     this.m_Z      = (sbyte)i.Z;
     this.m_Hue    = Hues.GetItemHue(this.m_ID, i.Hue);
     this.m_Height = Map.GetHeight(this.m_ID);
 }
Beispiel #7
0
 public void Refresh()
 {
     this.m_TileID     = this.m_Item.ID;
     this.m_Hue        = Hues.GetItemHue(this.m_TileID, this.m_Item.Hue);
     this.State        = 0;
     base.m_CanDrag    = true;
     base.m_CanDrop    = true;
     base.m_QuickDrag  = false;
     base.m_DragCursor = false;
 }
Beispiel #8
0
 private StaticItem(HuedTile tile, int influence, int serial)
 {
     this.m_ID            = (short)tile.itemId;
     this.m_Z             = tile.z;
     this.m_RealID        = this.m_ID;
     this.m_Hue           = Hues.GetItemHue((int)this.m_ID, (int)tile.hueId);
     this.m_Height        = Map.GetItemHeight(tile.itemId);
     this.m_SortInfluence = influence;
     this.Serial          = serial;
     this.m_vPool         = VertexConstructor.Create();
 }
Beispiel #9
0
        public GDraggedItem(Client.Item item) : base(0, 0)
        {
            this.m_vCache = new VertexCache();
            this.m_Item   = item;
            int index  = this.m_Item.ID & 0x3fff;
            int amount = (ushort)this.m_Item.Amount;

            this.m_Double = Map.m_ItemFlags[index][TileFlag.Generic] && (amount > 1);
            if ((index >= 0xeea) && (index <= 0xef2))
            {
                int num3 = (index - 0xeea) / 3;
                num3         *= 3;
                num3         += 0xeea;
                this.m_Double = false;
                if (amount <= 1)
                {
                    index = num3;
                }
                else if ((amount >= 2) && (amount <= 5))
                {
                    index = num3 + 1;
                }
                else
                {
                    index = num3 + 2;
                }
            }
            this.m_Hue   = Hues.GetItemHue(index, this.m_Item.Hue);
            this.m_Image = this.m_Hue.GetItem(index);
            if ((this.m_Image != null) && !this.m_Image.IsEmpty())
            {
                this.m_Draw   = true;
                this.m_Width  = this.m_Image.Width;
                this.m_Height = this.m_Image.Height;
                int num4 = this.m_Double ? 6 : 1;
                this.m_xOffset = base.m_OffsetX = this.m_Image.xMin + (((this.m_Image.xMax - this.m_Image.xMin) + num4) / 2);
                this.m_yOffset = this.m_Image.yMin;
                base.m_OffsetY = this.m_yOffset + (((this.m_Image.yMax - this.m_Image.yMin) + num4) / 2);
                if (this.m_Double)
                {
                    this.m_Width  += 5;
                    this.m_Height += 5;
                }
            }
            base.m_DragCursor = false;
            base.m_CanDrag    = true;
            base.m_QuickDrag  = true;
            base.m_IsDragging = true;
            Gumps.Drag        = this;
            Gumps.LastOver    = this;
            base.m_X          = Engine.m_xMouse - base.m_OffsetX;
            base.m_Y          = Engine.m_yMouse - base.m_OffsetY;
        }
Beispiel #10
0
        public void OnAgentUpdated()
        {
            Item obj = this._item;
            int  id  = obj.ID;
            int  hue = (int)obj.Hue;

            this.GumpID = Gumps.GetEquipGumpID(id, this._mobile.BodyGender, ref hue);
            this.Hue    = Hues.GetItemHue(id, hue);
            int num = (int)obj.Layer;

            this.m_QuickDrag = num < 1 || num > 24 || num == 11 || num == 16;
        }
Beispiel #11
0
 private StaticItem(HuedTile tile, int influence, int serial)
 {
     this.m_ID            = (short)tile.ID;
     this.m_Z             = (sbyte)tile.Z;
     this.m_RealID        = (short)((tile.ID & 0x3fff) | 0x4000);
     this.m_ID            = (short)(this.m_ID & 0x3fff);
     this.m_ID            = (short)(this.m_ID + 0x4000);
     this.m_Hue           = Hues.GetItemHue(this.m_ID, tile.Hue);
     this.m_Height        = Map.GetHeight(this.m_ID);
     this.m_SortInfluence = influence;
     this.Serial          = serial;
     this.m_vPool         = VertexConstructor.Create();
 }
Beispiel #12
0
 private unsafe StaticItem(byte *pvSrc, int si, int serial)
 {
     this.m_ID            = *((short *)pvSrc);
     this.m_Z             = *((sbyte *)(pvSrc + 4));
     this.m_RealID        = (short)((this.m_ID & 0x3fff) | 0x4000);
     this.m_ID            = (short)(this.m_ID & 0x3fff);
     this.m_ID            = (short)(this.m_ID + 0x4000);
     this.m_Hue           = Hues.GetItemHue(this.m_ID, *((ushort *)(pvSrc + 5)));
     this.m_Height        = Map.GetHeight(this.m_ID);
     this.m_SortInfluence = si;
     this.Serial          = serial;
     this.m_vPool         = VertexConstructor.Create();
 }
Beispiel #13
0
 public GContainerItem(Client.Item Item, Client.Item Container) : base(Item.ContainerX, Item.ContainerY)
 {
     this.m_Item       = Item;
     this.m_Container  = Container;
     this.m_TileID     = this.m_Item.ID;
     this.m_Hue        = Hues.GetItemHue(this.m_TileID, this.m_Item.Hue);
     this.State        = 0;
     base.m_CanDrag    = true;
     base.m_CanDrop    = true;
     base.m_QuickDrag  = false;
     base.m_DragCursor = false;
     if (Engine.Features.AOS)
     {
         base.Tooltip = new ItemTooltip(this.m_Item);
     }
 }
Beispiel #14
0
        private Texture GetPreviewTexture()
        {
            Item obj = this._dragPreview;

            if (obj != null)
            {
                int     id          = obj.ID;
                int     hue         = (int)obj.Hue;
                int     equipGumpId = Gumps.GetEquipGumpID(id, this.m_Mobile.BodyGender, ref hue);
                Texture gump        = Hues.GetItemHue(id, hue).GetGump(equipGumpId);
                if (gump != null && !gump.IsEmpty())
                {
                    return(gump);
                }
            }
            return((Texture)null);
        }
Beispiel #15
0
 public GContainerItem(Item Item, Item Container)
     : base(Item.X, Item.Y)
 {
     this.m_Item       = Item;
     this.m_Container  = Container;
     this.m_TileID     = this.m_Item.ID;
     this.m_Hue        = Hues.GetItemHue(this.m_TileID, (int)this.m_Item.Hue);
     this.State        = 0;
     this.m_CanDrag    = true;
     this.m_CanDrop    = true;
     this.m_QuickDrag  = false;
     this.m_DragCursor = false;
     if (!Engine.ServerFeatures.AOS)
     {
         return;
     }
     this.Tooltip = (ITooltip) new ItemTooltip(this.m_Item);
 }
Beispiel #16
0
 public static DynamicItem Instantiate(Item item)
 {
     if (m_InstancePool.Count > 0)
     {
         DynamicItem item2 = (DynamicItem)m_InstancePool.Dequeue();
         item2.m_Item         = item;
         item2.m_ID           = item.ID;
         item2.m_ID           = (short)(item2.m_ID & 0x3fff);
         item2.m_ID           = (short)(item2.m_ID + 0x4000);
         item2.m_Z            = (sbyte)item.Z;
         item2.m_Hue          = Hues.GetItemHue(item2.m_ID, item.Hue);
         item2.m_Height       = Map.GetHeight(item2.m_ID);
         item2.m_LastImage    = null;
         item2.m_LastImageHue = null;
         item2.m_LastImageID  = 0;
         return(item2);
     }
     return(new DynamicItem(item));
 }
Beispiel #17
0
        public GDraggedItem(Item item)
            : base(0, 0)
        {
            this.m_vCache = new VertexCache();
            this.m_Item   = item;
            int index = this.m_Item.ID & 16383;
            int num1  = (int)(ushort)this.m_Item.Amount;

            this.m_Double = Map.m_ItemFlags[index][(TileFlag)2048L] && num1 > 1;
            if (index >= 3818 && index <= 3826)
            {
                int num2 = (index - 3818) / 3 * 3 + 3818;
                this.m_Double = false;
                index         = num1 > 1 ? (num1 < 2 || num1 > 5 ? num2 + 2 : num2 + 1) : num2;
            }
            this.m_Hue   = Hues.GetItemHue(index, (int)this.m_Item.Hue);
            this.m_Image = this.m_Hue.GetItem(index);
            if (this.m_Image != null && !this.m_Image.IsEmpty())
            {
                this.m_Draw   = true;
                this.m_Width  = this.m_Image.Width;
                this.m_Height = this.m_Image.Height;
                int num2 = this.m_Double ? 6 : 1;
                this.m_xOffset = this.m_OffsetX = this.m_Image.xMin + (this.m_Image.xMax - this.m_Image.xMin + num2) / 2;
                this.m_yOffset = this.m_Image.yMin;
                this.m_OffsetY = this.m_yOffset + (this.m_Image.yMax - this.m_Image.yMin + num2) / 2;
                if (this.m_Double)
                {
                    this.m_Width  += 5;
                    this.m_Height += 5;
                }
            }
            this.m_DragCursor = false;
            this.m_CanDrag    = true;
            this.m_QuickDrag  = true;
            this.m_IsDragging = true;
            Gumps.Drag        = (Gump)this;
            Gumps.LastOver    = (Gump)this;
            this.m_X          = Engine.m_xMouse - this.m_OffsetX;
            this.m_Y          = Engine.m_yMouse - this.m_OffsetY;
        }
Beispiel #18
0
        public static StaticItem Instantiate(HuedTile tile, int influence, int serial)
        {
            if (StaticItem.m_InstancePool.Count <= 0)
            {
                return(new StaticItem(tile, influence, serial));
            }
            StaticItem staticItem = (StaticItem)StaticItem.m_InstancePool.Dequeue();

            staticItem.m_RealID        = (short)tile.itemId;
            staticItem.m_ID            = staticItem.m_RealID;
            staticItem.m_Z             = tile.z;
            staticItem.m_Hue           = Hues.GetItemHue((int)staticItem.m_ID, (int)tile.hueId);
            staticItem.m_Height        = Map.GetItemHeight(tile.itemId);
            staticItem.m_SortInfluence = influence;
            staticItem.Serial          = serial;
            staticItem.m_LastImage     = (Texture)null;
            staticItem.m_LastImageHue  = (IHue)null;
            staticItem.m_LastImageID   = (short)0;
            staticItem.m_fAlpha        = 0.0f;
            staticItem.m_bDraw         = false;
            staticItem.m_bInit         = false;
            return(staticItem);
        }
Beispiel #19
0
        private void ProcessLayout(LayoutEntry[] list, string[] text)
        {
            int  num1 = 0;
            int  num2 = 0;
            bool flag = false;

            for (int index = 0; index < list.Length; ++index)
            {
                LayoutEntry le = list[index];
                switch (le.Name)
                {
                case "nodispose":
                case "noresize":
                    goto case "nodispose";

                case "checkertrans":
                    this.Pages(num1).Add((Gump) new GTransparentRegion(this, le[0], le[1], le[2], le[3]));
                    goto case "nodispose";

                case "page":
                    num1 = le[0];
                    if (num1 == 0)
                    {
                        flag = false;
                        num2 = 0;
                        goto case "nodispose";
                    }
                    else if (!flag || num1 < num2)
                    {
                        num2 = num1;
                        flag = true;
                        goto case "nodispose";
                    }
                    else
                    {
                        goto case "nodispose";
                    }

                case "noclose":
                    this.m_CanClose = false;
                    goto case "nodispose";

                case "nomove":
                    this.m_CanMove = false;
                    goto case "nodispose";

                case "resizepic":
                    this.Pages(num1).Add((Gump) new GServerBackground(this, le[0], le[1], le[3], le[4], le[2] + 4, true));
                    goto case "nodispose";

                case "gumppictiled":
                    this.Pages(num1).Add((Gump) new GServerBackground(this, le[0], le[1], le[2], le[3], le[4], false));
                    goto case "nodispose";

                case "gumppic":
                    string attribute = le.GetAttribute("hue");
                    IHue   hue;
                    if (attribute != null)
                    {
                        try
                        {
                            hue = Hues.Load(Convert.ToInt32(attribute) + 1);
                        }
                        catch
                        {
                            hue = Hues.Default;
                        }
                    }
                    else
                    {
                        hue = Hues.Default;
                    }
                    if (le.GetAttribute("class") == "VirtueGumpItem")
                    {
                        this.Pages(num1).Add((Gump) new GVirtueItem(this, le[0], le[1], le[2], hue));
                        goto case "nodispose";
                    }
                    else
                    {
                        this.Pages(num1).Add((Gump) new GServerImage(this, le[0], le[1], le[2], hue));
                        goto case "nodispose";
                    }

                case "textentry":
                    this.Pages(num1).Add((Gump) new GServerTextBox(text[le[6]], le));
                    goto case "nodispose";

                case "tilepic":
                    this.Pages(num1).Add((Gump) new GItemArt(le[0], le[1], le[2]));
                    goto case "nodispose";

                case "tilepichue":
                    this.Pages(num1).Add((Gump) new GItemArt(le[0], le[1], le[2], Hues.GetItemHue(le[2], le[3] + 1)));
                    goto case "nodispose";

                case "button":
                    this.Pages(num1).Add((Gump) new GServerButton(this, le));
                    goto case "nodispose";

                case "radio":
                    this.Pages(num1).Add((Gump) new GServerRadio(this, le));
                    goto case "nodispose";

                case "checkbox":
                    this.Pages(num1).Add((Gump) new GServerCheckBox(this, le));
                    goto case "nodispose";

                case "text":
                    int num3 = le[2];
                    this.Pages(num1).Add((Gump) new GLabel(text[le[3]], (IFont)Engine.GetUniFont(1), Hues.Load(num3 + 1), le[0] - 1, le[1]));
                    goto case "nodispose";

                case "croppedtext":
                    int    num4   = le[4];
                    string str    = text[le[5]];
                    int    xWidth = le[2];
                    IFont  Font   = (IFont)Engine.GetUniFont(1);
                    if (Font.GetStringWidth(str) > xWidth)
                    {
                        while (str.Length > 0 && Font.GetStringWidth(str + "...") > xWidth)
                        {
                            str = str.Substring(0, str.Length - 1);
                        }
                        str += "...";
                    }
                    GLabel glabel = new GLabel(str, Font, Hues.Load(num4 + 1), le[0] - 1, le[1]);
                    glabel.Scissor(0, 0, xWidth, le[3]);
                    this.Pages(num1).Add((Gump)glabel);
                    goto case "nodispose";

                case "xmfhtmlgump":
                    this.ProcessHtmlGump(num1, le[0], le[1], le[2], le[3], Localization.GetString(le[4]), le[5] != 0, le[6] != 0, le[5] != 0 || le[6] == 0 ? 0 : 16777215);
                    goto case "nodispose";

                case "xmfhtmlgumpcolor":
                    this.ProcessHtmlGump(num1, le[0], le[1], le[2], le[3], Localization.GetString(le[4]), le[5] != 0, le[6] != 0, Engine.C16232(le[7]));
                    goto case "nodispose";

                case "htmlgump":
                    this.ProcessHtmlGump(num1, le[0], le[1], le[2], le[3], text[le[4]], le[5] != 0, le[6] != 0, le[5] != 0 || le[6] == 0 ? 0 : 16777215);
                    goto case "nodispose";

                default:
                    Engine.AddTextMessage(le.Name);
                    goto case "nodispose";
                }
            }
            this.Page = num2 == 0 ? 1 : num2;
        }
Beispiel #20
0
 protected internal override void OnDragEnter(Gump g)
 {
     if ((g != null) && (g.GetType() == typeof(GDraggedItem)))
     {
         GDraggedItem item  = (GDraggedItem)g;
         Item         item2 = item.Item;
         int          iD    = item2.ID;
         int          hue   = item2.Hue;
         Engine.ItemArt.Translate(ref iD, ref hue);
         if (Map.m_ItemFlags[iD][TileFlag.Wearable])
         {
             if (this.m_Image != null)
             {
                 Gumps.Destroy(this.m_Image);
             }
             this.m_Image       = new GImage(Gumps.GetEquipGumpID(iD, this.m_Gender, ref hue), Hues.GetItemHue(iD, hue), 8, 0x13);
             this.m_Image.Alpha = 0.5f;
             int           count     = base.m_Children.Count;
             LayerComparer paperdoll = LayerComparer.Paperdoll;
             int           num4      = paperdoll.GetValue(iD, (Layer)Map.GetQuality(iD));
             for (int i = 0; i < base.m_Children.Count; i++)
             {
                 Gump gump = base.m_Children[i];
                 if (gump.GetType() == typeof(GPaperdollItem))
                 {
                     GPaperdollItem item3 = (GPaperdollItem)gump;
                     if (paperdoll.GetValue(item3.Item.ID, (Layer)((byte)item3.Layer)) < num4)
                     {
                         count = i;
                         break;
                     }
                 }
             }
             base.m_Children.Insert(count, this.m_Image);
         }
     }
 }