public static OutPacket GetCharInfo(MapleCharacter chr) { using (var packet = new OutPacket(SendOpcodes.WarpToMap)) { packet.WriteInt(chr.Client.ChannelId); packet.WriteByte(0x00); packet.WriteByte(0x01); packet.WriteByte(0x01); packet.WriteShort(0); packet.WriteInt((int)(Randomizer.NextDouble() * 10)); packet.WriteLong(DateUtiliy.GetFileTimestamp(DateTime.Now.GetTimeMilliseconds())); packet.WriteLong(-1); packet.WriteByte(0x00); LoginPacket.AddCharStats(packet, chr); packet.WriteByte((byte)chr.Buddies.Capacity); PacketCreator.AddInventoryInfo(packet, chr); PacketCreator.AddSkillRecord(packet, chr); PacketCreator.AddQuestRecord(packet, chr); PacketCreator.AddRingInfo(packet, chr); PacketCreator.AddTeleportRockRecord(packet, chr); packet.WriteShort(0); packet.WriteLong(0); packet.WriteByte(0x00); packet.WriteInt(0); packet.WriteLong(DateUtiliy.GetFileTimestamp(DateTime.Now.GetTimeMilliseconds())); return(packet); } }
public static void AddCharStats(OutPacket p, MapleCharacter chr) { p.WriteInt(chr.Id); // character id p.WriteString(chr.Name); // 填充名字字符 // p.WriteZero(13 - Encoding.Default.GetByteCount(chr.CharacterName)); for (var x = Encoding.Default.GetByteCount(chr.Name); x < 13; x++) { // fill to maximum name length p.WriteByte(0); } p.WriteBool(chr.Gender); // gender (0 = male, 1 = female) p.WriteByte(chr.Skin.ColorId); // skin color p.WriteInt(chr.Face); // face p.WriteInt(chr.Hair); // hair p.WriteLong(0); p.WriteLong(0); p.WriteLong(0); p.WriteByte(chr.Level); // level p.WriteShort(chr.Job.JobId); // job p.WriteShort(chr.Str); // str p.WriteShort(chr.Dex); // dex p.WriteShort(chr.Int); // int p.WriteShort(chr.Luk); // luk p.WriteShort(chr.Hp); // hp (?) p.WriteShort(chr.MaxHp); // maxhp p.WriteShort(chr.Mp); // mp (?) p.WriteShort(chr.MaxMp); // maxmp p.WriteShort(chr.RemainingAp); // remaining ap p.WriteShort(chr.RemainingSp); // remaining sp p.WriteInt(chr.Exp.Value); // current exp p.WriteShort(chr.Fame); // fame p.WriteInt(0); p.WriteLong(DateUtiliy.GetFileTimestamp(DateTime.Now.GetTimeMilliseconds())); p.WriteInt(chr.Map?.MapId ?? 10000); // current map id p.WriteByte(chr.InitialSpawnPoint); // spawnpoint }