Exemplo n.º 1
0
        private static void Info(bool location, Serial serial, Point3D p, ushort gfxid)
        {
            StringBuilder str    = new StringBuilder();
            UOEntity      entity = WorldEx.GetEntity(serial);

            if (entity == null)
            {
                return;
            }

            str.AppendLine("Serial: " + serial);
            str.AppendLine("Graphic: 0x" + gfxid.ToString("X4"));
            str.AppendLine("Color: 0x" + entity.Hue.ToString("X4"));
            str.AppendLine("Position: " + entity.Position);
            str.AppendLine("Distance: " + Utility.Distance(entity.Position, World.Player.Position));
            str.AppendLine();

            foreach (PropertyInfo property in entity.GetType().GetProperties())
            {
                str.AppendLine(string.Format("{0}: {1}\n", property.Name, property.GetValue(entity, null)));
            }

            new MessageDialog("Info", str.ToString())
            {
                TopMost = true
            }.Show(Engine.MainWindow);
        }
Exemplo n.º 2
0
        public static List <Context> WaitForContext(int ser, int delay) // Delay in MS
        {
            List <Context> retList = new List <Context>();

            Assistant.Client.Instance.SendToServerWait(new ContextMenuRequest(ser));
            int subdelay = delay;

            while (World.Player.HasContext != true && World.Player.ContextID != ser && subdelay > 0)
            {
                Thread.Sleep(2);
                subdelay -= 2;
            }
            UOEntity ent = null;

            Assistant.Serial menuOwner = new Assistant.Serial((uint)ser);
            if (menuOwner.IsMobile)
            {
                ent = World.FindMobile(menuOwner);
            }
            else if (menuOwner.IsItem)
            {
                ent = World.FindItem(menuOwner);
            }
            if (ent != null)
            {
                foreach (var entry in ent.ContextMenu)
                {
                    Context temp = new Context();
                    temp.Response = entry.Key;
                    temp.Entry    = Language.GetString(entry.Value);
                    retList.Add(temp);
                }
            }
            return(retList);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Performs an equip on desired layer, returns result of process.
 /// </summary>
 /// <param name="l"></param>
 /// <param name="o"></param>
 /// <returns></returns>
 public virtual bool Equip(Layer l, UOEntity o)
 {
     if ((o == null) || (o.Serial.Value.Equals(0)))
     {
         return(false);
     }
     return(!l.Equals(Layer.Invalid) && Stealth.Client.WearItem((byte)l, o.Serial.Value));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 /// <param name="owner"></param>
 /// <param name="reader"></param>
 public BaseAttributes(UOEntity owner, List <ClilocItemRec> reader)
 {
     Owner = owner;
     if (reader == null)
     {
         reader = new List <ClilocItemRec>();
     }
     _lastmetatable = reader;
     _data          = new Dictionary <Enum, dynamic>();
     Parse();
 }
Exemplo n.º 5
0
 internal EnhancedEntity(UOEntity entity)
 {
     if (entity == null)
     {
         m_Serial = new Serial(0);
     }
     else
     {
         m_Serial = new Serial(entity.Serial);
     }
     m_UOEntity = entity;
 }
Exemplo n.º 6
0
 private static Item FindBag(UOEntity item)
 {
     if (item != null)
     {
         foreach (DressList list in DressList.m_List)
         {
             if (list.Items.Contains(item.Serial))
             {
                 Item bag = World.FindItem(list.m_UndressBag);
                 if (bag != null && bag.RootContainer == World.Player)
                 {
                     return(bag);
                 }
             }
         }
     }
     return(World.Player.Backpack);
 }
Exemplo n.º 7
0
        private static void DyeTarget(Serial target, ushort hue)
        {
            UOEntity targetObject = WorldEx.GetEntity(target);

            if (targetObject == null)
            {
                return;
            }

            Packet packet;

            if (targetObject is Item)
            {
                if (((Item)targetObject).Container is Mobile)
                {
                    packet = new EquipmentItem((Item)targetObject, hue, ((Mobile)((Item)targetObject).Container).Serial);
                }
                else
                {
                    packet = new ContainerItem((Item)targetObject);
                    packet.Seek(-2, SeekOrigin.End);
                    packet.Write(hue);
                }
            }
            else if (targetObject is Mobile)
            {
                Item mount = ((Mobile)targetObject).GetItemOnLayer(Layer.Mount);
                if (mount != null)
                {
                    packet = new EquipmentItem(mount, hue, targetObject.Serial);
                }
                else
                {
                    packet = new MobileIncoming((Mobile)targetObject);
                    packet.Seek(15, SeekOrigin.Begin);
                    packet.Write(hue);
                }
            }
            else
            {
                return;
            }
            WorldEx.SendToClient(packet);
        }
Exemplo n.º 8
0
        private static void OnCommand2(bool location, Serial serial, Point3D p, ushort gfxid)
        {
            UOEntity item = WorldEx.GetEntity(serial);

            if (item == null)
            {
                return;
            }
            StringBuilder sb = new StringBuilder();

            foreach (ObjectPropertyList.OPLEntry opl in item.ObjPropList.m_Content)
            {
                sb.AppendLine(string.Format("{0} - {1}", opl.Number, string.IsNullOrEmpty(opl.Args) ? string.Empty : opl.Args.Trim()));
            }
            new MessageDialog("Props", sb.ToString())
            {
                TopMost = true
            }.Show(Engine.MainWindow);
        }
Exemplo n.º 9
0
        private static void OnDye(Serial source, Serial target)
        {
            UOEntity sourceObject = WorldEx.GetEntity(source);

            if (sourceObject != null)
            {
                ushort hue    = sourceObject.Hue;
                Mobile mobile = sourceObject as Mobile;
                if (mobile != null)
                {
                    Item mount = mobile.GetItemOnLayer(Layer.Mount);
                    if (mount != null)
                    {
                        hue = mount.Hue;
                    }
                }
                DyeTarget(target, hue);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Return the List entry of a Context menu, of Mobile or Item objects.
        /// The function will ask the server for the List and wait for a maximum amount of time.
        /// </summary>
        /// <param name="serial">Serial of the entity.</param>
        /// <param name="delay">Maximum wait.</param>
        /// <param name="showContext">Show context menu in-game. (default: True)</param>
        /// <returns>A List of Context objects.</returns>
        public static List <Context> WaitForContext(int serial, int delay, bool showContext = false) // Delay in MS
        {
            if (!showContext)
            {
                var HideUntilMax = Math.Min(10000, Math.Max(1000, delay)); // at least 1 sec, but nmo more than 10 seconds
                Assistant.PacketHandlers.HideContextUntil = DateTime.Now.AddMilliseconds(HideUntilMax);
            }
            List <Context> retList = new List <Context>();

            Assistant.Client.Instance.SendToServerWait(new ContextMenuRequest(serial));
            int subdelay = delay;

            while (World.Player.HasContext != true && World.Player.ContextID != serial && subdelay > 0)
            {
                Thread.Sleep(2);
                subdelay -= 2;
            }
            UOEntity ent = null;

            Assistant.Serial menuOwner = new Assistant.Serial((uint)serial);
            if (menuOwner.IsMobile)
            {
                ent = World.FindMobile(menuOwner);
            }
            else if (menuOwner.IsItem)
            {
                ent = World.FindItem(menuOwner);
            }
            if (ent != null)
            {
                foreach (var entry in ent.ContextMenu)
                {
                    Context temp = new Context
                    {
                        Response = entry.Key,
                        Entry    = Language.GetString(entry.Value)
                    };
                    retList.Add(temp);
                }
            }
            return(retList);
        }
Exemplo n.º 11
0
        private static void InternalMessage(UOEntity entity, string msg, int hue = 0x0017, bool proc = true)
        {
            Serial serial = entity != null ? entity.Serial : Serial.MinusOne;
            int    graphic;
            Item   item   = entity as Item;
            Mobile mobile = entity as Mobile;

            if (item != null)
            {
                graphic = item.ItemID;
            }
            else if (mobile != null)
            {
                graphic = mobile.Body;
            }
            else
            {
                graphic = -1;
            }
            SendToClient(new UnicodeMessage(serial, graphic, MessageType.Regular, hue, 3, "CSY", "RazorEx", msg), proc);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Method allows to target to an object via active cursor.
        /// </summary>
        /// <param name="serial"></param>
        /// <returns></returns>
        public bool TargetTo(Serial serial)
        {
            var e = new UOEntity(serial);

            if (e.Valid)
            {
                Stealth.Client.TargetToObject(serial.Value);
                return
                    (OnUse(new TargetReplyEventArgs
                {
                    State = true,
                    ActionType = TargetActionType.Targeting,
                    ReplyType = TargetType.Object
                }));
            }
            return
                (OnUse(new TargetReplyEventArgs
            {
                State = false,
                ActionType = TargetActionType.Targeting,
                ReplyType = TargetType.Object
            }));
        }
Exemplo n.º 13
0
        public static void ContextReply(int serial, string menuname)
        {
            int      idx = -1;
            UOEntity e   = World.FindItem(serial);

            if (e == null)
            {
                e = World.FindMobile(serial);
            }

            if (e != null)
            {
                foreach (KeyValuePair <ushort, int> menu in e.ContextMenu)
                {
                    if (Language.GetCliloc(menu.Value).ToLower() == menuname.ToLower())
                    {
                        idx = menu.Key;
                        break;
                    }
                }
                if (idx >= 0)
                {
                    Assistant.Client.Instance.SendToServerWait(new ContextMenuResponse(serial, (ushort)idx));
                    World.Player.HasContext = false;
                    World.Player.ContextID  = 0;
                }
                else
                {
                    Scripts.SendMessageScriptError("Script Error: ContextReply: Menu entry " + menuname + " not exist");
                }
            }
            else
            {
                Scripts.SendMessageScriptError("Script Error: ContextReply: Mobile or item not exit");
            }
        }
Exemplo n.º 14
0
 /// <summary>
 /// Adds entity to ignore list.
 /// </summary>
 /// <param name="entity"></param>
 public static void Ignore(UOEntity entity)
 {
     Ignore(entity.Serial);
 }
Exemplo n.º 15
0
        private static void RemoveTextFlags( UOEntity m )
        {
            if ( m != null )
            {
                bool oplchanged = false;

                oplchanged |= m.ObjPropList.Remove( Language.GetString( LocString.LastTarget ) );
                oplchanged |= m.ObjPropList.Remove( Language.GetString( LocString.HarmfulTarget ) );
                oplchanged |= m.ObjPropList.Remove( Language.GetString( LocString.BeneficialTarget ) );

                if ( oplchanged )
                    m.OPLChanged();
            }
        }
Exemplo n.º 16
0
        private static void AddTextFlags( UOEntity m )
        {
            if ( m != null )
            {
                bool oplchanged = false;

                if ( Config.GetBool( "SmartLastTarget" ) )
                {
                    if ( m_LastHarmTarg != null && m_LastHarmTarg.Serial == m.Serial )
                    {
                        oplchanged = true;
                        m.ObjPropList.Add( Language.GetString( LocString.HarmfulTarget ) );
                    }

                    if ( m_LastBeneTarg != null && m_LastBeneTarg.Serial == m.Serial )
                    {
                        oplchanged = true;
                        m.ObjPropList.Add( Language.GetString( LocString.BeneficialTarget ) );
                    }
                }

                if ( !oplchanged && m_LastTarget != null && m_LastTarget.Serial == m.Serial )
                {
                    oplchanged = true;
                    m.ObjPropList.Add( Language.GetString( LocString.LastTarget ) );
                }

                if ( oplchanged )
                    m.OPLChanged();
            }
        }
Exemplo n.º 17
0
 public static T Cast <T>(this UOEntity obj) where T : UOEntity
 {
     return(Activator.CreateInstance(typeof(T), obj.Serial) as T);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Returns true if object is right under players feet.
 /// </summary>
 /// <param name="target"></param>
 /// <returns></returns>
 protected virtual bool IsUnderYourFeet(UOEntity target)
 {
     return(PlayerMobile.GetPlayer().Location.Equals(target.Location));
 }
Exemplo n.º 19
0
 public SkillBonuses(UOEntity owner)
     : base(owner, owner.Properties)
 {
 }
Exemplo n.º 20
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 /// <param name="properties"></param>
 /// <param name="owner"></param>
 public UOClilocAttributes(List <ClilocItemRec> properties, UOEntity owner = null)
     : this(properties)
 {
     _uoeowner = owner;
 }
Exemplo n.º 21
0
 public RemoveObject( UOEntity ent )
     : base(0x1D, 5)
 {
     Write( (uint)ent.Serial );
 }
Exemplo n.º 22
0
 private static void InternalMessage(UOEntity entity, string msg, int hue = 0x0017, bool proc = true)
 {
     Serial serial = entity != null ? entity.Serial : Serial.MinusOne;
     int graphic;
     Item item = entity as Item;
     Mobile mobile = entity as Mobile;
     if (item != null)
         graphic = item.ItemID;
     else if (mobile != null)
         graphic = mobile.Body;
     else
         graphic = -1;
     SendToClient(new UnicodeMessage(serial, graphic, MessageType.Regular, hue, 3, "CSY", "RazorEx", msg), proc);
 }
Exemplo n.º 23
0
 /// <summary>
 ///Object designer constructor.
 /// </summary>
 protected EntityTarget(UOEntity source, int delay) : base(source, delay)
 {
 }
Exemplo n.º 24
0
 public AbsorptionAttributes(UOEntity owner) : base(owner, owner.Properties)
 {
 }
Exemplo n.º 25
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 /// <param name="owner"></param>
 public ContextMenu(UOEntity owner)
 {
     Entries = new List <ContextMenuEntry>();
     Owner   = owner;
 }
Exemplo n.º 26
0
 public ArmorAttributes(UOEntity owner)
     : base(owner, owner.Properties)
 {
 }
Exemplo n.º 27
0
 public WeaponAttributes(UOEntity owner)
     : base(owner, owner.Properties)
 {
 }
Exemplo n.º 28
0
 /// <summary>
 ///  Removes entity from ignore list.
 /// </summary>
 /// <param name="entity"></param>
 public static void IgnoreRemove(UOEntity entity)
 {
     IgnoreRemove(new List <UOEntity> {
         entity
     });
 }
Exemplo n.º 29
0
 public ElementAttributes(UOEntity owner, List <ClilocItemRec> reader) : base(owner, reader)
 {
 }
Exemplo n.º 30
0
 public SkillBonuses(UOEntity owner, List <ClilocItemRec> reader)
     : base(owner, reader)
 {
 }
Exemplo n.º 31
0
 /// <summary>
 /// Default Constructor.
 /// </summary>
 /// <param name="properties"></param>
 /// <param name="owner"></param>
 public UOStringAttribute(string properties, UOEntity owner = null) : this(properties)
 {
     _uoeowner = owner;
 }
Exemplo n.º 32
0
 public ElementAttributes(UOEntity owner)
     : base(owner, owner.Properties)
 {
 }
Exemplo n.º 33
0
 internal EnhancedEntity(UOEntity entity)
 {
     m_Serial   = new Serial(entity.Serial);
     m_UOEntity = entity;
 }
Exemplo n.º 34
0
 public WeaponAttributes(UOEntity owner, List <ClilocItemRec> reader)
     : base(owner, reader)
 {
 }
Exemplo n.º 35
0
        public ContextMenuAction( UOEntity ent, ushort idx, ushort ctxName )
        {
            m_Entity = ent != null ? ent.Serial : Serial.MinusOne;

            if ( World.Player != null && World.Player.Serial == m_Entity )
                m_Entity = Serial.Zero;

            m_Idx = idx;
            m_CtxName = ctxName;
        }
Exemplo n.º 36
0
        public ObjectPropertyList( UOEntity owner )
        {
            m_Owner = owner;

            m_StringNums.AddRange( m_DefaultStringNums );
        }