Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 10:37

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Help]Saving Halos (in OldCODB)

Discussion on [Help]Saving Halos (in OldCODB) within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
Post [Help]Saving Halos (in OldCODB)

okay so my plan is to save the Halos (i assume you all know what that is) in OldCODB same as the other things such as, Nobility. Nobility saves the names of people inside the Nobility.dat in OldCODB. So I found out where it sends the info save to OldCODB which is in Database.cs. So I'm trying to make something similar to saving Halos. (so that when you log out it gets saved so that when you re-log you still have it.)

So I'm taking this as an example. But I noticed It's only 1 of these (starting with public static void, sorry if i don't use C# Words lol i'm still learning)
Code:
        }
        public static void SaveKOs()
        {
            FileStream FS = new FileStream(@"C:\OldCODB\KOBoard.dat", FileMode.OpenOrCreate);
            BinaryWriter BW = new BinaryWriter(FS);

            for (int i = 0; i < Game.World.KOBoard.Length; i++)
                Game.World.KOBoard[i].WriteThis(BW);

            BW.Close();
            FS.Close();
        }

And so then I look at the Nobility and then it has SaveEmpire and LoadEmpire. So, I'm assuming that it means that it saves the Nobility rank and then when you login it loads it right? How can I do this for the Halos? (sorry if I've confused you).
Code:
        public static void SaveEmpire()
        {
            FileStream FS = new FileStream(@"C:\OldCODB\Nobility.dat", FileMode.OpenOrCreate);
            BinaryWriter BW = new BinaryWriter(FS);

            for (int i = 0; i < Game.World.EmpireBoard.Length; i++)
                Game.World.EmpireBoard[i].WriteThis(BW);

            BW.Close();
            FS.Close();
        }
        public static void LoadEmpire()
        {
            if (System.IO.File.Exists(@"C:\OldCODB\Nobility.dat"))
            {
                FileStream FS = new FileStream(@"C:\OldCODB\Nobility.dat", FileMode.Open);
                BinaryReader BR = new BinaryReader(FS);

                for (int i = 0; i < Game.World.EmpireBoard.Length; i++)
                    Game.World.EmpireBoard[i].ReadThis(BR);
                BR.Close();
                FS.Close();
            }



#edit- To make things easier, this is what I have to make a "definition" or w\e for right?

Code:
                for (int i = 0; i < Game.World.[B]Halo[/B].Length; i++)
                    Game.World.[B]HaloBoard[/B][i].ReadThis(BR);
This is the one I'm trying to make, I took it as an example for Nobility's SaveEmpire:

Code:
            for (int i = 0; i < Game.World.[B]EmpireBoard[/B].Length; i++)
                Game.World.[B]EmpireBoard[/B][i].WriteThis(BW);
copz1337 is offline  
Old 01/19/2010, 01:06   #2
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,383
Ok so the database looks approximately right (I've not really done much with I/O from text/dat files but it looks correct)

You will then need something to assign characters their correct halo (look at how nobility is loaded!)

I would think (I don't know) that the easiest way to do it would be: Assign an arbitrary number to each halo for example

1 = top guild
2 = top dep
3 = top troj
etcetcetc

then save/load those values from your .dat file and use the switch statement to control if a player gets a halo or not.. the problem with that is, unless you do some more serious coding, it will only save 1 halo per character (not a problem if you are just doing top class... but still)

You could also have a different database field (separated entries if you are using a .dat format) structured in a way to use 1/0 as true/false to control if a player has a specific halo or not... that would require a bit more string manipulation while loading them and (in my mind any way) may turn out messier but would work just fine.


Anyways back on topic: You need to actually assign the halo to a player when they log in, much like you do with nobility.

Game.World.EmpireBoard[i].ReadThis(BR);

Looks like that is assigning the imported information to some sort of data structure located at Game.World.EmpireBoard. I'd take a peek at how that data is handled through the source and work from there.

Sorry I can't help more. Again, I don't use lotf.
pro4never is offline  
Old 01/19/2010, 01:10   #3
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
Quote:
Originally Posted by pro4never View Post
Ok so the database looks approximately right (I've not really done much with I/O from text/dat files but it looks correct)

You will then need something to assign characters their correct halo (look at how nobility is loaded!)

I would think (I don't know) that the easiest way to do it would be: Assign an arbitrary number to each halo for example

1 = top guild
2 = top dep
3 = top troj
etcetcetc

then save/load those values from your .dat file and use the switch statement to control if a player gets a halo or not.. the problem with that is, unless you do some more serious coding, it will only save 1 halo per character (not a problem if you are just doing top class... but still)

You could also have a different database field (separated entries if you are using a .dat format) structured in a way to use 1/0 as true/false to control if a player has a specific halo or not... that would require a bit more string manipulation while loading them and (in my mind any way) may turn out messier but would work just fine.


Anyways back on topic: You need to actually assign the halo to a player when they log in, much like you do with nobility.

Game.World.EmpireBoard[i].ReadThis(BR);

Looks like that is assigning the imported information to some sort of data structure located at Game.World.EmpireBoard. I'd take a peek at how that data is handled through the source and work from there.

Sorry I can't help more. Again, I don't use lotf.
Lol I don't think I can pull this off. Might just give up... but I'll have a look. Ty.
copz1337 is offline  
Old 01/19/2010, 01:21   #4


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by pro4never View Post
then save/load those values from your .dat file and use the switch statement to control if a player gets a halo or not.. the problem with that is, unless you do some more serious coding, it will only save 1 halo per character (not a problem if you are just doing top class... but still)

You could also have a different database field (separated entries if you are using a .dat format) structured in a way to use 1/0 as true/false to control if a player has a specific halo or not... that would require a bit more string manipulation while loading them and (in my mind any way) may turn out messier but would work just fine.
Well, a player can only have one halo active at one time, so that makes things easier. A suggestion i have would be to use a Flag system (similar to player status, bluename/redname/blackname/dead/ghost etc) to determine which halos your entitled too, then the npcs would just need to check if the player has claimed a halo, and to do this you would just need to check the flag.
Korvacs is offline  
Old 01/19/2010, 02:08   #5
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,383
Quote:
Originally Posted by Korvacs View Post
Well, a player can only have one halo active at one time, so that makes things easier. A suggestion i have would be to use a Flag system (similar to player status, bluename/redname/blackname/dead/ghost etc) to determine which halos your entitled too, then the npcs would just need to check if the player has claimed a halo, and to do this you would just need to check the flag.
But wouldn't non top-class halo be overwritten by other types such as top pk tournament, top guild/dep, etc?

Not a big deal really, just something that I thought could pose a problem if you were doing a simple switch statement.
pro4never is offline  
Old 01/19/2010, 02:12   #6


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by pro4never View Post
But wouldn't non top-class halo be overwritten by other types such as top pk tournament, top guild/dep, etc?

Not a big deal really, just something that I thought could pose a problem if you were doing a simple switch statement.
Thats the good thing about Flags, you can have 10 things turned on if you want, you just have to choose which you want, or which get priority over others.

In official conquer you can only store one active halo at a time anyway, so i would create 2 fields, one for flags, and anouther for the active one. So that you can go back to the npcs and switch your halos around if you want to use a different one on a different day.
Korvacs is offline  
Old 01/19/2010, 02:22   #7
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
I definitely won't be able to do this.
copz1337 is offline  
Reply


Similar Threads Similar Threads
[Help] Explaining npc code in oldcodb (npc.txt) + how to delete npcs
02/05/2012 - CO2 Private Server - 5 Replies
Can anyone help explain to me the code in npc.txt in OLDCODB These are how some of the codes appear: 4 40 1 0 1002 412 366 423 2706 1 0 1002 412 361 44 87 3 0 1036 182 180 185 1086 16 0 1036 230 173 184 1086 16 0 1036 230 177
[Exclusive]Fixed Source 5165 reed D:\OldCODB Rather than C:\OldCODB and more
12/07/2010 - CO2 PServer Guides & Releases - 48 Replies
this aFixed Source of Patch 5165 not ma work it's bk to Korolos I just make it reed D:\OldCODB Rather than C:\OldCODB Better in ? -Ninja 100 % Work -Steeds System 100 % Work -3rd Rebrith -4th Rebrith -New NPC 100 % work
[Request]Npc's.txt from OLDCODB!
11/30/2009 - CO2 Private Server - 4 Replies
Hey alll , anyone have Npc's.txt with ALL NPC ADDED PLZ? because when I add npcs my srv give error..:) Thanks



All times are GMT +1. The time now is 10:37.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.