hello
i would like to give player item with a comand and i can make it bound and have effect like ( /give player item heartnecklace super 12 7 255 13 13 1 HP )
this wil give player +12 -7 255 HP , 2dragon gem bound item and it have health regan
case "Give":
{
var varr = ServerBase.Kernel.GamePool.Values.GetEnumerator();
varr.MoveNext();
int COunt = ServerBase.Kernel.GamePool.Count;
for (uint x = 0;
x < COunt;
x++)
{
if (x >= COunt) break;
Client.GameState Client = (varr.Current as Client.GameState);
if (Client.Entity.Name.ToLower().Contains(Data[1]))
{
switch (Data[2])
{
case "at":
{
Client.Entity.Atributes = byte.Parse(Data[3]);
break;
}
case "vip":
Client.Entity.VIPLevel = byte.Parse(Data[3]);
break;
case "cps":
Client.Entity.ConquerPoints += uint.Parse(Data[3]);
break;
case "cps-":
Client.Entity.ConquerPoints -= uint.Parse(Data[3]);
break;
case "pkp":
Client.Entity.PKPoints = ushort.Parse(Data[3]);
break;
case "range":
Client.Entity.AttackRange = ushort.Parse(Data[3]);
break;
case "defense":
Client.Entity.Defence = ushort.Parse(Data[3]);
break;
case "minattack":
Client.Entity.MinAttack = uint.Parse(Data[3]);
break;
case "maxattack":
Client.Entity.MaxAttack = uint.Parse(Data[3]);
break;
case "mattck":
Client.Entity.MagicDamageIncrease = ushort.Parse(Data[3]);
break;
case "dodge":
Client.Entity.Dodge = byte.Parse(Data[3]);
break;
case "money":
Client.Entity.Money += uint.Parse(Data[3]);
break;
case "spell":
Client.AddSpell(new Spell(true) { ID = ushort.Parse(Data[3]) });
break;
case "level":
Client.Entity.Level = byte.Parse(Data[3]);
break;
case "item":
{
string ItemName = Data[3];
Game.Enums.ItemQuality Quality = Game.Enums.ItemQuality.Fixed;
switch (Data[4].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;
case "other": Quality = Game.Enums.ItemQuality.Other; break;
default:
{
Quality = (Conquer_Online_Server.Game.Enums.ItemQuality)int. Parse(Data[4]);
break;
}
}
Database.ConquerItemBaseInformation CIBI = null;
foreach (Database.ConquerItemBaseInformation infos in Database.ConquerItemInformation.BaseInformations.V alues)
{
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.Durability = CIBI.Durability;
newItem.MaximDurability = CIBI.Durability;
if (Data.Length > 3)
{
byte plus = 0;
byte.TryParse(Data[5], out plus);
newItem.Plus = Math.Min((byte)12, plus);
if (Data.Length > 4)
{
byte bless = 0;
byte.TryParse(Data[6], out bless);
newItem.Bless = Math.Min((byte)7, bless);
if (Data.Length > 5)
{
byte ench = 0;
byte.TryParse(Data[7], out ench);
newItem.Enchant = Math.Min((byte)255, ench);
if (Data.Length > 6)
{
byte soc1 = 0;
byte.TryParse(Data[8], 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[9], 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[10], out R);
byte.TryParse(Data[11], out G);
byte.TryParse(Data[12], 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;
duno about this one
but about the rest
at the client.inventory.add(item,plus,times) there is overload with 4th bool parm. for bounded
create a new override with damage,hp,gem1,gem2 in addition to the item id , plus , times
give it a try
i think you didnt understand me or i didnt understand you....
what i mean i can make any item ( neck , armor , boot , helmet...etc ) same as when you be rebrith you got a poison blade / bow give shield / backsword give HP / MP...i want to make a item bla super 12 7 255 13 13 1 HP
super
+12
-7 dmg
255 health
2 super dragon gem
1 bound ( 0 not bound )
HP ( chance to regain health ) [ same as backsword for fire rebrith ]
Step 1: Create the item in memory (Item class/struct which likely inherits from a ItemType class/struct). There are likely multiple constructors for this already. If you need additional parameters (such as reborn effect)then I suggest writing your own constructor for ther class.
Step 2: Populate this Item object via command input (actually same step but they involve different things). You're already doing this sortof but checking validity of input is always (strongly) recommended and I'm sure you can clean up that code after you get everything working.
Step 3: Save the new item to your database. Just a simple insert statement which should already exist in your source.
Step 4: Add the Item object to your Client's inventory.
Step 5:: Inform the client about their shiny new item. This is just an item info packet which you can send generally based on the Item object which you've already created.
case "Give":
{
var varr = ServerBase.Kernel.GamePool.Values.GetEnumerator();
varr.MoveNext();
int COunt = ServerBase.Kernel.GamePool.Count;
for (uint x = 0; x < COunt; x++)
{
if (x >= COunt) break;
Client.GameState Client = (varr.Current as Client.GameState);
if (Client.Entity.Name.ToLower().Contains(Data[1]))
{
switch (Data[2])
{
case "at":
{
Client.Entity.Atributes = byte.Parse(Data[3]);
break;
}
case "vip":
Client.Entity.VIPLevel = byte.Parse(Data[3]);
break;
case "cps":
Client.Entity.ConquerPoints += uint.Parse(Data[3]);
break;
case "cps-":
Client.Entity.ConquerPoints -= uint.Parse(Data[3]);
break;
case "pkp":
Client.Entity.PKPoints = ushort.Parse(Data[3]);
break;
case "range":
Client.Entity.AttackRange = ushort.Parse(Data[3]);
break;
case "defense":
Client.Entity.Defence = ushort.Parse(Data[3]);
break;
case "minattack":
Client.Entity.MinAttack = uint.Parse(Data[3]);
break;
case "maxattack":
Client.Entity.MaxAttack = uint.Parse(Data[3]);
break;
case "mattck":
Client.Entity.MagicDamageIncrease = ushort.Parse(Data[3]);
break;
case "dodge":
Client.Entity.Dodge = byte.Parse(Data[3]);
break;
case "money":
Client.Entity.Money += uint.Parse(Data[3]);
break;
case "spell":
Client.AddSpell(new Spell(true) { ID = ushort.Parse(Data[3]) });
break;
case "level":
Client.Entity.Level = byte.Parse(Data[3]);
break;
case "item":
{
string ItemName = Data[3];
Game.Enums.ItemQuality Quality = Game.Enums.ItemQuality.Fixed;
switch (Data[4].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;
case "other": Quality = Game.Enums.ItemQuality.Other; break;
default:
{
Quality = (Conquer_Online_Server.Game.Enums.ItemQuality)int. Parse(Data[4]);
break;
}
}
Database.ConquerItemBaseInformation CIBI = null;
foreach (Database.ConquerItemBaseInformation infos in Database.ConquerItemInformation.BaseInformations.V alues)
{
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.Durability = CIBI.Durability;
newItem.MaximDurability = CIBI.Durability;
if (Data.Length > 3)
{
byte plus = 0;
byte.TryParse(Data[5], out plus);
newItem.Plus = Math.Min((byte)12, plus);
if (Data.Length > 4)
{
byte bless = 0;
byte.TryParse(Data[6], out bless);
newItem.Bless = Math.Min((byte)7, bless);
if (Data.Length > 5)
{
byte ench = 0;
byte.TryParse(Data[7], out ench);
newItem.Enchant = Math.Min((byte)255, ench);
if (Data.Length > 6)
{
byte soc1 = 0;
byte.TryParse(Data[8], 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[9], 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[10], out R);
byte.TryParse(Data[11], out G);
byte.TryParse(Data[12], 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;
}
}
}
}
}
Based on the code provided, you need to use "/Give item <item_name> <item_quality> [plus] [bless] [enchant] [soc1] [soc2] [r] [g] [b]".
I should also mention your array length checks are wrong..
so i only have to close it after
" if (x >= COunt) break; " ?
and what is " [r] [g] [b] "....? and how do i use them , sorry but this code i found it in server it self so i was wonder if you guys would help me to make this happen
thnx alot
PS: i have try this /give player item steelblade super 12 7 255 13 13 0 0 1 ( i thog it gona be bound but it didnt be bound )
thnx again vary much all of you ( we reply and help me out , i would give thnx for every one help me or i see his topic usefully to me )
[HELP]Give Item 02/08/2011 - EO PServer Hosting - 8 Replies Hey guys .. i wanna ask how can i give item or eudemon in their inventory .. when they all donate to me for buying item or pets .? like they all relog then the item have at their inventory ?:o