public CharData(Player PlayerClass, string Account, string Character) { int Count = 0; this.PlayerClass = PlayerClass; FileName = "Accounts\\" + Account + "\\" + Character; if (!File.Exists(FileName)) return; byte[] Bytes = File.ReadAllBytes(FileName); Stream Stream = new MemoryStream(Bytes); BinaryReader Reader = new BinaryReader(Stream); #region CharData { Name = Reader.ReadString( ); Gender = (CharGender)Reader.ReadByte( ); Nation = (CharNation)Reader.ReadByte( ); Job = (CharJob)Reader.ReadByte( ); EXP = Reader.ReadUInt64( ); Level = Reader.ReadByte( ); Fame = Reader.ReadUInt32( ); NationRate = Reader.ReadUInt32( ); Face = Reader.ReadByte( ); Hair = Reader.ReadByte( ); Map = Reader.ReadUInt16( ); Coord = Reader.ReadPoint( ); CurHP = Reader.ReadUInt32( ); CurSP = Reader.ReadUInt32(); CurMP = Reader.ReadUInt32( ); MaxHP = Reader.ReadUInt32( ); MaxSP = Reader.ReadUInt32(); MaxMP = Reader.ReadUInt32( ); Power = Reader.ReadUInt16(); PhysicalDef = Reader.ReadUInt16( ); MagicalDef = Reader.ReadUInt16( ); AbbillityMin = Reader.ReadUInt16( ); AbbillityMax = Reader.ReadUInt16( ); Vitality = Reader.ReadUInt16( ); Sympathy = Reader.ReadUInt16( ); Stamina = Reader.ReadUInt16(); Intelligence = Reader.ReadUInt16( ); Dexterity = Reader.ReadUInt16( ); AbilltyPoint = Reader.ReadUInt16( ); Charisma = Reader.ReadByte( ); Luck = Reader.ReadByte( ); LeftSP = Reader.ReadUInt16(); TotalSP = Reader.ReadUInt16(); WonPVPs = Reader.ReadUInt32( ); TotalPVPs = Reader.ReadUInt32( ); Gold = Reader.ReadUInt32( ); } #endregion #region Skills { Count = Reader.ReadInt32( ); for (int i = 0; i < Count; i++) { Skills.Add(Reader.ReadUInt16( )); } } #endregion #region ClothesItems { Count = Reader.ReadInt32( ); for (int i = 0; i < Count; i++) { ClothesItems.Add(new CharItem( ) { Model = Reader.ReadUInt16( ), Slot = Reader.ReadInt32( ), Durabillty = Reader.ReadUInt16( ), RemainTime = Reader.ReadUInt16( ) }); } } #endregion #region GeneralItems { Count = Reader.ReadInt32( ); for (int i = 0; i < Count; i++) { GeneralItems.Add(new CharItem( ) { Model = Reader.ReadUInt16( ), Slot = Reader.ReadInt32( ), Durabillty = Reader.ReadUInt16( ), RemainTime = Reader.ReadUInt16( ) }); } } #endregion #region RidingItems { Count = Reader.ReadInt32( ); for (int i = 0; i < Count; i++) { RidingItems.Add(new CharItem( ) { Model = Reader.ReadUInt16( ), Slot = Reader.ReadInt32( ), Durabillty = Reader.ReadUInt16( ), RemainTime = Reader.ReadUInt16( ) }); } } #endregion #region InitItems { uint ID = 0; foreach (CharItem x in ClothesItems) { x.ID = ++ID; } foreach (CharItem x in GeneralItems) { x.ID = ++ID; } } #endregion Reader.Close( ); }
public static NPC IsNPC(Player player, Point Pos) { int PlayerMapIndex = Maps.MapsData.Find(player.CharData.Map); if (PlayerMapIndex == -1) return null; Map PlayerMap = Maps.MapsData[PlayerMapIndex]; foreach (NPC x in PlayerMap.NPCs) { if (x.Pos == Pos) return x; } return null; }