Exemplo n.º 1
0
 public Hues()
 {
     InitializeComponent();
     SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);
     pictureBox.MouseWheel += new MouseEventHandler(OnMouseWheel);
     refmarker = this;
 }
Exemplo n.º 2
0
 public HueEdit(int index, Hues m_refmarker)
 {
     InitializeComponent();
     this.Icon = FiddlerControls.Options.GetFiddlerIcon();
     refmarker = m_refmarker;
     hue = Ultima.Hues.GetHue(index);
     Colors = new short[32];
     hue.Colors.CopyTo(Colors, 0);
     textBoxName.Text = hue.Name;
     this.Text = String.Format("HueEdit {0}", index);
     Selected = 0;
     Second_Selected = -1;
     pictureBoxPreview.Image = new Bitmap(pictureBoxPreview.Width, pictureBoxPreview.Height);
 }
Exemplo n.º 3
0
        private bool SetContainerLabelHue()
        {
            ListViewItem selectedItem = containerView.Items[containerView.SelectedIndices[0]];

            HueEntry h = new HueEntry(GetHueFromListView(selectedItem.SubItems[0].Text));

            // TODO: BREAKING DRY!
            if (h.ShowDialog(this) == DialogResult.OK)
            {
                int hueIdx = h.Hue;

                if (hueIdx > 0 && hueIdx < 3000)
                {
                    selectedItem.SubItems[2].BackColor = Hues.GetHue(hueIdx - 1).GetColor(HueEntry.TextHueIDX);
                }
                else
                {
                    selectedItem.SubItems[2].BackColor = Color.White;
                }

                selectedItem.SubItems[2].ForeColor = (selectedItem.SubItems[2].BackColor.GetBrightness() < 0.35 ? Color.White : Color.Black);

                foreach (Core.ContainerLabels.ContainerLabel list in Core.ContainerLabels.ContainerLabelList)
                {
                    if (list.Id.Equals(selectedItem.Text))
                    {
                        list.Hue = hueIdx;
                        break;
                    }
                }

                foreach (Core.ContainerLabels.ContainerLabel list in NewContainerEntries)
                {
                    if (list.Id.Equals(selectedItem.Text))
                    {
                        list.Hue = hueIdx;
                        break;
                    }
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
 public GHealthBar(Mobile m, int X, int Y)
     : base(m.Player ? (m.Flags[MobileFlag.Warmode] ? 2055 : 2051) : 2052, X, Y)
 {
     this.m_Mobile    = m;
     this.m_CanDrop   = true;
     this.m_QuickDrag = false;
     this.m_Player    = m.Player;
     if (!this.m_Player)
     {
         this.Hue = Hues.GetNotoriety(m.Notoriety);
     }
     if (Engine.ServerFeatures.AOS)
     {
         this.Tooltip = (ITooltip) new MobileTooltip(m);
     }
     if (this.m_Player)
     {
         this.m_HP   = new GImageClip(this.GetHealthGumpID(m.Flags), 34, 12, m.CurrentHitPoints, m.MaximumHitPoints);
         this.m_Mana = new GImageClip(2054, 34, 25, m.CurrentMana, m.MaximumMana);
         this.m_Stam = new GImageClip(2054, 34, 38, m.CurrentStamina, m.MaximumStamina);
         this.m_Children.Add((Gump) new GImage(2053, 34, 12));
         this.m_Children.Add((Gump) new GImage(2053, 34, 25));
         this.m_Children.Add((Gump) new GImage(2053, 34, 38));
         this.m_Children.Add((Gump)this.m_HP);
         this.m_Children.Add((Gump)this.m_Mana);
         this.m_Children.Add((Gump)this.m_Stam);
         this.m_xHPCur   = m.CurrentHitPoints;
         this.m_xHPMax   = m.MaximumHitPoints;
         this.m_xStamCur = m.CurrentStamina;
         this.m_xStamMax = m.MaximumStamina;
         this.m_xManaCur = m.CurrentMana;
         this.m_xManaMax = m.MaximumMana;
     }
     else
     {
         this.m_Name   = new GLabel(m.Name, (IFont)Engine.GetFont(1), Hues.Load(1109), 16, 0);
         this.m_Name.Y = 11 + (24 - this.m_Name.Height) / 2;
         this.m_Name.Scissor(0, 0, 122, this.m_Name.Height);
         this.m_HP = new GImageClip(this.GetHealthGumpID(m.Flags), 34, 38, m.CurrentHitPoints, m.MaximumHitPoints);
         this.m_Children.Add((Gump) new GImage(2053, 34, 38));
         this.m_Children.Add((Gump)this.m_Name);
         this.m_Children.Add((Gump)this.m_HP);
         this.m_xName  = m.Name;
         this.m_xHPCur = m.CurrentHitPoints;
         this.m_xHPMax = m.MaximumHitPoints;
     }
 }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public HuesField()
        {
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, true);
            SetStyle(ControlStyles.StandardClick, true);
            SetStyle(ControlStyles.UserPaint, true);

            bitmapCache        = new Bitmap[32];
            hues               = null;
            hueSize            = new Size(8, 8);
            brightness         = 24;
            showAllColors      = false;
            selectedColorIndex = 1;

            InitializeComponent();
        }
        public override void Initialize()
        {
            base.Initialize();

            InstallLocation install = Install;

            _fileIndices = new[]
            {
                install.CreateFileIndex("anim.idx", "anim.mul"), install.CreateFileIndex("anim2.idx", "anim2.mul"),
                install.CreateFileIndex("anim3.idx", "anim3.mul"), install.CreateFileIndex("anim4.idx", "anim4.mul"),
                install.CreateFileIndex("anim5.idx", "anim5.mul")
            };

            _bodyTable     = new BodyTable(install.GetPath("body.def"));
            _bodyConverter = new BodyConverter(install.GetPath("bodyconv.def"));
            _hues          = new Hues(install);
        }
Exemplo n.º 8
0
        public void Update(Item pack)
        {
            Item[] itemArray = pack.FindItems(this.m_Validator);
            int    num       = 0;

            for (int i = 0; i < itemArray.Length; i++)
            {
                num += Math.Max((ushort)itemArray[i].Amount, 1);
            }
            if (this.m_LastAmount != num)
            {
                this.m_LastAmount = num;
                this.m_Label.Text = num.ToString();
                this.m_Label.Hue  = (num < 5) ? Hues.Load(0x22) : Hues.Bright;
                this.Size();
            }
        }
Exemplo n.º 9
0
        internal static unsafe void InitializePlugin(PluginHeader *plugin)
        {
            _onConnected             = OnConnected;
            _onDisconnected          = OnDisconnected;
            _onReceive               = OnPacketReceive;
            _onSend                  = OnPacketSend;
            _onPlayerPositionChanged = OnPlayerPositionChanged;
            _onClientClosing         = OnClientClosing;
            _onHotkeyPressed         = OnHotkeyPressed;
            _onMouse                 = OnMouse;
            _hWnd = plugin->HWND;

            plugin->OnConnected             = Marshal.GetFunctionPointerForDelegate(_onConnected);
            plugin->OnDisconnected          = Marshal.GetFunctionPointerForDelegate(_onDisconnected);
            plugin->OnRecv                  = Marshal.GetFunctionPointerForDelegate(_onReceive);
            plugin->OnSend                  = Marshal.GetFunctionPointerForDelegate(_onSend);
            plugin->OnPlayerPositionChanged = Marshal.GetFunctionPointerForDelegate(_onPlayerPositionChanged);
            plugin->OnClientClosing         = Marshal.GetFunctionPointerForDelegate(_onClientClosing);
            plugin->OnHotkeyPressed         = Marshal.GetFunctionPointerForDelegate(_onHotkeyPressed);
            plugin->OnMouse                 = Marshal.GetFunctionPointerForDelegate(_onMouse);

            _getPacketLength = Marshal.GetDelegateForFunctionPointer <OnGetPacketLength>(plugin->GetPacketLength);
            _getUOFilePath   = Marshal.GetDelegateForFunctionPointer <OnGetUOFilePath>(plugin->GetUOFilePath);
            _sendToClient    = Marshal.GetDelegateForFunctionPointer <OnPacketSendRecv>(plugin->Recv);
            _sendToServer    = Marshal.GetDelegateForFunctionPointer <OnPacketSendRecv>(plugin->Send);
            _requestMove     = Marshal.GetDelegateForFunctionPointer <RequestMove>(plugin->RequestMove);

            ClientPath    = _getUOFilePath();
            ClientVersion = new Version((byte)(plugin->ClientVersion >> 24), (byte)(plugin->ClientVersion >> 16),
                                        (byte)(plugin->ClientVersion >> 8), (byte)plugin->ClientVersion);

            if (!Path.IsPathRooted(ClientPath))
            {
                ClientPath = Path.GetFullPath(ClientPath);
            }

            Art.Initialize(ClientPath);
            Hues.Initialize(ClientPath);
            Cliloc.Initialize(ClientPath);
            Skills.Initialize(ClientPath);
            Speech.Initialize(ClientPath);
            TileData.Initialize(ClientPath);

            ClassicAssembly = AppDomain.CurrentDomain.GetAssemblies()
                              .FirstOrDefault(a => a.FullName.StartsWith("ClassicUO,"));
        }
Exemplo n.º 10
0
 public override void RefreshCache()
 {
     if (this.mHue == null)
     {
         this.mHue = Hues.GetHue(0);
     }
     if (this.mCache != null)
     {
         this.mCache.Dispose();
     }
     this.mCache = UnicodeFonts.WriteText(2, this.mInitialText + " ");
     if ((this.mHue == null || this.mHue.Index == 0 ? 0 : 1) == 0)
     {
         return;
     }
     this.mHue.ApplyTo(this.mCache, false);
 }
Exemplo n.º 11
0
        public Converter(MainForm f, int wid, int hei, byte mi, string inp, string outp, string binp, byte tsk_mapstatics, byte tsk_season, bool tsk_uop, bool tsk_dds)
        {
            form       = f;
            width      = wid;
            height     = hei;
            mapIndex   = mi;
            inPath     = inp;
            outPath    = outp;
            binPath    = binp;
            tileMatrix = new TileMatrix(inPath, mapIndex, mapIndex, width, height);

            task_mapstatics = tsk_mapstatics;
            task_season     = tsk_season;
            task_uop        = tsk_uop;
            task_dds        = tsk_dds;

            CDAppendToLog           = new DelegateString(form.AppendToLog);
            CDItemsState            = new DelegateBool(form.SetItemsState);
            CDProgressBarSetMarquee = new DelegateBool(form.ProgressbarSetMarquee);
            CDProgressBarIncrease   = new DelegateVoid(form.ProgressbarIncrease);
            CDProgressBarSetMax     = new DelegateInt(form.ProgressbarSetMax);
            CDProgressBarSetVal     = new DelegateInt(form.ProgressbarSetVal);
            CDSuccess = new DelegateVoid(form.Success);

            Log("Loading hues.mul into memory... ", true);
            Hues.Init();
            Log("Done!\n", true);

            if (task_season != 0)
            {
                LoadLTDictionary();
            }

            if (tsk_dds)
            {
                loadRadarcol();
                bmp = new Bitmap(width, height, PixelFormat.Format16bppRgb555);
                Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
                bmpData = bmp.LockBits(rect, ImageLockMode.WriteOnly, bmp.PixelFormat);
                unsafe
                {
                    bmpPtr = (byte *)bmpData.Scan0.ToPointer();
                }
            }
        }
Exemplo n.º 12
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);
 }
Exemplo n.º 13
0
 public GHuePicker(int X, int Y)
     : base(X, Y)
 {
     this.m_Tooltip    = (ITooltip) new Tooltip("");
     this.m_ColorTable = new int[20, 10, 5];
     for (int index1 = 0; index1 < 20; ++index1)
     {
         for (int index2 = 0; index2 < 10; ++index2)
         {
             for (int index3 = 0; index3 < 5; ++index3)
             {
                 ushort num1 = Hues.GetData(1 + (index2 * 20 + index1) * 5 + index3).colors[48];
                 int    num2 = (int)((double)((int)num1 >> 10 & 31) * 8.22580623626709) << 16 | (int)((double)((int)num1 >> 5 & 31) * 8.22580623626709) << 8 | (int)((double)((int)num1 & 31) * 8.22580623626709);
                 this.m_ColorTable[index1, index2, index3] = num2;
             }
         }
     }
 }
Exemplo n.º 14
0
        public void Update(Item pack)
        {
            Item[] items = pack.FindItems(this.m_Validator);
            int    num   = 0;

            for (int index = 0; index < items.Length; ++index)
            {
                num += (int)Math.Max((ushort)items[index].Amount, (ushort)1);
            }
            if (this.m_LastAmount == num)
            {
                return;
            }
            this.m_LastAmount = num;
            this.m_Label.Text = num.ToString();
            this.m_Label.Hue  = num < 5 ? Hues.Load(34) : Hues.Bright;
            this.Size();
        }
Exemplo n.º 15
0
        private static void OnProps(Packet p, PacketHandlerEventArgs args)
        {
            p.Seek(5, SeekOrigin.Begin);
            Item item = World.FindItem(p.ReadUInt32());

            if (item == null || item.ItemID != 0x21FC || !keys.ContainsKey(item.Hue))
            {
                return;
            }

            if (item.ObjPropList.m_CustomContent.Count == 0)
            {
                string color = ColorTranslator.ToHtml(Hues.GetHue(item.Hue).GetColor(30));
                item.ObjPropList.Add("<basefont color={0}>{1}", color, keys[item.Hue]);
            }
            args.Block = true;
            WorldEx.SendToClient(item.ObjPropList.BuildPacket());
        }
Exemplo n.º 16
0
        public GUpdateScroll(string text) : base(0x13c2, 100, 100, 40, 30, true)
        {
            GLabel        toAdd      = new GLabel("Updates", Engine.DefaultFont, Hues.Load(0x1f0), base.OffsetX, base.OffsetY);
            GBackground   background = new GBackground(0xbbc, 100, 100, base.OffsetX, (toAdd.Y + toAdd.Height) + 4, true);
            GWrappedLabel label2     = new GWrappedLabel(text, Engine.GetFont(1), Hues.Load(0x455), background.OffsetX + 2, background.OffsetY + 2, 250);

            background.Width  = ((background.Width - background.UseWidth) + label2.Width) + 6;
            background.Height = ((background.Height - background.UseHeight) + label2.Height) + 2;
            background.Children.Add(label2);
            this.Width       = (this.Width - base.UseWidth) + background.Width;
            this.Height      = (((this.Height - base.UseHeight) + toAdd.Height) + 4) + background.Height;
            toAdd.X         += (base.UseWidth - toAdd.Width) / 2;
            base.m_CanDrag   = true;
            base.m_QuickDrag = true;
            base.CanClose    = true;
            background.SetMouseOverride(this);
            base.m_Children.Add(toAdd);
            base.m_Children.Add(background);
        }
Exemplo n.º 17
0
        public static void Reacquire()
        {
            Mobile mobile = TargetManager.Acquire((Predicate <Mobile>)null);

            if (mobile == null)
            {
                return;
            }
            TargetManager.LastTarget          = (object)mobile;
            TargetManager.LastOffensiveTarget = mobile;
            mobile.AddTextMessage("", "Last target set.", Engine.DefaultFont, Hues.Load(89), false);
            string identifier = mobile.Identifier;

            if (identifier == null)
            {
                return;
            }
            Party.SendAutomatedMessage("Changing last target to {0}", (object)identifier);
        }
Exemplo n.º 18
0
        public GCombatGump() : base(0x2b02, 50, 50)
        {
            AbilityInfo[] abilities = AbilityInfo.Abilities;
            AbilityInfo   active    = AbilityInfo.Active;
            AbilityInfo   primary   = AbilityInfo.Primary;
            AbilityInfo   secondary = AbilityInfo.Secondary;
            IFont         uniFont   = Engine.GetUniFont(1);
            OnClick       onClick   = new OnClick(this.Name_OnClick);
            GLabel        toAdd     = new GLabel("INDEX", Engine.GetFont(6), Hues.Default, 100, 4);

            base.m_Children.Add(toAdd);
            toAdd = new GLabel("INDEX", Engine.GetFont(6), Hues.Default, 0x106, 4);
            base.m_Children.Add(toAdd);
            for (int i = 0; i < abilities.Length; i++)
            {
                AbilityInfo a      = abilities[i];
                IHue        hueFor = GetHueFor(a);
                toAdd       = new GTextButton(Localization.GetString(a.Name), uniFont, hueFor, hueFor, 0x38 + ((i / 9) * 0xa2), 0x26 + ((i % 9) * 15), onClick);
                a.NameLabel = (GTextButton)toAdd;
                toAdd.SetTag("Ability", a);
                toAdd.Tooltip       = new Tooltip(Localization.GetString(a.Tooltip), true, 240);
                toAdd.Tooltip.Delay = 0.25f;
                base.m_Children.Add(toAdd);
            }
            this.m_PrimaryIcon               = new GAbilityIcon(true, true, primary.Icon, 0xda, 0x69);
            this.m_PrimaryIcon.Tooltip       = new Tooltip(Localization.GetString(primary.Name), true);
            this.m_PrimaryIcon.Tooltip.Delay = 0.25f;
            this.m_PrimaryIcon.Hue           = (primary == AbilityInfo.Active) ? Hues.Load(0x8026) : Hues.Default;
            base.m_Children.Add(this.m_PrimaryIcon);
            toAdd = new GLabel("Primary", Engine.GetFont(6), Hues.Default, 0x10c, 0x69);
            base.m_Children.Add(toAdd);
            toAdd = new GLabel("Ability Icon", Engine.GetFont(6), Hues.Default, 0x10c, 0x77);
            base.m_Children.Add(toAdd);
            this.m_SecondaryIcon               = new GAbilityIcon(true, false, secondary.Icon, 0xda, 150);
            this.m_SecondaryIcon.Tooltip       = new Tooltip(Localization.GetString(secondary.Name), true);
            this.m_SecondaryIcon.Tooltip.Delay = 0.25f;
            this.m_SecondaryIcon.Hue           = (secondary == AbilityInfo.Active) ? Hues.Load(0x8026) : Hues.Default;
            base.m_Children.Add(this.m_SecondaryIcon);
            toAdd = new GLabel("Secondary", Engine.GetFont(6), Hues.Default, 0x10c, 150);
            base.m_Children.Add(toAdd);
            toAdd = new GLabel("Ability Icon", Engine.GetFont(6), Hues.Default, 0x10c, 0xa4);
            base.m_Children.Add(toAdd);
        }
Exemplo n.º 19
0
 public void OnTarget(object o)
 {
     if (o is Mobile)
     {
         ((Mobile)o).AddTextMessage("", "Last target set.", Engine.DefaultFont, Hues.Load(0x59), false);
         if (((Party.State == PartyState.Joined) && (((Mobile)o).Name != null)) && (((Mobile)o).Name.Length > 0))
         {
             Network.Send(new PParty_PublicMessage("Changing last target to " + ((Mobile)o).Name));
         }
     }
     else if (o is Item)
     {
         ((Item)o).AddTextMessage("", "Last target set.", Engine.DefaultFont, Hues.Load(0x59), false);
     }
     else
     {
         Engine.AddTextMessage("Last target set.", Engine.DefaultFont, Hues.Load(0x59));
     }
 }
Exemplo n.º 20
0
        public void SetValue(object val)
        {
            this.m_Entry.Property.SetValue(this.m_Object, val, (object[])null);
            if (this.m_Value == null)
            {
                return;
            }
            IFont font = (val is ValueType ? (val.Equals(this.m_Entry.Optionable.Default) ? 1 : 0) : (object.ReferenceEquals(val, this.m_Entry.Optionable.Default) ? 1 : 0)) == 0 ? (IFont)Engine.GetUniFont(1) : (IFont)Engine.GetUniFont(2);

            if (this.m_Hue == null)
            {
                this.m_Value.Text = this.GetValString(val);
            }
            else
            {
                this.m_Hue.FillColor = Engine.C16232((int)Hues.Load((int)val).Pixel(ushort.MaxValue));
            }
            this.m_Value.Font = font;
        }
Exemplo n.º 21
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));
 }
Exemplo n.º 22
0
        private void ApplyHue(int hue)
        {
            if (m_Image == null || hue != m_Hue)
            {
                m_Image = (Bitmap)Art.GetStatic(m_Index).Clone();
            }

            if (hue == m_Hue)
            {
                return;
            }

            m_Hue = hue;

            if (m_Hue > 0)
            {
                Hues.GetHue(m_Hue).ApplyTo(m_Image, false);
            }
        }
Exemplo n.º 23
0
        private void SetContainerLabelHue()
        {
            ListViewItem selectedItem = cliLocOverheadView.Items[cliLocOverheadView.SelectedIndices[0]];

            HueEntry h = new HueEntry(GetHueFromListView(selectedItem.SubItems[1].Text));

            // TODO: BREAKING DRY!
            if (h.ShowDialog(this) == DialogResult.OK)
            {
                int hueIdx = h.Hue;

                if (hueIdx > 0 && hueIdx < 3000)
                {
                    selectedItem.SubItems[1].BackColor = Hues.GetHue(hueIdx - 1).GetColor(HueEntry.TextHueIDX);
                }
                else
                {
                    selectedItem.SubItems[1].BackColor = Color.White;
                }

                selectedItem.SubItems[1].ForeColor = (selectedItem.SubItems[1].BackColor.GetBrightness() < 0.35
                    ? Color.White
                    : Color.Black);

                foreach (Core.OverheadMessages.OverheadMessage list in Core.OverheadMessages.OverheadMessageList)
                {
                    if (list.SearchMessage.Equals(selectedItem.Text))
                    {
                        list.Hue = hueIdx;
                        break;
                    }
                }

                foreach (Core.OverheadMessages.OverheadMessage list in NewOverheadEntries)
                {
                    if (list.SearchMessage.Equals(selectedItem.Text))
                    {
                        list.Hue = hueIdx;
                        break;
                    }
                }
            }
        }
Exemplo n.º 24
0
        public GUpdateScroll(string text)
            : base(5058, 100, 100, 40, 30, true)
        {
            GLabel        glabel        = new GLabel("Updates", Engine.DefaultFont, Hues.Load(496), this.OffsetX, this.OffsetY);
            GBackground   gbackground   = new GBackground(3004, 100, 100, this.OffsetX, glabel.Y + glabel.Height + 4, true);
            GWrappedLabel gwrappedLabel = new GWrappedLabel(text, (IFont)Engine.GetFont(1), Hues.Load(1109), gbackground.OffsetX + 2, gbackground.OffsetY + 2, 250);

            gbackground.Width  = gbackground.Width - gbackground.UseWidth + gwrappedLabel.Width + 6;
            gbackground.Height = gbackground.Height - gbackground.UseHeight + gwrappedLabel.Height + 2;
            gbackground.Children.Add((Gump)gwrappedLabel);
            this.Width       = this.Width - this.UseWidth + gbackground.Width;
            this.Height      = this.Height - this.UseHeight + glabel.Height + 4 + gbackground.Height;
            glabel.X        += (this.UseWidth - glabel.Width) / 2;
            this.m_CanDrag   = true;
            this.m_QuickDrag = true;
            this.CanClose    = true;
            gbackground.SetMouseOverride((Gump)this);
            this.m_Children.Add((Gump)glabel);
            this.m_Children.Add((Gump)gbackground);
        }
Exemplo n.º 25
0
 public SellInfo(Client.Item item, int itemID, int hue, int amount, int price, string name)
 {
     this.m_Item   = item;
     this.m_ItemID = itemID;
     this.m_Amount = amount;
     this.m_Price  = price;
     try
     {
         this.m_Name = Localization.GetString(Convert.ToInt32(name));
     }
     catch
     {
         this.m_Name = name;
     }
     if (!Map.m_ItemFlags[itemID & 0x3fff][TileFlag.PartialHue])
     {
         hue ^= 0x8000;
     }
     this.m_Hue = Hues.Load(hue);
 }
Exemplo n.º 26
0
        public ActionResult MultiArt(int id, int hue = 0)
        {
            DeleteTempFiles(System.Web.HttpContext.Current);
            Files.SetMulPath(HttpContext.Server.MapPath("~/mul"));
            Bitmap bmp = new Bitmap(Multis.GetComponents(id).GetImage());

            if (hue > 0 && hue <= 3000)
            {
                short[] colors = Hues.GetHue(hue).Colors;
                Hues.ApplyTo(bmp, colors, (TileData.ItemTable[id].Flags & TileFlag.PartialHue) != 0);
            }
            byte[] byteArray = ImageToByte(bmp);
            using (Image image = Image.FromStream(new MemoryStream(byteArray)))
            {
                image.Save(HttpContext.Server.MapPath("~/tempfiles/") + id + hue + ".png", ImageFormat.Png);
            }

            ViewBag.img = "/tempfiles/" + id + hue + ".png";
            return(File(HttpContext.Server.MapPath("~/tempfiles/") + id + hue + ".png", "image/png"));
        }
Exemplo n.º 27
0
 public SellInfo(Item item, int itemID, int hue, int amount, int price, string name)
 {
     this.m_Item   = item;
     this.m_ItemID = itemID;
     this.m_Amount = amount;
     this.m_Price  = price;
     try
     {
         this.m_Name = Localization.GetString(Convert.ToInt32(name));
     }
     catch
     {
         this.m_Name = name;
     }
     if (!Map.m_ItemFlags[itemID & 16383][(TileFlag)262144L])
     {
         hue ^= 32768;
     }
     this.m_Hue = Hues.Load(hue);
 }
Exemplo n.º 28
0
        public static void DrawSpectrum(Bitmap bitmap, Hues hues, int index)
        {
            if (bitmap == null)
            {
                throw new ArgumentNullException("bitmap");
            }
            if (hues == null)
            {
                throw new ArgumentNullException("hues");
            }

            if (index < hues.MinIndex || index > hues.MaxIndex)
            {
                throw new ArgumentOutOfRangeException("index");
            }

            HueEntry hue = hues.Get(index);

            BitmapData data = bitmap.LockBits(new Rectangle(new Point(), bitmap.Size), ImageLockMode.WriteOnly, PixelFormat.Format16bppArgb1555);

            float colorWidth = (float)bitmap.Width / 32.0f;

            short[] line = new short[bitmap.Width];

            for (int x = 0; x < bitmap.Width; x++)
            {
                int id = (int)(x / colorWidth);
                if (id < 32)
                {
                    line[x] = (short)(hue.Colors[id] | 0x8000);
                }
            }

            for (int y = 0; y < bitmap.Height; y++)
            {
                int offset = (int)data.Scan0 + y * data.Stride;
                Marshal.Copy(line, 0, (IntPtr)offset, line.Length);
            }

            bitmap.UnlockBits(data);
        }
Exemplo n.º 29
0
        private GContextMenu(object owner, PopupEntry[] list)
            : base(100, 100)
        {
            this.m_Owner = owner;
            this.m_GUID  = "MobilePopup";
            int     num1     = 0;
            int     num2     = 0;
            int     length   = list.Length;
            IFont   font     = (IFont)Engine.GetUniFont(3);
            IHue    bright   = Hues.Bright;
            IHue    focusHue = Hues.Load(53);
            IHue    @default = Hues.Default;
            OnClick onClick  = new OnClick(this.Entry_OnClick);

            for (int index = 0; index < length; ++index)
            {
                PopupEntry popupEntry = list[index];
                GLabel     glabel;
                if (popupEntry.Flags == 1)
                {
                    glabel = new GLabel(popupEntry.Text, font, @default, 7, 7 + num2);
                }
                else
                {
                    glabel = (GLabel) new GTextButton(popupEntry.Text, font, bright, focusHue, 7, 7 + num2, onClick);
                    glabel.SetTag("EntryID", (object)popupEntry.EntryID);
                }
                glabel.X -= glabel.Image.xMin;
                glabel.Y -= glabel.Image.yMin;
                num2     += glabel.Image.yMax - glabel.Image.yMin + 4;
                if (glabel.Image.xMax - glabel.Image.xMin + 1 > num1)
                {
                    num1 = glabel.Image.xMax - glabel.Image.xMin + 1;
                }
                this.m_Children.Add((Gump)glabel);
            }
            int num3 = num2 - 3;

            this.m_Width  = num1 + 14;
            this.m_Height = num3 + 14;
        }
Exemplo n.º 30
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;
        }
Exemplo n.º 31
0
        internal static unsafe void InitializePlugin(PluginHeader *plugin)
        {
            _onConnected             = OnConnected;
            _onDisconnected          = OnDisconnected;
            _onReceive               = OnPacketReceive;
            _onSend                  = OnPacketSend;
            _onPlayerPositionChanged = OnPlayerPositionChanged;
            _onClientClosing         = OnClientClosing;
            _onHotkeyPressed         = OnHotkeyPressed;
            _onMouse                 = OnMouse;
            _hWnd = plugin->HWND;

            plugin->OnConnected             = Marshal.GetFunctionPointerForDelegate(_onConnected);
            plugin->OnDisconnected          = Marshal.GetFunctionPointerForDelegate(_onDisconnected);
            plugin->OnRecv                  = Marshal.GetFunctionPointerForDelegate(_onReceive);
            plugin->OnSend                  = Marshal.GetFunctionPointerForDelegate(_onSend);
            plugin->OnPlayerPositionChanged = Marshal.GetFunctionPointerForDelegate(_onPlayerPositionChanged);
            plugin->OnClientClosing         = Marshal.GetFunctionPointerForDelegate(_onClientClosing);
            plugin->OnHotkeyPressed         = Marshal.GetFunctionPointerForDelegate(_onHotkeyPressed);
            plugin->OnMouse                 = Marshal.GetFunctionPointerForDelegate(_onMouse);

            _getPacketLength = Marshal.GetDelegateForFunctionPointer <OnGetPacketLength>(plugin->GetPacketLength);
            _getUOFilePath   = Marshal.GetDelegateForFunctionPointer <OnGetUOFilePath>(plugin->GetUOFilePath);
            _sendToClient    = Marshal.GetDelegateForFunctionPointer <OnPacketSendRecv>(plugin->Recv);
            _sendToServer    = Marshal.GetDelegateForFunctionPointer <OnPacketSendRecv>(plugin->Send);
            _requestMove     = Marshal.GetDelegateForFunctionPointer <RequestMove>(plugin->RequestMove);

            ClientPath = _getUOFilePath();

            if (!Path.IsPathRooted(ClientPath))
            {
                ClientPath = Path.GetFullPath(ClientPath);
            }

            Art.Initialize(ClientPath);
            Hues.Initialize(ClientPath);
            Cliloc.Initialize(ClientPath);
            Skills.Initialize(ClientPath);
            Speech.Initialize(ClientPath);
            TileData.Initialize(ClientPath);
        }
Exemplo n.º 32
0
 public virtual Gump GetGump()
 {
     if (this.m_Gump == null)
     {
         GWrappedLabel label;
         if ((this.m_Text == null) || (this.m_Text.Length <= 0))
         {
             return((Gump)(this.m_Gump = null));
         }
         this.m_Gump = new GAlphaBackground(0, 0, 100, 100);
         label       = new GWrappedLabel(this.m_Text, Engine.GetUniFont(1), Hues.Load(0x481), 4, 4, this.m_WrapWidth)
         {
             X = label.X - label.Image.xMin,
             Y = label.Y - label.Image.yMin
         };
         this.m_Gump.Width  = (label.Image.xMax - label.Image.xMin) + 9;
         this.m_Gump.Height = (label.Image.yMax - label.Image.yMin) + 9;
         this.m_Gump.Children.Add(label);
     }
     return(this.m_Gump);
 }