コード例 #1
0
ファイル: AFK.cs プロジェクト: jaryn-kubik/RazorEx
 private static void OnCompressedGump(PacketReader p, PacketHandlerEventArgs e)
 {
     p.MoveToData();
     uint sender = p.ReadUInt32();
     uint id = p.ReadUInt32();
     if (id == responseID)
         _responseSender = sender;
     if (id != compressedID)
         return;
     p.Seek(19, SeekOrigin.Begin);
     p.Seek(p.ReadInt32(), SeekOrigin.Current);
     int lines = p.ReadInt32(), cLen = p.ReadInt32(), dLen = p.ReadInt32();
     if (cLen < 5)
         return;
     byte[] buffer = new byte[dLen];
     ZLib.uncompress(buffer, ref dLen, p.CopyBytes(p.Position, cLen - 4), cLen - 4);
     string afk = string.Empty;
     for (int i = 0, pos = 0; i < lines; i++)
     {
         int strLen = (buffer[pos++] << 8) | buffer[pos++];
         string str = Encoding.BigEndianUnicode.GetString(buffer, pos, strLen * 2);
         int index = str.IndexOf('>');
         if (index != -1 && index < str.Length - 1)
             afk += str[index + 1].ToString().ToUpper().Normalize(NormalizationForm.FormD)[0];
         pos += strLen * 2;
     }
     afk = afk.Trim();
     if (afk.Length == 5 && _responseSender != 0)
     {
         /*ClientCommunication.SendToClient(new CloseGump(responseID));
         WorldEx.SendToServer(new GumpResponse(responseSender, responseID, 0x310, new int[0], new[] { new GumpTextEntry(0x310, afk) }));
         responseSender = 0;*/
         WorldEx.OverHeadMessage(afk);
     }
 }
コード例 #2
0
ファイル: Event.Others.cs プロジェクト: jaryn-kubik/RazorEx
 private static void OnHuedEffect(PacketReader p, PacketHandlerEventArgs args)
 {
     byte type = p.ReadByte();
     Serial src = p.ReadUInt32();
     Serial dest = p.ReadUInt32();
     ItemID itemID = p.ReadUInt16();
     p.Seek(10, SeekOrigin.Current);
     byte speed = p.ReadByte();
     byte count = p.ReadByte();
     p.ReadUInt32();
     uint hue = p.ReadUInt32();
     uint mode = p.ReadUInt32();
     Handle(huedEffect, args, type, src, dest, itemID, speed, count, hue, mode);
 }
コード例 #3
0
ファイル: PotionStack.cs プロジェクト: jaryn-kubik/RazorEx
 private static void ClientDoubleClick(PacketReader p, PacketHandlerEventArgs args)
 {
     Serial serial = p.ReadUInt32();
     if (items.ContainsKey(serial))
     {
         args.Block = true;
         WorldEx.SendToServer(new DoubleClick(items[serial].List.Last()));
     }
     else
         args.Block = PacketHandler.ProcessViewers(clientDoubleClick, p);
 }
コード例 #4
0
ファイル: ChatHandler.cs プロジェクト: Zenohate/PolarisServer
        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            if (context.Character == null)
                return;

            var reader = new PacketReader(data, position, size);
            reader.BaseStream.Seek(0xC, SeekOrigin.Begin);
            var channel = reader.ReadUInt32();
            var message = reader.ReadUtf16(0x9D3F, 0x44);

            if (message.StartsWith(PolarisApp.Config.CommandPrefix))
            {
                var valid = false;

                // Iterate commands
                foreach (var command in PolarisApp.ConsoleSystem.Commands)
                {
                    var full = message.Substring(1); // Strip the command chars
                    var args = full.Split(' ');

                    if (command.Names.Any(name => args[0].ToLower() == name.ToLower()))
                    {
                        command.Run(args, args.Length, full, context);
                        valid = true;
                        Logger.WriteCommand(null, "[CMD] {0} issued command {1}", context.User.Username, full);
                    }

                    if (valid)
                        break;
                }

                if (!valid)
                    Logger.WriteClient(context, "[CMD] {0} - Command not found", message.Split(' ')[0].Trim('\r'));
            }
            else
            {
                Logger.Write("[CHT] <{0}> <{1}>", context.Character.Name, message);

                var writer = new PacketWriter();
                writer.WritePlayerHeader((uint) context.User.PlayerId);
                writer.Write(channel);
                writer.WriteUtf16(message, 0x9D3F, 0x44);

                data = writer.ToArray();

                foreach (var c in Server.Instance.Clients)
                {
                    if (c.Character == null || c.CurrentZone != context.CurrentZone)
                        continue;

                    c.SendPacket(0x07, 0x00, 0x44, data);
                }
            }
        }
コード例 #5
0
ファイル: SOS.cs プロジェクト: jaryn-kubik/RazorEx
        private static void OnCompressedGump(PacketReader p, PacketHandlerEventArgs e)
        {
            p.Seek(7, SeekOrigin.Begin);
            if (p.ReadUInt32() != 0x1105B263)
                return;

            p.Seek(19, SeekOrigin.Begin);
            p.Seek(p.ReadInt32() + 4, SeekOrigin.Current);
            int cLen = p.ReadInt32(), dLen = p.ReadInt32();
            byte[] buffer = new byte[dLen];
            ZLib.uncompress(buffer, ref dLen, p.CopyBytes(p.Position, cLen - 4), cLen - 4);
            int strLen = (buffer[0] << 8) | buffer[1];
            string[] str = Encoding.BigEndianUnicode.GetString(buffer, 2, strLen * 2).Split(',');

            string[] lat = str[0].Split('°');
            int yLat = int.Parse(lat[0]);
            int yMins = int.Parse(lat[1].Split('\'')[0]);
            bool ySouth = lat[1][lat[1].Length - 1] == 'S';

            string[] lon = str[1].Split('°');
            int xLong = int.Parse(lon[0]);
            int xMins = int.Parse(lon[1].Split('\'')[0]);
            bool xEast = lon[1][lon[1].Length - 1] == 'E';

            const int xWidth = 5120;
            const int yHeight = 4096;
            const int xCenter = 1323;
            const int yCenter = 1624;

            double absLong = xLong + ((double)xMins / 60);
            double absLat = yLat + ((double)yMins / 60);

            if (!xEast)
                absLong = 360.0 - absLong;

            if (!ySouth)
                absLat = 360.0 - absLat;

            int x = xCenter + (int)((absLong * xWidth) / 360);
            int y = yCenter + (int)((absLat * yHeight) / 360);

            if (x < 0)
                x += xWidth;
            else if (x >= xWidth)
                x -= xWidth;

            if (y < 0)
                y += yHeight;
            else if (y >= yHeight)
                y -= yHeight;

            onGump(x, y);
        }
コード例 #6
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void EquipmentUpdate( PacketReader p )
        {
            Serial serial = p.ReadUInt32();

            Item i = World.FindItem( serial );
            if ( i == null )
            {
                World.AddItem( i=new Item( serial ) );
                Item.UpdateContainers();
            }

            if ( World.Player != null && World.Player.Holding == i )
                World.Player.Holding = null;

            ushort iid = p.ReadUInt16();
            i.ItemID = (ushort)(iid + p.ReadSByte()); // signed, itemID offset
            i.Layer = p.ReadByte();
            Serial ser = p.ReadUInt32();// cont must be set after hue (for counters)
            i.Hue = p.ReadUInt16();

            i.Container = ser;
        }
コード例 #7
0
        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            PacketReader reader = new PacketReader(data);

            reader.ReadUInt64(); // Skip 8 bytes
            if(reader.ReadUInt32() != 0x10)
            {
                Logger.WriteWarning("[WRN] Packet 0x3 0x34's first value was not 0x10! Investigate.");
            }

            uint partOfLobby = reader.ReadUInt32();
            PSOLocation destination;
            if(partOfLobby == 0) // Gate area
            {
                destination = new PSOLocation(0f, 1f, 0f, 0f, -0.22f, 2.4f, 198.75f);
            }
            else // Shop area
            {
                destination = new PSOLocation(0f, 1f, 0f, 20f, 0.20f, 1.23f, -175.25f);
            }
            Map lobbyMap = ZoneManager.Instance.MapFromInstance("lobby", "lobby");
            lobbyMap.SpawnClient(context, destination, "lobby");
        }
コード例 #8
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void EquipRequest( PacketReader p, PacketHandlerEventArgs args )
        {
            Serial iser = p.ReadUInt32(); // item being dropped serial
            Layer layer = (Layer)p.ReadByte();
            Serial mser = p.ReadUInt32();

            Item item = World.FindItem( iser );

            if ( MacroManager.AcceptActions )
            {
                if ( layer == Layer.Invalid || layer > Layer.LastValid )
                {
                    if ( item != null )
                    {
                        layer = item.Layer;
                        if ( layer == Layer.Invalid || layer > Layer.LastValid )
                            layer = (Layer)item.ItemID.ItemData.Quality;
                    }
                }

                if ( layer > Layer.Invalid && layer <= Layer.LastUserValid )
                    MacroManager.Action( new DropAction( mser, Point3D.Zero, layer ) );
            }

            if ( item == null )
                return;

            Mobile m = World.FindMobile( mser );
            if ( m == null )
                return;

            if ( Config.GetBool( "QueueActions" ) )
                args.Block = DragDropManager.Drop( item, m, layer );
        }
コード例 #9
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
 private static void DeathAnimation( PacketReader p, PacketHandlerEventArgs args )
 {
     Serial killed = p.ReadUInt32();
     if ( Config.GetBool( "AutoCap" ) )
     {
         Mobile m = World.FindMobile( killed );
         if ( m != null && ( ( m.Body >= 0x0190 && m.Body <= 0x0193 ) || ( m.Body >= 0x025D && m.Body <= 0x0260 ) ) && Utility.Distance( World.Player.Position, m.Position ) <= 12 )
             ScreenCapManager.DeathCapture();
     }
 }
コード例 #10
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void CompressedGump( PacketReader p, PacketHandlerEventArgs args )
        {
            if ( World.Player != null )
            {
                World.Player.CurrentGumpS = p.ReadUInt32();
                World.Player.CurrentGumpI = p.ReadUInt32();
            }

            /*try
            {
                int x = p.ReadInt32(), y = p.ReadInt32();

                string layout = p.GetCompressedReader().ReadString();

                int numStrings = p.ReadInt32();
                if ( numStrings < 0 || numStrings > 256 )
                    numStrings = 0;
                ArrayList strings = new ArrayList( numStrings );
                PacketReader pComp = p.GetCompressedReader();
                int len = 0;
                while ( !pComp.AtEnd && (len=pComp.ReadInt16()) > 0 )
                    strings.Add( pComp.ReadUnicodeString( len ) );
            }
            catch
            {
            }*/

            if ( Macros.MacroManager.AcceptActions && MacroManager.Action( new WaitForGumpAction( World.Player.CurrentGumpI ) ) )
                args.Block = true;

            // ZIPPY REV 80
            // ClientCommunication.ForwardPacket( p.Pointer, p.Length );
        }
コード例 #11
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void ClientGumpResponse( PacketReader p, PacketHandlerEventArgs args )
        {
            if ( World.Player == null )
                return;

            Serial ser = p.ReadUInt32();
            uint tid = p.ReadUInt32();
            int bid = p.ReadInt32();

            World.Player.HasGump = false;

            int sc = p.ReadInt32();
            if ( sc < 0 || sc > 2000 )
                return;
            int[] switches = new int[sc];
            for(int i=0;i<sc;i++)
                switches[i] = p.ReadInt32();

            int ec = p.ReadInt32();
            if ( ec < 0 || ec > 2000 )
                return;
            GumpTextEntry[] entries = new GumpTextEntry[ec];
            for(int i=0;i<ec;i++)
            {
                ushort id = p.ReadUInt16();
                ushort len = p.ReadUInt16();
                if ( len >= 240 )
                    return;
                string text = p.ReadUnicodeStringSafe( len );
                entries[i] = new GumpTextEntry( id, text );
            }

            if ( Macros.MacroManager.AcceptActions )
                MacroManager.Action( new GumpResponseAction( bid, switches, entries ) );
        }
コード例 #12
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void ClientDoubleClick( PacketReader p, PacketHandlerEventArgs args )
        {
            Serial ser = p.ReadUInt32();
            if ( Config.GetBool( "BlockDismount" ) && World.Player != null && ser == World.Player.Serial && World.Player.Warmode && World.Player.GetItemOnLayer( Layer.Mount ) != null )
            { // mount layer = 0x19
                World.Player.SendMessage( LocString.DismountBlocked );
                args.Block = true;
                return;
            }

            if ( Config.GetBool( "QueueActions" ) )
                args.Block = !PlayerData.DoubleClick( ser, false );

            if ( Macros.MacroManager.AcceptActions )
            {
                ushort gfx = 0;
                if ( ser.IsItem )
                {
                    Item i = World.FindItem( ser );
                    if ( i != null )
                        gfx = i.ItemID;
                }
                else
                {
                    Mobile m = World.FindMobile( ser );
                    if ( m != null )
                        gfx = m.Body;
                }

                if ( gfx != 0 )
                    MacroManager.Action( new DoubleClickAction( ser, gfx ) );
            }
        }
コード例 #13
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void WorldItem( PacketReader p, PacketHandlerEventArgs args )
        {
            Item item;
            uint serial = p.ReadUInt32();
            item = World.FindItem( serial&0x7FFFFFFF );
            bool isNew = false;
            if ( item == null )
            {
                World.AddItem( item=new Item( serial&0x7FFFFFFF ) );
                isNew = true;
            }
            else
            {
                item.CancelRemove();
            }

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

            item.Container = null;
            Counter.Uncount( item );

            ushort itemID = p.ReadUInt16();
            item.ItemID = (ushort)(itemID&0x7FFF);

            if ( (serial & 0x80000000) != 0 )
                item.Amount = p.ReadUInt16();
            else
                item.Amount = 1;

            if ( (itemID & 0x8000) != 0 )
                item.ItemID = (ushort)(item.ItemID + p.ReadSByte());

            ushort x = p.ReadUInt16();
            ushort y = p.ReadUInt16();

            if ( (x & 0x8000) != 0 )
                item.Direction = p.ReadByte();
            else
                item.Direction = 0;

            short z = p.ReadSByte();

            item.Position = new Point3D( x&0x7FFF, y&0x3FFF, z );

            if ( ( y & 0x8000 ) != 0 )
                item.Hue = p.ReadUInt16();
            else
                item.Hue = 0;

            byte flags = 0;
            if ( ( y & 0x4000 ) != 0 )
                flags = p.ReadByte();

            item.ProcessPacketFlags( flags );

            if ( isNew && World.Player != null )
            {
                if ( item.ItemID == 0x2006 )// corpse itemid = 0x2006
                {
                    if ( Config.GetBool( "ShowCorpseNames" ) )
                        ClientCommunication.SendToServer( new SingleClick( item ) );
                    if ( Config.GetBool( "AutoOpenCorpses" ) && Utility.InRange( item.Position, World.Player.Position, Config.GetInt( "CorpseRange" ) ) && World.Player != null && World.Player.Visible )
                        PlayerData.DoubleClick( item ) ;
                }
                else if ( item.IsMulti )
                {
                    ClientCommunication.PostAddMulti( item.ItemID, item.Position );
                }
                else
                {
                    ScavengerAgent s = ScavengerAgent.Instance;
                    int dist = Utility.Distance( item.GetWorldPosition(), World.Player.Position );
                    if ( !World.Player.IsGhost && World.Player.Visible && dist <= 2 && s.Enabled && item.Movable )
                        s.Scavenge( item );
                }
            }

            Item.UpdateContainers();
        }
コード例 #14
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void OnPartyMessage( PacketReader p, PacketHandlerEventArgs args )
        {
            switch ( p.ReadByte() )
            {
                case 0x01: // List
                {
                    m_Party.Clear();

                    int count = p.ReadByte();
                    for(int i=0;i<count;i++)
                    {
                        Serial s = p.ReadUInt32();
                        if ( World.Player == null || s != World.Player.Serial )
                            m_Party.Add( s );
                    }

                    break;
                }
                case 0x02: // Remove Member/Re-list
                {
                    m_Party.Clear();
                    int count = p.ReadByte();
                    Serial remSerial = p.ReadUInt32(); // the serial of who was removed

                    if ( World.Player != null )
                    {
                        Mobile rem = World.FindMobile( remSerial );
                        if ( rem != null && !Utility.InRange( World.Player.Position, rem.Position, World.Player.VisRange ) )
                            rem.Remove();
                    }

                    for(int i=0;i<count;i++)
                    {
                        Serial s = p.ReadUInt32();
                        if ( World.Player == null || s != World.Player.Serial )
                            m_Party.Add( s );
                    }

                    break;
                }
                case 0x03: // text message
                case 0x04: // 3 = private, 4 = public
                {
                    //Serial from = p.ReadUInt32();
                    //string text = p.ReadUnicodeStringSafe();
                    break;
                }
                case 0x07: // party invite
                {
                    //Serial leader = p.ReadUInt32();
                    PartyLeader = p.ReadUInt32();
                    if ( m_PartyDeclineTimer == null )
                        m_PartyDeclineTimer = Timer.DelayedCallback( TimeSpan.FromSeconds( 10.0 ), new TimerCallback( PartyAutoDecline ) );
                    m_PartyDeclineTimer.Start();
                    break;
                }
            }

            if (Engine.MainWindow.MapWindow != null)
                Engine.MainWindow.MapWindow.UpdateMap();
        }
コード例 #15
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void NewMobileStatus( PacketReader p, PacketHandlerEventArgs args )
        {
            Mobile m = World.FindMobile( (Serial)p.ReadUInt32() );

            if ( m == null )
                return;

            UseNewStatus = true;

            // 00 01
            p.ReadUInt16();

            // 00 01 Poison
            // 00 02 Yellow Health Bar

            ushort id = p.ReadUInt16();

            // 00 Off
            // 01 On
            // For Poison: Poison Level + 1

            byte flag = p.ReadByte();

            if ( id == 1 ) {
                bool wasPoisoned = m.Poisoned;
                m.Poisoned = ( flag != 0 );

                if ( m == World.Player && wasPoisoned != m.Poisoned )
                    ClientCommunication.RequestTitlebarUpdate();
            }
        }
コード例 #16
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void ServerList( PacketReader p, PacketHandlerEventArgs args )
        {
            p.ReadByte(); //unknown
            ushort numServers = p.ReadUInt16();

            for ( int i = 0; i < numServers; ++i )
            {
                ushort num = p.ReadUInt16();
                World.Servers[num] = p.ReadString( 32 );
                p.ReadByte(); // full %
                p.ReadSByte(); // time zone
                p.ReadUInt32(); // ip
            }
        }
コード例 #17
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void StamUpdate( PacketReader p, PacketHandlerEventArgs args )
        {
            Mobile m = World.FindMobile( p.ReadUInt32() );

            if ( m != null )
            {
                int oldPercent = (int)(m.Stam*100 / (m.StamMax == 0 ? (ushort)1 : m.StamMax));

                m.StamMax = p.ReadUInt16();
                m.Stam = p.ReadUInt16();

                if ( m == World.Player )
                {
                    ClientCommunication.RequestTitlebarUpdate();
                    ClientCommunication.PostStamUpdate();
                }

                if ( m != World.Player && ClientCommunication.AllowBit( FeatureBit.OverheadHealth ) && Config.GetBool( "ShowPartyStats" ) )
                {
                    int stamPercent = (int)(m.Stam*100 / (m.StamMax == 0 ? (ushort)1 : m.StamMax));
                    int manaPercent = (int)(m.Mana*100 / (m.ManaMax == 0 ? (ushort)1 : m.ManaMax));

                    // Limit to people who are on screen and check the previous value so we dont get spammed.
                    if ( oldPercent != stamPercent && World.Player != null && Utility.Distance( World.Player.Position, m.Position ) <= 12 )
                    {
                        try
                        {
                            m.OverheadMessageFrom( 0x63,
                                Language.Format( LocString.sStatsA1, m.Name ),
                                Config.GetString( "PartyStatFmt" ), manaPercent, stamPercent );
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
コード例 #18
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
 private static void PersonalLight( PacketReader p, PacketHandlerEventArgs args )
 {
     if ( World.Player != null && !args.Block )
     {
         p.ReadUInt32(); // serial
         World.Player.LocalLightLevel = p.ReadSByte();
     }
 }
コード例 #19
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
 private static void BeginContainerContent( PacketReader p, PacketHandlerEventArgs args )
 {
     Serial ser = p.ReadUInt32();
     if ( !ser.IsItem )
         return;
     Item item = World.FindItem( ser );
     if ( item != null )
     {
         if ( m_IgnoreGumps.Contains( item ) )
         {
             m_IgnoreGumps.Remove( item );
             args.Block = true;
         }
     }
     else
     {
         World.AddItem( new Item( ser ) );
         Item.UpdateContainers();
     }
 }
コード例 #20
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void PlayCharacter( PacketReader p, PacketHandlerEventArgs args )
        {
            p.ReadUInt32(); //0xedededed
            World.OrigPlayerName = p.ReadStringSafe( 30 );

            PlayCharTime = DateTime.Now;

            if ( Engine.MainWindow != null )
                Engine.MainWindow.UpdateControlLocks();

            ClientCommunication.TranslateLogin( World.OrigPlayerName, World.ShardName );
        }
コード例 #21
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void ClientEncodedPacket( PacketReader p, PacketHandlerEventArgs args )
        {
            Serial serial = p.ReadUInt32();
            ushort packetID = p.ReadUInt16();
            switch ( packetID )
            {
                case 0x19: // set ability
                {
                    int ability = 0;
                    if ( p.ReadByte() == 0 )
                        ability = p.ReadInt32();

                    if ( ability >= 0 && ability < (int)AOSAbility.Invalid && Macros.MacroManager.AcceptActions )
                        MacroManager.Action( new SetAbilityAction( (AOSAbility)ability ) );
                    break;
                }
            }
        }
コード例 #22
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void RemoveObject( PacketReader p, PacketHandlerEventArgs args )
        {
            Serial serial = p.ReadUInt32();

            if ( serial.IsMobile )
            {
                Mobile m = World.FindMobile( serial );
                if ( m != null && m != World.Player )
                    m.Remove();
            }
            else if ( serial.IsItem )
            {
                Item i = World.FindItem( serial );
                if ( i != null )
                {
                    if ( DragDropManager.Holding == i )
                    {
                        Counter.SupressWarnings = true;
                        i.Container = null;
                        Counter.SupressWarnings = false;
                    }
                    else
                    {
                        i.RemoveRequest();
                    }
                }
            }
        }
コード例 #23
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
 private static void ClientSingleClick( PacketReader p, PacketHandlerEventArgs args )
 {
     // if you modify this, don't forget to modify the allnames hotkey
     if ( Config.GetBool( "LastTargTextFlags" ) )
     {
         Mobile m = World.FindMobile( p.ReadUInt32() );
         if ( m != null )
             Targeting.CheckTextFlags( m );
     }
 }
コード例 #24
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        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;
                }
            }
        }
コード例 #25
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void CustomHouseInfo( PacketReader p, PacketHandlerEventArgs args )
        {
            p.ReadByte(); // compression
            p.ReadByte(); // Unknown

            Item i = World.FindItem( p.ReadUInt32() );
            if ( i != null )
            {
                i.HouseRevision = p.ReadInt32();
                i.HousePacket = p.CopyBytes( 0, p.Length );
            }
        }
コード例 #26
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void SAWorldItem(PacketReader p, PacketHandlerEventArgs args)
        {
            /*
            New World Item Packet
            PacketID: 0xF3
            PacketLen: 24
            Format:

                BYTE - 0xF3 packetId
                WORD - 0x01
                BYTE - ArtDataID: 0x00 if the item uses art from TileData table, 0x02 if the item uses art from MultiData table)
                DWORD - item Serial
                WORD - item ID
                BYTE - item direction (same as old)
                WORD - amount
                WORD - amount
                WORD - X
                WORD - Y
                SBYTE - Z
                BYTE - item light
                WORD - item Hue
                BYTE - item flags (same as old packet)
            */

            // Post-7.0.9.0
            /*
            New World Item Packet
            PacketID: 0xF3
            PacketLen: 26
            Format:

                BYTE - 0xF3 packetId
                WORD - 0x01
                BYTE - ArtDataID: 0x00 if the item uses art from TileData table, 0x02 if the item uses art from MultiData table)
                DWORD - item Serial
                WORD - item ID
                BYTE - item direction (same as old)
                WORD - amount
                WORD - amount
                WORD - X
                WORD - Y
                SBYTE - Z
                BYTE - item light
                WORD - item Hue
                BYTE - item flags (same as old packet)
                WORD ???
            */

            ushort _unk1 = p.ReadUInt16();

            byte _artDataID = p.ReadByte();

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

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

            item.Container = null;
            Counter.Uncount(item);

            ushort itemID = p.ReadUInt16();
            item.ItemID = (ushort)( _artDataID == 0x02 ? itemID | 0x4000 : itemID );

            item.Direction = p.ReadByte();

            ushort _amount = p.ReadUInt16();
            item.Amount = _amount = p.ReadUInt16();

            ushort x = p.ReadUInt16();
            ushort y = p.ReadUInt16();
            short z = p.ReadSByte();

            item.Position = new Point3D(x, y, z);

            byte _light = p.ReadByte();

            item.Hue = p.ReadUInt16();

            byte flags = p.ReadByte();

            item.ProcessPacketFlags(flags);

            if (Engine.UsePostHSChanges)
            {
                p.ReadUInt16();
            }

            if (isNew && World.Player != null)
            {
                if (item.ItemID == 0x2006)// corpse itemid = 0x2006
                {
                    if (Config.GetBool("ShowCorpseNames"))
                        ClientCommunication.SendToServer(new SingleClick(item));
                    if (Config.GetBool("AutoOpenCorpses") && Utility.InRange(item.Position, World.Player.Position, Config.GetInt("CorpseRange")) && World.Player != null && World.Player.Visible)
                        PlayerData.DoubleClick(item);
                }
                else if (item.IsMulti)
                {
                    ClientCommunication.PostAddMulti(item.ItemID, item.Position);
                }
                else
                {
                    ScavengerAgent s = ScavengerAgent.Instance;
                    int dist = Utility.Distance(item.GetWorldPosition(), World.Player.Position);
                    if (!World.Player.IsGhost && World.Player.Visible && dist <= 2 && s.Enabled && item.Movable)
                        s.Scavenge(item);
                }
            }

            Item.UpdateContainers();
        }
コード例 #27
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void DropRequest( PacketReader p, PacketHandlerEventArgs args )
        {
            Serial iser = p.ReadUInt32();
            int x = p.ReadInt16();
            int y = p.ReadInt16();
            int z = p.ReadSByte();
            if ( Engine.UsePostKRPackets )
                /* grid num */p.ReadByte();
            Point3D newPos = new Point3D( x, y, z );
            Serial dser = p.ReadUInt32();

            if ( Macros.MacroManager.AcceptActions )
                MacroManager.Action( new DropAction( dser, newPos ) );

            Item i = World.FindItem( iser );
            if ( i == null )
                return;

            Item dest = World.FindItem( dser );
            if ( dest != null && dest.IsContainer && World.Player != null && ( dest.IsChildOf( World.Player.Backpack ) || dest.IsChildOf( World.Player.Quiver ) ) )
                i.IsNew = true;

            if ( Config.GetBool( "QueueActions" ) )
                args.Block = DragDropManager.Drop( i, dser, newPos );
        }
コード例 #28
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void SendGump( PacketReader p, PacketHandlerEventArgs args )
        {
            if ( World.Player == null )
                return;

            World.Player.CurrentGumpS = p.ReadUInt32();
            World.Player.CurrentGumpI = p.ReadUInt32();
            World.Player.HasGump = true;
            //byte[] data = p.CopyBytes( 11, p.Length - 11 );

            if ( Macros.MacroManager.AcceptActions && MacroManager.Action( new WaitForGumpAction( World.Player.CurrentGumpI ) ) )
                args.Block = true;

            // ZIPPY REV 80
            // ClientCommunication.ForwardPacket( p.Pointer, p.Length );
        }
コード例 #29
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void ExtendedPacket( PacketReader p, PacketHandlerEventArgs args )
        {
            ushort type = p.ReadUInt16();

            switch ( type )
            {
                case 0x04: // close gump
                {
                    // int serial, int tid
                    if ( World.Player != null )
                        World.Player.HasGump = false;
                    break;
                }
                case 0x06: // party messages
                {
                    OnPartyMessage( p, args );
                    break;
                }
                case 0x08: // map change
                {
                    if ( World.Player != null )
                        World.Player.Map = p.ReadByte();
                    break;
                }
                case 0x14: // context menu
                {
                    p.ReadInt16(); // 0x01
                    UOEntity ent = null;
                    Serial ser = p.ReadUInt32();
                    if ( ser.IsMobile )
                        ent = World.FindMobile( ser );
                    else if ( ser.IsItem )
                        ent = World.FindItem( ser );

                    if ( ent != null )
                    {
                        byte count = p.ReadByte();

                        try
                        {
                            ent.ContextMenu.Clear();

                            for(int i=0;i<count;i++)
                            {
                                ushort idx = p.ReadUInt16();
                                ushort num = p.ReadUInt16();
                                ushort flags = p.ReadUInt16();
                                ushort color = 0;

                                if ( (flags&0x02) != 0 )
                                    color = p.ReadUInt16();

                                ent.ContextMenu.Add( idx, num );
                            }
                        }
                        catch
                        {
                        }
                    }
                    break;
                }
                case 0x18: // map patches
                {
                    if ( World.Player != null )
                    {
                        int count = p.ReadInt32() * 2;
                        try
                        {
                            World.Player.MapPatches = new int[count];
                            for(int i=0;i<count;i++)
                                World.Player.MapPatches[i] = p.ReadInt32();
                        }
                        catch
                        {
                        }
                    }
                    break;
                }
                case 0x19: //  stat locks
                {
                    if ( p.ReadByte() == 0x02 )
                    {
                        Mobile m = World.FindMobile( p.ReadUInt32() );
                        if ( World.Player == m && m != null )
                        {
                            p.ReadByte();// 0?

                            byte locks = p.ReadByte();

                            World.Player.StrLock = (LockType)((locks>>4) & 3);
                            World.Player.DexLock = (LockType)((locks>>2) & 3);
                            World.Player.IntLock = (LockType)(locks & 3);
                        }
                    }
                    break;
                }
                case 0x1D: // Custom House "General Info"
                {
                    Item i = World.FindItem( p.ReadUInt32() );
                    if ( i != null )
                        i.HouseRevision = p.ReadInt32();
                    break;
                }
            }
        }
コード例 #30
0
ファイル: Handlers.cs プロジェクト: herculesjr/razor
        private static void SendMenu( PacketReader p, PacketHandlerEventArgs args )
        {
            if ( World.Player == null )
                return;

            World.Player.CurrentMenuS = p.ReadUInt32();
            World.Player.CurrentMenuI = p.ReadUInt16();
            World.Player.HasMenu = true;
            if ( MacroManager.AcceptActions && MacroManager.Action( new WaitForMenuAction( World.Player.CurrentMenuI ) ) )
                args.Block = true;
        }