|
You last visited: Today at 15:14
Advertisement
[Request] 5165 Class Ban
Discussion on [Request] 5165 Class Ban within the CO2 Private Server forum part of the Conquer Online 2 category.
01/18/2015, 08:17
|
#1
|
elite*gold: 0
Join Date: Nov 2010
Posts: 47
Received Thanks: 2
|
[Request] 5165 Class Ban
Hello to whoever bothers to read this.
I am currently working on the 5165 NCOS and I do not intend to divert from it any time soon.
I am trying to add a ban on ninjas, and I have seen this done in other 5165 servers. I know around where the code is needed, but I don't have the knowledge of what should be added to it.
Code:
FS = new FileStream(@"C:\OldCODB\Users\" + Account + ".usr", FileMode.Append);
BW = new BinaryWriter(FS);
BW.Write((byte)Name.Length);
BW.Write(Encoding.ASCII.GetBytes(Name));
BW.Flush();
FS.Flush();
BW.Close();
FS.Close();
Game.Character C = LoadCharacter(Name, ref Account);
if (C != null)
{
C.UniversityPoints = 0;
SaveCharacter(C, Account);
}
}
catch { return "Error! Try again."; }
return "ANSWER_OK";
}
return "Error: Character already exists!";
}
catch (Exception Exc) { Console.WriteLine(Exc); return "Failed to create the character."; }
}
}
Any help is welcome. Any comments about downgrading my source will most likely be ignored, or I will give you a reason on why I won't.
**EDIT
Also, if anyone has all of the files for the dragon souls, could you please upload them?
I can't find a download anywhere.
|
|
|
01/20/2015, 04:20
|
#2
|
elite*gold: 0
Join Date: Nov 2010
Posts: 47
Received Thanks: 2
|
Bump.
I'm assuming that out of 60+ views, nobody even has a comment? 0.o
|
|
|
01/20/2015, 05:38
|
#3
|
elite*gold: 0
Join Date: Oct 2011
Posts: 267
Received Thanks: 59
|
Its easy.. Add a new check..
if(Class ninja)
{
go **** yourself;
}
|
|
|
01/20/2015, 05:53
|
#4
|
elite*gold: 0
Join Date: Nov 2010
Posts: 47
Received Thanks: 2
|
I doubt that's the code, for multiple reasons.
1. None of the other code in that area matches,
2. There wouldn't be a "Class" or "Ninja", that I know of,
3. It creates an error when entered, which is fully expected.
4. I know that there are more codes to go around that, especially around the text that pops up when you attempt to create a character.
If you think I am a rookie, you are wrong.
And congratulations at failing to be an *******.
|
|
|
01/20/2015, 06:03
|
#5
|
elite*gold: 0
Join Date: Oct 2011
Posts: 267
Received Thanks: 59
|
Seriously dude, im trying to help here and i gave you the right answer..
i told you make a check,
if(client class = 50( which is ninja)
{
return message = "Class is not available";
}
|
|
|
01/20/2015, 06:23
|
#6
|
elite*gold: 0
Join Date: Dec 2010
Posts: 494
Received Thanks: 54
|
I believe he was expecting directly the code, not an idea on how to create it himself.
|
|
|
01/20/2015, 06:48
|
#7
|
elite*gold: 0
Join Date: Nov 2010
Posts: 47
Received Thanks: 2
|
My slight knowledge of C# is in the NPC/Command making area. I can make NPCs, and I can make commands based on other codes in the source, but I do not recognize the codes in the database.cs, I apologize for my earlier comments.
As for the code you gave, I believe it would work, except the source does not recognize "client" "class" and "message"
|
|
|
01/20/2015, 06:53
|
#8
|
elite*gold: 0
Join Date: Dec 2010
Posts: 494
Received Thanks: 54
|
Quote:
Originally Posted by stormy547
My slight knowledge of C# is in the NPC/Command making area. I can make NPCs, and I can make commands based on other codes in the source, but I do not recognize the codes in the database.cs, I apologize for my earlier comments.
As for the code you gave, I believe it would work, except the source does not recognize "client" "class" and "message"
|
Just go to the Character creation sections add an line where it checks the class, if it's 50 make it pop up a message telling you are not allowed, i did that while ago and it worked.
It won't require more C# knowledge than making an NPC check ffs.
If (Character.Profession == 50)
{
Message ("You are not allowed to create ninja")
return;
}
Something like this, now look in your source and figure it out, not that had.
|
|
|
01/20/2015, 07:53
|
#9
|
elite*gold: 0
Join Date: Nov 2010
Posts: 47
Received Thanks: 2
|
So, below
catch { return "Error! Try again."; }
return "ANSWER_OK";
}
return "Error: Character already exists!";
I added:
if (Job == 50)
{
return ("You are not allowed to create ninja");
}
And now, every account, regardless of class, gets the error message "Error! Try again.", and on second attempt, it says "Error: Character already exists!".
It also adds a new char file, with given name. If you try to login with that acc and pass, it takes you back to the character creation.
|
|
|
01/20/2015, 11:48
|
#10
|
elite*gold: 0
Join Date: Dec 2010
Posts: 494
Received Thanks: 54
|
because you are doing it wrong, you have to check for job right before it creates it and sends the answer....
It easy, just try different places every time, it's basic logic here.
|
|
|
01/20/2015, 12:18
|
#11
|
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 793
|
Quote:
Originally Posted by stormy547
I doubt that's the code, for multiple reasons.
1. None of the other code in that area matches,
2. There wouldn't be a "Class" or "Ninja", that I know of,
3. It creates an error when entered, which is fully expected.
4. I know that there are more codes to go around that, especially around the text that pops up when you attempt to create a character.
If you think I am a rookie, you are wrong.
|
I love epvp. He was trying to help you with a basic pseudocode.
Quote:
And congratulations at failing to be an *******.
|
Well, at least you`ve shown him how it`s done!
Quote:
I apologize for my earlier comments
|
Then again I see hope in you.
|
|
|
01/20/2015, 15:56
|
#12
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
|
We've given you tons of help. We're telling you the logic that needs to be entered in to block a specific character from being created.
Your job is now this.
#1: Locate where characters are created (it will be reading from a packet the client sends)
#2: Determine where in the packet the player's profession is stored (it should be obvious because the source already has to read it)
#3: Check that profession against what is either allowed or banned (in this case ninja profession which is base profession 50... you should really be going with a list of allowed base professions though or I can just spoof a packet and create a max promotion character at lvl 1)
#4: Return an error to the client if they try to create a character with a profession you don't want them able to use
|
|
|
01/20/2015, 23:47
|
#13
|
elite*gold: 0
Join Date: Nov 2010
Posts: 47
Received Thanks: 2
|
And I thank you all very much for the help you have given me.
I only have one issue left, for some reason now no class can be made. Ninja is fully banned, but I'm not sure if I've left something out of the code I made with your help. Currently the entire creation code is as follows:
Code:
public static string CreateCharacter(string Account, string Name, ushort Body, byte Job)
{
if (Job == 50)
{
return ("Ninja is not allowed. Pick another class.");
}
try
{
if (File.Exists(@"C:\OldCODB\Users\" + Account + ".usr") && !File.Exists(@"C:\OldCODB\Users\Characters\" + Name + ".chr"))
{
try
{
FileStream FS = new FileStream(@"C:\OldCODB\Users\Characters\" + Name + ".chr", FileMode.CreateNew);
BinaryWriter BW = new BinaryWriter(FS);
BW.Write(Account);
BW.Write((uint)Program.Rnd.Next(1000001, 19999999));
if (Body == 1003 || Body == 1004)
BW.Write((ushort)1);
else
BW.Write((ushort)201);
BW.Write(Body);
BW.Write((ushort)(410 + (Program.Rnd.Next(5) * 100)));
BW.Write((ushort)1010);
BW.Write((ushort)61);
BW.Write((ushort)109);
BW.Write((ushort)0);
BW.Write(Job);
BW.Write((byte)0);
BW.Write((byte)1);
BW.Write((ulong)0);
ushort Str = 0, Agi = 0, Vit = 0, Spi = 0;
GetInitialStats(Job, ref Str, ref Agi, ref Vit, ref Spi);
BW.Write(Str);
BW.Write(Agi);
BW.Write(Vit);
BW.Write(Spi);
BW.Write((ushort)0);
ushort HP = (ushort)(Vit * 24 + Str * 3 + Agi * 3 + Spi * 3);
BW.Write(HP);
BW.Write((ushort)(Spi * 5));
BW.Write((ulong)0);
BW.Write((uint)100);
BW.Write((uint)0);
BW.Write((uint)0);
BW.Write((ulong)0);
BW.Write((ushort)0);
BW.Write((ushort)0);
BW.Write((uint)0);
BW.Write((byte)0);
Game.Equipment Eq = new NewestCOServer.Game.Equipment();
Eq.Open();
Eq.WriteThis(BW);
BW.Write((byte)5);
#region Beginner Items
if (Job == 100)
{
Game.Item I = new NewestCOServer.Game.Item();
I.ID = 421301;
I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)421301]).Durability;
I.CurDur = I.MaxDur;
I.UID = (uint)Program.Rnd.Next(10000000);
I.WriteThis(BW);
}
else if (Job == 50)
{
Game.Item I = new NewestCOServer.Game.Item();
I.ID = 601301;
I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)601301]).Durability;
I.CurDur = I.MaxDur;
I.UID = (uint)Program.Rnd.Next(10000000);
I.WriteThis(BW);
}
else
{
Game.Item I = new NewestCOServer.Game.Item();
I.ID = 410301;
I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)410301]).Durability;
I.CurDur = I.MaxDur;
I.UID = (uint)Program.Rnd.Next(10000000);
I.WriteThis(BW);
}
Game.Item Armor = new NewestCOServer.Game.Item();
Armor.ID = 132004;
Armor.Color = (Game.Item.ArmorColor)(Program.Rnd.Next(3, 9));
Armor.MaxDur = ((DatabaseItem)DatabaseItems[(uint)132004]).Durability;
Armor.CurDur = Armor.MaxDur;
Armor.UID = (uint)Program.Rnd.Next(10000000);
Armor.WriteThis(BW);
Game.Item Stancher = new NewestCOServer.Game.Item();
Stancher.ID = 1000000;
Stancher.UID = (uint)Program.Rnd.Next(10000000);
Stancher.WriteThis(BW);
Stancher.UID = (uint)Program.Rnd.Next(10000000);
Stancher.WriteThis(BW);
Stancher.UID = (uint)Program.Rnd.Next(10000000);
Stancher.WriteThis(BW);
#endregion
for (int n = 0; n < 5; n++)
{
BW.Write((byte)0);//WH[n] Count
//Warehouse[n]
}
BW.Write((byte)0);//WH[5] Count
//Warehouse[5]
BW.Write((byte)0);//Prof Count
if (Job != 100)
BW.Write((byte)0);
else
{
BW.Write((byte)2);
Game.Skill S = new Game.Skill() { ID = 1000 };
S.WriteThis(BW);
S = new Game.Skill() { ID = 1005 };
S.WriteThis(BW);
}
BW.Write((byte)0);
BW.Write((byte)0);
BW.Write(false);
BW.Write((int)0);
BW.Write((int)0);
BW.Write((long)0);
BW.Write((int)0);
BW.Write((byte)0);
BW.Write((byte)0);
BW.Write((byte)1);
BW.Write(0);
BW.Write(DateTime.Now.Ticks);
BW.Write((ushort)0);
BW.Write(false);
BW.Write((byte)0);
BW.Write("0");
BW.Write("None");
BW.Write((uint)0);
BW.Flush();
FS.Flush();
BW.Close();
FS.Close();
FS = new FileStream(@"C:\OldCODB\Users\" + Account + ".usr", FileMode.Append);
BW = new BinaryWriter(FS);
BW.Write((byte)Name.Length);
BW.Write(Encoding.ASCII.GetBytes(Name));
BW.Flush();
FS.Flush();
BW.Close();
FS.Close();
Game.Character C = LoadCharacter(Name, ref Account);
if (C != null)
{
C.UniversityPoints = 0;
SaveCharacter(C, Account);
}
}
catch { return "Error! Try again."; }
return "ANSWER_OK";
}
return "Error: Character already exists!";
}
catch (Exception Exc) { Console.WriteLine(Exc); return "Failed to create the character."; }
}
}
The code I added is at the very top, under the first line,
Code:
if (Job == 50)
{
return ("Ninja is not allowed. Pick another class.");
}
Now the message comes through for "Ninja is not allowed. Pick another class." every single time, without creating a new character. Every other class, it first says "Error! Try again." and then if you try again with the same name, it says "Error: Character already exists!", and the new character that it created has no account, its simply a character created. You can't login with it, and you can spam the database with accounts.
What is missing?
|
|
|
01/21/2015, 05:31
|
#14
|
elite*gold: 0
Join Date: Oct 2011
Posts: 267
Received Thanks: 59
|
try this
Code:
public static string CreateCharacter(string Account, string Name, ushort Body, byte Job)
{
try
{
if (File.Exists(@"C:\OldCODB\Users\" + Account + ".usr") && !File.Exists(@"C:\OldCODB\Users\Characters\" + Name + ".chr"))
{
if (Job == 50)
{
try
{
FileStream FS = new FileStream(@"C:\OldCODB\Users\Characters\" + Name + ".chr", FileMode.CreateNew);
BinaryWriter BW = new BinaryWriter(FS);
BW.Write(Account);
BW.Write((uint)Program.Rnd.Next(1000001, 19999999));
if (Body == 1003 || Body == 1004)
BW.Write((ushort)1);
else
BW.Write((ushort)201);
BW.Write(Body);
BW.Write((ushort)(410 + (Program.Rnd.Next(5) * 100)));
BW.Write((ushort)1010);
BW.Write((ushort)61);
BW.Write((ushort)109);
BW.Write((ushort)0);
BW.Write(Job);
BW.Write((byte)0);
BW.Write((byte)1);
BW.Write((ulong)0);
ushort Str = 0, Agi = 0, Vit = 0, Spi = 0;
GetInitialStats(Job, ref Str, ref Agi, ref Vit, ref Spi);
BW.Write(Str);
BW.Write(Agi);
BW.Write(Vit);
BW.Write(Spi);
BW.Write((ushort)0);
ushort HP = (ushort)(Vit * 24 + Str * 3 + Agi * 3 + Spi * 3);
BW.Write(HP);
BW.Write((ushort)(Spi * 5));
BW.Write((ulong)0);
BW.Write((uint)100);
BW.Write((uint)0);
BW.Write((uint)0);
BW.Write((ulong)0);
BW.Write((ushort)0);
BW.Write((ushort)0);
BW.Write((uint)0);
BW.Write((byte)0);
Game.Equipment Eq = new NewestCOServer.Game.Equipment();
Eq.Open();
Eq.WriteThis(BW);
BW.Write((byte)5);
#region Beginner Items
if (Job == 100)
{
Game.Item I = new NewestCOServer.Game.Item();
I.ID = 421301;
I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)421301]).Durability;
I.CurDur = I.MaxDur;
I.UID = (uint)Program.Rnd.Next(10000000);
I.WriteThis(BW);
}
else if (Job == 50)
{
Game.Item I = new NewestCOServer.Game.Item();
I.ID = 601301;
I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)601301]).Durability;
I.CurDur = I.MaxDur;
I.UID = (uint)Program.Rnd.Next(10000000);
I.WriteThis(BW);
}
else
{
Game.Item I = new NewestCOServer.Game.Item();
I.ID = 410301;
I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)410301]).Durability;
I.CurDur = I.MaxDur;
I.UID = (uint)Program.Rnd.Next(10000000);
I.WriteThis(BW);
}
Game.Item Armor = new NewestCOServer.Game.Item();
Armor.ID = 132004;
Armor.Color = (Game.Item.ArmorColor)(Program.Rnd.Next(3, 9));
Armor.MaxDur = ((DatabaseItem)DatabaseItems[(uint)132004]).Durability;
Armor.CurDur = Armor.MaxDur;
Armor.UID = (uint)Program.Rnd.Next(10000000);
Armor.WriteThis(BW);
Game.Item Stancher = new NewestCOServer.Game.Item();
Stancher.ID = 1000000;
Stancher.UID = (uint)Program.Rnd.Next(10000000);
Stancher.WriteThis(BW);
Stancher.UID = (uint)Program.Rnd.Next(10000000);
Stancher.WriteThis(BW);
Stancher.UID = (uint)Program.Rnd.Next(10000000);
Stancher.WriteThis(BW);
#endregion
for (int n = 0; n < 5; n++)
{
BW.Write((byte)0);//WH[n] Count
//Warehouse[n]
}
BW.Write((byte)0);//WH[5] Count
//Warehouse[5]
BW.Write((byte)0);//Prof Count
if (Job != 100)
BW.Write((byte)0);
else
{
BW.Write((byte)2);
Game.Skill S = new Game.Skill() { ID = 1000 };
S.WriteThis(BW);
S = new Game.Skill() { ID = 1005 };
S.WriteThis(BW);
}
BW.Write((byte)0);
BW.Write((byte)0);
BW.Write(false);
BW.Write((int)0);
BW.Write((int)0);
BW.Write((long)0);
BW.Write((int)0);
BW.Write((byte)0);
BW.Write((byte)0);
BW.Write((byte)1);
BW.Write(0);
BW.Write(DateTime.Now.Ticks);
BW.Write((ushort)0);
BW.Write(false);
BW.Write((byte)0);
BW.Write("0");
BW.Write("None");
BW.Write((uint)0);
BW.Flush();
FS.Flush();
BW.Close();
FS.Close();
FS = new FileStream(@"C:\OldCODB\Users\" + Account + ".usr", FileMode.Append);
BW = new BinaryWriter(FS);
BW.Write((byte)Name.Length);
BW.Write(Encoding.ASCII.GetBytes(Name));
BW.Flush();
FS.Flush();
BW.Close();
FS.Close();
Game.Character C = LoadCharacter(Name, ref Account);
if (C != null)
{
C.UniversityPoints = 0;
SaveCharacter(C, Account);
}
}
catch { return "Error! Try again."; }
return "ANSWER_OK";
}
return "Error: Ninja is not available!";
}
return "Error: Character already exists!";
}
catch (Exception Exc) { Console.WriteLine(Exc); return "Failed to create the character."; }
}
}
|
|
|
01/22/2015, 03:47
|
#15
|
elite*gold: 0
Join Date: Nov 2010
Posts: 47
Received Thanks: 2
|
Now, Ninja isn't banned, instead every other class is banned with the No Ninja message. Also, Ninja now has that error about the "try again' and then "character already created". I think that this didn't fix anything, but actually reversed the desired effect 0.o
|
|
|
|
|
Similar Threads
|
[Release]Sub Class Items 5165!
05/06/2018 - CO2 PServer Guides & Releases - 97 Replies
(Note: This is not an edit, This files contains the .dbc files!!!)
Guide on how to add the Sub-Class Items:
First: You have to download this textures and Meshes. And extract it on your 5165 client. Multiupload.com - upload your files to multiple file hosting sites! It contains the texture, mesh and also the Icons.
Second: Add this to your Items.txt (on your LOTF source) and also in your itemtype.dat (on your client)
Third: You need to add this also into your ItemMinIcon.ani in...
|
[5165] My Class PkEnvoy Bugs
12/15/2010 - CO2 Private Server - 6 Replies
Hello i have a co pserver 5165 , well i added ClassPkEnvoy to my source
it's working 100% , but when some1 is in the pk map of ClassPkEnvoy and he Disconnect (normal disconnecting, from hes connetion ) and Relog , he find himself Without gears and empty enventry, cps and gold don't go
well, he goes to TC for exemple, he relog and gears back
could you help me ? tell me what's where's the problem, and how to fix it
the ClassPkEnvoy Are : 1735 1734 etc...
|
itemType.ini That Contain Sub-Class Items for 5165
07/09/2010 - CO2 Private Server - 9 Replies
hey all i Need itemType.ini That Contain Sub-Class Items for 5165
or how to add it :handsdown: ... at Client/ini
anyone Can Help ! :D
134159 WaterflowArmor 190 0 130 0 0 0 0 0 0 0 129000 0 0 0 435 0 0 0 0 4098 4098 0 0 0 0 0 0 147 80 1 1000 0 0 0 0 Taoist`sRobe None 5
131159 WarriorSoulArmor 25 0 130 0 0 0 0 0 0 0 129000 0 0 0 1258 0 0 0 0 4098 4098 0 0 0 0 0 0 0 49 1 1000 0 0 0 0 Warrior`sArmor None 5
133159 ArcherSoulArmor 45 0 130 0 0 240 0 0 0 0 258000 0 0 0 700 0 0 0 0 4098 4098 0...
|
[Release]Class PK Envoy for 5165
01/17/2010 - CO2 PServer Guides & Releases - 16 Replies
thats Class Pk Envoy for 5165 and ProfPKChief for WeeklyPKChampion
#region Top WeeklyPKChampion
case 1502:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("Hey there i hold WeeklyPKChampion for Trojans, Warriors, Ninjas, Taoists And Archers , So Tell me your Class so i can Sign you Up.at 19:45!"));
GC.AddSend(Packets.NPCLink("Iam a Trojan", 1));
|
All times are GMT +2. The time now is 15:14.
|
|