Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 19:03

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

Advertisement



COPS v6 : Source & Tools [Custom Emulator]

Discussion on COPS v6 : Source & Tools [Custom Emulator] within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old 01/14/2020, 00:23   #166


 
CptSky's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,434
Received Thanks: 1,147
You could try that Ini implementation, it uses Nini (

Code:
// *
// * ******** COPS v6 Emulator - Open Source ********
// * Copyright (C) 2014 - 2015 Jean-Philippe Boivin
// *
// * Please read the WARNING, DISCLAIMER and PATENTS
// * sections in the LICENSE file.
// *

using System;
using System.IO;
using Nini.Ini;

namespace COServer
{
    /// <summary>
    /// INI parser.
    /// </summary>
    public class Ini : IDisposable
    {
        /// <summary>
        /// The Nini document.
        /// </summary>
        private IniDocument mDoc;
        /// <summary>
        /// The stream of the file.
        /// </summary>
        private Stream mStream;
        /// <summary>
        /// The text reader used by Nini.
        /// </summary>
        private TextReader mReader;

        /// <summary>
        /// Indicate whether or not the object is disposed.
        /// </summary>
        private bool mIsDisposed = false;

        /// <summary>
        /// Open the specified file with an INI reader.
        /// </summary>
        public Ini(String aPath)
        {
            mStream = new FileStream(aPath, FileMode.Open, FileAccess.Read, FileShare.Read);
            mReader = new StreamReader(mStream, Program.Encoding);
            mDoc = new IniDocument(mReader, IniFileType.WindowsStyle);
        }

        ~Ini()
        {
            Dispose(false);
        }

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing,
        /// or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing,
        /// or resetting unmanaged resources.
        /// </summary>
        protected virtual void Dispose(bool aDisposing)
        {
            if (!mIsDisposed)
            {
                if (aDisposing)
                {
                    if (mReader != null)
                        mReader.Dispose();
                    if (mStream != null)
                        mStream.Dispose();
                }

                mReader = null;
                mStream = null;

                mIsDisposed = true;
            }
        }

        /// <summary>
        /// Determine if the specified key exists in the section.
        /// </summary>
        public Boolean KeyExist(String aSection, String aKey)
        {
            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                return section.Contains(aKey);

            return false;
        }

        /// <summary>
        /// Read the value as a 8-bits signed integer.
        /// </summary>
        public SByte ReadInt8(String aSection, String aKey)
        {
            SByte value = 0;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                SByte.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 8-bits signed integer.
        /// </summary>
        public SByte ReadInt8(String aSection, String aKey, SByte aDefault)
        {
            SByte value = aDefault;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                SByte.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 8-bits unsigned integer.
        /// </summary>
        public Byte ReadUInt8(String aSection, String aKey)
        {
            Byte value = 0;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Byte.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 8-bits unsigned integer.
        /// </summary>
        public Byte ReadUInt8(String aSection, String aKey, Byte aDefault)
        {
            Byte value = aDefault;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Byte.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 16-bits signed integer.
        /// </summary>
        public Int16 ReadInt16(String aSection, String aKey)
        {
            Int16 value = 0;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Int16.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 16-bits signed integer.
        /// </summary>
        public Int16 ReadInt16(String aSection, String aKey, Int16 aDefault)
        {
            Int16 value = aDefault;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Int16.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 16-bits unsigned integer.
        /// </summary>
        public UInt16 ReadUInt16(String aSection, String aKey)
        {
            UInt16 value = 0;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                UInt16.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 16-bits unsigned integer.
        /// </summary>
        public UInt16 ReadUInt16(String aSection, String aKey, UInt16 aDefault)
        {
            UInt16 value = aDefault;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                UInt16.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 32-bits signed integer.
        /// </summary>
        public Int32 ReadInt32(String aSection, String aKey)
        {
            Int32 value = 0;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Int32.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 32-bits signed integer.
        /// </summary>
        public Int32 ReadInt32(String aSection, String aKey, Int32 aDefault)
        {
            Int32 value = aDefault;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Int32.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 32-bits unsigned integer.
        /// </summary>
        public UInt32 ReadUInt32(String aSection, String aKey)
        {
            UInt32 value = 0;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                UInt32.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 32-bits unsigned integer.
        /// </summary>
        public UInt32 ReadUInt32(String aSection, String aKey, UInt32 aDefault)
        {
            UInt32 value = aDefault;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                UInt32.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 64-bits signed integer.
        /// </summary>
        public Int64 ReadInt64(String aSection, String aKey)
        {
            Int64 value = 0;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Int64.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 64-bits signed integer.
        /// </summary>
        public Int64 ReadInt64(String aSection, String aKey, Int64 aDefault)
        {
            Int64 value = aDefault;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Int64.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 64-bits unsigned integer.
        /// </summary>
        public UInt64 ReadUInt64(String aSection, String aKey)
        {
            UInt64 value = 0;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                UInt64.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 64-bits unsigned integer.
        /// </summary>
        public UInt64 ReadUInt64(String aSection, String aKey, UInt64 aDefault)
        {
            UInt64 value = aDefault;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                UInt64.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 32-bits signed decimal.
        /// </summary>
        public Single ReadFloat(String aSection, String aKey)
        {
            Single value = 0;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Single.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 32-bits signed decimal.
        /// </summary>
        public Single ReadFloat(String aSection, String aKey, Single aDefault)
        {
            Single value = aDefault;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Single.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 64-bits signed decimal.
        /// </summary>
        public Double ReadDouble(String aSection, String aKey)
        {
            Double value = 0;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Double.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a 64-bits signed decimal.
        /// </summary>
        public Double ReadDouble(String aSection, String aKey, Double aDefault)
        {
            Double value = aDefault;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Double.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a boolean.
        /// </summary>
        public Boolean ReadBoolean(String aSection, String aKey)
        {
            Boolean value = false;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Boolean.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a boolean.
        /// </summary>
        public Boolean ReadBoolean(String aSection, String aKey, Boolean aDefault)
        {
            Boolean value = aDefault;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                Boolean.TryParse(section.GetValue(aKey), out value);

            return value;
        }

        /// <summary>
        /// Read the value as a string.
        /// </summary>
        [Obsolete]
        public String ReadValue(String aSection, String aKey)
        {
            return ReadString(aSection, aKey);
        }

        /// <summary>
        /// Read the value as a string.
        /// </summary>
        public String ReadString(String aSection, String aKey)
        {
            String value = null;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                value = section.GetValue(aKey);

            return value != null ? value : "";
        }

        /// <summary>
        /// Read the value as a string.
        /// </summary>
        public String ReadString(String aSection, String aKey, String aDefault)
        {
            String value = null;

            IniSection section = mDoc.Sections[aSection];
            if (section != null)
                value = section.GetValue(aKey);

            return value != null ? value : aDefault;
        }
    }
}
CptSky is offline  
Old 04/18/2020, 17:26   #167
 
elite*gold: 0
Join Date: Sep 2010
Posts: 13
Received Thanks: 2

Everything is OK. but here is frozen.
emobaba31 is offline  
Old 04/18/2020, 21:02   #168
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,214
Received Thanks: 4,118
Quote:
Originally Posted by emobaba31 View Post

Everything is OK. but here is frozen.
Spirited is offline  
Thanks
1 User
Old 04/24/2020, 09:22   #169
 
elite*gold: 0
Join Date: Mar 2015
Posts: 5
Received Thanks: 0
I'm not able to update spawns, can someone point me in the right direction? Just trying to increase pack density in some areas.
grimreaper5325 is offline  
Old 04/24/2020, 23:36   #170


 
CptSky's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,434
Received Thanks: 1,147
Quote:
Originally Posted by grimreaper5325 View Post
I'm not able to update spawns, can someone point me in the right direction? Just trying to increase pack density in some areas.
You need to modify the Spawn.txt (or something like that) and generate the binary file using the Generator.exe

Here's the file layout in txt:
Code:
BWriter.Write(Int16.Parse(Parts[1])); //MapId
BWriter.Write(UInt16.Parse(Parts[2])); //StartX
BWriter.Write(UInt16.Parse(Parts[3])); //StartY
BWriter.Write(UInt16.Parse(Parts[4])); //AddX
BWriter.Write(UInt16.Parse(Parts[5])); //AddY
BWriter.Write(Int32.Parse(Parts[6])); //MaxNPC
BWriter.Write(Int32.Parse(Parts[7])); //Rest Secs
BWriter.Write(Int32.Parse(Parts[8])); //Max_Per_Gen
BWriter.Write(Int32.Parse(Parts[9])); //NpcType
CptSky is offline  
Thanks
1 User
Old 04/25/2020, 00:38   #171
 
elite*gold: 0
Join Date: Mar 2015
Posts: 5
Received Thanks: 0
Quote:
Originally Posted by CptSky View Post
You need to modify the Spawn.txt (or something like that) and generate the binary file using the Generator.exe

Here's the file layout in txt:
Code:
BWriter.Write(Int16.Parse(Parts[1])); //MapId
BWriter.Write(UInt16.Parse(Parts[2])); //StartX
BWriter.Write(UInt16.Parse(Parts[3])); //StartY
BWriter.Write(UInt16.Parse(Parts[4])); //AddX
BWriter.Write(UInt16.Parse(Parts[5])); //AddY
BWriter.Write(Int32.Parse(Parts[6])); //MaxNPC
BWriter.Write(Int32.Parse(Parts[7])); //Rest Secs
BWriter.Write(Int32.Parse(Parts[8])); //Max_Per_Gen
BWriter.Write(Int32.Parse(Parts[9])); //NpcType
Thank you, when I tried this before I encountered some errors, not quite sure what I was doing wrong before. I've run into two issues, lottery.exe doesn't work, throws an error that input string is in wrong format (haven't edited it yet). Also can't get shops to update using generator.exe and goods.exe, though I've got spawn editing working.
grimreaper5325 is offline  
Old 04/18/2021, 21:19   #172
 
elite*gold: 0
Join Date: Apr 2021
Posts: 1
Received Thanks: 0
Everything working but FPS drops constantly

Hello!

So i am new to programming and private servers. I have played cq back in the day when it was awesome for 6 years and have played on private servers as well.

So i ran everything on 5017 version of the client. Everything works fine, i can connect i can create accounts etc.

Problem is that after I connect, the FPS starts to just go from 38 to 7 to 14 to 24 to 27 and back to 7 constantly, if I move around. If i don't move, it constantly jumps between 37 and 39.

Shouldn't it be a constant 38 or 39? What could be the problem as I have not found anything regarding this issue around.

I also cannot find the "Accounts" file where i am supposed to make my account to be a GM. I have the account files but there is no AccLvl entry in them.

Also i cannot find any commands but i suppose they are the ones for the 5017 client. I do not know yet but i'll keep trying around.

Thank you cheers!
skittles225 is offline  
Reply

Tags
c#, cops v6, cptsky, emulator


Similar Threads Similar Threads
COPS v3 - Reborn Edition : Source & Tools [LOTF Emulator]
10/22/2012 - CO2 PServer Guides & Releases - 29 Replies
I was cleaning my hard drive and I found an old source. The source is based on LOTF. I used it during COPS v3 (August 2008 - June 2009). After, I worked on my custom source, but I was too lazy, so I reworked a bit on this one for a short private server: COPS v3 - Reborn Edition. The base is bad. After all, it's LOTF... The parts I coded/recoded during 2008/2009 are really bad, maybe worst than the original :rolleyes: I was learning. And the parts I recoded during the few months I worked on...
COPS v3 - Source & Tools [LOTF Emulator]
09/25/2012 - CO2 PServer Guides & Releases - 4 Replies
I reformatted a USB Key and found an old source dating of January 2009. The source is based on LOTF. I used it during COPS v3 (August 2008 - June 2009). It is the base of my previous release of the COPS v3 - Reborn Edition emulator. So, it's really not good... Anything to say, except that nobody should use it? Anyway, some people who have played COPS might be interested to see the source, or some special feature. The test emulator is from January 17th, 2009. So it doesn't contains the final...
Custom source
04/03/2012 - CO2 Private Server - 4 Replies
#Never mind, solved. To those who replied, thanks.



All times are GMT +2. The time now is 19:03.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

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