Ejemplo n.º 1
0
        internal static void SetLastTargetFromListHotKey(string targetid)
        {
            TargetGUI targetdata = Settings.Target.TargetRead(targetid);

            if (targetdata == null)
            {
                return;
            }

            Mobiles.Filter filter   = targetdata.TargetGuiObject.Filter.ToMobileFilter();
            string         selector = targetdata.TargetGuiObject.Selector;

            List <Mobile> filterresult;

            filterresult = Mobiles.ApplyFilter(filter);

            Mobile mobtarget = Mobiles.Select(filterresult, selector);

            if (mobtarget == null)
            {
                return;
            }

            TargetMessage(mobtarget.Serial, false);             // Process message for highlight

            Assistant.Mobile mobile = World.FindMobile(mobtarget.Serial);
            if (mobile != null)
            {
                Targeting.SetLastTarget(mobile.Serial, 0, false);
            }
        }
Ejemplo n.º 2
0
		internal static void Record_EquipRequest(Assistant.Item item, Assistant.Layer l, Assistant.Mobile m)
		{
			if (m == World.Player)
				AddLog("Player.EquipItem(0x"+ item.Serial.Value.ToString("X8") + ")");
			else
				AddLog("Player.UnEquipItemByLayer("+ l.ToString() + ")");
		}
Ejemplo n.º 3
0
        // Core

        internal static void EngineRun(Assistant.Mobile target)
        {
            if ((int)(target.Hits * 100 / (target.HitsMax == 0 ? (ushort)1 : target.HitsMax)) < m_hplimit || target.Poisoned)       // Check HP se bendare o meno.
            {
                if (RazorEnhanced.Settings.General.ReadBool("BandageHealhiddedCheckBox"))
                {
                    if (!World.Player.Visible)  // Esce se attivo blocco hidded
                    {
                        return;
                    }
                }

                if (RazorEnhanced.Settings.General.ReadBool("BandageHealpoisonCheckBox"))
                {
                    if (target.Poisoned) // Esce se attivo blocco poison
                    {
                        return;
                    }
                }

                if (RazorEnhanced.Settings.General.ReadBool("BandageHealmortalCheckBox"))                // Esce se attivo blocco mortal
                {
                    if (Player.BuffsExist("Mortal Strike") && (target.Serial == Player.Serial))
                    {
                        return;
                    }
                }
                Heal(target);
            }
            else        // Fine bende
            {
                Thread.Sleep(5000);
            }
        }
Ejemplo n.º 4
0
        public static void WaitForProps(int mobileserial, int delay) // Delay in MS
        {
            if (World.Player.Expansion <= 3)                         // Non esistono le props
            {
                return;
            }

            Assistant.Mobile m = Assistant.World.FindMobile((Assistant.Serial)((uint)mobileserial));

            if (m == null)
            {
                return;
            }

            if (m.PropsUpdated)
            {
                return;
            }

            Assistant.Client.Instance.SendToServerWait(new QueryProperties(m.Serial));
            int subdelay = delay;

            while (!m.PropsUpdated)
            {
                Thread.Sleep(2);
                subdelay -= 2;
                if (subdelay <= 0)
                {
                    break;
                }
            }
        }
Ejemplo n.º 5
0
        public static void WaitForStats(int mobileserial, int delay)         // Delay in MS
        {
            Assistant.Mobile m = World.FindMobile(mobileserial);

            if (m == null)
            {
                return;
            }

            if (m.StatsUpdated)
            {
                return;
            }

            Assistant.Client.Instance.SendToServerWait(new StatusQuery(m.Serial));

            int subdelay = delay;

            while (!m.StatsUpdated)
            {
                Thread.Sleep(2);
                subdelay -= 2;
                if (subdelay <= 0)
                {
                    break;
                }
            }
        }
Ejemplo n.º 6
0
        public static float GetPropValue(int serial, string name)
        {
            Assistant.Mobile assistantMobile = Assistant.World.FindMobile((uint)serial);

            if (assistantMobile != null)
            {
                List <ObjectPropertyList.OPLEntry> props = new List <ObjectPropertyList.OPLEntry>(assistantMobile.ObjPropList.Content);

                foreach (Assistant.ObjectPropertyList.OPLEntry prop in props)
                {
                    if (!prop.ToString().ToLower().Contains(name.ToLower()))
                    {
                        continue;
                    }

                    if (prop.Args == null)                      // Props esiste ma non ha valore
                    {
                        return(1);
                    }

                    try
                    {
                        return(Convert.ToSingle(Language.ParsePropsCliloc(prop.Args), CultureInfo.InvariantCulture));
                    }
                    catch
                    {
                        return(1);                         // errore di conversione ma esiste
                    }
                }
            }
            return(0);             // Non esiste
        }
Ejemplo n.º 7
0
        // Check Poison
        private static bool CheckHealPoisonTarg(Assistant.Serial ser)
        {
            if (World.Player == null)
            {
                return(false);
            }

            if (!RazorEnhanced.Settings.General.ReadBool("BlockHealPoison"))
            {
                return(false);
            }

            if (ser.IsMobile && (World.Player.LastSpell == Spell.ToID(1, 4) || World.Player.LastSpell == Spell.ToID(4, 5) || World.Player.LastSpell == 202))
            {
                Assistant.Mobile m = World.FindMobile(ser);

                if (m != null && m.Poisoned)
                {
                    World.Player.SendMessage(MsgLevel.Warning, "Heal blocked, Target is poisoned!");
                    return(true);
                }
                else if (m != null && m.Blessed)
                {
                    World.Player.SendMessage(MsgLevel.Warning, "Heal blocked, Target is mortelled!");
                    return(true);
                }
                return(false);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 8
0
        internal static bool Terrain(Assistant.Mobile mobile, List <int> zlist)
        {
            if (zlist.Count == 0)
            {
                return(true);
            }

            int playerZ = World.Player.Position.Z;
            int mobileZ = mobile.Position.Z;

            if (playerZ > mobileZ)
            {
                int altitude = playerZ - mobileZ;
                int steps    = altitude / zlist.Count();
                int count    = 0;
                while (count < zlist.Count())
                {
                    int acceptible = mobileZ + (steps * count);
                    if (zlist[count] > acceptible + 14)
                    {
                        return(false);
                    }
                    count++;
                }
            }
            else if (playerZ < mobileZ)
            {
                int altitude = mobileZ - playerZ;
                int steps    = altitude / zlist.Count();
                int count    = 0;
                while (count < zlist.Count())
                {
                    int acceptible = mobileZ - (steps * count);
                    if (zlist[count] > acceptible + 10)
                    {
                        return(false);
                    }
                    count++;
                }
            }
            else
            {
                // if all entries are the same, or within playerZ+8 it is okay
                foreach (int entry in zlist)
                {
                    if (entry != zlist[0])
                    {
                        if (entry > (playerZ + 8))
                        {
                            return(false);
                        }
                    }
                }
                return(true);
            }


            return(true);
        }
Ejemplo n.º 9
0
 public static void SetLast(int serial)
 {
     Assistant.Mobile mobile = World.FindMobile(serial);
     if (mobile != null)
     {
         Assistant.Targeting.SetLastTargetWait(mobile, 0);
     }
 }
Ejemplo n.º 10
0
 public static void SetLast(RazorEnhanced.Mobile mob)
 {
     Assistant.Mobile mobile = World.FindMobile(mob.Serial);
     if (mobile != null)
     {
         SetLast(mob.Serial);
     }
 }
Ejemplo n.º 11
0
        public static void Move(int source, int destination, int amount, int x, int y)
        {
            Assistant.Item bag  = Assistant.World.FindItem(destination);
            Assistant.Item item = Assistant.World.FindItem(source);
            int            serialdestination = 0;

            if (item == null)
            {
                Scripts.SendMessageScriptError("Script Error: Move: Source Item  not found");
                return;
            }

            if (bag != null)
            {
                serialdestination = bag.Serial;
            }
            else
            {
                Assistant.Mobile mbag = Assistant.World.FindMobile(destination);
                if (mbag != null)
                {
                    serialdestination = mbag.Serial;
                }
            }

            if (serialdestination == 0)
            {
                Scripts.SendMessageScriptError("Script Error: Move: Destination not found");
                return;
            }

            Assistant.Point3D loc = Assistant.Point3D.MinusOne;
            if (x != -1 && y != -1)
            {
                loc = new Assistant.Point3D(x, y, 0);
            }

            if (amount == 0)
            {
                DragDropManager.HoldingItem = true;
                Assistant.ClientCommunication.SendToServerWait(new LiftRequest(item.Serial, item.Amount));
                Thread.Sleep(80);
                Assistant.ClientCommunication.SendToServerWait(new DropRequest(item.Serial, loc, serialdestination));
                DragDropManager.HoldingItem = false;
            }
            else
            {
                if (item.Amount < amount)
                {
                    amount = item.Amount;
                }
                DragDropManager.HoldingItem = true;
                Assistant.ClientCommunication.SendToServerWait(new LiftRequest(item.Serial, amount));
                Thread.Sleep(80);
                Assistant.ClientCommunication.SendToServerWait(new DropRequest(item.Serial, loc, serialdestination));
                DragDropManager.HoldingItem = false;
            }
        }
Ejemplo n.º 12
0
 public static void SingleClick(int mobileserial)
 {
     Assistant.Mobile mobile = Assistant.World.FindMobile(mobileserial);
     if (mobile == null)
     {
         Scripts.SendMessageScriptError("Script Error: SingleClick: Invalid Serial");
         return;
     }
     Assistant.Client.Instance.SendToServerWait(new SingleClick(mobile));
 }
Ejemplo n.º 13
0
        internal static void AutoRun()
        {
            if (!Client.Running)
            {
                return;
            }

            if (World.Player == null)
            {
                return;
            }

            if (World.Player.IsGhost)
            {
                return;
            }

            Assistant.Mobile target = null;

            switch (RazorEnhanced.Settings.General.ReadString("BandageHealtargetComboBox"))
            {
            case "Self":
                target = World.Player;
                break;

            case "Target":
                target = Assistant.World.FindMobile(TargetSerial);
                break;

            case "Friend":
                RazorEnhanced.Mobiles.Filter targfilter = new Mobiles.Filter
                {
                    Enabled  = true,
                    Friend   = 1,
                    RangeMax = m_maxrange
                };
                Mobile targ = RazorEnhanced.Mobiles.Select(RazorEnhanced.Mobiles.ApplyFilter(targfilter), "Weakest");
                if (targ != null)
                {
                    target = Assistant.World.FindMobile(targ.Serial);
                }
                break;
            }

            if (target == null)                     // Verifica se il target è valido
            {
                return;
            }
            if (!Utility.InRange(new Assistant.Point2D(Assistant.World.Player.Position.X, Assistant.World.Player.Position.Y), new Assistant.Point2D(target.Position.X, target.Position.Y), m_maxrange))             // Verifica distanza
            {
                return;
            }

            EngineRun(target);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Check if a you have line of sight over a Mobile.
        /// </summary>
        /// <param name="mobile">Mobile object to check.</param>
        /// <returns>True: you have line of sight - False: otherwise.</returns>
        internal static bool IsVisible(Assistant.Mobile mobile)
        {
            if (mobile.Position.X == Player.Position.X &&
                mobile.Position.Y == Player.Position.Y &&
                mobile.Position.Z == Player.Position.Z
                )
            {
                return(true);
            }
            List <Assistant.Point3D> coords = CoordsToMobile(mobile);

            return(CheckCoords(mobile, coords));
        }
Ejemplo n.º 15
0
 public static Mobile FindBySerial(int serial)
 {
     Assistant.Mobile assistantMobile = Assistant.World.FindMobile((Assistant.Serial)((uint)serial));
     if (assistantMobile == null)
     {
         return(null);
     }
     else
     {
         RazorEnhanced.Mobile enhancedMobile = new RazorEnhanced.Mobile(assistantMobile);
         return(enhancedMobile);
     }
 }
Ejemplo n.º 16
0
 public static Mobile FindBySerial(int serial)
 {
     Assistant.Mobile assistantMobile = Assistant.World.FindMobile((Assistant.Serial)((uint)serial));
     if (assistantMobile == null)
     {
         Scripts.SendMessageScriptError("Script Error: FindBySerial: Item serial: (" + serial + ") not found");
         return(null);
     }
     else
     {
         RazorEnhanced.Mobile enhancedMobile = new RazorEnhanced.Mobile(assistantMobile);
         return(enhancedMobile);
     }
 }
Ejemplo n.º 17
0
        // returns true if clear or false if blocked
        internal static bool CheckTile(Assistant.Mobile mobile, int x, int y, int z)
        {
            int tile = Statics.GetLandID(x, y, Player.Map);
            List <Statics.TileInfo> statics = Statics.GetStaticsTileInfo(x, y, Player.Map);

            bool blocked = false;

            foreach (var checkStatic in statics)
            {
                if (IsStaticWall(mobile, checkStatic) || IsFloorBlocking(mobile, checkStatic))
                {
                    blocked = true;;
                }
            }
            return(!blocked);
        }
Ejemplo n.º 18
0
 private static void FriendPlayerTarget_Callback(bool loc, Assistant.Serial serial, Assistant.Point3D pt, ushort itemid)
 {
     Assistant.Mobile friendplayer = World.FindMobile(serial);
     if (friendplayer != null && friendplayer.Serial.IsMobile && friendplayer.Serial != World.Player.Serial)
     {
         Engine.MainWindow.SafeAction(s => { Friend.AddPlayerToList(friendplayer.Name, friendplayer.Serial); });
     }
     else
     {
         if (Engine.MainWindow.ShowAgentMessageCheckBox.Checked)
         {
             Misc.SendMessage("Invalid target", false);
         }
         Friend.AddLog("Invalid target");
     }
 }
Ejemplo n.º 19
0
        internal static void SetLastTargetFromListHotKey(string targetid)
        {
            TargetGUI.TargetGUIObject targetdata = Settings.Target.TargetRead(targetid);

            if (targetdata == null)
            {
                return;
            }

            Mobiles.Filter filter   = targetdata.Filter;
            string         selector = targetdata.Selector;

            List <Mobile> filterresult;

            filterresult = Mobiles.ApplyFilter(filter);

            Mobile mobtarget = Mobiles.Select(filterresult, selector);

            if (mobtarget == null)
            {
                return;
            }

            if (RazorEnhanced.Settings.General.ReadBool("ShowHeadTargetCheckBox"))
            {
                if (Friend.IsFriend(mobtarget.Serial))
                {
                    Assistant.ClientCommunication.SendToClient(new UnicodeMessage(World.Player.Serial, World.Player.Body, MessageType.Regular, 63, 3, Language.CliLocName, World.Player.Name, "Target: [" + GetPlayerName(mobtarget.Serial) + "]"));
                }
                else
                {
                    Assistant.ClientCommunication.SendToClient(new UnicodeMessage(World.Player.Serial, World.Player.Body, MessageType.Regular, GetPlayerColor(mobtarget), 3, Language.CliLocName, World.Player.Name, "Target: [" + GetPlayerName(mobtarget.Serial) + "]"));
                }
            }

            if (RazorEnhanced.Settings.General.ReadBool("HighlightTargetCheckBox"))
            {
                Mobiles.MessageNoWait(mobtarget.Serial, 10, "* Target *");
            }


            Assistant.Mobile mobile = World.FindMobile(mobtarget.Serial);
            if (mobile != null)
            {
                Targeting.SetLastTargetWait(mobile, 0);
            }
        }
Ejemplo n.º 20
0
        public static void UseMobile(int mobileserial)
        {
            Assistant.Mobile mobile = Assistant.World.FindMobile(mobileserial);
            if (mobile == null)
            {
                Scripts.SendMessageScriptError("Script Error: UseMobile: Invalid Serial");
                return;
            }

            if (mobile.Serial.IsMobile)
            {
                Assistant.Client.Instance.SendToServerWait(new DoubleClick(mobile.Serial));
            }
            else
            {
                Scripts.SendMessageScriptError("Script Error: UseMobile: (" + mobile.Serial.ToString() + ") is not a mobile");
            }
        }
Ejemplo n.º 21
0
        private static bool GetGuild(string name, int serial)
        {
            Assistant.Mobile target = Assistant.World.FindMobile(serial);

            if (target == null)
            {
                return(false);
            }

            if (target.ObjPropList.Content.Count > 0)
            {
                string firstProp = target.ObjPropList.Content[0].ToString();
                if (firstProp.Contains(string.Format("[{0}]", name)))
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 22
0
        internal static bool IsFloorBlocking(Assistant.Mobile mobile, Statics.TileInfo checkStatic)
        {
            string staticName = Statics.GetTileName(checkStatic.StaticID);

            if (staticName.IndexOf("roof", StringComparison.OrdinalIgnoreCase) >= 0 ||
                staticName.IndexOf("planks", StringComparison.OrdinalIgnoreCase) >= 0 ||
                staticName.IndexOf("pavers", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                if (checkStatic.StaticZ > Player.Position.Z && checkStatic.StaticZ <= mobile.Position.Z)
                {
                    return(true);
                }
                if (checkStatic.StaticZ <= Player.Position.Z && checkStatic.StaticZ > mobile.Position.Z)
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 23
0
        internal static void ApplyColor(Assistant.Mobile m)
        {
            if (m.IsGhost)             // Non eseguire azione se fantasma
            {
                return;
            }

            int color = 0;

            if (m.Poisoned)
            {
                color = (int)HighLightColor.Poison;
            }
            else if (m.Paralized)
            {
                color = (int)HighLightColor.Paralized;
            }
            else if (m.Blessed)             // Mortal
            {
                color = (int)HighLightColor.Mortal;
            }
            else if (m == World.Player && Player.BuffsExist("Bload Oath (curse)"))
            {
                color = (int)HighLightColor.BloodOath;
            }
            else
            {
                Decolorize(m);
                return;
            }

            // Apply color for valid flag
            foreach (Layer l in m_colorized_layer)
            {
                Assistant.Item i = m.GetItemOnLayer(l);
                if (i == null)
                {
                    continue;
                }

                Assistant.Client.Instance.SendToClient(new EquipmentItem(i, (ushort)color, m.Serial));
            }
        }
Ejemplo n.º 24
0
        public static string GetPropStringByIndex(int serial, int index)
        {
            string propstring = String.Empty;

            Assistant.Mobile assistantMobile = Assistant.World.FindMobile((uint)serial);

            if (assistantMobile == null)
            {
                return(propstring);
            }

            List <Assistant.ObjectPropertyList.OPLEntry> props = assistantMobile.ObjPropList.Content;

            if (props.Count > index)
            {
                propstring = props[index].ToString();
            }
            return(propstring);
        }
Ejemplo n.º 25
0
        internal static void RemountAutoRun()
        {
            if (World.Player == null)
            {
                return;
            }

            if (m_autoremountserial == 0)
            {
                return;
            }

            if (World.Player.IsGhost)
            {
                return;
            }

            if (!World.Player.IsHuman)             // Not mount if not human form
            {
                return;
            }

            if (World.Player.GetItemOnLayer(Layer.Mount) != null)               // Gia su mount
            {
                return;
            }

            Assistant.Item etheralMount = Assistant.World.FindItem(m_autoremountserial);
            if (etheralMount != null && etheralMount.Serial.IsItem)
            {
                Items.UseItem(m_autoremountserial);
                Thread.Sleep(m_autoremountedelay);
            }
            else
            {
                Assistant.Mobile mount = Assistant.World.FindMobile(m_autoremountserial);
                if (mount != null && mount.Serial.IsMobile)
                {
                    Mobiles.UseMobile(m_autoremountserial);
                    Thread.Sleep(m_autoremountdelay);
                }
            }
        }
Ejemplo n.º 26
0
        static public void StoreBuyList(PacketReader p, PacketHandlerEventArgs args)
        {
            Assistant.Serial serial = p.ReadUInt32();
            ushort           gump   = p.ReadUInt16();

            Assistant.Mobile vendor = Assistant.World.FindMobile(serial);
            if (vendor == null)
            {
                return;
            }

            Assistant.Item pack = vendor.GetItemOnLayer(Layer.ShopBuy);
            if (pack == null || pack.Contains == null || pack.Contains.Count <= 0)
            {
                return;
            }
            Vendor.LastVendor  = vendor;
            Vendor.LastBuyList = pack.Contains;
        }
Ejemplo n.º 27
0
        public static List <string> GetPropStringList(int serial)
        {
            List <string> propstringlist = new List <string>();

            Assistant.Mobile assistantMobile = Assistant.World.FindMobile((uint)serial);

            if (assistantMobile == null)
            {
                return(propstringlist);
            }

            List <Assistant.ObjectPropertyList.OPLEntry> props = assistantMobile.ObjPropList.Content;

            foreach (Assistant.ObjectPropertyList.OPLEntry prop in props)
            {
                propstringlist.Add(prop.ToString());
            }
            return(propstringlist);
        }
Ejemplo n.º 28
0
        public static void UseItem(int itemSerial, int targetSerial, bool wait)
        {
            Assistant.Item item = Assistant.World.FindItem(itemSerial);
            if (item == null)
            {
                Scripts.SendMessageScriptError("Script Error: UseItem: Invalid Use Serial");
                return;
            }

            Assistant.Item   itemTarget   = Assistant.World.FindItem(targetSerial);
            Assistant.Mobile mobileTarget = Assistant.World.FindMobile(targetSerial);
            if (itemTarget == null && mobileTarget == null)
            {
                Scripts.SendMessageScriptError("Script Error: UseItem: Invalid Target Serial");
                return;
            }

            if (!item.Serial.IsItem)
            {
                Scripts.SendMessageScriptError("Script Error: UseItem: (" + item.Serial.ToString() + ") is not an item");
                return;
            }
            if (itemTarget == null && !mobileTarget.Serial.IsMobile)
            {
                Scripts.SendMessageScriptError("Script Error: UseItem: (" + targetSerial.ToString() + ") is not a mobile");
                return;
            }
            if (mobileTarget == null && !itemTarget.Serial.IsItem)
            {
                Scripts.SendMessageScriptError("Script Error: UseItem: (" + targetSerial.ToString() + ") is not an item");
                return;
            }

            if (wait)
            {
                Assistant.Client.Instance.SendToServerWait(new UseTargetedItem((uint)itemSerial, (uint)targetSerial));
            }
            else
            {
                Assistant.Client.Instance.SendToServer(new UseTargetedItem((uint)itemSerial, (uint)targetSerial));
            }
        }
Ejemplo n.º 29
0
        internal static bool CheckCoords(Assistant.Mobile mobile, List <Assistant.Point3D> coords)
        {
            List <int> zlist = new List <int>();
            List <Assistant.Point3D> badLand = new List <Assistant.Point3D>();

            foreach (var coord in coords)
            {
                zlist.Add(coord.Z);
                if (CheckTile(mobile, coord.X, coord.Y, coord.Z) == false)
                {
                    return(false);
                }
            }
            if (Terrain(mobile, zlist) == false)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 30
0
        internal static bool IsStaticWall(Assistant.Mobile mobile, Statics.TileInfo checkStatic)
        {
            string staticName = Statics.GetTileName(checkStatic.StaticID);

            bool wall = Statics.GetTileFlag(checkStatic.StaticID, "Wall");

            if (wall)
            {
                if (Player.Position.Z >= (checkStatic.StaticZ + 20) || mobile.Position.Z >= (checkStatic.StaticZ + 20))
                {
                    return(false);
                }
                int  height   = Statics.GetTileHeight(checkStatic.StaticID);
                bool blocking = Statics.GetTileFlag(checkStatic.StaticID, "NoShoot");
                if (blocking) // && height > 5)
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 31
0
        private static void MobileUpdate( Packet p, PacketHandlerEventArgs args )
        {
            if ( World.Player == null )
                return;

            Serial serial = p.ReadUInt32();
            Mobile m = World.FindMobile( serial );
            if ( m == null )
                World.AddMobile( m = new Mobile( serial ) );

            bool wasHidden = !m.Visible;

            m.Body = (ushort)(p.ReadUInt16() + p.ReadSByte());
            m.Hue = p.ReadUInt16();
            int ltHue = Config.GetInt( "LTHilight" );
            if ( ltHue != 0 && Targeting.IsLastTarget( m ) )
            {
                p.Seek( -2, SeekOrigin.Current );
                p.Write( (ushort)(ltHue|0x8000) );
            }

            bool wasPoisoned = m.Poisoned;
            m.ProcessPacketFlags( p.ReadByte() );

            if ( m == World.Player )
            {
                ClientCommunication.BeginCalibratePosition();

                World.Player.Resync();

                if ( !wasHidden && !m.Visible )
                {
                    if ( Config.GetBool( "AlwaysStealth" ) )
                        StealthSteps.Hide();
                }
                else if ( wasHidden && m.Visible )
                {
                    StealthSteps.Unhide();
                }

                if ( wasPoisoned != m.Poisoned )
                    ClientCommunication.RequestTitlebarUpdate();
            }

            ushort x = p.ReadUInt16();
            ushort y = p.ReadUInt16();
            p.ReadUInt16(); //always 0?
            m.Direction = (Direction)p.ReadByte();
            m.Position = new Point3D( x, y, p.ReadSByte() );

            Item.UpdateContainers();
        }
Ejemplo n.º 32
0
        private static void MobileStatus( PacketReader p, PacketHandlerEventArgs args )
        {
            Serial serial = p.ReadUInt32();
            Mobile m = World.FindMobile( serial );
            if ( m == null )
                World.AddMobile( m = new Mobile( serial ) );

            m.Name = p.ReadString( 30 );

            m.Hits = p.ReadUInt16();
            m.HitsMax = p.ReadUInt16();

            p.ReadBoolean();//CanBeRenamed

            byte type = p.ReadByte();

            if ( m == World.Player && type != 0x00 )
            {
                PlayerData player = (PlayerData)m;

                player.Female = p.ReadBoolean();

                int oStr = player.Str, oDex = player.Dex, oInt = player.Int;

                player.Str = p.ReadUInt16();
                player.Dex = p.ReadUInt16();
                player.Int = p.ReadUInt16();

                if ( player.Str != oStr && oStr != 0 && Config.GetBool( "DisplaySkillChanges" ) )
                    World.Player.SendMessage( MsgLevel.Force, LocString.StrChanged, player.Str - oStr > 0 ? "+" : "", player.Str - oStr, player.Str );

                if ( player.Dex != oDex && oDex != 0 && Config.GetBool( "DisplaySkillChanges" ) )
                    World.Player.SendMessage( MsgLevel.Force, LocString.DexChanged, player.Dex - oDex > 0 ? "+" : "", player.Dex - oDex, player.Dex );

                if ( player.Int != oInt && oInt != 0 && Config.GetBool( "DisplaySkillChanges" ) )
                    World.Player.SendMessage( MsgLevel.Force, LocString.IntChanged, player.Int - oInt > 0 ? "+" : "", player.Int - oInt, player.Int );

                player.Stam = p.ReadUInt16();
                player.StamMax = p.ReadUInt16();
                player.Mana = p.ReadUInt16();
                player.ManaMax = p.ReadUInt16();

                player.Gold = p.ReadUInt32();
                player.AR = p.ReadUInt16(); // ar / physical resist
                player.Weight = p.ReadUInt16();

                if ( type >= 0x03 )
                {
                    if ( type > 0x04 )
                    {
                        player.MaxWeight = p.ReadUInt16();

                        p.ReadByte(); // race?
                    }

                    player.StatCap = p.ReadUInt16();

                    if ( type > 0x03 )
                    {
                        player.Followers = p.ReadByte();
                        player.FollowersMax = p.ReadByte();

                        player.FireResistance = p.ReadInt16();
                        player.ColdResistance = p.ReadInt16();
                        player.PoisonResistance = p.ReadInt16();
                        player.EnergyResistance = p.ReadInt16();

                        player.Luck = p.ReadInt16();

                        player.DamageMin = p.ReadUInt16();
                        player.DamageMax = p.ReadUInt16();

                        player.Tithe = p.ReadInt32();
                    }
                }

                ClientCommunication.RequestTitlebarUpdate();

                ClientCommunication.PostHitsUpdate();
                ClientCommunication.PostStamUpdate();
                ClientCommunication.PostManaUpdate();

                Engine.MainWindow.UpdateTitle(); // update player name
            }
        }
Ejemplo n.º 33
0
        private static void MobileIncoming( Packet p, PacketHandlerEventArgs args )
        {
            if ( World.Player == null )
                return;

            Serial serial = p.ReadUInt32();
            ushort body =  p.ReadUInt16();
            Point3D position = new Point3D( p.ReadUInt16(), p.ReadUInt16(), p.ReadSByte() );

            if ( World.Player.Position != Point3D.Zero && !Utility.InRange( World.Player.Position, position, World.Player.VisRange ) )
                return;

            Mobile m = World.FindMobile( serial );
            if ( m == null )
                World.AddMobile( m = new Mobile( serial ) );

            bool wasHidden = !m.Visible;

            if ( m != World.Player && Config.GetBool( "ShowMobNames" ) )
                ClientCommunication.SendToServer( new SingleClick( m ) );
            if ( Config.GetBool( "LastTargTextFlags" ) )
                Targeting.CheckTextFlags( m );

            int ltHue = Config.GetInt( "LTHilight" );
            bool isLT;
            if ( ltHue != 0 )
                isLT = Targeting.IsLastTarget( m );
            else
                isLT = false;

            m.Body = body;
            if ( m != World.Player || World.Player.OutstandingMoveReqs == 0 )
                m.Position = position;
            m.Direction = (Direction)p.ReadByte();
            m.Hue = p.ReadUInt16();
            if ( isLT )
            {
                p.Seek( -2, SeekOrigin.Current );
                p.Write( (short)(ltHue|0x8000) );
            }

            bool wasPoisoned = m.Poisoned;
            m.ProcessPacketFlags( p.ReadByte() );
            byte oldNoto = m.Notoriety;
            m.Notoriety = p.ReadByte();

            if ( m == World.Player )
            {
                ClientCommunication.BeginCalibratePosition();

                if ( !wasHidden && !m.Visible )
                {
                    if ( Config.GetBool( "AlwaysStealth" ) )
                        StealthSteps.Hide();
                }
                else if ( wasHidden && m.Visible )
                {
                    StealthSteps.Unhide();
                }

                if ( wasPoisoned != m.Poisoned || ( oldNoto != m.Notoriety && Config.GetBool( "ShowNotoHue" ) ) )
                    ClientCommunication.RequestTitlebarUpdate();
            }

            while ( true )
            {
                serial = p.ReadUInt32();
                if ( !serial.IsItem )
                    break;

                Item item = World.FindItem( serial );
                bool isNew = false;
                if ( item == null )
                {
                    isNew = true;
                    World.AddItem( item = new Item( serial ) );
                }

                if ( !DragDropManager.EndHolding( serial ) )
                    continue;

                item.Container = m;

                ushort id = p.ReadUInt16();

                if (Engine.UseNewMobileIncoming)
                    item.ItemID = (ushort)(id & 0xFFFF);
                else if (Engine.UsePostSAChanges)
                    item.ItemID = (ushort)(id & 0x7FFF);
                else
                    item.ItemID = (ushort)(id & 0x3FFF);

                item.Layer = (Layer)p.ReadByte();

                if (Engine.UseNewMobileIncoming)
                {
                    item.Hue = p.ReadUInt16();
                    if (isLT)
                    {
                        p.Seek(-2, SeekOrigin.Current);
                        p.Write((short)(ltHue & 0x3FFF));
                    }
                }
                else
                {
                    if ((id & 0x8000) != 0)
                    {
                        item.Hue = p.ReadUInt16();
                        if (isLT)
                        {
                            p.Seek(-2, SeekOrigin.Current);
                            p.Write((short)(ltHue & 0x3FFF));
                        }
                    }
                    else
                    {
                        item.Hue = 0;
                        if (isLT)
                            ClientCommunication.SendToClient(new EquipmentItem(item, (ushort)(ltHue & 0x3FFF), m.Serial));
                    }
                }

                if ( item.Layer == Layer.Backpack && isNew && Config.GetBool( "AutoSearch" ) && m == World.Player && m != null )
                {
                    m_IgnoreGumps.Add( item );
                    PlayerData.DoubleClick( item );
                }
            }

            Item.UpdateContainers();
        }
Ejemplo n.º 34
0
 public EquipRequest( Serial item, Mobile to, Layer layer )
     : base(0x13, 10)
 {
     Write( item );
     Write( (byte)layer );
     Write( to.Serial );
 }
Ejemplo n.º 35
0
 public static void DragDrop( Item i, Mobile to, Layer layer )
 {
     Drag( i, i.Amount, false );
     Drop( i, to, layer );
 }
Ejemplo n.º 36
0
        private void OnVendorSell( PacketReader pvSrc, PacketHandlerEventArgs args )
        {
            if ( !m_Enabled || !ClientCommunication.AllowBit( FeatureBit.SellAgent ) || ( m_Items.Count == 0 && m_HotBag == Serial.Zero ) )
                return;

            Item hb = null;
            if ( m_HotBag != Serial.Zero )
            {
                hb = World.FindItem( m_HotBag );
                if ( hb == null )
                {
                    //m_HotBag = Serial.Zero;
                    //SetHBText();
                    World.Player.SendMessage( MsgLevel.Warning, "Sell Agent HotBag could not be found." );

                    if ( m_Items.Count == 0 )
                        return;
                }
            }

            int total = 0;

            uint serial = pvSrc.ReadUInt32();
            Mobile vendor = World.FindMobile( serial );
            if ( vendor == null )
                World.AddMobile( vendor=new Mobile( serial ) );
            int count = pvSrc.ReadUInt16();

            int maxSell = Config.GetInt( "SellAgentMax" );
            int sold = 0;
            ArrayList list = new ArrayList( count );
            for (int i=0;i<count && ( sold < maxSell || maxSell <= 0 );i++)
            {
                uint ser = pvSrc.ReadUInt32();
                ushort gfx = pvSrc.ReadUInt16();
                ushort hue = pvSrc.ReadUInt16();
                ushort amount = pvSrc.ReadUInt16();
                ushort price = pvSrc.ReadUInt16();

                pvSrc.ReadString( pvSrc.ReadUInt16() );//name

                Item item = World.FindItem( ser );

                if ( m_Items.Contains( gfx ) || ( item != null && item != hb && item.IsChildOf( hb ) ) )
                {
                    if ( sold + amount > maxSell && maxSell > 0 )
                        amount = (ushort)(maxSell - sold);
                    list.Add( new SellListItem( ser, amount ) );
                    total += amount * price;
                    sold += amount;
                }
                //if ( sold >= maxSell && maxSell > 0 ) break;
            }

            if ( list.Count > 0 )
            {
                ClientCommunication.SendToServer( new VendorSellResponse( vendor, list ) );
                World.Player.SendMessage( MsgLevel.Force, LocString.SellTotals, sold, total );
                args.Block = true;
            }
        }
Ejemplo n.º 37
0
        public int DistanceTo( Mobile m )
        {
            int x = Math.Abs( this.Position.X - m.Position.X );
            int y = Math.Abs( this.Position.Y - m.Position.Y );

            return x > y ? x : y;
        }
Ejemplo n.º 38
0
 public SkillsQuery( Mobile m )
     : base(0x34, 10)
 {
     Write( (uint)0xEDEDEDED ); // que el f**k, osi
     Write( (byte)0x05 );
     Write( m.Serial );
 }
Ejemplo n.º 39
0
 private void OPLCheckFriend( Mobile m )
 {
     if ( IsFriend( m ) )
         m.ObjPropList.Add( Language.GetString( LocString.RazorFriend ) );
 }
Ejemplo n.º 40
0
 public MobileUpdate( Mobile m )
     : base(0x20, 19)
 {
     Write( (int) m.Serial );
     Write( (short) m.Body );
     Write( (byte) 0 );
     int ltHue = Config.GetInt( "LTHilight" );
     if ( ltHue != 0 && Targeting.IsLastTarget( m ) )
         Write( (short)(ltHue|0x8000) );
     else
         Write( (short) m.Hue );
     Write( (byte) m.GetPacketFlags() );
     Write( (short) m.Position.X );
     Write( (short) m.Position.Y );
     Write( (short) 0 );
     Write( (byte) m.Direction );
     Write( (sbyte) m.Position.Z );
 }
Ejemplo n.º 41
0
        public MobileStatusCompact( Mobile m )
            : base(0x11)
        {
            string name = m.Name;
            if ( name == null ) name = "";

            this.EnsureCapacity( 88 );

            Write( (uint) m.Serial );
            WriteAsciiFixed( name, 30 );

            Write( (short) m.Hits );
            Write( (short) m.HitsMax );

            Write( false ); // cannot edit name

            Write( (byte) 0x00 ); // no aos info
        }
Ejemplo n.º 42
0
        public static bool IsLastTarget( Mobile m )
        {
            if ( m != null )
            {
                if ( Config.GetBool( "SmartLastTarget" ) && ClientCommunication.AllowBit( FeatureBit.SmartLT ) )
                {
                    if ( m_LastHarmTarg != null && m_LastHarmTarg.Serial == m.Serial )
                        return true;
                }
                else
                {
                    if ( m_LastTarget != null && m_LastTarget.Serial == m.Serial )
                        return true;
                }
            }

            return false;
        }
Ejemplo n.º 43
0
        private static void RunUOProtocolExtention(PacketReader p, PacketHandlerEventArgs args)
        {
            args.Block = true;

            switch (p.ReadByte())
            {
                case 1: // Custom Party information
                {
                    Serial serial;

                    PacketHandlers.SpecialPartyReceived++;

                    while ((serial = p.ReadUInt32()) > 0)
                    {
                        Mobile mobile = World.FindMobile(serial);

                        short x = p.ReadInt16();
                        short y = p.ReadInt16();
                        byte map = p.ReadByte();

                        if (mobile == null)
                        {
                            World.AddMobile( mobile = new Mobile(serial) );
                            mobile.Visible = false;
                        }

                        if ( mobile.Name == null || mobile.Name.Length <= 0 )
                            mobile.Name = "(Not Seen)";

                        if ( !m_Party.Contains( serial ) )
                            m_Party.Add( serial );

                        if ( map == World.Player.Map )
                            mobile.Position = new Point3D(x, y, mobile.Position.Z);
                        else
                            mobile.Position = Point3D.Zero;
                    }

                    if (Engine.MainWindow.MapWindow != null)
                        Engine.MainWindow.MapWindow.UpdateMap();

                    break;
                }
                case 0xFE: // Begin Handshake/Features Negotiation
                {
                    ulong features = p.ReadRawUInt64();

                    if ( ClientCommunication.HandleNegotiate( features ) != 0 )
                    {
                        ClientCommunication.SendToServer( new RazorNegotiateResponse() );
                        Engine.MainWindow.UpdateControlLocks();
                    }
                    break;
                }
            }
        }
Ejemplo n.º 44
0
 public static bool IsFriend( Mobile m )
 {
     return m_Instance.IsFriend( m.Serial );
 }
Ejemplo n.º 45
0
        public static void CheckTextFlags( Mobile m )
        {
            if ( Config.GetBool( "SmartLastTarget" ) && ClientCommunication.AllowBit( FeatureBit.SmartLT ) )
            {
                bool harm = m_LastHarmTarg != null && m_LastHarmTarg.Serial == m.Serial;
                bool bene = m_LastBeneTarg != null && m_LastBeneTarg.Serial == m.Serial;
                if ( harm )
                    m.OverheadMessage( 0x90, String.Format( "[{0}]", Language.GetString( LocString.HarmfulTarget ) ) );
                if ( bene )
                    m.OverheadMessage( 0x3F, String.Format( "[{0}]", Language.GetString( LocString.BeneficialTarget ) ) );
            }

            if ( m_LastTarget != null && m_LastTarget.Serial == m.Serial )
                m.OverheadMessage( 0x3B2, String.Format( "[{0}]", Language.GetString( LocString.LastTarget ) ) );
        }
Ejemplo n.º 46
0
 public static void InvokeMobileCreated( Mobile m )
 {
     if ( OnMobileCreated != null )
         OnMobileCreated( m );
 }
Ejemplo n.º 47
0
        public static void SetLastTargetTo( Mobile m, byte flagType )
        {
            TargetInfo targ = new TargetInfo();
            m_LastGroundTarg = m_LastTarget = targ;

            if ( ( m_HasTarget && m_CurFlags == 1 ) || flagType == 1 )
                m_LastHarmTarg = targ;
            else if ( ( m_HasTarget && m_CurFlags == 2 ) || flagType == 2 )
                m_LastBeneTarg = targ;
            else if ( flagType == 0 )
                m_LastHarmTarg = m_LastBeneTarg = targ;

            targ.Type = 0;
            if ( m_HasTarget )
                targ.Flags = m_CurFlags;
            else
                targ.Flags = flagType;

            targ.Gfx = m.Body;
            targ.Serial = m.Serial;
            targ.X = m.Position.X;
            targ.Y = m.Position.Y;
            targ.Z = m.Position.Z;

            ClientCommunication.SendToClient( new ChangeCombatant( m ) );
            m_LastCombatant = m.Serial;
            World.Player.SendMessage( MsgLevel.Force, LocString.NewTargSet );

            bool wasSmart = Config.GetBool( "SmartLastTarget" );
            if ( wasSmart )
                Config.SetProperty( "SmartLastTarget", false );
            LastTarget();
            if ( wasSmart )
                Config.SetProperty( "SmartLastTarget", true );
            LastTargetChanged();
        }
Ejemplo n.º 48
0
 public DisplayPaperdoll( Mobile m, string text )
     : base(0x88, 66)
 {
     Write( (int) m.Serial );
     WriteAsciiFixed( text, 60 );
     Write( (byte) (m.Warmode ? 1 : 0) );
 }
Ejemplo n.º 49
0
 public StatusQuery( Mobile m )
     : base(0x34, 10)
 {
     Write( (uint)0xEDEDEDED );
     Write( (byte)0x04 );
     Write( m.Serial );
 }
Ejemplo n.º 50
0
 public static void SetLastTargetTo( Mobile m )
 {
     SetLastTargetTo( m, 0 );
 }
Ejemplo n.º 51
0
 public TargetResponse( uint id, Mobile m )
     : base(0x6C, 19)
 {
     Write( (byte) 0x00 ); // target object
     Write( (uint) id );
     Write( (byte) 0 ); // flags
     Write( (uint) m.Serial );
     Write( (ushort) m.Position.X );
     Write( (ushort) m.Position.Y );
     Write( (short) m.Position.Z );
     Write( (ushort) m.Body );
 }
Ejemplo n.º 52
0
        public VendorSellResponse( Mobile vendor, ArrayList list )
            : base(0x9F)
        {
            EnsureCapacity( 1 + 2 + 4 + 2 + list.Count*6 );

            Write( (uint) vendor.Serial );
            Write( (ushort)list.Count );

            for (int i=0;i<list.Count;i++)
            {
                SellListItem sli = (SellListItem)list[i];
                Write( (uint)sli.Serial );
                Write( (ushort)sli.Amount );
            }
        }
Ejemplo n.º 53
0
 public MoveReject( byte seq, Mobile m )
     : base(0x21, 8)
 {
     Write( (byte) seq );
     Write( (short)m.Position.X );
     Write( (short)m.Position.Y );
     Write( (byte) m.Direction );
     Write( (sbyte)m.Position.Z );
 }
Ejemplo n.º 54
0
 private Brush GetBrush(Mobile mobile)
 {
     return mobile == World.Player ? Brushes.DeepPink : Brushes.Red;
 }
Ejemplo n.º 55
0
 public ChangeCombatant( Mobile m )
     : this(m.Serial)
 {
 }
Ejemplo n.º 56
0
        public static void CheckLastTargetRange( Mobile m )
        {
            if ( World.Player == null )
                return;

            if ( m_HasTarget && m != null && m_LastTarget != null && m.Serial == m_LastTarget.Serial && m_QueueTarget == LastTargetAction )
            {
                if ( Config.GetBool( "RangeCheckLT" ) && ClientCommunication.AllowBit( FeatureBit.RangeCheckLT ) )
                {
                    if ( Utility.InRange( World.Player.Position, m.Position, Config.GetInt( "LTRange" ) ) )
                    {
                        if ( m_QueueTarget() )
                            ClearQueue();
                    }
                }
            }
        }
Ejemplo n.º 57
0
 public static void DragDrop( Item i, Mobile to, Layer layer, bool doLast )
 {
     Drag( i, i.Amount, false, doLast );
     Drop( i, to, layer );
 }
Ejemplo n.º 58
0
        public LoginConfirm( Mobile m )
            : base(0x1B, 37)
        {
            Write( (int) m.Serial );
            Write( (int) 0 );
            Write( (short) m.Body );
            Write( (short) m.Position.X );
            Write( (short) m.Position.Y );
            Write( (short) m.Position.Z );
            Write( (byte) m.Direction );
            Write( (byte) 0 );
            Write( (int) -1 );

            Write( (short) 0 );
            Write( (short) 0 );
            Write( (short) 6144 );
            Write( (short) 4096 );
        }
Ejemplo n.º 59
0
        public static bool Drop( Item i, Mobile to, Layer layer )
        {
            if ( m_Pending == i.Serial )
            {
                Log( "Equipping {0} to {1} (@{2})", i, to.Serial, layer );
                ClientCommunication.SendToServer( new EquipRequest( i.Serial, to, layer ) );
                m_Pending = Serial.Zero;
                m_Lifted = DateTime.MinValue;
                return true;
            }
            else
            {
                bool add = false;

                for(byte j=m_Front;j!=m_Back && !add;j++)
                {
                    if ( m_LiftReqs[j] != null && m_LiftReqs[j].Serial == i.Serial )
                    {
                        add = true;
                        break;
                    }
                }

                if ( add )
                {
                    Log( "Queuing Equip {0} to {1} (@{2})", i, to.Serial, layer );

                    Queue q = m_DropReqs[i.Serial] as Queue;
                    if ( q == null )
                        m_DropReqs[i.Serial] = q = new Queue();
                    q.Enqueue( new DropReq( to == null ? Serial.Zero : to.Serial, layer ) );
                    return true;
                }
                else
                {
                    Log( "Drop/Equip for {0} (to {1} (@{2})) not found, skipped", i, to == null ? Serial.Zero : to.Serial, layer );
                    return false;
                }
            }
        }
Ejemplo n.º 60
0
        public MobileIncoming( Mobile m )
            : base(0x78)
        {
            int count = m.Contains.Count;
            int ltHue = Config.GetInt( "LTHilight" );
            bool isLT;
            if ( ltHue != 0 )
                isLT = Targeting.IsLastTarget( m );
            else
                isLT = false;

            EnsureCapacity( 3 + 4 + 2 + 2 + 2 + 1 + 1 + 2 + 1 + 1 + 4 + count*(4+2+1+2) );
            Write( (uint) m.Serial );
            Write( (ushort) m.Body );
            Write( (ushort) m.Position.X );
            Write( (ushort) m.Position.Y );
            Write( (sbyte) m.Position.Z );
            Write( (byte) m.Direction );
            Write( (ushort)( isLT ? ltHue|0x8000 : m.Hue ) );
            Write( (byte) m.GetPacketFlags() );
            Write( (byte) m.Notoriety );

            for ( int i = 0; i < count; ++i )
            {
                Item item = (Item)m.Contains[i];

                int itemID = item.ItemID & 0x3FFF;
                bool writeHue = ( item.Hue != 0 );
                if ( writeHue || isLT )
                    itemID |= 0x8000;

                Write( (uint) item.Serial );
                Write( (ushort) itemID );
                Write( (byte) item.Layer );
                if ( isLT )
                    Write( (ushort)(ltHue & 0x3FFF) );
                else if ( writeHue )
                    Write( (ushort) item.Hue );
            }
            Write( (uint) 0 ); // terminate
        }