so plz HELP ME as I cannot login to the game cuz of dis damm error >.>...
LoadCharacter(MINE-ORIGINAL):
Code:
public static Game.Character LoadCharacter(string Name, ref string Account)
{
try
{
Game.Character C = new NewestCOServer.Game.Character();
if (File.Exists(@"C:\OldCODB\Users\Characters\" + Name + ".chr"))
{
FileStream FS = new FileStream(@"C:\OldCODB\Users\Characters\" + Name + ".chr", FileMode.Open);
BinaryReader BR = new BinaryReader(FS);
C.Name = Name;
Account = BR.ReadString();
C.EntityID = BR.ReadUInt32();
C.Avatar = BR.ReadUInt16();
C.Body = BR.ReadUInt16();
C.Hair = BR.ReadUInt16();
C.Loc = new NewestCOServer.Game.Location();
C.Loc.Map = BR.ReadUInt16();
C.Loc.X = BR.ReadUInt16();
C.Loc.Y = BR.ReadUInt16();
C.Loc.PreviousMap = BR.ReadUInt16();
C.Job = BR.ReadByte();
C.PreviousJob1 = BR.ReadByte();
C.Level = BR.ReadByte();
C.Experience = BR.ReadUInt64();
C.Str = BR.ReadUInt16();
C.Agi = BR.ReadUInt16();
C.Vit = BR.ReadUInt16();
C.Spi = BR.ReadUInt16();
C.StatPoints = BR.ReadUInt16();
C.CurHP = BR.ReadUInt16();
C.CurMP = BR.ReadUInt16();
C.Nobility.Donation = BR.ReadUInt64();
C.Nobility.ListPlace = -1;
if (C.Nobility.Donation >= 3000000)
{
C.Nobility.ListPlace = 50;
for (int i = 49; i >= 0; i--)
{
if (C.Nobility.Donation >= Game.World.EmpireBoard[i].Donation)
C.Nobility.ListPlace--;
}
if (C.Nobility.ListPlace < 50)
{
if (C.Nobility.Donation >= 30000000 && C.Nobility.Donation <= 100000000)
C.Nobility.Rank = Game.Ranks.Knight;
else if (C.Nobility.Donation >= 100000000 && C.Nobility.Donation <= 200000000)
C.Nobility.Rank = Game.Ranks.Baron;
else if (C.Nobility.Donation >= 200000000 && C.Nobility.Donation <= 300000000)
C.Nobility.Rank = Game.Ranks.Earl;
else if (C.Nobility.ListPlace >= 15 && C.Nobility.ListPlace <= 50)
C.Nobility.Rank = Game.Ranks.Duke;
else if (C.Nobility.ListPlace >= 3 && C.Nobility.ListPlace <= 15)
C.Nobility.Rank = Game.Ranks.Prince;
else if (C.Nobility.ListPlace <= 3)
C.Nobility.Rank = Game.Ranks.King;
}
}
C.Silvers = BR.ReadUInt32();
C.CPs = BR.ReadUInt32();
C.WHSilvers = BR.ReadUInt32();
C.VP = BR.ReadUInt64();
C.PKPoints = BR.ReadUInt16();
ushort GID = BR.ReadUInt16();
if (Features.Guilds.AllTheGuilds.Contains(GID))
{
C.MyGuild = (Features.Guild)Features.Guilds.AllTheGuilds[GID];
uint Don = BR.ReadUInt32(); ;
byte GR = BR.ReadByte();
if (((Hashtable)C.MyGuild.Members[GR]).Contains(C.EntityID))
{
C.GuildDonation = Don;
C.GuildRank = (Features.GuildRank)GR;
C.MembInfo = (Features.MemberInfo)((Hashtable)C.MyGuild.Members[GR])[C.EntityID];
C.MembInfo.Level = C.Level;
C.GuildDonation = C.MembInfo.Donation;
C.GuildRank = C.MembInfo.Rank;
}
else
C.MyGuild = null;
}
else BR.ReadBytes(5);
C.Equips = new NewestCOServer.Game.Equipment();
C.Equips.ReadThis(BR);
C.Inventory = new ArrayList(40);
byte InventoryCount = BR.ReadByte();
for (byte i = 0; i < InventoryCount; i++)
{
Game.Item I = new NewestCOServer.Game.Item();
I.ReadThis(BR);
C.Inventory.Add(I);
}
C.Warehouses = new NewestCOServer.Game.Banks();
C.Warehouses.ReadThis(BR);
C.Skills = new Hashtable();
byte SkillCount = BR.ReadByte();
for (byte i = 0; i < SkillCount; i++)
{
Game.Skill S = new NewestCOServer.Game.Skill();
S.ReadThis(BR);
C.Skills.Add(S.ID, S);
if (S.ID == 3060)
C.CanReflect = true;
}
C.Profs = new Hashtable();
byte ProfCount = BR.ReadByte();
for (byte i = 0; i < ProfCount; i++)
{
Game.Prof P = new NewestCOServer.Game.Prof();
P.ReadThis(BR);
if (!C.Profs.Contains(P.ID))
C.Profs.Add(P.ID, P);
}
C.Friends = new Hashtable();
byte FriendCount = BR.ReadByte();
for (byte i = 0; i < FriendCount; i++)
{
Game.Friend F = new NewestCOServer.Game.Friend();
F.ReadThis(BR);
if (!C.Friends.Contains(F.UID))
C.Friends.Add(F.UID, F);
}
C.Enemies = new Hashtable();
byte EnemyCount = BR.ReadByte();
for (byte i = 0; i < EnemyCount; i++)
{
Game.Enemy E = new NewestCOServer.Game.Enemy();
E.ReadThis(BR);
if (!C.Enemies.Contains(E.UID))
C.Enemies.Add(E.UID, E);
}
try
{
C.DoubleExp = BR.ReadBoolean();
C.DoubleExpLeft = BR.ReadInt32();
C.BlessingLasts = BR.ReadInt32();
C.BlessingStarted = DateTime.FromBinary(BR.ReadInt64());
C.LuckyTime = BR.ReadUInt32();
C.ExpBallsUsedToday = BR.ReadByte();
C.Reborns = BR.ReadByte();
C.Merchant = (NewestCOServer.Game.MerchantTypes)BR.ReadByte();
C.VipLevel = BR.ReadByte();
try
{
C.LastLogin = DateTime.FromBinary(BR.ReadInt64());
}
catch { C.LastLogin = DateTime.Now; }
C.TrainTimeLeft = BR.ReadUInt16();
C.InOTG = BR.ReadBoolean();
C.LotteryUsed = BR.ReadByte();
try
{
C.WHPassword = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
if (!C.MyClient.ValidWHPass(C.WHPassword))
C.WHPassword = "0";
}
catch { C.WHPassword = "0"; C.UniversityPoints = 0; }
try
{
C.Spouse = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
C.UniversityPoints = BR.ReadUInt32();
}
catch
{
C.VipLevel = 0;
C.ExpBallsUsedToday = 0;
C.LotteryUsed = 0;
C.TrainTimeLeft = 0;
C.InOTG = false;
C.LotteryUsed = 0;
C.WHPassword = "0";
C.Spouse = "None";
C.UniversityPoints = 0;
}
LoadFlowerRank(Name);
}
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
FS.Flush();
BR.Close();
FS.Close();
C.Loaded = true;
}
return C;
}
catch (Exception Exc) { Console.WriteLine(Exc); return null; }
}
Code:
public void ReadThis(System.IO.BinaryReader BR)
{
TCWarehouse = new ArrayList(20);
byte Count = BR.ReadByte();
for (byte i = 0; i < Count; i++)
{
Item I = new Item();
I.ReadThis(BR);
if (I.ID != 0)
TCWarehouse.Add(I);
}
PCWarehouse = new ArrayList(20);
Count = BR.ReadByte();
for (byte i = 0; i < Count; i++)
{
Item I = new Item();
I.ReadThis(BR);
if (I.ID != 0)
PCWarehouse.Add(I);
}
ACWarehouse = new ArrayList(20);
Count = BR.ReadByte();
for (byte i = 0; i < Count; i++)
{
Item I = new Item();
I.ReadThis(BR);
if (I.ID != 0)
ACWarehouse.Add(I);
}
DCWarehouse = new ArrayList(20);
Count = BR.ReadByte();
for (byte i = 0; i < Count; i++)
{
Item I = new Item();
I.ReadThis(BR);
if (I.ID != 0)
DCWarehouse.Add(I);
}
BIWarehouse = new ArrayList(20);
Count = BR.ReadByte();
for (byte i = 0; i < Count; i++)
{
Item I = new Item();
I.ReadThis(BR);
if (I.ID != 0)
BIWarehouse.Add(I);
}
MAWarehouse = new ArrayList(20);
Count = BR.ReadByte();
for (byte i = 0; i < Count; i++)
{
Item I = new Item();
I.ReadThis(BR);
if (I.ID != 0)
MAWarehouse.Add(I);
}
}
}
3rd and last error:
Code:
public void ReadThis(System.IO.BinaryReader I)
{
byte Length = I.ReadByte();
if (Length == 25)
{
UID = I.ReadUInt32();
if (UID == 0) UID = (uint)Program.Rnd.Next(10000000);
if (UID == 0) UID = (uint)World.Rnd.Next(10000000);
ID = I.ReadUInt32();
if (Database.DatabaseItems.Contains(ID))
{
Plus = I.ReadByte();
Bless = I.ReadByte();
Enchant = I.ReadByte();
Soc1 = (Gem)I.ReadByte();
Soc2 = (Gem)I.ReadByte();
MaxDur = I.ReadUInt16();
CurDur = I.ReadUInt16();
FreeItem = I.ReadBoolean();
TalismanProgress = I.ReadUInt32();
Progress = I.ReadUInt16();
Color = (ArmorColor)I.ReadByte();
}
else
{
UID = 0;
ID = 0;
I.ReadBytes(17);
}
}
else I.ReadBytes(Length);
}
}
public enum Ranks : byte { Serf = 0, Knight = 1, Baron = 3, Earl = 5, Duke = 7, Prince = 9, King = 12 }
PLZ HELP =D!!!btw they all have to do with " unable to read beyond end of stream" something like dat...






