Esempio n. 1
0
        public static void ToggleMounted()
        {
            PlayerMobile player = Engine.Player;

            if (player == null)
            {
                return;
            }

            if (player.IsMounted)
            {
                ObjectCommands.UseObject(player.Serial);
                return;
            }

            if (!AliasCommands.FindAlias("mount"))
            {
                int serial = UOC.GetTargetSerialAsync(Strings.Target_new_mount___).Result;

                if (serial == -1)
                {
                    UOC.SystemMessage(Strings.Invalid_mount___);
                    return;
                }

                AliasCommands.SetAlias("mount", serial);
            }

            int mountSerial = AliasCommands.GetAlias("mount");

            ObjectCommands.UseObject(mountSerial);
        }
Esempio n. 2
0
        public static int PromptAlias(string aliasName)
        {
            int serial = UOC.GetTargetSerialAsync(string.Format(Strings.Target_object___0_____, aliasName)).Result;

            SetAlias(aliasName, serial);
            return(serial);
        }
Esempio n. 3
0
        public Entity PromptTarget()
        {
            int serial = UOC.GetTargetSerialAsync(Strings.Target_object___).Result;

            if (serial == 0)
            {
                UOC.SystemMessage(Strings.Invalid_or_unknown_object_id);
                return(null);
            }

            Entity entity = UOMath.IsMobile(serial)
                ? (Entity)Engine.Mobiles.GetMobile(serial)
                : Engine.Items.GetItem(serial);

            if (entity != null)
            {
                return(entity);
            }

            if (!MacroManager.QuietMode)
            {
                UOC.SystemMessage(
                    UOMath.IsMobile(serial) ? Strings.Mobile_not_found___ : Strings.Cannot_find_item___);
            }

            return(null);
        }
Esempio n. 4
0
        public static void Info(object obj = null)
        {
            int serial = 0;

            if (obj == null)
            {
                serial = UOC.GetTargetSerialAsync(Strings.Target_object___).Result;

                if (serial == 0)
                {
                    return;
                }
            }

            serial = AliasCommands.ResolveSerial(serial != 0 ? serial : obj);

            if (serial == 0)
            {
                return;
            }

            Entity entity = UOMath.IsMobile(serial)
                ? Engine.Mobiles.GetMobile(serial)
                : (Entity)Engine.Items.GetItem(serial);

            if (entity == null)
            {
                UOC.SystemMessage(Strings.Cannot_find_item___);
                return;
            }

            Thread t = new Thread(() =>
            {
                ObjectInspectorWindow window =
                    new ObjectInspectorWindow {
                    DataContext = new ObjectInspectorViewModel(entity)
                };

                window.ShowDialog();
            })
            {
                IsBackground = true
            };

            t.SetApartmentState(ApartmentState.STA);
            t.Start();
        }
Esempio n. 5
0
        public Entity PromptTarget()
        {
            int serial = UOC.GetTargetSerialAsync(Strings.Target_object___).Result;

            if (serial == 0)
            {
                UOC.SystemMessage(Strings.Invalid_or_unknown_object_id);
                return(null);
            }

            Mobile mobile = Engine.Mobiles.GetMobile(serial);

            if (mobile != null)
            {
                return(mobile);
            }

            UOC.SystemMessage(Strings.Mobile_not_found___);
            return(null);
        }