示例#1
0
        public ContainerGump(AEntity containerItem, int gumpID)
            : base(containerItem.Serial, 0)
        {
            m_data = ContainerData.GetData(gumpID);
            m_item = (Container)containerItem;
            m_item.OnContentsUpdated += OnItemContentsUpdate;

            IsMoveable = true;

            AddControl(new GumpPicContainer(this, 0, 0, m_data.GumpID, 0, m_item));
        }
示例#2
0
        public static ContainerData Get(int itemID)
        {
            ContainerData data = null;

            m_Table.TryGetValue(itemID, out data);

            if (data != null)
            {
                return(data);
            }
            else
            {
                return(m_Default);
            }
        }
示例#3
0
        static ContainerData()
        {
            m_Table = new Dictionary <int, ContainerData>();

            string path = @"data/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);
            }
        }
示例#4
0
        static ContainerData()
        {
            m_Table = new Dictionary<int, ContainerData>();

            string path = @"data\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);
        }