Register for your free account! | Forgot your password?

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

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

Advertisement



[HELP]ini files for npcs

Discussion on [HELP]ini files for npcs within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
taylor2846's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 469
Received Thanks: 94
[HELP]ini files for items

Ty for your all help

how wold i setup for items??
taylor2846 is offline  
Old 11/10/2008, 01:10   #2
 
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
Code:
    
    public static void LoadNPCs()
        {
            try
            {
                string[] ENpc = File.ReadAllLines(System.Windows.Forms.Application.StartupPath + @"\gets\npcs.ini");
                NPCs = new uint[ENpc.Length][];
                for (int ik = 0; ik < ENpc.Length; ik++)
                {
                    string[] a = ENpc[ik].Split('#');
                    NPCs[ik] = new uint[8] { uint.Parse(a[0]), uint.Parse(a[1]), uint.Parse(a[3]), uint.Parse(a[4]), uint.Parse(a[5]), uint.Parse(a[6]), uint.Parse(a[7]), uint.Parse(a[8]) };
                }
                Console.Write("NPCs Loaded from DataBase: " + ENpc.Length + "\n");
                passednpcs = true;
            }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); passednpcs = false; }
        }
the thing i`m using.
Attached Files
File Type: rar npcs.rar (6.6 KB, 23 views)
alexbigfoot is offline  
Old 11/10/2008, 01:26   #3
 
taylor2846's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 469
Received Thanks: 94
ty dude i was just aking for help but this works and saves me lots of time so ty dude no im gona go start working on the rest of my files to ini files
taylor2846 is offline  
Old 11/10/2008, 01:36   #4
 
© Haydz's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 1,042
Received Thanks: 252
Code:
 
public static string LoadNpcs
        {
            get
            {
                string[] StrDelimiter = File.ReadAllLines(DBFolder + "\\Npc\\Spawns.txt");
                Npcs = new ConquerNpc[StrDelimiter.Length];
                for (uint i = 0; i < StrDelimiter.Length; i++)
                    Npcs[i] = ConquerNpc.Parse(StrDelimiter[i]);
                return string.Format("\tLoaded {0} Npcs.", Npcs.Length);
            }
        }
Haydz wins?
© Haydz is offline  
Old 11/10/2008, 05:07   #5
 
taguro's Avatar
 
elite*gold: 0
Join Date: Jun 2007
Posts: 387
Received Thanks: 64
Actually, the way LOTF handles the NPC's is probably the most efficient. MYSQL only made the server unstable when it was required to keep an active connection to the server at all times. As players made changes to characters, the way the MYSQL connection was coded, the more unstable the server became. This was the source of the login error. C# reads from a MYSQL database faster than from flat files(most of the time, depending on the coding and the coder...), and in LOTF loading all non-changing entities from the MYSQL database increased the speed of the loading, and reduced overall memory usage. If your going to use flat files, you should only convert the characters, accounts, guilds, and friends to text files. This is strictly a personal opinion, as others may and will have different views, but I believe this is the most efficient way to write a server source.
taguro is offline  
Old 11/10/2008, 09:05   #6
 
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
Quote:
Originally Posted by © Haydz View Post
Code:
 
public static string LoadNpcs
        {
            get
            {
                string[] StrDelimiter = File.ReadAllLines(DBFolder + "\\Npc\\Spawns.txt");
                Npcs = new ConquerNpc[StrDelimiter.Length];
                for (uint i = 0; i < StrDelimiter.Length; i++)
                    Npcs[i] = ConquerNpc.Parse(StrDelimiter[i]);
                return string.Format("\tLoaded {0} Npcs.", Npcs.Length);
            }
        }
Haydz wins?
probabily , after all, i`m not a genius
alexbigfoot is offline  
Old 11/10/2008, 13:25   #7
 
elite*gold: 0
Join Date: Feb 2008
Posts: 1,590
Received Thanks: 154
I intend to use .txt and .ini files for my new source the whole way through .

But from the looks of the first post it reads 1 value from each key and does nothing? Wtf? ._.
tao4229 is offline  
Old 11/10/2008, 14:59   #8


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by © Haydz View Post
Code:
 
public static string LoadNpcs
        {
            get
            {
                string[] StrDelimiter = File.ReadAllLines(DBFolder + "\\Npc\\Spawns.txt");
                Npcs = new ConquerNpc[StrDelimiter.Length];
                for (uint i = 0; i < StrDelimiter.Length; i++)
                    Npcs[i] = ConquerNpc.Parse(StrDelimiter[i]);
                return string.Format("\tLoaded {0} Npcs.", Npcs.Length);
            }
        }
Haydz wins?
Not really, your still using strings at the end of the day which requires alot more processing...so no.
Korvacs is offline  
Old 11/10/2008, 15:45   #9
 
Ultimatum's Avatar
 
elite*gold: 0
Join Date: Feb 2008
Posts: 277
Received Thanks: 52
Quote:
public static void LoadNpcs()
{
string[] NPCFile = File.ReadAllLines(DB + "\\Instance\\NPC.txt");
foreach (string Content in NPCFile)
{
string[] NPCArray = Content.Split(' ');
NPCInstance Npc = new NPCInstance();
Npc.UID = Convert.ToUInt32(NPCArray[0]);
Npc.ID = Convert.ToUInt32(NPCArray[1]);
Npc.PosX = Convert.ToUInt16(NPCArray[2]);
Npc.PosY = Convert.ToUInt16(NPCArray[3]);
Npc.Type = Convert.ToUInt16(NPCArray[4]);
Npc.Direction = Convert.ToUInt16(NPCArray[5]);
Npc.Flag = Convert.ToUInt32(NPCArray[6]);
Npc.MapID = Convert.ToUInt16(NPCArray[7]);
SpawnNPCPack Spawn = new SpawnNPCPack();
Spawn.Npc = Npc;
Spawn.BuildPacket();
Spawn.SpawnNPCPack = Spawn.PacketData;
World.AllNpcs.Add(Npc.UID, Npc);
}
}
A bit like haydz ;D
Ultimatum is offline  
Old 11/10/2008, 16:34   #10
 
elite*gold: 0
Join Date: Feb 2008
Posts: 668
Received Thanks: 160
I can't equip any items anymore =( Someone knows how comes? ( I'm using Ini's )
YukiXian is offline  
Old 11/10/2008, 16:51   #11
 
© Haydz's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 1,042
Received Thanks: 252
Quote:
Originally Posted by Korvacs View Post
Not really, your still using strings at the end of the day which requires alot more processing...so no.
The competion was between the other 2 pieces of code.
© Haydz is offline  
Old 11/10/2008, 20:34   #12
 
elite*gold: 0
Join Date: Feb 2008
Posts: 668
Received Thanks: 160
Quote:
Originally Posted by YukiXian View Post
I can't equip any items anymore =( Someone knows how comes? ( I'm using Ini's )
*Edit : Found out my Source doesn't load my Ini items. how to load them?
I'f got this :
Code:
public static void LoadItems()
        {
            string[] Item = File.ReadAllLines(System.Windows.Forms.Application.StartupPath + @"\Others\AllItems.ini");
            DBItems = new string[Item.Length][];

            for (int i = 0; i < Item.Length; i++)
            {
                string[] Splitter = Item[i].Split('-');
                //Items[i] = new uint[15] { uint.Parse(Splitter[0]), uint.Parse(Splitter[1]), uint.Parse(Splitter[2]), uint.Parse(Splitter[3]), uint.Parse(Splitter[4]), uint.Parse(Splitter[5]), uint.Parse(Splitter[6]), uint.Parse(Splitter[7]), uint.Parse(Splitter[8]), uint.Parse(Splitter[9]), uint.Parse(Splitter[10]), uint.Parse(Splitter[11]), uint.Parse(Splitter[12]), uint.Parse(Splitter[13]), uint.Parse(Splitter[14]), uint.Parse(Splitter[15]) };
                DBItems[i] = new string[16] { Splitter[0], Splitter[1], uint.Parse(Splitter[2]), uint.Parse(Splitter[3]), uint.Parse(Splitter[4]), uint.Parse(Splitter[5]), uint.Parse(Splitter[6]), uint.Parse(Splitter[7]), uint.Parse(Splitter[8]), uint.Parse(Splitter[9]), uint.Parse(Splitter[10]), uint.Parse(Splitter[11]), uint.Parse(Splitter[12]), uint.Parse(Splitter[13]), uint.Parse(Splitter[14]), uint.Parse(Splitter[15]) };
            }
            Console.WriteLine("Loaded all items.");
YukiXian is offline  
Reply


Similar Threads Similar Threads
Fling mount data base files and sever files
03/07/2010 - EO PServer Hosting - 15 Replies
well i think i have found the flying mounts so if u guys want to have a look here is the link for u to download the database files and all the other stuff u need for it Free File Hosting Made Simple - MediaFire Cerdits to 4fcom Good luck



All times are GMT +1. The time now is 11:13.


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.