|
You last visited: Today at 12:28
Advertisement
[HELP PLEASE!] <------
Discussion on [HELP PLEASE!] <------ within the CO2 Private Server forum part of the Conquer Online 2 category.
03/02/2010, 03:17
|
#1
|
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
|
[HELP PLEASE!] <------
ok so I make a new account and SOMEHOW they start with kings rank and like 23k+ attrbiute points IDK wtf did I touch to make dis happen...can sum1 tell me wtf did I touch lol? becuz I fixed my source GREATLY today with alot of updates and the ONLY problem i get is that...
SO PLEASE HELP ME!
|
|
|
03/02/2010, 03:18
|
#2
|
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
|
Your CreateCharacter/SaveCharacter/LoadCharacter values are out of line, try checking them.
|
|
|
03/02/2010, 03:21
|
#3
|
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
|
Quote:
Originally Posted by walmartboi
Your CreateCharacter/SaveCharacter/LoadCharacter values are out of line, try checking them.
|
here are my CreateCharacter/LoadCharacter/SaveCharacter voids...
Create character:
Code:
public static string CreateCharacter(string Account, string Name, ushort Body, byte Job)
{
try
{
if (File.Exists(@"C:\OldCODB\Users\" + Account + ".usr") && !File.Exists(@"C:\OldCODB\Users\Characters\" + Name + ".chr"))
{
try
{
FileStream FS = new FileStream(@"C:\OldCODB\Users\Characters\" + Name + ".chr", FileMode.CreateNew);
BinaryWriter BW = new BinaryWriter(FS);
BW.Write(Account);
BW.Write((uint)Program.Rnd.Next(1000001, 19999999));
if (Body == 1003 || Body == 1004)
BW.Write((ushort)1);//Avatar
else
BW.Write((ushort)201);//Avatar
BW.Write(Body);
BW.Write((ushort)(410 + (Program.Rnd.Next(5) * 100)));//Hair
BW.Write((ushort)1010);//Map
BW.Write((ushort)61);//X
BW.Write((ushort)109);//Y
BW.Write((ushort)0);//Previous Map
BW.Write(Job);
BW.Write((byte)0);//Previous Job, 1st RB
BW.Write((byte)1);//Level
BW.Write((ulong)0);//Experience
ushort Str = 0,Agi = 0, Vit = 0, Spi = 0;
GetInitialStats(Job, ref Str, ref Agi, ref Vit, ref Spi);
BW.Write(Str);
BW.Write(Agi);
BW.Write(Vit);
BW.Write(Spi);
BW.Write((ushort)0);//Stat Points
ushort HP = (ushort)(Vit * 24 + Str * 3 + Agi * 3 + Spi * 3);
BW.Write(HP);
BW.Write((ushort)(Spi * 5));//MP
BW.Write((ulong)0);//Donation
BW.Write((uint)100);//Silvers
BW.Write((uint)0);//CPs
BW.Write((uint)0);//Warehouse Silvers
BW.Write((ulong)0);//Virtue Points
BW.Write((ushort)0);//PK Points
BW.Write((ushort)0);//Guild
BW.Write((uint)0);//Guild Donation
BW.Write((byte)0);//Guild Rank
Game.Equipment Eq = new NewestCOServer.Game.Equipment();
Eq.Open();
Eq.WriteThis(BW);
BW.Write((byte)5);//Inventory Count
#region Beginner Items
if (Job == 100)
{
Game.Item I = new NewestCOServer.Game.Item();
I.ID = 421301;
I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)421301]).Durability;
I.CurDur = I.MaxDur;
I.UID = (uint)Program.Rnd.Next(10000000);
I.WriteThis(BW);
}
else if (Job == 50)
{
Game.Item I = new NewestCOServer.Game.Item();
I.ID = 601301;
I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)601301]).Durability;
I.CurDur = I.MaxDur;
I.UID = (uint)Program.Rnd.Next(10000000);
I.WriteThis(BW);
}
else
{
Game.Item I = new NewestCOServer.Game.Item();
I.ID = 410301;
I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)410301]).Durability;
I.CurDur = I.MaxDur;
I.UID = (uint)Program.Rnd.Next(10000000);
I.WriteThis(BW);
}
Game.Item Armor = new NewestCOServer.Game.Item();
Armor.ID = 132004;
Armor.Color = (Game.Item.ArmorColor)(Program.Rnd.Next(3, 9));
Armor.MaxDur = ((DatabaseItem)DatabaseItems[(uint)132004]).Durability;
Armor.CurDur = Armor.MaxDur;
Armor.UID = (uint)Program.Rnd.Next(10000000);
Armor.WriteThis(BW);
Game.Item Stancher = new NewestCOServer.Game.Item();
Stancher.ID = 1000000;
Stancher.UID = (uint)Program.Rnd.Next(10000000);
Stancher.WriteThis(BW);
Stancher.UID = (uint)Program.Rnd.Next(10000000);
Stancher.WriteThis(BW);
Stancher.UID = (uint)Program.Rnd.Next(10000000);
Stancher.WriteThis(BW);
#endregion
for (int n = 0; n < 5; n++)
{
BW.Write((byte)0);//WH[n] Count
//Warehouse[n]
}
BW.Write((byte)0);//WH[5] Count
//Warehouse[5]
BW.Write((byte)0);//Prof Count
if (Job != 100)
BW.Write((byte)0);//SkillCount
else
{
BW.Write((byte)2);//SkillCount
Game.Skill S = new Game.Skill() { ID = 1000 };
S.WriteThis(BW);
S = new Game.Skill() { ID = 1005 };
S.WriteThis(BW);
}
BW.Write((byte)0);//Friend Count
BW.Write((byte)0);//Enemy Count
BW.Write(false);
BW.Write((int)0);
BW.Write((int)0);
BW.Write((long)0);
BW.Write((int)0);
BW.Write((byte)0);
BW.Write((byte)0);
BW.Write((byte)1);//Merchant
BW.Write(0);//
BW.Write(DateTime.Now.Ticks);
BW.Write((ushort)0);
BW.Write(false);
BW.Write((byte)0);//lottery uses today
BW.Write((byte)0);
BW.Write("0");//WH Pass
BW.Write("None");//Spouse Name
BW.Write((uint)0);//Quiz Pts
BW.Flush();
FS.Flush();
BW.Close();
FS.Close();
FS = new FileStream(@"C:\OldCODB\Users\" + Account + ".usr", FileMode.Append);
BW = new BinaryWriter(FS);
BW.Write((byte)Name.Length);
BW.Write(Encoding.ASCII.GetBytes(Name));
BW.Flush();
FS.Flush();
BW.Close();
FS.Close();
Game.Character C = LoadCharacter(Name, ref Account);
if (C != null)
{
C.UniversityPoints = 0;
SaveCharacter(C, Account);
}
}
catch { return "Error! Try again."; }
return "ANSWER_OK";
}
return "Error: Character already exists!";
}
catch (Exception Exc) { Console.WriteLine(Exc); return "Failed to create the character."; }
}
}
LoadCharacter:
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.PreviousJob2 = 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; }
}
and my SaveCharacter:
Code:
public static void SaveCharacter(Game.Character C, string Acc)
{
try
{
FileStream FS = new FileStream(@"C:\OldCODB\Users\Characters\" + C.Name + ".chr", FileMode.Open);
BinaryWriter BW = new BinaryWriter(FS);
int DoubleExp = C.DoubleExpLeft;
if (C.DoubleExp)
DoubleExp -= (int)(DateTime.Now - C.ExpPotionUsed).TotalSeconds;
BW.Write(Acc);
BW.Write(C.EntityID);
BW.Write(C.Avatar);
BW.Write(C.Body);
BW.Write(C.Hair);//Hair
BW.Write(C.Loc.Map);//Map
BW.Write(C.Loc.X);//X
BW.Write(C.Loc.Y);//Y
BW.Write(C.Loc.PreviousMap);//Previous Map
BW.Write(C.Job);
BW.Write(C.PreviousJob1);//Previous Job, 1st RB
BW.Write(C.PreviousJob2);
BW.Write(C.Level);//Level
BW.Write(C.Experience);//Experience
BW.Write(C.Str);
BW.Write(C.Agi);
BW.Write(C.Vit);
BW.Write(C.Spi);
BW.Write(C.StatPoints);//Stat Points
BW.Write(C.CurHP);
BW.Write(C.CurMP);//MP
BW.Write(C.Nobility.Donation);
BW.Write(C.Silvers);//Silvers
BW.Write(C.CPs);
BW.Write(C.WHSilvers);//Warehouse Silvers
BW.Write(C.VP);//Virtue Points
BW.Write(C.PKPoints);//PK Points
if (C.MyGuild != null)
{
BW.Write(C.MyGuild.GuildID);//Guild
BW.Write(C.GuildDonation);//Guild Donation
BW.Write((byte)C.GuildRank);//Guild Rank
}
else BW.Write(new byte[7]);
C.Equips.WriteThis(BW);
BW.Write((byte)C.Inventory.Count);
foreach (Game.Item I in C.Inventory)
I.WriteThis(BW);
C.Warehouses.WriteThis(BW);
BW.Write((byte)C.Skills.Count);
foreach (Game.Skill I in C.Skills.Values)
I.WriteThis(BW);
BW.Write((byte)C.Profs.Count);
foreach (Game.Prof I in C.Profs.Values)
I.WriteThis(BW);
BW.Write((byte)C.Friends.Count);
foreach (Game.Friend I in C.Friends.Values)
I.WriteThis(BW);
BW.Write((byte)C.Enemies.Count);
foreach (Game.Enemy I in C.Enemies.Values)
I.WriteThis(BW);
BW.Write(C.DoubleExp);
BW.Write(DoubleExp);
BW.Write(C.BlessingLasts);
BW.Write(C.BlessingStarted.Ticks);
if (C.GettingLuckyTime)
{
if (!C.Prayer)
C.LuckyTime += (uint)(DateTime.Now - C.PrayDT).TotalSeconds;
else
C.LuckyTime += (uint)(DateTime.Now - C.PrayDT).TotalSeconds * 3;
C.PrayDT = DateTime.Now;
}
BW.Write(C.LuckyTime);
BW.Write(C.ExpBallsUsedToday);
BW.Write(C.Reborns);
BW.Write((byte)C.Merchant);//
BW.Write(C.VipLevel);//
BW.Write(DateTime.Now.Ticks);//When logged off, for otg feature purposes
BW.Write((ushort)(C.TrainTimeLeft + ((DateTime.Now - C.LoggedOn).TotalMinutes * 10)));//Train time left (in minutes)
BW.Write(C.InOTG);
BW.Write(C.LotteryUsed);
BW.Write(C.WHPassword);
BW.Write(C.Spouse);
BW.Write(C.UniversityPoints);//Quiz Pts
if (C.MyClient != null && C.MyClient.AuthInfo.Status != "[GM]" && C.MyClient.AuthInfo.Status != "[PM]")
{
if (C.WHSilvers + C.Silvers >= 50000000)
Console.WriteLine(C.Name + " has suspiciously much silvers: " + (C.WHSilvers + C.Silvers));
if (C.CPs >= 100000)
Console.WriteLine(C.Name + " has suspiciously much cps: " + C.CPs);
}
BW.Flush();
FS.Flush();
BW.Close();
FS.Close();
SaveFlowerRank(C);
}
catch (Exception Exc) { Console.WriteLine(Exc); }
}
can u tell anything from dat lol? Im a newb sorry...
|
|
|
03/02/2010, 03:27
|
#4
|
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
|
I'm too busy to read through it all, but just from skimming through it, it looks all fine, and since you haven't edited anything major, then it shouldn't be that(although you could of ****** SOMETHING up). lol.
|
|
|
03/02/2010, 03:31
|
#5
|
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
|
Quote:
Originally Posted by walmartboi
I'm too busy to read through it all, but just from skimming through it, it looks all fine, and since you haven't edited anything major, then it shouldn't be that(although you could of ****** SOMETHING up). lol.
|
dammm...sucks bro...maybe I added wrong things in there? I wish sum1 helps me wit dis tho since It will suck to new characters dat login...can't remember anything else I did...
|
|
|
03/02/2010, 03:35
|
#6
|
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
|
Quote:
Originally Posted by killersub
dammm...sucks bro...maybe I added wrong things in there? I wish sum1 helps me wit dis tho since It will suck to new characters dat login...can't remember anything else I did...
|
Just replace those voids from a stock 5165 source since you didn't do any major changing that I can see.
|
|
|
03/02/2010, 03:44
|
#7
|
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
|
Quote:
Originally Posted by walmartboi
Just replace those voids from a stock 5165 source since you didn't do any major changing that I can see.
|
I am using 12 tail's reflect code and .Arco's perfect rb code...I added a fresh new 3 voids and still does the same thing...btw I added the perfect rb code and the reflect code...does dat do anything?
|
|
|
03/02/2010, 03:46
|
#8
|
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
|
Well did you add the saving correctly for .Acro's RB Code? If you didn't add them right, it will get the whole loading sequence off track, giving your characters wrong values.(Which is why I hate flat file, and am currently transferring my source to SQL lol)
|
|
|
03/02/2010, 03:54
|
#9
|
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
|
Quote:
Originally Posted by walmartboi
Well did you add the saving correctly for .Acro's RB Code? If you didn't add them right, it will get the whole loading sequence off track, giving your characters wrong values.(Which is why I hate flat file, and am currently transferring my source to SQL lol)
|
I added what he said...I'm not that of a nub lol XD! anyways if u wanna hit me up on MSN or maybe tv me for help ur more then welcome to XD...
MSN:
I will giv u 1kkkk cookies if u do  ...
|
|
|
03/02/2010, 04:14
|
#10
|
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
|
Alright I added you
|
|
|
03/03/2010, 23:36
|
#11
|
elite*gold: 0
Join Date: Dec 2009
Posts: 52
Received Thanks: 1
|
SQL is much more organized. Seeing as how the source and all of its codes are organized quite neatly I'm surprised they wouldnt have a Navitcat database in stead of this OldCODB ****
|
|
|
03/04/2010, 00:31
|
#12
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
|
BW.Write((byte)0);//lottery uses today
BW.Write((byte)0);
Try taking that out.
|
|
|
03/04/2010, 00:44
|
#13
|
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
|
Quote:
Originally Posted by .Arco
BW.Write((byte)0);//lottery uses today
BW.Write((byte)0);
Try taking that out.
|
BTW dats from ur perfect rb script u released o_0...
|
|
|
03/04/2010, 00:45
|
#14
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
|
Quote:
Originally Posted by killersub
BTW dats from ur perfect rb script u released o_0...
|
I know that, like I said before, that needs to be updated.
|
|
|
03/04/2010, 00:48
|
#15
|
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
|
Quote:
Originally Posted by .Arco
I know that, like I said before, that needs to be updated.
|
anything u say bro  ...Anyways I have fixed it  ...thnx
|
|
|
All times are GMT +1. The time now is 12:29.
|
|