|
You last visited: Today at 04:47
Advertisement
Chat.cs
Discussion on Chat.cs within the CO2 Private Server forum part of the Conquer Online 2 category.
05/13/2010, 16:58
|
#1
|
elite*gold: 0
Join Date: May 2010
Posts: 29
Received Thanks: 8
|
Chat.cs
Guys anyone knows anyway to make a command like this
/item "player" 2 DragonBall
Where Player would be the name of any player where i want to give 2 DragonBalls? or ExpBall or whatever?
Can anyone helpme to do that?
|
|
|
05/13/2010, 19:58
|
#2
|
elite*gold: 0
Join Date: May 2010
Posts: 630
Received Thanks: 130
|
Use /giveitem
to give another player an item.
this is the command.
ex. /giveitem kingofsword super 12 7 255 13 13
and for dragonball /giveitem dragonball normal 0 0 0 0 0
Code:
if (Cmd[0] == "/giveitem")
{
foreach (Character Charrrrrrr in World.H_Chars.Values)
{
uint ID = 0;
foreach (DatabaseItem DI in Database.DatabaseItems.Values)
if (DI.Name == Cmd[1])
{
ID = DI.ID;
Game.ItemIDManipulation e = new Game.ItemIDManipulation(ID);
Game.Item.ItemQuality Quality = e.Quality;
if (Cmd[2].ToLower() == "refined") Quality = Game.Item.ItemQuality.Refined;
else if (Cmd[2].ToLower() == "unique") Quality = Game.Item.ItemQuality.Unique;
else if (Cmd[2].ToLower() == "elite") Quality = Game.Item.ItemQuality.Elite;
else if (Cmd[2].ToLower() == "super") Quality = Game.Item.ItemQuality.Super;
else if (Cmd[2].ToLower() == "simple") Quality = Game.Item.ItemQuality.Simple;
else if (Cmd[2].ToLower() == "fixed") Quality = Game.Item.ItemQuality.Fixed;
else if (Cmd[2].ToLower() == "poor") Quality = Game.Item.ItemQuality.Poor;
else if (Cmd[2].ToLower() == "normal") Quality = Game.Item.ItemQuality.Normal;
if (e.Quality == Quality)
break;
}
if (ID != 0 && Charrrrrrr.Inventory.Count < 40)
{
Game.ItemIDManipulation e = new Game.ItemIDManipulation(ID);
Game.Item.ItemQuality Quality = e.Quality;
bool change = true;
if (Cmd[2].ToLower() == "refined") Quality = Game.Item.ItemQuality.Refined;
else if (Cmd[2].ToLower() == "unique") Quality = Game.Item.ItemQuality.Unique;
else if (Cmd[2].ToLower() == "elite") Quality = Game.Item.ItemQuality.Elite;
else if (Cmd[2].ToLower() == "super") Quality = Game.Item.ItemQuality.Super;
else if (Cmd[2].ToLower() == "simple") Quality = Game.Item.ItemQuality.Simple;
else if (Cmd[2].ToLower() == "fixed") Quality = Game.Item.ItemQuality.Fixed;
else if (Cmd[2].ToLower() == "poor") Quality = Game.Item.ItemQuality.Poor;
else if (Cmd[2].ToLower() == "normal") Quality = Game.Item.ItemQuality.Normal;
else change = false;
if (change)
e.QualityChange(Quality);
ID = e.ToID();
if (!Database.DatabaseItems.ContainsKey(ID))
{
return;
}
Game.Item I = new NewestCOServer.Game.Item();
if (e.Part(0, 2) == 11 || e.Part(0, 2) == 13 || e.Part(0, 3) == 123 || e.Part(0, 3) == 141 || e.Part(0, 3) == 142)
I.Color = NewestCOServer.Game.Item.ArmorColor.Orange;
//I.FreeItem = true;
I.ID = ID;
I.UID = (uint)Program.Rnd.Next(10000000);
try
{
I.MaxDur = I.DBInfo.Durability;
I.CurDur = I.MaxDur;
}
catch (Exception Exc) { Program.WriteLine(Exc); }
try
{
I.Plus = byte.Parse(Cmd[3]);
}
catch { }
try
{
I.Bless = byte.Parse(Cmd[4]);
}
catch { }
try
{
I.Enchant = byte.Parse(Cmd[5]);
}
catch { }
try
{
I.Soc1 = (Game.Item.Gem)byte.Parse(Cmd[6]);
}
catch { }
try
{
I.Soc2 = (Game.Item.Gem)byte.Parse(Cmd[7]);
}
catch { }
I.Effect = NewestCOServer.Game.Item.RebornEffect.None;
Charrrrrrr.AddItem(I);
}
}
}
|
|
|
05/14/2010, 06:01
|
#3
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
|
Wtf?
foreach (Character Charrrrrrr in World.H_Chars.Values)
Why are you giving EVERY char online the item.
He wants to input the char name and it gives the character the item.
|
|
|
05/14/2010, 06:24
|
#4
|
elite*gold: 0
Join Date: May 2010
Posts: 630
Received Thanks: 130
|
dont know if it could be done at this way, if it can, then is fixed.
i can't see for errors, or wrong types, becuz i haven't open c#, because i on ma way to bed :P
but if im right then is ex.
/item dragonball normal 0 0 0 0 0 Charname
Code:
if (Cmd[0] == "/giveitem")
{
foreach (Character Charrrrrrr in World.H_Chars.Values)
{
uint ID = 0;
foreach (DatabaseItem DI in Database.DatabaseItems.Values)
if (DI.Name == Cmd[1])
{
ID = DI.ID;
Game.ItemIDManipulation e = new Game.ItemIDManipulation(ID);
Game.Item.ItemQuality Quality = e.Quality;
if (Cmd[2].ToLower() == "refined") Quality = Game.Item.ItemQuality.Refined;
else if (Cmd[2].ToLower() == "unique") Quality = Game.Item.ItemQuality.Unique;
else if (Cmd[2].ToLower() == "elite") Quality = Game.Item.ItemQuality.Elite;
else if (Cmd[2].ToLower() == "super") Quality = Game.Item.ItemQuality.Super;
else if (Cmd[2].ToLower() == "simple") Quality = Game.Item.ItemQuality.Simple;
else if (Cmd[2].ToLower() == "fixed") Quality = Game.Item.ItemQuality.Fixed;
else if (Cmd[2].ToLower() == "poor") Quality = Game.Item.ItemQuality.Poor;
else if (Cmd[2].ToLower() == "normal") Quality = Game.Item.ItemQuality.Normal;
if (e.Quality == Quality)
break;
}
if (ID != 0 && Charrrrrrr.Inventory.Count < 40)
{
Game.ItemIDManipulation e = new Game.ItemIDManipulation(ID);
Game.Item.ItemQuality Quality = e.Quality;
bool change = true;
if (Cmd[2].ToLower() == "refined") Quality = Game.Item.ItemQuality.Refined;
else if (Cmd[2].ToLower() == "unique") Quality = Game.Item.ItemQuality.Unique;
else if (Cmd[2].ToLower() == "elite") Quality = Game.Item.ItemQuality.Elite;
else if (Cmd[2].ToLower() == "super") Quality = Game.Item.ItemQuality.Super;
else if (Cmd[2].ToLower() == "simple") Quality = Game.Item.ItemQuality.Simple;
else if (Cmd[2].ToLower() == "fixed") Quality = Game.Item.ItemQuality.Fixed;
else if (Cmd[2].ToLower() == "poor") Quality = Game.Item.ItemQuality.Poor;
else if (Cmd[2].ToLower() == "normal") Quality = Game.Item.ItemQuality.Normal;
else change = false;
if (change)
e.QualityChange(Quality);
ID = e.ToID();
if (!Database.DatabaseItems.ContainsKey(ID))
{
return;
}
Game.Item I = new NewestCOServer.Game.Item();
if (e.Part(0, 2) == 11 || e.Part(0, 2) == 13 || e.Part(0, 3) == 123 || e.Part(0, 3) == 141 || e.Part(0, 3) == 142)
I.Color = NewestCOServer.Game.Item.ArmorColor.Orange;
//I.FreeItem = true;
I.ID = ID;
I.UID = (uint)Program.Rnd.Next(10000000);
try
{
I.MaxDur = I.DBInfo.Durability;
I.CurDur = I.MaxDur;
}
catch (Exception Exc) { Program.WriteLine(Exc); }
try
{
I.Plus = byte.Parse(Cmd[3]);
}
catch { }
try
{
I.Bless = byte.Parse(Cmd[4]);
}
catch { }
try
{
I.Enchant = byte.Parse(Cmd[5]);
}
catch { }
try
{
I.Soc1 = (Game.Item.Gem)byte.Parse(Cmd[6]);
}
catch { }
try
{
I.Soc2 = (Game.Item.Gem)byte.Parse(Cmd[7]);
}
catch { }
I.Effect = NewestCOServer.Game.Item.RebornEffect.None;
if (Charrrrrrr.Name == Cmd[8])
{
Charrrrrrr.AddItem(I);
}
}
}
}
|
|
|
05/14/2010, 06:31
|
#5
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
|
Still adding the item to every character online.
|
|
|
05/14/2010, 06:41
|
#6
|
elite*gold: 0
Join Date: May 2010
Posts: 630
Received Thanks: 130
|
nope.
if (Charrrrrrr.Name == Cmd[8])
{
Charrrrrrr.AddItem(I);
}
checking if the char is the name as cmd 8.
|
|
|
05/14/2010, 06:48
|
#7
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
|
Ah I see what you did lol.
|
|
|
05/14/2010, 07:21
|
#8
|
elite*gold: 0
Join Date: May 2010
Posts: 29
Received Thanks: 8
|
Thanks a lot i tested and works thank u
|
|
|
05/14/2010, 20:03
|
#9
|
elite*gold: 0
Join Date: May 2010
Posts: 630
Received Thanks: 130
|
Quote:
Originally Posted by .Arco
Ah I see what you did lol.
|
hehe
|
|
|
05/15/2010, 02:04
|
#10
|
elite*gold: 0
Join Date: Jan 2007
Posts: 177
Received Thanks: 57
|
Quote:
Originally Posted by .Summer
dont know if it could be done at this way, if it can, then is fixed.
i can't see for errors, or wrong types, becuz i haven't open c#, because i on ma way to bed :P
but if im right then is ex.
/item dragonball normal 0 0 0 0 0 Charname
Code:
if (Cmd[0] == "/giveitem")
{
foreach (Character Charrrrrrr in World.H_Chars.Values)
{
uint ID = 0;
foreach (DatabaseItem DI in Database.DatabaseItems.Values)
if (DI.Name == Cmd[1])
{
ID = DI.ID;
Game.ItemIDManipulation e = new Game.ItemIDManipulation(ID);
Game.Item.ItemQuality Quality = e.Quality;
if (Cmd[2].ToLower() == "refined") Quality = Game.Item.ItemQuality.Refined;
else if (Cmd[2].ToLower() == "unique") Quality = Game.Item.ItemQuality.Unique;
else if (Cmd[2].ToLower() == "elite") Quality = Game.Item.ItemQuality.Elite;
else if (Cmd[2].ToLower() == "super") Quality = Game.Item.ItemQuality.Super;
else if (Cmd[2].ToLower() == "simple") Quality = Game.Item.ItemQuality.Simple;
else if (Cmd[2].ToLower() == "fixed") Quality = Game.Item.ItemQuality.Fixed;
else if (Cmd[2].ToLower() == "poor") Quality = Game.Item.ItemQuality.Poor;
else if (Cmd[2].ToLower() == "normal") Quality = Game.Item.ItemQuality.Normal;
if (e.Quality == Quality)
break;
}
if (ID != 0 && Charrrrrrr.Inventory.Count < 40)
{
Game.ItemIDManipulation e = new Game.ItemIDManipulation(ID);
Game.Item.ItemQuality Quality = e.Quality;
bool change = true;
if (Cmd[2].ToLower() == "refined") Quality = Game.Item.ItemQuality.Refined;
else if (Cmd[2].ToLower() == "unique") Quality = Game.Item.ItemQuality.Unique;
else if (Cmd[2].ToLower() == "elite") Quality = Game.Item.ItemQuality.Elite;
else if (Cmd[2].ToLower() == "super") Quality = Game.Item.ItemQuality.Super;
else if (Cmd[2].ToLower() == "simple") Quality = Game.Item.ItemQuality.Simple;
else if (Cmd[2].ToLower() == "fixed") Quality = Game.Item.ItemQuality.Fixed;
else if (Cmd[2].ToLower() == "poor") Quality = Game.Item.ItemQuality.Poor;
else if (Cmd[2].ToLower() == "normal") Quality = Game.Item.ItemQuality.Normal;
else change = false;
if (change)
e.QualityChange(Quality);
ID = e.ToID();
if (!Database.DatabaseItems.ContainsKey(ID))
{
return;
}
Game.Item I = new NewestCOServer.Game.Item();
if (e.Part(0, 2) == 11 || e.Part(0, 2) == 13 || e.Part(0, 3) == 123 || e.Part(0, 3) == 141 || e.Part(0, 3) == 142)
I.Color = NewestCOServer.Game.Item.ArmorColor.Orange;
//I.FreeItem = true;
I.ID = ID;
I.UID = (uint)Program.Rnd.Next(10000000);
try
{
I.MaxDur = I.DBInfo.Durability;
I.CurDur = I.MaxDur;
}
catch (Exception Exc) { Program.WriteLine(Exc); }
try
{
I.Plus = byte.Parse(Cmd[3]);
}
catch { }
try
{
I.Bless = byte.Parse(Cmd[4]);
}
catch { }
try
{
I.Enchant = byte.Parse(Cmd[5]);
}
catch { }
try
{
I.Soc1 = (Game.Item.Gem)byte.Parse(Cmd[6]);
}
catch { }
try
{
I.Soc2 = (Game.Item.Gem)byte.Parse(Cmd[7]);
}
catch { }
I.Effect = NewestCOServer.Game.Item.RebornEffect.None;
if (Charrrrrrr.Name == Cmd[8])
{
Charrrrrrr.AddItem(I);
}
}
}
}
|
lmao this works, but at the same time it searches through the database and finds the item for each character until it hits the right one, which is terribly ineffecient. have two foreach loops, one that gets the uid of the character and one that builds the item, then put them together at the end.
Code:
if (Cmd[0] == "/giveitem")
{
uint ID = 0;
foreach (DatabaseItem DI in Database.DatabaseItems.Values)
if (DI.Name == Cmd[1])
{
ID = DI.ID;
Game.ItemIDManipulation e = new Game.ItemIDManipulation(ID);
Game.Item.ItemQuality Quality = e.Quality;
if (Cmd[2].ToLower() == "refined") Quality = Game.Item.ItemQuality.Refined;
else if (Cmd[2].ToLower() == "unique") Quality = Game.Item.ItemQuality.Unique;
else if (Cmd[2].ToLower() == "elite") Quality = Game.Item.ItemQuality.Elite;
else if (Cmd[2].ToLower() == "super") Quality = Game.Item.ItemQuality.Super;
else if (Cmd[2].ToLower() == "simple") Quality = Game.Item.ItemQuality.Simple;
else if (Cmd[2].ToLower() == "fixed") Quality = Game.Item.ItemQuality.Fixed;
else if (Cmd[2].ToLower() == "poor") Quality = Game.Item.ItemQuality.Poor;
else if (Cmd[2].ToLower() == "normal") Quality = Game.Item.ItemQuality.Normal;
if (e.Quality == Quality)
break;
}
if (ID != 0)
{
Game.ItemIDManipulation e = new Game.ItemIDManipulation(ID);
Game.Item.ItemQuality Quality = e.Quality;
bool change = true;
if (Cmd[2].ToLower() == "refined") Quality = Game.Item.ItemQuality.Refined;
else if (Cmd[2].ToLower() == "unique") Quality = Game.Item.ItemQuality.Unique;
else if (Cmd[2].ToLower() == "elite") Quality = Game.Item.ItemQuality.Elite;
else if (Cmd[2].ToLower() == "super") Quality = Game.Item.ItemQuality.Super;
else if (Cmd[2].ToLower() == "simple") Quality = Game.Item.ItemQuality.Simple;
else if (Cmd[2].ToLower() == "fixed") Quality = Game.Item.ItemQuality.Fixed;
else if (Cmd[2].ToLower() == "poor") Quality = Game.Item.ItemQuality.Poor;
else if (Cmd[2].ToLower() == "normal") Quality = Game.Item.ItemQuality.Normal;
else change = false;
if (change)
e.QualityChange(Quality);
ID = e.ToID();
if (!Database.DatabaseItems.ContainsKey(ID))
{
return;
}
Game.Item I = new NewestCOServer.Game.Item();
if (e.Part(0, 2) == 11 || e.Part(0, 2) == 13 || e.Part(0, 3) == 123 || e.Part(0, 3) == 141 || e.Part(0, 3) == 142)
I.Color = NewestCOServer.Game.Item.ArmorColor.Orange;
//I.FreeItem = true;
I.ID = ID;
I.UID = (uint)Program.Rnd.Next(10000000);
try
{
I.MaxDur = I.DBInfo.Durability;
I.CurDur = I.MaxDur;
}
catch (Exception Exc) { Program.WriteLine(Exc); }
try
{
I.Plus = byte.Parse(Cmd[3]);
}
catch { }
try
{
I.Bless = byte.Parse(Cmd[4]);
}
catch { }
try
{
I.Enchant = byte.Parse(Cmd[5]);
}
catch { }
try
{
I.Soc1 = (Game.Item.Gem)byte.Parse(Cmd[6]);
}
catch { }
try
{
I.Soc2 = (Game.Item.Gem)byte.Parse(Cmd[7]);
}
catch { }
I.Effect = NewestCOServer.Game.Item.RebornEffect.None;
foreach (Character Charrrrrrr in World.H_Chars.Values)
{
if (Charrrrrrr.Name == Cmd[8] && Charrrrrrr.Inventory.Count < 40)
{
Charrrrrrr.AddItem(I);
}
}
}
}
still looks ugly though... i'll touch it up in a bit
edit:
don't have the source that you're working with, so i had to make a few assumptions about how things worked, but i removed some redundancies
Code:
if (Cmd[0] == "/giveitem")
{
uint ID = 0;
foreach (DatabaseItem DI in Database.DatabaseItems.Values)
if (DI.Name.ToLower() == Cmd[1].ToLower())
{
ID = DI.ID;
Game.ItemIDManipulation e = new Game.ItemIDManipulation(ID);
Game.Item.ItemQuality Quality = e.Quality;
switch (Cmd[2].ToLower())
{
case "refined": Quality = Game.Item.ItemQuality.Refined; break;
case "unique": Quality = Game.Item.ItemQuality.Unique; break;
case "elite": Quality = Game.Item.ItemQuality.Elite; break;
case "super": Quality = Game.Item.ItemQuality.Super; break;
case "simple": Quality = Game.Item.ItemQuality.Simple; break;
case "fixed": Quality = Game.Item.ItemQuality.Fixed; break;
case "poor": Quality = Game.Item.ItemQuality.Poor; break;
case "normal": Quality = Game.Item.ItemQuality.Normal; break;
default: return;
}
e.QualityChange(Quality);
ID = e.ToID();
if (!Database.DatabaseItems.ContainsKey(ID))
return;
Game.Item I = new NewestCOServer.Game.Item();
if (e.Part(0, 2) == 11 || e.Part(0, 2) == 13 || e.Part(0, 3) == 123 || e.Part(0, 3) == 141 || e.Part(0, 3) == 142)
I.Color = NewestCOServer.Game.Item.ArmorColor.Orange;
//I.FreeItem = true;
I.ID = ID;
I.UID = (uint)Program.Rnd.Next(10000000);
try
{
I.MaxDur = I.DBInfo.Durability;
I.CurDur = I.MaxDur;
}
catch (Exception Exc) { Program.WriteLine(Exc); }
try
{
I.Plus = byte.Parse(Cmd[3]);
}
catch { }
try
{
I.Bless = byte.Parse(Cmd[4]);
}
catch { }
try
{
I.Enchant = byte.Parse(Cmd[5]);
}
catch { }
try
{
I.Soc1 = (Game.Item.Gem)byte.Parse(Cmd[6]);
}
catch { }
try
{
I.Soc2 = (Game.Item.Gem)byte.Parse(Cmd[7]);
}
catch { }
I.Effect = NewestCOServer.Game.Item.RebornEffect.None;
foreach (Character Charrrrrrr in World.H_Chars.Values)
{
if (Charrrrrrr.Name == Cmd[8] && Charrrrrrr.Inventory.Count < 40)
{
Charrrrrrr.AddItem(I);
}
}
}
}
|
|
|
05/15/2010, 02:06
|
#11
|
elite*gold: 0
Join Date: May 2010
Posts: 630
Received Thanks: 130
|
I didnt make the code 
jsut took the original item command at putted a foreach o.o
|
|
|
05/15/2010, 02:14
|
#12
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
|
Why didn't you just use CharacterFromName?
|
|
|
05/15/2010, 02:25
|
#13
|
elite*gold: 0
Join Date: May 2010
Posts: 630
Received Thanks: 130
|
I dont know  doh! fail :P
|
|
|
05/15/2010, 04:23
|
#14
|
elite*gold: 0
Join Date: Feb 2006
Posts: 550
Received Thanks: 82
|
Quote:
Originally Posted by .Arco
Why didn't you just use CharacterFromName?
|
it would most likely do the same thing anyway.
|
|
|
05/15/2010, 04:25
|
#15
|
elite*gold: 0
Join Date: May 2010
Posts: 630
Received Thanks: 130
|
Quote:
Originally Posted by ChingChong23
it would most likely do the same thing anyway.
|
not really, then it would not search the whole db for the player.
|
|
|
 |
Similar Threads
|
[Release] BoI Helper (Chat Cmd's, Speed/Chat/Zoom hack)
03/01/2011 - Battle of the Immortals - 54 Replies
Hi!
First of all, i know this will completely destroy the world chat cuz of colored flasching and flying texts everywhere but anyhow i wanted to release this little tool.
I like to use some Chat Commands to color my Text when advertising sales or looking for a party etc. but im too lazy to write the commands for that again and again so i wrote this little Tool that generates the codes i need with a few clicks and puts it into the clipboard =)
Features:
Color: Give your Text a...
|
-> warrock section chat <- CHAT
06/24/2010 - WarRock - 5 Replies
Hallo ich bins annoying orange wurde irgendwie aus unerklärlichen gründen gebannt
ich stelle hier mal den warrock/section chat wieder online,
unter der adressen
Chatango: Elitepvpers Warrock Section
kommt doch mal drauf
|
P-Server CHAT und GM CHAT /b /n Problem HILFE
11/07/2009 - Metin2 Private Server - 5 Replies
Hallo leute,
Also, seit dem ich Updates auf meinem PC insterlliert habe und den PC neugestartet habe, hat mein Server irgendein Problem bekommen. Wenn ich mich einlogge kann ich noch Items erstellen kämpfen usw.. außer in irgendeiner Form Chatten. So zB. wenn ich versuche was zu schreiben kommt der Satz halt nicht über dem Kopf oder im Chat und dann ist alles weg also kann keine Items erstellen und nur Attacken einsetzten MObs kann ich nicht töten, also so als ob das Internet dann weg wäre....
|
Chat & Guild Chat Farbe ändern
10/29/2007 - RO Exploits, Hacks, Bots & Guides - 14 Replies
Chat & Guild Chat Farbe ändern
Also es habe ja schon viele gefragt wie man dies macht,
ich habe nun die Antwort !
es ist eigentlich ganz simpel,
öffnet mit einem Hex-Editor eure ragexe.exe/sakexe.exe
Für Chat Farbe: (es reicht den 1. eintrag den er findet zu ersetzen)
|
All times are GMT +1. The time now is 04:49.
|
|