示例#1
0
文件: UO.cs 项目: byterj/phoenix
        public static UOItem FindType(string objectName, Graphic graphic, UOColor color, Serial container)
        {
            UOItem foundItem;

            if (container != 0)
            {
                UOObject obj = World.GetObject(container);
                if (obj.Serial.IsValid)
                {
                    if (obj is UOItem)
                    {
                        foundItem = ((UOItem)obj).AllItems.FindType(graphic, color);
                    }
                    else
                    {
                        foundItem = ((UOCharacter)obj).Layers.FindType(graphic, color);
                    }
                }
                else
                {
                    ScriptErrorException.Throw("Invalid container serial.");
                    foundItem = new UOItem(Serial.Invalid);
                }
            }
            else
            {
                foundItem = World.Ground.FindType(graphic, color);
            }

            Aliases.SetObject(objectName, foundItem);
            return(foundItem);
        }
示例#2
0
文件: UO.cs 项目: byterj/phoenix
 public static void AddObject(string name, Serial value)
 {
     if (Helper.CheckName(ref name, false))
     {
         Aliases.SetObject(name, value);
     }
     else
     {
         ScriptErrorException.Throw("Invalid object name.");
     }
 }
示例#3
0
文件: UO.cs 项目: byterj/phoenix
        public static void AddObject(string name)
        {
            if (Helper.CheckName(ref name, false))
            {
                UO.Print("Select {0}:", name);

                Serial serial = UIManager.TargetObject();

                if (serial.IsValid)
                {
                    Aliases.SetObject(name, serial);
                }
                else
                {
                    ScriptErrorException.Throw("Invalid object serial.");
                }
            }
            else
            {
                ScriptErrorException.Throw("Invalid object name.");
            }
        }