proplem in load FreeItems in 5165

10/03/2010 23:54 koko425#1
i have a proplem of loading freeitems (bound) in 5165

and here is my packets
public static byte[] AddItem(Game.Item I, byte Pos)
{
byte[] Packet = new byte[8 + 48];
COPacket P = new COPacket(Packet);
try
{
P.WriteUshortAddPos2((ushort)(Packet.Length - 8));
P.WriteUshortAddPos2((ushort)0x3f0);
P.WriteUintAddPos4(I.UID);
P.WriteUintAddPos4(I.ID);
P.WriteUshortAddPos2(I.CurDur);
P.WriteUshortAddPos2(I.MaxDur);
P.WriteUshortAddPos2(1);
P.WriteUshortAddPos2(Pos);
P.WriteUintAddPos4(I.TalismanProgress);
P.WriteByteAddPos1((byte)I.Soc1);
P.WriteByteAddPos1((byte)I.Soc2);
P.WriteUshortAddPos2((ushort)I.Effect);
P.WriteByteAddPos1(I.Plus);
P.WriteByteAddPos1(I.Bless);
if (I.FreeItem)
P.WriteByteAddPos1(1);
else
P.WriteByteAddPos1(0);
P.WriteByteAddPos1(I.Enchant);
P.WriteUintAddPos4(0);
P.WriteUshortAddPos2(0);
//P.Move(6);
if (I.Locked == 1)
P.WriteUshortAddPos2(1);
else if (I.Locked == 2)
P.WriteUshortAddPos2(1);
else
P.WriteUshortAddPos2(0);
if (I.Color == 0)
I.Color = (Game.Item.ArmorColor)new Random().Next(1, 9);
P.WriteUintAddPos4((uint)I.Color);
P.WriteUintAddPos4(I.Progress);
}
catch (Exception Exc) { Program.WriteLine(Exc); }
return P.AddTQServer8Byte();
}

and this code for get items free
PHP Code:
 case "#item":
                                                    {
                                                        
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 != && GC.MyChar.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(02) == 11 || e.Part(02) == 13 || e.Part(03) == 123 || e.Part(03) == 141 || e.Part(03) == 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 { }
                                                            try
                                                            {
                                                                if (
Cmd[8] == "Poison")
                                                                {
                                                                    
I.Effect NewestCOServer.Game.Item.RebornEffect.Poison;
                                                                }
                                                                else if (
Cmd[8] == "HP")
                                                                {
                                                                    
I.Effect NewestCOServer.Game.Item.RebornEffect.HP;
                                                                }
                                                                else if (
Cmd[8] == "MP")
                                                                {
                                                                    
I.Effect NewestCOServer.Game.Item.RebornEffect.MP;
                                                                }
                                                                else if (
Cmd[8] == "Shield")
                                                                {
                                                                    
I.Effect NewestCOServer.Game.Item.RebornEffect.Shield;
                                                                }
                                                                else if (
Cmd[8] == "Horsie")
                                                                {
                                                                    
I.Effect NewestCOServer.Game.Item.RebornEffect.Horsie;
                                                                }
                                                                else
                                                                    
I.Effect NewestCOServer.Game.Item.RebornEffect.None;

                                                            }
                                                            catch { }

                                                            
GC.MyChar.AddFullItem(I.IDI.BlessI.PlusI.EnchantI.Soc1I.Soc2I.ColorI.ProgressI.TalismanProgressI.EffectI.FreeItemI.CurDurI.MaxDurI.SuspiciousI.LockedI.LockedDaysI.RBG[0], I.RBG[1], I.RBG[2], I.RBG[3]);
                                                        }
                                                        break;
                                                    } 
10/06/2010 12:52 |xabi|#2
nice!
10/06/2010 14:04 pro4never#3
I assume they are working when you create but not saving?

Ensure you are writing the free status to your database and loading it when items are loaded back into the server on login. If not it will obviously reset every login.
10/06/2010 21:08 koko425#4
Quote:
Originally Posted by pro4never View Post
I assume they are working when you create but not saving?

Ensure you are writing the free status to your database and loading it when items are loaded back into the server on login. If not it will obviously reset every login.
ya this write but not load
10/07/2010 03:15 pro4never#5
Then modify the reader you use to load character items on login.
10/08/2010 23:48 koko425#6
Quote:
Originally Posted by pro4never View Post
Then modify the reader you use to load character items on login.
ya i am sure i modified to read it but not load