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 02:47

  • 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 04/19/2009, 20:18   #61
 
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
Well...that a very easy thing...
Code:
    public class Proficiency
    {
        private byte[] Packet;
        public Proficiency()
        {
                Packet = new byte[16];
                PacketBuilder.WriteUInt16(16, Packet, 0);
                PacketBuilder.WriteUInt16(0x401, Packet, 2);
        }
        public uint WeaponID
        {
            get { return BitConverter.ToUInt32(Packet, 4); }
            set { PacketBuilder.WriteUInt32(value, Packet, 4); }
        }
        public uint Level
        {
            get { return BitConverter.ToUInt32(Packet, 8); }
            set { PacketBuilder.WriteUInt32(value, Packet, 8); }
        }
        public uint Exp
        {
            get { return BitConverter.ToUInt32(Packet, 12); }
            set { PacketBuilder.WriteUInt32(value, Packet, 12); }
        }
        public byte[] Serialize()
        {
            return Packet;
        }
    }
Usage: Proficiency prof = new Proficiency(); prof.WeaponID = 480; prof.Level = 19; prof.Exp = 192321; Client.Send(prof.Serialize());

The database save & load its ur job.
alexbigfoot is offline  
Old 04/19/2009, 21:35   #62
 
elite*gold: 0
Join Date: Feb 2008
Posts: 1,590
Received Thanks: 154
You'll have to add the database part, but this is all I've got lol.
Attached Files
File Type: rar CSBasicRev3.rar (231.3 KB, 167 views)
tao4229 is offline  
Thanks
10 Users
Old 04/22/2009, 18:04   #63
 
LordSesshomaru's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 48
Received Thanks: 15
Ok here is a code that i have been working on for + item restriction (as seen on AcidCO) I figured since i am using Hybrid's source that i should post it here and hopes that more people will take interest in this growing source.

Code:
string[] Info = Item.Split('-');
ItemData.ID = uint.Parse(Info[0]);
ItemData.Plus = Math.Min(byte.Parse(Info[1]), 9);
ItemData.Bless = byte.Parse(Info[2]);
ItemData.Enchant = byte.Parse(Info[3]);
ItemData.SocketOne = byte.Parse(Info[4]);
ItemData.SocketTwo = byte.Parse(Info[5]);
ItemData.UID = NextItemUID;
return true;
Big Thanks to Tao for the one who helped me figure out a better way than how i tired it.

@Anyone
Anyone know a good decompiler , i want to decompile the SocketNetwork.dll so i can study what Hybrid did with it. Thanks
LordSesshomaru is offline  
Old 04/22/2009, 19:02   #64
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 913
Quote:
Originally Posted by LordSesshomaru View Post
@Anyone
Anyone know a good decompiler , i want to decompile the SocketNetwork.dll so i can study what Hybrid did with it. Thanks
.Net Reflector
Attached Files
File Type: zip SocketNetwork.zip (7.7 KB, 90 views)
kinshi88 is offline  
Thanks
3 Users
Old 04/23/2009, 03:56   #65
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 913
Code:
        private static void LoadInventory(GameClient Client)
        {
            IniFile rdr = new IniFile(DatabasePath + @"\Inventory\" + Client.Username + ".ini");
            sbyte count = rdr.ReadSByte("Inventory", "Count", 0);
            for (sbyte i = 0; i < count; i++)
            {
                string[] Item = (rdr.ReadString("Inventory", "Item[" + i.ToString() + "]", String.Empty)).Split(' ');
                ItemDataPacket LoadedItem = new ItemDataPacket(true);
                LoadedItem.ID = uint.Parse(Item[0]);
                LoadedItem.Plus = byte.Parse(Item[1]);
                LoadedItem.Enchant = byte.Parse(Item[2]);
                LoadedItem.SocketOne = byte.Parse(Item[3]);
                LoadedItem.SocketTwo = byte.Parse(Item[4]);
                LoadedItem.UID = ItemDataPacket.NextItemUID;
                Client.AddInventory(LoadedItem);
            }
        }
That's whats in my source, seems to work just fine =P
kinshi88 is offline  
Thanks
2 Users
Old 04/23/2009, 22:15   #66
 
LordSesshomaru's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 48
Received Thanks: 15
Code:
        private static void LoadEquips(GameClient Client)
        {
            IniFile rdr = new IniFile(DatabasePath + @"\Equips\" + Client.Username + ".ini");
            for (sbyte i = 0; i < Client.Equipment.Count; i++)
            {
                ItemDataPacket LoadedEquip;
                if (ItemDataPacket.Parse(rdr.ReadString("Equips", "Item[" + i.ToString() + "]", String.Empty), out LoadedEquip))
                {
                    Client.Equip(LoadedEquip, (ushort)(i + 1));
                }
            }
        }
Ok this is the code i have been working on for loading gears this code "does not work" I been working on this since yesterday anyone have any idea what is wrong? Ive rewrote it 3 times and either way i write it it still don't load. When it saves it looks like this
Code:
[Equips]
Item[2]=137310 0 0 0 0 0
Ill keep taking cracks at it. Good luck to anyone else working with this soure
LordSesshomaru is offline  
Old 04/23/2009, 22:47   #67
 
LordSesshomaru's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 48
Received Thanks: 15
Code:
        private static void LoadInventory(GameClient Client)
        {
            IniFile rdr = new IniFile(DatabasePath + @"\Inventory\" + Client.Username + ".ini");
            sbyte count = rdr.ReadSByte("Inventory", "Count", 0);
            for (sbyte i = 0; i < count; i++)
            {
                string[] Item = (rdr.ReadString("Inventory", "Item[" + i.ToString() + "]", String.Empty)).Split(' ');
                ItemDataPacket LoadedItem = new ItemDataPacket(true);
                LoadedItem.ID = uint.Parse(Item[0]);
                LoadedItem.Plus = byte.Parse(Item[1]);
                LoadedItem.Enchant = byte.Parse(Item[2]);
                LoadedItem.SocketOne = byte.Parse(Item[3]);
                LoadedItem.SocketTwo = byte.Parse(Item[4]);
                LoadedItem.UID = ItemDataPacket.NextItemUID;
                Client.AddInventory(LoadedItem);
            }
        }
here you go This one does work
LordSesshomaru is offline  
Old 04/24/2009, 16:20   #68
 
LordSesshomaru's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 48
Received Thanks: 15
@Djago
here is my save inventory ( Make sure u have a folder called Inventory in your database?)
Quote:
private static void SaveInventory(GameClient Client)
{
IniFile wrtr = new IniFile(DatabasePath + @"\Inventory\" + Client.Username + ".ini");

sbyte i = 0;
foreach (IConquerItem Item in Client.Inventory)
{
wrtr.Write("Inventory", "Item[" + i.ToString() + "]", Item.ToString());
i++;

}
wrtr.Write("Inventory", "Count", i.ToString());
}
And don't give up yet please add me to msn and ill help you there to get your problem solved faster k man

Also at the end of public static void SaveCharacter(GameClient Client)

make sure it looks like this man
Quote:
wrtr.Write("Character", "Y", Client.Entity.Y);
wrtr.Write("Character", "RebornCount", Client.Entity.Reborn);

SaveInventory(Client);
LordSesshomaru is offline  
Old 04/24/2009, 19:54   #69
 
LordSesshomaru's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 48
Received Thanks: 15
Need some help here been working on this since yesterday with talking npc's just using the code that was there and i think i got it figured out just need someone to confirm my theory?

Quote:
case 900100:
{
dialog(Client, new string[] {
"AVATAR 30",
"TEXT Hello i am a testing NPC!",
"OPTION-1 Ok Good Bye!",

});
break;
}
All i did was add that before the default. But i got a couple of questions i am not sure about with the code that is already in the source is that good enough npc code? If it is how can i add another "page of talking? thanks ill keep taking a crack at it to figure it if i can.

Can a mod merge my my 2 posts forgot that i just replied to Djago sorry
LordSesshomaru is offline  
Old 04/24/2009, 22:27   #70
 
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
To add more "pages" you should use this:
Code:
                case 900100:
                    {
                        if(OptionID == 0)
                        dialog(Client, new string[] {
                            "AVATAR 30",
                            "TEXT Hello i am a testing NPC!",
                            "OPTION-1 Ok Good Bye!",
                            });
                        else if(OptionID == 1)
                            dialog(Client, new string[] {
                            "AVATAR 30",
                            "TEXT Hello this is the second page i`ve been working on for ages!",
                            "OPTION-255 Ok Good Bye!",
                            });

                        break;
                    }
When you click on a npc... the OptionID will be automaticaly 0, the first "page" you`ll get.

Also, there is a kinda bug while adding the optionid which will be sent and i posted the way to fix some weeks ago(i think).
Here`s the link:
alexbigfoot is offline  
Thanks
2 Users
Old 04/25/2009, 16:25   #71
 
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
Code:
if(OptionID == 0)
{
dialog(Client, new string[] {
"AVATAR 30",
"TEXT Howdy! Would you like some money?",
"OPTION-1 Ohh, yea I need some."
"OPTION-255 No, thank you."
}); 
}
else if (OptionID == 1)
{
dialog(Client, new string[] {
"AVATAR 30",
"TEXT Here it is!",
"OPTION-255 Okay. Thanks."
}); 
Client.Money += 1000;
SyncPacket Package = new SyncPacket(1);
Package.UID = Client.Identifier;
Package[0] = SyncPacket.Data.Create(SyncPacket.Money, Client.Money);
Client.Send(Package.Serialize());
}
alexbigfoot is offline  
Thanks
2 Users
Old 04/25/2009, 19:27   #72


 
KraHen's Avatar
 
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 794
@Alexbigfoot : Make the syncpacket out of that NPC code, you don`t want to create it every time, only send it.
KraHen is offline  
Old 04/26/2009, 01:17   #73
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 913
Quote:
Originally Posted by alexbigfoot View Post
Code:
if(OptionID == 0)
{
dialog(Client, new string[] {
"AVATAR 30",
"TEXT Howdy! Would you like some money?",
"OPTION-1 Ohh, yea I need some."
"OPTION-255 No, thank you."
}); 
}
else if (OptionID == 1)
{
dialog(Client, new string[] {
"AVATAR 30",
"TEXT Here it is!",
"OPTION-255 Okay. Thanks."
}); 
Client.Money += 1000;
SyncPacket Package = new SyncPacket(1);
Package.UID = Client.Identifier;
Package[0] = SyncPacket.Data.Create(SyncPacket.Money, Client.Money);
Client.Send(Package.Serialize());
}
Use switches for Npc Dialog.
kinshi88 is offline  
Old 04/26/2009, 12:36   #74
 
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
why would I? I mean its not a big difference. It works the same...
anyway as you wish
Code:
switch(OptionID)
{
case 0:{dialog(Client, new string[] {
"AVATAR 30",
"TEXT Howdy! Would you like some money?",
"OPTION-1 Ohh, yea I need some."
"OPTION-255 No, thank you."
});}  break;
case 1:{dialog(Client, new string[] {
"AVATAR 30",
"TEXT Here it is!",
"OPTION-255 Okay. Thanks."
}); 
Client.Money += 1000;
SyncPacket Package = new SyncPacket(1);
Package.UID = Client.Identifier;
Package[0] = SyncPacket.Data.Create(SyncPacket.Money, Client.Money);
Client.Send(Package.Serialize()); }break;
}
alexbigfoot is offline  
Old 04/26/2009, 18:03   #75


 
KraHen's Avatar
 
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 794
Okay, got spawned a mob, mobspawns should be easy now.

Here comes the attack packet (although I`m not even 10% sure that it works since I never really worked with them). If something is missing or isn`t correct, correct me as you wish :P

1.) Create a file with the name Attack Packet.cs

2.) Copy this in it


Quote:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConquerServer_Basic
{
public class AttackPacket : IClassPacket
{
private byte[] Packet;
public uint UID
{
get { return BitConverter.ToUInt32(Packet, 8); }
set { PacketBuilder.WriteUInt32(value, Packet, 8); }
}
public uint Target
{
get { return BitConverter.ToUInt32(Packet, 12); }
set { PacketBuilder.WriteUInt32(value, Packet, 12); }
}
public ushort TargetX
{
get { return BitConverter.ToUInt16(Packet, 16); }
set { PacketBuilder.WriteUInt32(value, Packet, 16); }
}
public ushort TargetY
{
get { return BitConverter.ToUInt16(Packet, 18); }
set { PacketBuilder.WriteUInt32(value, Packet, 18); }
}
public uint AttackType
{
get { return BitConverter.ToUInt32(Packet, 20); }
set { PacketBuilder.WriteUInt32(value, Packet, 20); }
}
public uint Damage
{
get { return BitConverter.ToUInt32(Packet, 24); }
set { PacketBuilder.WriteUInt32(value, Packet, 24); }
}
public void Deserialize(byte[] Bytes)
{
Packet = Bytes;
}
public byte[] Serialize()
{
return this.Packet;
}
}
}
KraHen is offline  
Thanks
2 Users
Closed Thread


Similar Threads 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 +1. The time now is 02:51.


Powered by vBulletin®
Copyright ©2000 - 2025, 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 ©2025 elitepvpers All Rights Reserved.