Ejemplo n.º 1
0
        public static bool ServerPacket(Packet p)
        {
            if (Playing)
            {
                return(false);                // dont allow the client to recv server packets.
            }
            else if (m_Recording && p != null)
            {
                if (World.Player == null)
                {
                    Stop();
                    return(true);
                }

                switch (p.PacketID)
                {
                case 0x21:                         // Movement Reject
                case 0x27:                         // Lift Reject
                case 0x6C:                         // Target
                case 0x7C:                         // Menu
                case 0x88:                         // Display paper doll
                case 0xB2:                         // Chat Message
                case 0xBA:                         // Quest Arrow
                    return(true);

                case 0x22:                         // Movement Ack
                {
                    // replace movement ack with a force walk
                    byte seq = p.ReadByte();
                    if (World.Player.HasWalkEntry(seq))
                    {
                        WritePacket(new ForceWalk(World.Player.GetMoveEntry(seq).Dir & Direction.Mask));
                        //WritePacket( new MobileUpdate( World.Player ) );
                    }
                    return(true);
                }

                case 0xBF:
                {
                    short type = p.ReadInt16();
                    switch (type)
                    {
                    case 0x06:                                    // party stuff
                    {
                        byte subType = p.ReadByte();

                        if (subType == 0x03 || subType == 0x04)
                        {
                            Mobile from = World.FindMobile(p.ReadUInt32());
                            string msg  = p.ReadUnicodeStringSafe();

                            string send = String.Format("[{0}]: {1}", from != null && from.Name != null && from.Name.Length > 0 ? from.Name : "Party", msg);

                            WritePacket(new UnicodeMessage(Serial.MinusOne, 0, MessageType.System, 0x3b2, 3, "ENU", "Party", send));
                        }
                        return(true);
                    }

                    case 0x1D:                                     // House Revision info
                    {
                        Item i = World.FindItem(p.ReadUInt32());
                        if (i != null)
                        {
                            i.HouseRevision = p.ReadInt32();

                            if (!m_HouseDataWritten.Contains(i.Serial))
                            {
                                if (i.HousePacket == null)
                                {
                                    i.MakeHousePacket();
                                }
                                if (i.HousePacket != null)
                                {
                                    m_HouseDataWritten.Add(i.Serial);
                                    // WritePacket( p );
                                    WritePacket(new Packet(i.HousePacket, i.HousePacket.Length, true));
                                    return(true);
                                }
                            }
                        }

                        break;
                    }
                    }
                    break;
                }

                case 0xD8:                         // Custom House data
                {
                    p.ReadByte();                  // Compression
                    p.ReadByte();                  // Unknown
                    Serial s = p.ReadUInt32();

                    m_HouseDataWritten.Add(s);
                    break;
                }
                }

                WritePacket(p);
                return(true);
            }
            else
            {
                return(true);
            }
        }