예제 #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.World.cs 프로젝트: byterj/phoenix
        public static bool MoveItem(Serial item, ushort amount, ushort x, ushort y, sbyte z)
        {
            if (!item.IsValid)
            {
                return(ScriptErrorException.Throw("Invalid item serial."));
            }

            return(UIManager.MoveItem(item, amount, x, y, z, 0));
        }
예제 #3
0
 public static void Attack(Serial serial)
 {
     if (serial.IsValid)
     {
         Core.SendToServer(PacketBuilder.AttackRequest(serial), true);
     }
     else
     {
         ScriptErrorException.Throw("Invalid serial.");
     }
 }
예제 #4
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.");
     }
 }
예제 #5
0
파일: UO.cs 프로젝트: byterj/phoenix
 public static void Hide(Serial serial)
 {
     if (serial.IsValid)
     {
         Core.SendToClient(PacketBuilder.ObjectRemove(serial));
     }
     else
     {
         ScriptErrorException.Throw("Invalid serial.");
     }
 }
예제 #6
0
파일: UO.World.cs 프로젝트: byterj/phoenix
        public static void UseType(Graphic graphic, UOColor color)
        {
            UOItem item = World.Player.Layers.FindType(graphic, color);

            if (item.Serial.IsValid)
            {
                UO.UseObject(item);
            }
            else
            {
                ScriptErrorException.Throw("Type not found.");
            }
        }
예제 #7
0
파일: UO.World.cs 프로젝트: byterj/phoenix
        public static bool MoveItem(Serial item, ushort amount, Serial destination, ushort x, ushort y)
        {
            if (!item.IsValid)
            {
                return(ScriptErrorException.Throw("Invalid item serial."));
            }

            if (!destination.IsValid)
            {
                return(ScriptErrorException.Throw("Destination container serial is invalid."));
            }

            return(UIManager.MoveItem(item, amount, x, y, 0, destination));
        }
예제 #8
0
        public static void UseSkill(string skill)
        {
            skill = skill.ToLowerInvariant();

            for (int i = 0; i < DataFiles.Skills.Count; i++)
            {
                if (DataFiles.Skills[i].Name.ToLowerInvariant().Contains(skill))
                {
                    UseSkill((ushort)i);
                    return;
                }
            }

            ScriptErrorException.Throw("Unknown skill '{0}'", skill);
        }
예제 #9
0
파일: UO.World.cs 프로젝트: byterj/phoenix
        public static bool Grab(ushort amount, Serial item, Serial recevingContainer)
        {
            if (!item.IsValid)
            {
                return(ScriptErrorException.Throw("Invalid item serial."));
            }

            if (recevingContainer.IsValid)
            {
                return(UIManager.MoveItem(item, amount, 0xFFFF, 0xFFFF, 0, recevingContainer));
            }
            else
            {
                return(ScriptErrorException.Throw("Invalid RecevingContainer."));
            }
        }
예제 #10
0
파일: UO.cs 프로젝트: byterj/phoenix
        public static bool BandageSelf()
        {
            UOItem bandages = World.Player.Backpack.AllItems.FindType(0x0E21);

            if (bandages.Exist)
            {
                UO.WaitTargetSelf();
                bandages.Use();
                Wait(50);
                return(true);
            }
            else
            {
                ScriptErrorException.Throw("No bandages found.");
                return(false);
            }
        }
예제 #11
0
        public static void Cast(string spellname, Serial target)
        {
            Byte spellNum;

            if (Core.SpellList.TryFind(spellname, out spellNum))
            {
                if (target.IsValid)
                {
                    WaitTargetObject(target);
                }

                Core.SendToServer(PacketBuilder.CastSpell(spellNum), true);
            }
            else
            {
                ScriptErrorException.Throw("Unknown spell '{0}'", spellname);
            }
        }
예제 #12
0
파일: UO.cs 프로젝트: byterj/phoenix
        public static void Macro(string name)
        {
            Phoenix.Macros.Macro macro;

            if (!RuntimeCore.Macros.TryGetValue(name, out macro))
            {
                ScriptErrorException.Throw("Macro {0} not found.", name);
                return;
            }

            try {
                macro.Run();
            }
            catch (Exception e) {
                Trace.WriteLine("Unhandled exception during macro execution. Details:\n" + e.ToString(), "Runtime");
                UO.Print(Env.ErrorColor, "Macro Error: {0}", e.Message);
            }
        }
예제 #13
0
파일: UO.World.cs 프로젝트: byterj/phoenix
        public static bool EquipItem(Serial serial)
        {
            if (!serial.IsValid)
            {
                return(ScriptErrorException.Throw("Item serial is invalid."));
            }

            byte layer = 0;

            try {
                UOItem item = World.GetItem(serial);
                if (item.Exist)
                {
                    layer = DataFiles.Tiledata.GetArt(item.Graphic).Layer;
                }
            }
            catch (Exception e) {
                System.Diagnostics.Trace.WriteLine("Unexpected error in UO.EquipItem(). Exception:\n" + e.ToString(), "Runtime");
            }

            return(UIManager.EquipItem(serial, World.Player.Serial, layer));
        }
예제 #14
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.");
            }
        }