ParseType() public static méthode

public static ParseType ( string s ) : string
s string
Résultat string
        public List <string> CreateArray(RelayInfo info, Mobile from)
        {
            List <string> creaturesName = new List <string>();

            for (int i = 0; i < 13; i++)
            {
                TextRelay te = info.GetTextEntry(i);

                if (te != null)
                {
                    string str = te.Text;

                    if (str.Length > 0)
                    {
                        str = str.Trim();

                        string t = Spawner.ParseType(str);

                        Type type = ScriptCompiler.FindTypeByName(t);

                        if (type != null)
                        {
                            creaturesName.Add(str);
                        }
                        else
                        {
                            from.SendMessage("{0} is not a valid type name.", t);
                        }
                    }
                }
            }

            return(creaturesName);
        }
Exemple #2
0
        public void UpdateSpawnObjects(RelayInfo info, Mobile from)
        {
            TextRelay tr = info.GetTextEntry(500);

            if (tr != null && tr.Text.Length > 0)
            {
                m_Spawner.MaxCount = Math.Max(0, Utility.ToInt32(tr.Text));
            }

            for (int i = 0; i < MaxEntries; i++)
            {
                TextRelay te  = info.GetTextEntry(i);
                TextRelay te2 = info.GetTextEntry(i + 20);

                SpawnObject so = i < m_Spawner.SpawnObjects.Count ? m_Spawner.SpawnObjects[i] : null;

                if (te != null)
                {
                    string name     = te.Text;
                    string maxCount = te2 != null ? te2.Text : null;
                    int    max      = 0;

                    if (name.Length > 0)
                    {
                        name = name.Trim();

                        if (!String.IsNullOrEmpty(maxCount))
                        {
                            max = Utility.ToInt32(maxCount);
                        }

                        max = Math.Max(0, max);

                        string t    = Spawner.ParseType(name);
                        Type   type = ScriptCompiler.FindTypeByName(t);

                        if (type == null)
                        {
                            from.SendMessage("{0} is not a valid type name.", t);
                            continue;
                        }

                        if (so != null)
                        {
                            if (so.SpawnName != name)
                            {
                                so.SpawnName = name;
                            }

                            if (so.MaxCount != max)
                            {
                                so.MaxCount = max;
                            }
                        }
                        else
                        {
                            m_Spawner.AddSpawnObject(new SpawnObject(name, max));
                        }
                    }
                }
            }
        }