Think about the problem you're having right now...
Currently the command is accepting a string (text) input to let you pick via an item name. You want it to instead accept a int/uint (number) to let you pick an item via ItemID.
first step will be trying to read the item ID from command.
uint itemID = uint.Parse(Data[1]);
Note: This will throw an exception if you do NOT enter a number in the command. As such it's best to either verify that it's a number you're converting or catch the exception before continuing.
Once this is done then you need to try to look up the item information based on ID instead of name.
You should be able to do this via something like...
if(ConquerBaseItemInformations.ContainsKey(ItemID) )
{
//pull Item info and continue generating the item.
}
Keep in mind you won't need any of the quality checks anymore as each item quality has a different ID.
that's from the first source i ever used for nextco
you may only do something like
@item id
and it will try to give you any available quality
or @item id quality pla pla pla
and it will give you a certain quality
Code:
#region items
case "item":
{
if (Data.Length < 3)
{
string ItemName = Data[1];
Database.ConquerItemBaseInformation CIBI2 = null;
foreach (Database.ConquerItemBaseInformation infos in Database.ConquerItemInformation.BaseInformations.Values)
{
if (infos.ID == Convert.ToUInt32(Data[1]))
{
CIBI2 = infos;
}
}
Game.Enums.ItemQuality Quality2 = Game.Enums.ItemQuality.Fixed;
Interfaces.IConquerItem newItem = new GamePackets.ConquerItem(true);
newItem.ID = Convert.ToUInt32(Data[1]);
newItem.UID = GamePackets.ConquerItem.ItemUID.Next;
newItem.Durability = CIBI2.Durability;
newItem.MaximDurability = CIBI2.Durability;
newItem.Color = (Conquer_Online_Server.Game.Enums.Color)ServerBase.Kernel.Random.Next(4, 8);
client.Inventory.Add(newItem, Game.Enums.ItemUse.CreateAndAdd);
if (Data.Length == 2)
{
for (int i = 0; i < (Convert.ToInt32(Data[2])); i++)
{
client.Inventory.Add(newItem, Game.Enums.ItemUse.CreateAndAdd);
}
}
Quality2 = Game.Enums.ItemQuality.Normal;
client.Inventory.Add(newItem, Game.Enums.ItemUse.CreateAndAdd);
Quality2 = Game.Enums.ItemQuality.NormalV1;
client.Inventory.Add(newItem, Game.Enums.ItemUse.CreateAndAdd);
Quality2 = Game.Enums.ItemQuality.NormalV2;
client.Inventory.Add(newItem, Game.Enums.ItemUse.CreateAndAdd);
Quality2 = Game.Enums.ItemQuality.NormalV3;
client.Inventory.Add(newItem, Game.Enums.ItemUse.CreateAndAdd);
Quality2 = Game.Enums.ItemQuality.Refined;
client.Inventory.Add(newItem, Game.Enums.ItemUse.CreateAndAdd);
Quality2 = Game.Enums.ItemQuality.Unique;
client.Inventory.Add(newItem, Game.Enums.ItemUse.CreateAndAdd);
Quality2 = Game.Enums.ItemQuality.Elite;
client.Inventory.Add(newItem, Game.Enums.ItemUse.CreateAndAdd);
Quality2 = Game.Enums.ItemQuality.Super;
client.Inventory.Add(newItem, Game.Enums.ItemUse.CreateAndAdd);
}
if (Data.Length > 2)
{
string ItemName = Data[1];
Game.Enums.ItemQuality Quality = Game.Enums.ItemQuality.Fixed;
switch (Data[2].ToLower())
{
case "fixed": Quality = Game.Enums.ItemQuality.Fixed; break;
case "normal": Quality = Game.Enums.ItemQuality.Normal; break;
case "normalv1": Quality = Game.Enums.ItemQuality.NormalV1; break;
case "normalv2": Quality = Game.Enums.ItemQuality.NormalV2; break;
case "normalv3": Quality = Game.Enums.ItemQuality.NormalV3; break;
case "refined": Quality = Game.Enums.ItemQuality.Refined; break;
case "unique": Quality = Game.Enums.ItemQuality.Unique; break;
case "elite": Quality = Game.Enums.ItemQuality.Elite; break;
case "super": Quality = Game.Enums.ItemQuality.Super; break;
}
Database.ConquerItemBaseInformation CIBI = null;
foreach (Database.ConquerItemBaseInformation infos in Database.ConquerItemInformation.BaseInformations.Values)
{
if (infos.Name.ToLower() == ItemName.ToLower() && Quality == (Game.Enums.ItemQuality)(infos.ID % 10))
{
CIBI = infos;
}
}
if (CIBI == null)
break;
Interfaces.IConquerItem newItem = new GamePackets.ConquerItem(true);
newItem.ID = CIBI.ID;
newItem.UID = GamePackets.ConquerItem.ItemUID.Next;
newItem.Durability = CIBI.Durability;
newItem.MaximDurability = CIBI.Durability;
if (Data.Length > 3)
{
byte plus = 0;
byte.TryParse(Data[3], out plus);
newItem.Plus = Math.Min((byte)12, plus);
if (Data.Length > 4)
{
byte bless = 0;
byte.TryParse(Data[4], out bless);
newItem.Bless = Math.Min((byte)7, bless);
if (Data.Length > 5)
{
byte ench = 0;
byte.TryParse(Data[5], out ench);
newItem.Enchant = Math.Min((byte)255, ench);
if (Data.Length > 6)
{
byte soc1 = 0;
byte.TryParse(Data[6], out soc1);
if (Enum.IsDefined(typeof(Game.Enums.Gem), soc1))
{
newItem.SocketOne = (Game.Enums.Gem)soc1;
}
if (Data.Length > 7)
{
byte soc2 = 0;
byte.TryParse(Data[7], out soc2);
if (Enum.IsDefined(typeof(Game.Enums.Gem), soc2))
{
newItem.SocketTwo = (Game.Enums.Gem)soc2;
}
}
if (Data.Length > 10)
{
byte R = 0, G = 0, B = 0;
byte.TryParse(Data[8], out R);
byte.TryParse(Data[9], out G);
byte.TryParse(Data[10], out B);
newItem.SocketProgress = (uint)(B | (G << 8) | (R << 16));
}
}
}
}
}
newItem.Color = (Conquer_Online_Server.Game.Enums.Color)ServerBase.Kernel.Random.Next(4, 8);
client.Inventory.Add(newItem, Game.Enums.ItemUse.CreateAndAdd);
}
break;
}
#endregion
thnx you " go for it " im vary thnxfully to you , you do help too much and also " pro4ever " ^_^
PS: i try to use it and it fine... but can you tell me how to i get " 720615@@+3PassionSteedPack " each time i try to get it , i can use the pack to get it... ( i didnt test it on all item but on steed for now latter i will test it on others. )
you mean you always get the pack not the steed inside the pack ?
you want to get the steed from the steedpack id which is not going to happen , you should use the steed id not the pack id
steed id is 300000 (uncolored steed) , you should try with trail and error to get certain color
that's how you color it
at the item command i gave you there is a section where it's saying
Code:
if (Data.Length > 10)
{
byte R = 0, G = 0, B = 0;
byte.TryParse(Data[8], out R);
byte.TryParse(Data[9], out G);
byte.TryParse(Data[10], out B);
newItem.SocketProgress = (uint)(B | (G << 8) | (R << 16));
}
that's how you color it , those 3 variables R G B
some rare colors i found in an edited trinity
Comand´s minecraft 03/03/2011 - Minecraft - 12 Replies Hey leute wie füg ich comad hinzu ? z.b.w jumpto oder so?
hat wer ne anleitung wäre nett
help with a comand 04/14/2010 - Dekaron - 1 Replies is there a comand for blocking incoming pm's?cuz my friends told me it is but they dont know it,plss help me tell it 2 me:D
[HELP] GW end Comand 12/30/2009 - CO2 Private Server - 16 Replies how make comand for end gw?
I try this but dont work, what do wrong?
if (Cmd == "/gwend" && !Features.GuildWars.War)
Features.GuildWars.EndWar();