Exemplo n.º 1
0
        public static bool ContainsModule(Serial ser, Type type)
        {
            ModuleList mod = (ModuleList)m_Modules[ser];

            if (mod != null)
            {
                return(mod.Contains(type));
            }
            return(false);
        }
Exemplo n.º 2
0
 public static void Add(Serial ser, ModuleList list)
 {
     m_DictionaryOfModuleLists[ser] = list;
 }
Exemplo n.º 3
0
 public static void Add(Serial ser, ModuleList list)
 {
     m_Modules[ser] = list;
 }
Exemplo n.º 4
0
        public override void Gump(Mobile from, Gump gump, object[] subParams)
        {
            gump.AddButton(190, 40, 2445, 2445, 101, GumpButtonType.Reply, 0);
            gump.AddLabel(204, 42, 1153, "List Mobiles");
            gump.AddButton(310, 40, 2445, 2445, 102, GumpButtonType.Reply, 0);
            gump.AddLabel(331, 42, 1153, "List Items");
            gump.AddButton(430, 40, 2445, 2445, 103, GumpButtonType.Reply, 0);
            gump.AddLabel(450, 42, 1153, "List Types");
//			gump.AddButton( 190, 70, 2445, 2445, 104, GumpButtonType.Reply, 0 );
//			gump.AddLabel(  208, 72, 1153, "Add Module" );
//			gump.AddButton( 310, 70, 2445, 2445, 105, GumpButtonType.Reply, 0 );
//			gump.AddLabel(  326, 72, 1153, "Edit Module" );
//			gump.AddButton( 430, 70, 2445, 2445, 106, GumpButtonType.Reply, 0 );
//			gump.AddLabel(  439, 72, 1153, "Delete Module" );

            if (subParams == null)
            {
                gump.AddHtml(215, 15, 300, 25, "<basefont size=7 color=white><center>Central Memory</center></font>", false, false);
                gump.AddHtml(140, 95, 450, 250, "<basefont color=white><center>Welcome to the Central Memory Admin Gump!</center><br>With this gump, you can see a list of all entries that the CM contains.  You can add new Modules or modify or delete existing Modules.<br><br>Make your selection from the top buttons, either List Mobiles or Items.  This will bring up a list of all Mobiles or Items that the CM is keeping track of.<br><br>You may then select one of the entries to list the Modules that are stored to that entry.  You can then add, modify or remove modules to that entry.</font>", false, false);
                return;
            }

            Params = subParams;

            if (subParams[0] is int && (int)subParams[0] == -2)
            {            //Mobiles
                gump.AddLabel(120, 95, 1153, "Listing all Mobiles:");

                e_List = GetMobiles();
                if (e_List == null || e_List.Count == 0)
                {
                    return;
                }

                int p = 0;
                if (subParams.Length == 2 && subParams[1] is int)
                {
                    p = (int)subParams[1];
                }

                if (p < 0)
                {
                    p = 0;
                }


                if (p > 0)
                {
                    gump.AddButton(120, 332, 4014, 4015, 104, GumpButtonType.Reply, 0);
                }
                if ((p + 1) * 21 <= e_List.Count)
                {
                    gump.AddButton(540, 332, 4005, 4006, 105, GumpButtonType.Reply, 0);
                }

                for (int i = p * 21, r = 0, c = 0; i < e_List.Count; i++)
                {
                    Mobile m = (Mobile)e_List[i];
                    if (m == null)
                    {
                        continue;
                    }
                    gump.AddButton(120 + c * 155, 125 + r * 30, 2501, 2501, 1000 + i, GumpButtonType.Reply, 0);
                    gump.AddLabel(130 + c * 155, 126 + r * 30, 1153, (m.Name == null?m.Serial.ToString():m.Name));
                }
            }

            else if (subParams[0] is int && (int)subParams[0] == -3)
            {            //Items
                gump.AddLabel(120, 95, 1153, "Listing all Items:");

                e_List = GetItems();
                if (e_List == null || e_List.Count == 0)
                {
                    return;
                }

                int p = 0;
                if (subParams.Length == 2 && subParams[1] is int)
                {
                    p = (int)subParams[1];
                }

                if (p < 0)
                {
                    p = 0;
                }

                if (p > 0)
                {
                    gump.AddButton(120, 332, 4014, 4015, 104, GumpButtonType.Reply, 0);
                }
                if ((p + 1) * 21 <= e_List.Count)
                {
                    gump.AddButton(540, 332, 4005, 4006, 105, GumpButtonType.Reply, 0);
                }

                for (int i = p * 21, r = 0, c = 0; i < e_List.Count; i++)
                {
                    Item m = (Item)e_List[i];
                    if (m == null)
                    {
                        continue;
                    }
                    gump.AddButton(120 + c * 155, 125 + r * 30, 2501, 2501, 1000 + i, GumpButtonType.Reply, 0);
                    gump.AddLabel(130 + c * 155, 126 + r * 30, 1153, (m.Name == null?m.Serial.ToString():m.Name));
                }
            }

            else if (subParams[0] is Serial)
            {            //List the Modules for that serial
                Serial s = (Serial)subParams[0];
                if (!m_Modules.Contains(s))
                {
                    gump.AddLabel(120, 95, 1153, "This entity no longer exists in the Central Memory!");
                    return;
                }

                ModuleList ml = (ModuleList)m_Modules[s];
                if (ml == null || ml.Count == 0)
                {
                    gump.AddLabel(120, 95, 1153, "This entity has no Modules!");
                    Remove(s);
                    return;
                }

                string name = "";
                if (s.IsMobile)
                {
                    name = World.FindMobile(s).Name;
                }
                else if (s.IsItem)
                {
                    name = World.FindItem(s).Name;
                }

                if (name == null || name.Length == 0)
                {
                    name = s.ToString();
                }

                gump.AddLabel(120, 95, 1153, String.Format("Listing all Modules for {0}:", name));

                m_List = new ArrayList(ml.Values);
                if (m_List == null || m_List.Count == 0)
                {
                    return;
                }

                int p = 0;
                if (subParams.Length == 3 && subParams[2] is int)
                {
                    p = (int)subParams[2];
                }

                if (p < 0)
                {
                    p = 0;
                }
                if (p * 21 >= m_List.Count)
                {
                    p = m_List.Count - 21;
                }

                if (p > 0)
                {
                    gump.AddButton(120, 332, 4014, 4015, 104, GumpButtonType.Reply, 0);
                }
                if ((p + 1) * 21 <= m_List.Count)
                {
                    gump.AddButton(540, 332, 4005, 4006, 105, GumpButtonType.Reply, 0);
                }

                gump.AddButton(331, 332, 4008, 4009, 106, GumpButtonType.Reply, 0);

                for (int i = p * 21, r = 0, c = 0; i < m_List.Count; i++)
                {
                    Module m = (Module)m_List[i];
                    if (m == null)
                    {
                        continue;
                    }

                    gump.AddButton(120 + c * 155, 125 + r * 30, 2501, 2501, 1000 + i, GumpButtonType.Reply, 0);
                    gump.AddLabel(130 + c * 155, 126 + r * 30, 1153, (m.Name().Length == 0?m.Owner.ToString():m.Name()));
                }
            }
        }
Exemplo n.º 5
0
		public static void Add( Serial ser, ModuleList list )
		{
			m_Modules[ser] = list;
		}