Example #1
0
        public static byte[] UserEnterField(Character chr)
        {
            var packet = new PacketWriter();
            packet.WriteOpcode(SendOps.UserEnterField);
            packet.WriteInt(chr.mID);
            packet.WriteByte(chr.mPrimaryStats.Level);
            packet.WriteMapleString(chr.mName);
            packet.WriteMapleString(""); // ultimate explourer
            packet.WriteMapleString(chr.mGuild.Name);
            packet.WriteShort(chr.mGuild.EmblemBG);
            packet.WriteByte(chr.mGuild.EmblemBGColour);
            packet.WriteShort(chr.mGuild.Emblem);
            packet.WriteByte(chr.mGuild.EmblemColour);
            int[] buffs = new int[8];
            foreach (Buff buff in chr.mBuffs)
                buffs[buff.Position] |= buff.BuffID;
            //foreach (int i in buffs)
            //    packet.WriteInt(i); // buffer 32
            packet.WriteHexString("00 00 00 FE 00 00 A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ");
            //buff values

            packet.WriteInt(-1); // end buff values reading ?

            //packet.WriteByte(0);
            //packet.WriteByte(0);
            //packet.WriteByte(0);
            //packet.WriteByte(0);

            //packet.WriteBytes(new byte[4]);
            //packet.WriteBytes(new byte[4]);
            //packet.WriteByte(1);

            packet.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 01");

            packet.WriteInt(Environment.TickCount);
            packet.WriteShort(0);
            packet.WriteBytes(new byte[4]);
            packet.WriteBytes(new byte[4]);
            packet.WriteByte(1);
            packet.WriteInt(Environment.TickCount);
            packet.WriteShort(0);
            packet.WriteBytes(new byte[4]);
            packet.WriteBytes(new byte[4]);
            packet.WriteByte(1);
            packet.WriteInt(Environment.TickCount);
            packet.WriteShort(0);
            packet.WriteBytes(new byte[4]);
            packet.WriteBytes(new byte[4]);
            packet.WriteByte(1);
            packet.WriteInt(Environment.TickCount);
            packet.WriteBytes(new byte[4]);
            packet.WriteBytes(new byte[4]);
            packet.WriteByte(1);
            packet.WriteInt(Environment.TickCount);
            packet.WriteByte(1);
            packet.WriteInt(0);
            packet.WriteShort(0);
            packet.WriteBytes(new byte[4]);
            packet.WriteBytes(new byte[4]);
            packet.WriteByte(1);
            packet.WriteInt(Environment.TickCount);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteBytes(new byte[4]);
            packet.WriteBytes(new byte[4]);
            packet.WriteByte(1);
            packet.WriteInt(Environment.TickCount);
            packet.WriteShort(0);

            packet.WriteShort(chr.mPrimaryStats.Job);
            packet.WriteShort(0);
            Global.AddAvatarData(packet, chr);
            packet.WriteInt(0);
            packet.WriteBytes(new byte[12]);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteInt(0);

            packet.WriteShort(chr.mPosition.X);
            packet.WriteShort(chr.mPosition.Y);
            packet.WriteByte(chr.mStance); // chr.mStance
            packet.WriteShort(chr.mFoothold);

            packet.WriteByte(0);
            packet.WriteByte(0);

            packet.WriteByte(1);
            packet.WriteByte(0);

            packet.WriteInt(1); // mount level
            packet.WriteInt(0); // mount exp
            packet.WriteInt(0); // mount fatigue

            packet.WriteByte(0); // ``Announce Box''

            packet.WriteByte(0); // Chalk Board

            Global.AddRingData(packet, chr);
            Global.AddRingData(packet, chr);
            Global.AddRingData(packet, chr);

            packet.WriteByte(0); // berserk
            packet.WriteInt(0);
            packet.WriteByte(0); // new year cards
            packet.WriteInt(0);
            return packet.ToArray();
        }