And how to make the item Free
Any Help WILL BE GREATLY Appreciated
Code:
case "item":
{
if(CSocket.Client.isPM || CSocket.Client.isGM)
{
if (CSocket.Client.Inventory.Count >= 40)
{
CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, " Your inventory is full.", Struct.ChatType.Top));
break;
}
Struct.ItemData Item = null;
int NewItemID = 0;
foreach (KeyValuePair<int, Struct.ItemData> Items in Nano.Items)
{
if (Items.Value.Name.ToLower() == Command[1].ToLower())
{
Item = Items.Value;
int l = int.Parse(Item.ID.ToString().Remove(0, Item.ID.ToString().Length - 1));
string Version = Command[2].ToLower();
int version = 9;
switch (Version)
{
case "free": version = 20; break;
case "super": version = 9; break;
case "elite": version = 8; break;
case "unique": version = 7; break;
case "refined": version = 6; break;
case "normal": version = 2; break;
case "normalv1": version = 3; break;
case "normalv2": version = 4; break;
case "normalv3": version = 5; break;
}
if (l == version)
{ NewItemID = Item.ID; break; }
else
continue;
}
}
if (Item != null)
{
string ItemID = Item.ID.ToString();
Struct.ItemInfo NewItem = new Struct.ItemInfo();
NewItem.Bless = 0;
NewItem.Dura = Item.MaxDura;
NewItem.Enchant = 0;
if (!Nano.Items.ContainsKey(Convert.ToInt32(ItemID))) { throw new Exception("Invalid quality. Could not create the it."); }
NewItem.ItemID = NewItemID = Convert.ToInt32(ItemID);
NewItem.MaxDura = Item.MaxDura;
NewItem.Plus = 0;
NewItem.Position = 0;
NewItem.Soc1 = 0;
NewItem.Soc2 = 0;
NewItem.Color = new Random().Next(2, 9);
NewItem.UID = Database.Database.ItemUID;
if (Command.Length > 3)
{
NewItem.Plus = Math.Min(12, int.Parse(Command[3]));
if (Command.Length > 4)
{
NewItem.Bless = Math.Min(7, int.Parse(Command[4]));
if (Command.Length > 5)
{
NewItem.Enchant = Math.Min(255, int.Parse(Command[5]));
if (Command.Length > 6)
{
NewItem.Soc1 = Math.Min(255, int.Parse(Command[6]));
if (Command.Length > 7)
{
NewItem.Soc2 = Math.Min(255, int.Parse(Command[7]));
}
}
}
}
}
bool created = Database.Database.NewItem(NewItem, CSocket);
CSocket.Client.Inventory.Add(NewItem.UID, NewItem);
CSocket.Send(ConquerPacket.ItemInfo(NewItem.UID, NewItem.ItemID, NewItem.Plus, NewItem.Bless, NewItem.Enchant, NewItem.Soc1, NewItem.Soc2, NewItem.Dura, NewItem.MaxDura, NewItem.Suspicious, NewItem.Free, NewItem.Locked, NewItem.Progress, NewItem.SocketProgress, NewItem.Position, NewItem.Color));
break;
}
else
CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, " Invalid item name. Could not create it.", Struct.ChatType.Top));
}
break;






