Exemplo n.º 1
0
        public ContainerGump(Entity containerItem, int gumpID)
            : base(containerItem.Serial, 0)
        {
            _data = Data.ContainerData.GetData(gumpID);
            _item = (Container)containerItem;
            IsMovable = true;

            AddControl(new GumpPicContainer(this, 0, 0, 0, _data.GumpID, 0, _item));
            LastControl.MakeDragger(this);
            LastControl.MakeCloseTarget(this);

            _tickerText = (HtmlGump)AddControl(new HtmlGump(this, 0, 50, 50, 0, 0, 0, 0, string.Empty));
        }
Exemplo n.º 2
0
        static ContainerData()
        {
            m_Table = new Dictionary<int, ContainerData>();

            string path = "..\\..\\res\\containers.cfg";

            if (!File.Exists(path))
            {
                m_Default = new ContainerData(0x3C, new Rectangle(44, 65, 142, 94), 0x48);
                return;
            }

            using (StreamReader reader = new StreamReader(path))
            {
                string line;

                while ((line = reader.ReadLine()) != null)
                {
                    line = line.Trim();

                    if (line.Length == 0 || line.StartsWith("#"))
                        continue;

                    try
                    {
                        string[] split = line.Split('\t');

                        if (split.Length >= 3)
                        {
                            int gumpID = Utility.ToInt32(split[0]);

                            string[] aRect = split[1].Split(' ');
                            if (aRect.Length < 4)
                                continue;

                            int x = Utility.ToInt32(aRect[0]);
                            int y = Utility.ToInt32(aRect[1]);
                            int width = Utility.ToInt32(aRect[2]);
                            int height = Utility.ToInt32(aRect[3]);

                            Rectangle bounds = new Rectangle(x, y, width, height);

                            int dropSound = Utility.ToInt32(split[2]);

                            ContainerData data = new ContainerData(gumpID, bounds, dropSound);

                            if (m_Default == null)
                                m_Default = data;

                            if (split.Length >= 4)
                            {
                                string[] aIDs = split[3].Split(',');

                                for (int i = 0; i < aIDs.Length; i++)
                                {
                                    int id = Utility.ToInt32(aIDs[i]);

                                    if (m_Table.ContainsKey(id))
                                    {
                                        Console.WriteLine(@"Warning: double ItemID entry in Data\containers.cfg");
                                    }
                                    else
                                    {
                                        m_Table[id] = data;
                                    }
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }

            if (m_Default == null)
                m_Default = new ContainerData(0x3C, new Rectangle(44, 65, 142, 94), 0x48);
        }