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 23:07

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

Advertisement



[Release] Extremely basic (but working/bugless) C# Source

Discussion on [Release] Extremely basic (but working/bugless) C# Source within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Closed Thread
 
Old   #1
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,878
[Release, Updated 1/23/09] Extremely basic (but working/bugless) C# Source

This pretty much has a very finite amount of stuff done in it. Specifically this is pretty much all thats in it.

If your serious about trying to develop a server in C#, I suggest looking at this. There's a DLL also included (check the "bin" folder) which will need to be added as a reference. SocketNetwork.dll pretty much handles the socket-system and encryptions for you it is not packed or obfuscated if you would like to decompile it and take a look at it, be my guest.

I included a folder with the database also which is the dumped version of cq_npc.sql, if anyone would like me to post my cq (sql) database dumper to inis let me know.

The source is completely flatfile. I will be providing no support in explaining how things work, how to add things and etc, etc. Your on your own for that.

At the moment, the source is 100% "safe-code" which means no pointer usage.

Revision 1:


Revision 2:


Revision 3:

- Rev3 Implements Equipment, but does not save it!
- Rev3 Does not contain a database, read the "Notes" section below!
- MUST READ FOR REV3! -

PS:
This is for the old encryption, patch 5017, not 5018+ :P.

Utilities




Notes For Rev3 (and above)

You'll need to create a folder in the compiled folder where your .exe comes out, for instance if it comes out in "...\debug\" you need to make a folder called "...\debug\database".

The database folder should contain a folder called "Items" produced with my "itemtype dat dumper" and a "cq_npc" folder produced by my "cq_database dumper".

It should also contain a empty folder called "Inventory" (as characters save this will be filled).

It should also contain a folder called "Misc" which has the files; "Archer.ini", "Trojan.ini", "Taoist.ini", and "Warrior.ini" in it, this can be obtained from downloading rev2, or rev1 Thanks to CoEMU for this, dunno where they got it from, got it from their oooolllld source from ages ago

Lastly, there should be a folder called "Accounts" which can be obtained from rev1, or rev2. The full layout of the file can be obtained by logging in once, and then out (letting the server save the file).

You need to create accounts manually at this time :P


*Edit by Kinshi*
Database:



InfamousNoone is offline  
Thanks
123 Users
Old 01/19/2009, 22:51   #2
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,878
Quote:
Originally Posted by Djago160 View Post
Unexpected...
It's from the crypts of those lonely days when I have a blackout, my internet is being gay, or reflecting on my old HCO source

Only difference is, I included what I learned of the last year in this source; the beauty of interfaces and multiple interface inheritance in C#. Aside from pointers that it, the beauty of pointer logic > multiple inheritance (...of interfaces of course).


InfamousNoone is offline  
Thanks
1 User
Old 01/20/2009, 11:24   #3
 
elite*gold: 0
Join Date: Dec 2008
Posts: 493
Received Thanks: 71
Just have one question and u can call me an idiot all you like i dont mind - How do i make a new account?
Beta Limit is offline  
Thanks
1 User
Old 01/20/2009, 12:07   #4
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,160
Quote:
Originally Posted by Beta Limit View Post
Just have one question and u can call me an idiot all you like i dont mind - How do i make a new account?
Should be fairly easy to find..
Anyways, go here:
ConquerServer_Basic\bin\Debug\Database\Accounts\
You will see the account "test", just copy that file and make a new one, change the name test to BetaLimit for example, and change the information inside.


_Emme_ is offline  
Thanks
8 Users
Old 01/20/2009, 21:50   #5
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,878
Seeing as I have about 6 days off I might end up working on it again and releasing a version with more **** done.

As for creating characters, do what Emme said; but make sure you add one to the UID (make sure two players UIDs are never the same).
InfamousNoone is offline  
Thanks
3 Users
Old 01/20/2009, 22:01   #6
 
elite*gold: 0
Join Date: Dec 2008
Posts: 493
Received Thanks: 71
Quote:
Originally Posted by InfamousNoone View Post
Seeing as I have about 6 days off I might end up working on it again and releasing a version with more **** done.

As for creating characters, do what Emme said; but make sure you add one to the UID (make sure two players UIDs are never the same).
Nice one Hybrid look forward to it. So far i have added a few things to the console Display and thats about it.
Beta Limit is offline  
Old 01/20/2009, 23:16   #7
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,878
Here's walking/running:

Code:
// \Networking\Packets\Ground Movement Packet.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConquerServer_Basic
{
    /// <summary>
    /// You know, walking and running (can be used for monster-movement aswell).
    /// </summary>
    public class GroundMovementPacket : IClassPacket
    {
        private byte[] Packet;

        public GroundMovementPacket(bool CreateInstance)
        {
            if (CreateInstance)
            {
                Packet = new byte[12];
                PacketBuilder.WriteUInt32(12, Packet, 0);
                PacketBuilder.WriteUInt32(1005, Packet, 2);
            }
        }
        public byte[] Serialize()
        {
            return Packet; 
        }
        public void Deserialize(byte[] Bytes)
        {
            Packet = Bytes;
        }

        public uint UID
        {
            get { return BitConverter.ToUInt32(Packet, 4); }
            set { PacketBuilder.WriteUInt32(value, Packet, 4); }
        }
        public ConquerAngle Direction
        {
            get { return (ConquerAngle)(Packet[8] % 8); }
            set { Packet[5] = (byte)value; }
        }
        public bool IsRunning
        {
            get { return (Packet[9] == 1); }
            set { Packet[9] = (byte)(value ? 1 : 0); }
        }
    }
}
Code:
// \Networking\Packet Processor.cs -- Edit
        public static void PlayerGroundMovment(GameClient Client, GroundMovementPacket Packet)
        {
            Client.SendScreen(Packet, true);
            Client.Entity.Move(Packet.Direction);
            Client.Screen.Reload(false, null);
        }

// goes in the switch for PacketProcessor.Process()
                case 1005:
                    {
                        GroundMovementPacket cPacket = new GroundMovementPacket(false);
                        cPacket.Deserialize(Packet);
                        PlayerGroundMovment(Client, cPacket);
                        break;
                    }
Your job! Implementing the Move function to the class IEntity.
Hint:
It modifies the properties Facing (with the parameter received for the Direction), X, and Y, take a look in other sources and see how they do it if you can't figure it out.
InfamousNoone is offline  
Thanks
13 Users
Old 01/21/2009, 01:13   #8
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,878
Quote:
Originally Posted by unknownone View Post
Sparkie suggests revision control. I could contribute to this in good ways
Feel free to anyone to post code relating to this source and help others; but I suggest when releasing anything code related, don't give it all away, let them work out some of it from themselves.

If I release more, I'll mark revisions on it (the rar file).
InfamousNoone is offline  
Thanks
2 Users
Old 01/21/2009, 12:29   #9
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,160
Mmk.
First, define the chat packet which is 1004.
Search for:
Jump = 133,
Under, add:
Chat = 1004,


Good.


Now go to the packet processor, and add a new case for chat. This is how mine looks like with a little help from Haydz



Quote:
case DataPacket.Chat:
{
MessagePacket Msg = new MessagePacket(Packet);
Command.Commands(Msg.Message, Client);
break;
}
Then go into MessagePackets.cs and add this by the message packets:
Quote:
public MessagePacket(byte[] Buffer)
{
Deserialize(Buffer);
}

Now, create a new .cs file called Command. In there, create a void/bool ( I prefer bool ) and do like this:

Quote:
public bool Commands(string Msg,GameClient Client)
{
}
Now you will have to do a string[] to split up, well do that by urself , im not releasing everything. Heres an example of a command:

Quote:
if (Cmd[0] == "/dc")
Client.Socket.Disconnect();
Enjoy, and press thanks!
_Emme_ is offline  
Thanks
4 Users
Old 01/21/2009, 16:12   #10
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,878
Emme, chatting is not a sub-type of packet (you make it seem as if it's a sub-type of the DataPacket) therefore you should just have
case 1004:
InfamousNoone is offline  
Thanks
1 User
Old 01/21/2009, 17:58   #11
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,878
InfamousNoone is offline  
Thanks
3 Users
Old 01/21/2009, 20:46   #12
 
elite*gold: 0
Join Date: Jan 2009
Posts: 212
Received Thanks: 14
Quote:
Originally Posted by InfamousNoone View Post

hey bro, was just wondering with config.ini is ? :P i aint changed any info and it says Database loader 0.0
HellCo is offline  
Old 01/21/2009, 22:54   #13
 
elite*gold: 0
Join Date: Jun 2005
Posts: 27
Received Thanks: 49
Thought i'd help add to the server the basic Chat handling code.
Atm it only supports Chat and Whisper.
Correct me if I'm wrong in anyway. Because that's why were here to LEARN and contribute where we can .

*Code not yet tested*

PacketProcessor.cs
Process add:
Code:
case 1004:
                    {
                        MessagePacket cPacket = new MessagePacket();
                        cPacket.Deserialize(Packet);
                        PlayerChat(Client, cPacket);
                        break;
                    }

PacketProcessor.cs
add:
Code:
public static void PlayerChat(GameClient Client, MessagePacket Packet)
        {
            switch (Packet.ChatType)
            {
                case 2000: //Talk
                    {
                        foreach (GameClient pClient in Kernel.Clients)
                        {
                            if (pClient.Identifier != Client.Identifier)
                            {
                                if (pClient.Entity.MapID == Client.Entity.MapID)
                                {
                                    if (Kernel.GetDistance(pClient.Entity.X, pClient.Entity.Y, Client.Entity.X, Client.Entity.Y) <= 16)
                                    {
                                        pClient.Send(Packet.Serialize());
                                    }
                                }
                            }
                        }
                        break;
                    }
                case 2001: //Whisper
                    {
                        foreach (GameClient pClient in Kernel.Clients)
                        {
                            if (pClient.Identifier != Client.Identifier)
                            {
                                if (pClient.Entity.Name == Packet._To)
                                {
                                    pClient.Send(Packet.Serialize());
                                }
                            }
                        }
                        break;
                    }
                default: break;
            }
        }
                    }
Message Packet.cs
MessagePacket add:
Code:
public MessagePacket()
        {
        }
punkmak2 is offline  
Thanks
1 User
Old 01/21/2009, 23:24   #14
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,878
Client.SendScreen(packet, false);

instead of looping through all them clients...
InfamousNoone is offline  
Old 01/21/2009, 23:48   #15
 
elite*gold: 0
Join Date: Dec 2008
Posts: 493
Received Thanks: 71
Hmm wont let me login two accounts from the same computer

EDIT: Can log two in but if they are in within 20 spaces the client just closes


Beta Limit is offline  
Closed Thread


Similar Threads
[Huge-Release] All-In-One Basic NPC Scripts For The 5165 Source!
02/19/2010 - CO2 PServer Guides & Releases - 30 Replies
Well I'm sorry that I spammed the whole forum full of my posts So pro4never and .Ryu gave me the idea of making this All-In-One thread about all my NPC's! THESE ARE UPDATED DAILY! NOTE: TO PEOPLE... SOME OF THE CODES ARE NOT MADE BY ME! I USUALLY JUST FIXED/UPDATED THE BASIC ONES! SORRY I'M LEARNING ON HOW TO CODE! 1. Birth-Island-NPC's(The NPC text is not from "REAL CONQUER" SORRY!...) #region BirthOldGeneralYang case 425: {
[FINAL RELEASE]HuB- Source (BASIC) (Original LOTF easier workable)
11/14/2009 - CO2 PServer Guides & Releases - 25 Replies
#REMOVED
[RELEASE] Basic LOTF Source
09/03/2009 - CO2 PServer Guides & Releases - 17 Replies
hey this is a basic lotf source edited based off shadowco, if you dont like it then dont post here... flames will be told on!!! :D i will tell on you to the mods if you flame What it has... - LuckyTime - Guard - 24/7 GW



All times are GMT +2. The time now is 23:07.


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

BTC: 33E6kMtxYa7dApCFzrS3Jb7U3NrVvo8nsK
ETH: 0xc6ec801B7563A4376751F33b0573308aDa611E05

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