Reborn 5522 help

09/27/2011 18:47 aloisioXD#1
How i can fix the reborn and reincanation of source 5522?

when I was reincarnated, or reborn, the skills do not appear and disappear that are not, I wanted to know what to do to be reborn and reborn skills appear both when reincarnating and able to fix it.

patchs in here:

" SkillTable.cs "

Code:
using System;
using System.IO;
using System.Linq;
using System.Text;

namespace Conquer_Online_Server.Database
{
    public class SkillTable
    {
        public static void LoadProficiencies(Client.GameState client)
        {
            if (client.Entity == null)
                return;
            client.Proficiencies = new System.SafeDictionary<ushort, Interfaces.ISkill>(100);
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("skills").Where("Type", "Proficiency").And("EntityID", client.Entity.UID);
            MySqlReader r = new MySqlReader(cmd);
            while (r.Read())
            {
                Interfaces.ISkill proficiency = new Network.GamePackets.Proficiency(true);
                proficiency.ID = r.ReadUInt16("ID");
                proficiency.Level = r.ReadByte("Level");
                proficiency.PreviousLevel = r.ReadByte("PreviousLevel");
                proficiency.Experience = r.ReadUInt32("Experience");
                proficiency.Available = true;
                if (!client.Proficiencies.ContainsKey(proficiency.ID))
                    client.Proficiencies.Add(proficiency.ID, proficiency);
            }
            r.Close();
        }
        public static void SaveProficiencies(Client.GameState client)
        {
            if (client.Entity == null)
                return;
            if (client.Proficiencies == null)
                return;
            if (client.Proficiencies.Count == 0)
                return;
            foreach (Interfaces.ISkill proficiency in client.Proficiencies.Values)
            {
                if (proficiency.Available)
                {
                    MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmd.Update("skills").Set("Level", proficiency.Level).Set("PreviousLevel", proficiency.PreviousLevel)
                        .Set("Experience", proficiency.Experience).Where("EntityID", client.Entity.UID).And("ID", proficiency.ID).Execute();
                }
                else
                {
                    proficiency.Available = true;
                    MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
                    cmd.Insert("skills").Insert("Level", proficiency.Level).Insert("Experience", proficiency.Experience).Insert("EntityID", client.Entity.UID)
                        .Insert("Type", "Proficiency").Insert("ID", proficiency.ID).Execute();
                }
            }
        }
        public static void LoadSpells(Client.GameState client)
        {
            if (client.Entity == null)
                return;
            client.Spells = new System.SafeDictionary<ushort, Interfaces.ISkill>(100);
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("skills").Where("Type", "Spell").And("EntityID", client.Entity.UID);
            MySqlReader r = new MySqlReader(cmd);
            while (r.Read())
            {
                Interfaces.ISkill spell = new Network.GamePackets.Spell(true);
                spell.ID = r.ReadUInt16("ID");
                spell.Level = r.ReadByte("Level");
                spell.PreviousLevel = r.ReadByte("PreviousLevel");
                spell.Experience = r.ReadUInt32("Experience");
                spell.Available = true;
                if (!client.Spells.ContainsKey(spell.ID))
                    client.Spells.Add(spell.ID, spell);
            }
            r.Close();
        }
        public static void SaveSpells(Client.GameState client)
        {
            if (client.Entity == null)
                return;
            if (client.Spells == null)
                return;
            if (client.Spells.Count == 0)
                return;
            foreach (Interfaces.ISkill spell in client.Spells.Values)
            {
                if (spell.Available)
                {
                    MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmd.Update("skills").Set("Level", spell.Level).Set("PreviousLevel", spell.PreviousLevel)
                        .Set("Experience", spell.Experience).Where("EntityID", client.Entity.UID).And("ID", spell.ID).Execute();
                }
                else
                {
                    spell.Available = true;
                    MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
                    cmd.Insert("skills").Insert("Level", spell.Level).Insert("Experience", spell.Experience).Insert("EntityID", client.Entity.UID)
                        .Insert("Type", "Spell").Insert("ID", spell.ID).Execute();
                }
            }
        }
        public static void DeleteSpell(Client.GameState client, ushort ID)
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.DELETE);
            cmd.Delete("skills", "ID", ID).And("EntityID", client.Entity.UID).Execute();
        }

    }
}

" GameState.cs"

Code:
 public bool Reborn(byte toClass)
        {
            #region Items
            if (Inventory.Count > 38)
                return false;
            switch (toClass)
            {
                case 11:
                case 21:
                    {
                        Inventory.Add(410077, Game.Enums.ItemEffect.Poison);
                        break;
                    }
                case 41:
                    {
                        Inventory.Add(500057, Game.Enums.ItemEffect.Shield);
                        break;
                    }
                case 132:
                case 142:
                    {
                        if (toClass == 132)
                            Inventory.Add(421077, Game.Enums.ItemEffect.MP);
                        else
                            Inventory.Add(421077, Game.Enums.ItemEffect.HP);
                        break;
                    }
            }
            #region Low level items
            for (byte i = 1; i < 9; i++)
            {
                if (i != 7)
                {
                    Interfaces.IConquerItem item = Equipment.TryGetItem(i);
                    if (item != null && item.ID != 0)
                    {
                        try
                        {
                            UnloadItemStats(item, false);
                            Database.ConquerItemInformation cii = new Conquer_Online_Server.Database.ConquerItemInformation(item.ID, item.Plus);
                            item.ID = cii.LowestID(Network.PacketHandler.ItemMinLevel(Network.PacketHandler.ItemPosition(item.ID)));
                            item.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                            item.Send(this);
                            LoadItemStats(item);
                            Database.ConquerItemTable.UpdateItemID(item, this);
                        }
                        catch
                        {
                            Console.WriteLine("Reborn item problem: " + item.ID);
                        }
                    }
                }
            }
            Interfaces.IConquerItem hand = Equipment.TryGetItem(5);
            if (hand != null)
            {
                Equipment.Remove(5);
                CalculateStatBonus();
                CalculateHPBonus();
                SendStatMessage();
            }
            else
                SendScreen(Entity.SpawnPacket, false);
            #endregion
            #endregion
            if (Entity.Reborn == 0)
            {
                Entity.FirstRebornClass = Entity.Class;
                Entity.FirstRebornLevel = Entity.Level;
                Entity.Atributes =
                    (ushort)(ExtraAtributePoints(Entity.FirstRebornClass, Entity.FirstRebornLevel) + 52);
            }
            else
            {
                Entity.SecondRebornClass = Entity.Class;
                Entity.SecondRebornLevel = Entity.Level;
                Entity.Atributes =
                    (ushort)(ExtraAtributePoints(Entity.FirstRebornClass, Entity.FirstRebornLevel) +
                    ExtraAtributePoints(Entity.SecondRebornClass, Entity.SecondRebornLevel) + 62);
            }
            byte PreviousClass = Entity.Class;
            Entity.Reborn++;
            Entity.Class = toClass;
            Entity.Level = 15;
            Entity.Experience = 0;
            #region Spells
            Interfaces.ISkill[] spells = Spells.Values.ToArray();
            foreach (Interfaces.ISkill spell in spells)
            {
                spell.PreviousLevel = spell.Level;
                spell.Level = 0;
                spell.Experience = 0;
                #region Monk
                if (PreviousClass == 65)
                {
                    if (Entity.Class != 61)
                    {
                        switch (spell.ID)
                        {
                            case 10490:
                            case 10415:
                            case 10381:
                                RemoveSpell(spell);
                                break;
                        }
                    }
                }
                #endregion
                #region Warrior
                if (PreviousClass == 25)
                {
                    if (Entity.Class != 21)
                    {
                        switch (spell.ID)
                        {
                            case 1025:
                                if (Entity.Class != 21 && Entity.Class != 132)
                                    RemoveSpell(spell);
                                break;
                        }
                    }
                }
                #endregion
                #region Ninja
                if (toClass != 51)
                {
                    switch (spell.ID)
                    {
                        case 6010:
                        case 6000:
                        case 6011:
                            RemoveSpell(spell);
                            break;
                    }
                }
                #endregion
                #region Trojan
                if (toClass != 11)
                {
                    switch (spell.ID)
                    {
                        case 1115:
                            RemoveSpell(spell);
                            break;
                    }
                }
                #endregion
                #region Archer
                if (toClass != 41)
                {
                    switch (spell.ID)
                    {
                        case 8001:
                        case 8000:
                        case 8003:
                        case 9000:
                        case 8002:
                        case 8030:
                            RemoveSpell(spell);
                            break;
                    }
                }
                #endregion
                #region WaterTaoist
                if (PreviousClass == 135)
                {
                    if (toClass != 132)
                    {
                        switch (spell.ID)
                        {
                            case 1000:
                            case 1001:
                            case 1010:
                            case 1125:
                            case 1100:
                            case 8030:
                                RemoveSpell(spell);
                                break;
                            case 1050:
                            case 1175:
                            case 1170:
                                if (toClass != 142)
                                    RemoveSpell(spell);
                                break;
                        }
                    }
                }
                #endregion
                #region FireTaoist
                if (PreviousClass == 145)
                {
                    if (toClass != 142)
                    {
                        switch (spell.ID)
                        {
                            case 1000:
                            case 1001:
                            case 1150:
                            case 1180:
                            case 1120:
                            case 1002:
                            case 1160:
                            case 1165:
                                RemoveSpell(spell);
                                break;
                        }
                    }
                }
                #endregion
                if (Spells.ContainsKey(spell.ID))
                    if (spell.ID != (ushort)Game.Enums.SkillIDs.Reflect)
                        spell.Send(this);
            }
            #endregion
            #region Proficiencies
            foreach (Interfaces.ISkill proficiency in Proficiencies.Values)
            {
                proficiency.PreviousLevel = proficiency.Level;
                proficiency.Level = 0;
                proficiency.Experience = 0;
                proficiency.Send(this);
            }
            #endregion
            #region Adding earned skills
            if (Entity.Reborn == 2)
                AddSpell(new Spell(true) { ID = 9876 });
            #endregion

            Database.DataHolder.GetStats(Entity.Class, Entity.Level, this);
            CalculateStatBonus();
            CalculateHPBonus();
            GemAlgorithm();
            SendStatMessage();
            Network.PacketHandler.WorldMessage(Entity.Name + " has got " + Entity.Reborn + " reborns. Congratulations!");
            return true;
        }
"PacketHandler.cs "
Code:
        #region Reincarnation
       public class Reincarnation
       {
           private Client.GameState _client;
           private SafeDictionary<ushort, Conquer_Online_Server.Interfaces.ISkill> RemoveSkill = null;
           private SafeDictionary<ushort, Conquer_Online_Server.Interfaces.ISkill> Addskill = null;
           public Reincarnation(Client.GameState client, byte new_class)
           {
               if (client.Entity.Level < 130)
                   return;
               _client = client;
               RemoveSkill = new SafeDictionary<ushort, Conquer_Online_Server.Interfaces.ISkill>(500);
               Addskill = new SafeDictionary<ushort, Conquer_Online_Server.Interfaces.ISkill>(500);
               #region Low level items
               for (byte i = 1; i < 9; i++)
               {
                   if (i != 7)
                   {
                       Interfaces.IConquerItem item = client.Equipment.TryGetItem(i);
                       if (item != null && item.ID != 0)
                       {
                           try
                           {
                               client.UnloadItemStats(item, false);
                               Database.ConquerItemInformation cii = new Conquer_Online_Server.Database.ConquerItemInformation(item.ID, item.Plus);
                               item.ID = cii.LowestID(Network.PacketHandler.ItemMinLevel(Network.PacketHandler.ItemPosition(item.ID)));
                               item.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                               item.Send(client);
                               client.LoadItemStats(item);
                               Database.ConquerItemTable.UpdateItemID(item, client);
                           }
                           catch
                           {
                               Console.WriteLine("Reborn item problem: " + item.ID);
                           }
                       }
                   }
               }
               Interfaces.IConquerItem hand = client.Equipment.TryGetItem(5);
               if (hand != null)
               {
                   client.Equipment.Remove(5);
                   client.CalculateStatBonus();
                   client.CalculateHPBonus();
                   client.SendStatMessage();
               }
               else
                   client.Screen.SendScreen(client.Entity.SpawnPacket, false);
               #endregion

               #region Remove Extra Skill
               if (client.Entity.FirstRebornClass == 15 && client.Entity.SecondRebornClass == 15 && client.Entity.Class == 15)
               {
                   WontAdd(Conquer_Online_Server.Game.Enums.SkillIDs.DragonWhirl);
               }
               if (client.Entity.FirstRebornClass == 25 && client.Entity.SecondRebornClass == 25 && client.Entity.Class == 25)
               {
                   WontAdd(Conquer_Online_Server.Game.Enums.SkillIDs.Perseverance);
               }
               if (client.Entity.FirstRebornClass == 45 && client.Entity.SecondRebornClass == 45 && client.Entity.Class == 45)
               {
                   WontAdd(Conquer_Online_Server.Game.Enums.SkillIDs.StarArrow);
               }
               if (client.Entity.FirstRebornClass == 55 && client.Entity.SecondRebornClass == 55 && client.Entity.Class == 55)
               {
                   WontAdd(Conquer_Online_Server.Game.Enums.SkillIDs.PoisonStar);
               }
               if (client.Entity.FirstRebornClass == 65 && client.Entity.SecondRebornClass == 65 && client.Entity.Class == 65)
               {
                   WontAdd(Conquer_Online_Server.Game.Enums.SkillIDs.SoulShackle);
               } 
               if (client.Entity.FirstRebornClass == 135 && client.Entity.SecondRebornClass == 135 && client.Entity.Class == 135)
               {
                   WontAdd(Conquer_Online_Server.Game.Enums.SkillIDs.AzureShield);
               }
               if (client.Entity.FirstRebornClass == 145 && client.Entity.SecondRebornClass == 145 && client.Entity.Class == 145)
               {
                   WontAdd(Conquer_Online_Server.Game.Enums.SkillIDs.HeavenBlade);
               }
               #endregion
               client.Entity.FirstRebornClass = client.Entity.SecondRebornClass;
               client.Entity.SecondRebornClass = client.Entity.Class;
               client.Entity.Class = new_class;
               client.Entity.SecondRebornLevel = client.Entity.Level;
               client.Entity.ReincarnationLev = client.Entity.Level;
               client.Entity.Level = 15;
               client.Entity.Experience = 0;
               client.Entity.Atributes =
    (ushort)(client.ExtraAtributePoints(client.Entity.FirstRebornClass, client.Entity.FirstRebornLevel) +
     client.ExtraAtributePoints(client.Entity.SecondRebornClass, client.Entity.SecondRebornLevel) + 62);



               client.Spells.Clear();
               client.Spells = new SafeDictionary<ushort, Conquer_Online_Server.Interfaces.ISkill>(100);
               switch (client.Entity.FirstRebornClass)
               {
                   case 15:
                       {
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Cyclone);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Hercules);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.SpiritHealing);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Robot);
                           break;
                       }
                   case 25:
                       {
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.SuperMan);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Dash);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Shield);
                           break;
                       }
                   case 45:
                       {
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Intensify);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Scatter);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.RapidFire);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.XPFly);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.AdvancedFly);
                           break;
                       }
                   case 55:
                       {
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.FatalStrike);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.ShurikenVortex);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.ToxicFog);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.TwofoldBlades);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.PoisonStar);

                           break;
                       }
                   case 65:
                       {
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.RadiantPalm);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.WhirlwindKick);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.TripleAttack);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Oblivion);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Serenity);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Compassion);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.TyrantAura);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.TyrantAura);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.DeflectionAura);
                           break;
                       }
                   case 135:
                       {
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Thunder);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.WaterElf);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Cure);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Lightning);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Volcano);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Pray);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.AdvancedCure);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Meditation);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Stigma);
                           break;
                       }
                   case 140:
                       {
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Thunder);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Cure);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Lightning);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.Tornado);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.FireCircle);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.FireMeteor);
                           Add(Conquer_Online_Server.Game.Enums.SkillIDs.FireRing);
                           break;
                       }

               }

              byte PreviousClass = client.Entity.FirstRebornClass;
              byte toClass = (byte)(client.Entity.SecondRebornClass - 4);

               Interfaces.ISkill[] ADD_spells = this.Addskill.Values.ToArray();
               foreach (Interfaces.ISkill skill in ADD_spells)
               {
                   skill.Available = true;
                   if (!client.Spells.ContainsKey(skill.ID))
                       client.Spells.Add(skill.ID, skill);
               }
               #region Spells
               Interfaces.ISkill[] spells = client.Spells.Values.ToArray();
               foreach (Interfaces.ISkill spell in spells)
               {
                   spell.PreviousLevel = spell.Level;
                   spell.Level = 0;
                   spell.Experience = 0;
                   #region Monk
                   if (PreviousClass == 65)
                   {
                       if (client.Entity.Class != 61)
                       {
                           switch (spell.ID)
                           {
                               case 10490:
                               case 10415:
                               case 10381:
                                   client.RemoveSpell(spell);
                                   break;
                           }
                       }
                   }
                   #endregion
                   #region Warrior
                   if (PreviousClass == 25)
                   {
                       if (client.Entity.Class != 21)
                       {
                           switch (spell.ID)
                           {
                               case 1025:
                                   if (client.Entity.Class != 21 && client.Entity.Class != 132)
                                       client.RemoveSpell(spell);
                                   break;
                           }
                       }
                   }
                   #endregion
                   #region Ninja
                   if (toClass != 51)
                   {
                       switch (spell.ID)
                       {
                           case 6010:
                           case 6000:
                           case 6011:
                               client.RemoveSpell(spell);
                               break;
                       }
                   }
                   #endregion
                   #region Trojan
                   if (toClass != 11)
                   {
                       switch (spell.ID)
                       {
                           case 1115:
                               client.RemoveSpell(spell);
                               break;
                       }
                   }
                   #endregion
                   #region Archer
                   if (toClass != 41)
                   {
                       switch (spell.ID)
                       {
                           case 8001:
                           case 8000:
                           case 8003:
                           case 9000:
                           case 8002:
                           case 8030:
                               client.RemoveSpell(spell);
                               break;
                       }
                   }
                   #endregion
                   #region WaterTaoist
                   if (PreviousClass == 135)
                   {
                       if (toClass != 132)
                       {
                           switch (spell.ID)
                           {
                               case 1000:
                               case 1001:
                               case 1010:
                               case 1125:
                               case 1100:
                               case 8030:
                                   client.RemoveSpell(spell);
                                   break;
                               case 1050:
                               case 1175:
                               case 1170:
                                   if (toClass != 142)
                                       client.RemoveSpell(spell);
                                   break;
                           }
                       }
                   }
                   #endregion
                   #region FireTaoist
                   if (PreviousClass == 145)
                   {
                       if (toClass != 142)
                       {
                           switch (spell.ID)
                           {
                               case 1000:
                               case 1001:
                               case 1150:
                               case 1180:
                               case 1120:
                               case 1002:
                               case 1160:
                               case 1165:
                                  client.RemoveSpell(spell);
                                   break;
                           }
                       }
                   }
                   #endregion
                   if (client.Spells.ContainsKey(spell.ID))
                       if (spell.ID != (ushort)Game.Enums.SkillIDs.Reflect)
                           spell.Send(client);
               }
               #endregion
               Add(Conquer_Online_Server.Game.Enums.SkillIDs.Bless);
              
               Addskill.Clear();
               Addskill = new SafeDictionary<ushort, Conquer_Online_Server.Interfaces.ISkill>(100);

                PreviousClass = client.Entity.SecondRebornClass;
                toClass = client.Entity.Class;
                switch (client.Entity.SecondRebornClass)
                {
                    case 15:
                        {
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Robot);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Cyclone);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Hercules);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.SpiritHealing);

                            break;
                        }
                    case 25:
                        {
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.SuperMan);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Dash);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Shield);
                            break;
                        }
                    case 45:
                        {
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Intensify);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Scatter);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.RapidFire);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.XPFly);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.AdvancedFly);
                            break;
                        }
                    case 55:
                        {
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.FatalStrike);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.ShurikenVortex);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.ToxicFog);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.TwofoldBlades);
                            break;
                        }
                    case 65:
                        {
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.RadiantPalm);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.WhirlwindKick);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.TripleAttack);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Oblivion);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Serenity);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Compassion);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.TyrantAura);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.TyrantAura);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.DeflectionAura);
                            break;
                        }
                    case 135:
                        {
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Thunder);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.WaterElf);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Cure);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Lightning);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Volcano);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Pray);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Stigma);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.AdvancedCure);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Meditation);
                            break;
                        }
                    case 140:
                        {
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Thunder);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Cure);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Lightning);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.Tornado);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.FireCircle);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.FireMeteor);
                            Add(Conquer_Online_Server.Game.Enums.SkillIDs.FireRing);
                            break;
                        }

                }

                //PreviousClass = client.Entity.FirstRebornClass;
                //toClass = client.Entity.SecondRebornClass;
                Add(Conquer_Online_Server.Game.Enums.SkillIDs.Bless);
            
                Interfaces.ISkill[] aADD_spells = this.Addskill.Values.ToArray();
                foreach (Interfaces.ISkill skill in aADD_spells)
                {
                    skill.Available = true;
                    if (!client.Spells.ContainsKey(skill.ID))
                        client.Spells.Add(skill.ID, skill);
                }
                #region Spells
                Interfaces.ISkill[] aspells = client.Spells.Values.ToArray();
                foreach (Interfaces.ISkill aspell in spells)
                {
                    aspell.PreviousLevel = aspell.Level;
                    aspell.Level = 0;
                    aspell.Experience = 0;
                    #region Monk
                    if (PreviousClass == 65)
                    {
                        if (client.Entity.Class != 61)
                        {
                            switch (aspell.ID)
                            {
                                case 10490:
                                case 10415:
                                case 10381:
                                    client.RemoveSpell(aspell);
                                    break;
                            }
                        }
                    }
                    #endregion
                    #region Warrior
                    if (PreviousClass == 25)
                    {
                        if (client.Entity.Class != 21)
                        {
                            switch (aspell.ID)
                            {
                                case 1025:
                                    if (client.Entity.Class != 21 && client.Entity.Class != 132)
                                        client.RemoveSpell(aspell);
                                    break;
                            }
                        }
                    }
                    #endregion
                    #region Ninja
                    if (toClass != 51)
                    {
                        switch (aspell.ID)
                        {
                            case 6010:
                            case 6000:
                            case 6011:
                                client.RemoveSpell(aspell);
                                break;
                        }
                    }
                    #endregion
                    #region Trojan
                    if (toClass != 11)
                    {
                        switch (aspell.ID)
                        {
                            case 1115:
                                client.RemoveSpell(aspell);
                                break;
                        }
                    }
                    #endregion
                    #region Archer
                    if (toClass != 41)
                    {
                        switch (aspell.ID)
                        {
                            case 8001:
                            case 8000:
                            case 8003:
                            case 9000:
                            case 8002:
                            case 8030:
                                client.RemoveSpell(aspell);
                                break;
                        }
                    }
                    #endregion
                    #region WaterTaoist
                    if (PreviousClass == 135)
                    {
                        if (toClass != 132)
                        {
                            switch (aspell.ID)
                            {
                                case 1000:
                                case 1001:
                                case 1010:
                                case 1125:
                                case 1100:
                                case 8030:
                                    client.RemoveSpell(aspell);
                                    break;
                                case 1050:
                                case 1175:
                                case 1170:
                                    if (toClass != 142)
                                        client.RemoveSpell(aspell);
                                    break;
                            }
                        }
                    }
                    #endregion
                    #region FireTaoist
                    if (PreviousClass == 145)
                    {
                        if (toClass != 142)
                        {
                            switch (aspell.ID)
                            {
                                case 1000:
                                case 1001:
                                case 1150:
                                case 1180:
                                case 1120:
                                case 1002:
                                case 1160:
                                case 1165:
                                    client.RemoveSpell(aspell);
                                    break;
                            }
                        }
                    }
                    #endregion
                    if (client.Spells.ContainsKey(aspell.ID))
                        if (aspell.ID != (ushort)Game.Enums.SkillIDs.Reflect)
                            aspell.Send(client);
                }
                #endregion
                Addskill.Clear();
                Addskill = new SafeDictionary<ushort, Conquer_Online_Server.Interfaces.ISkill>(20);
                #region Add Extra Skill
                if (client.Entity.FirstRebornClass == 15 && client.Entity.SecondRebornClass == 15 && client.Entity.Class == 11)
                {
                    Add(Conquer_Online_Server.Game.Enums.SkillIDs.DragonWhirl);
                }
                if (client.Entity.FirstRebornClass == 25 && client.Entity.SecondRebornClass == 25 && client.Entity.Class == 21)
                {
                    Add(Conquer_Online_Server.Game.Enums.SkillIDs.Perseverance);
                }
                if (client.Entity.FirstRebornClass == 45 && client.Entity.SecondRebornClass == 45 && client.Entity.Class == 41)
                {
                    Add(Conquer_Online_Server.Game.Enums.SkillIDs.StarArrow);
                }
                if (client.Entity.FirstRebornClass == 55 && client.Entity.SecondRebornClass == 55 && client.Entity.Class == 55)
                {
                    Add(Conquer_Online_Server.Game.Enums.SkillIDs.PoisonStar);
                    Add(Conquer_Online_Server.Game.Enums.SkillIDs.CounterKill);
                }
                if (client.Entity.FirstRebornClass == 65 && client.Entity.SecondRebornClass == 65 && client.Entity.Class == 61)
                {
                    Add(Conquer_Online_Server.Game.Enums.SkillIDs.SoulShackle);
                }
                if (client.Entity.FirstRebornClass == 135 && client.Entity.SecondRebornClass == 135 && client.Entity.Class == 132)
                {
                    Add(Conquer_Online_Server.Game.Enums.SkillIDs.AzureShield);
                }
                if (client.Entity.FirstRebornClass == 145 && client.Entity.SecondRebornClass == 145 && client.Entity.Class == 142)
                {
                    Add(Conquer_Online_Server.Game.Enums.SkillIDs.HeavenBlade);
                }
                #endregion
                Interfaces.ISkill[] aaADD_spells = this.Addskill.Values.ToArray();
                foreach (Interfaces.ISkill skill in aaADD_spells)
                {
                    skill.Available = true;
                    if (!client.Spells.ContainsKey(skill.ID))
                        client.Spells.Add(skill.ID, skill);
                }

               #region Proficiencies
               foreach (Interfaces.ISkill proficiency in client.Proficiencies.Values)
               {
                   proficiency.PreviousLevel = proficiency.Level;
                   proficiency.Level = 0;
                   proficiency.Experience = 0;
                   proficiency.Send(client);
               }
               #endregion
               Database.DataHolder.GetStats(client.Entity.Class, client.Entity.Level, client);
               client.CalculateStatBonus();
               client.CalculateHPBonus();
               client.GemAlgorithm();
               client.SendStatMessage();
               using (var conn = Database.DataHolder.MySqlConnection)
               {
                   conn.Open();
                   Database.EntityTable.SaveEntity(client, conn);
                   Database.SkillTable.SaveSpells(client);
                   Database.SkillTable.SaveProficiencies(client);
               }
               Network.PacketHandler.WorldMessage(client.Entity.Name + " Reincarnou! Parabéns!!");

           }
           void Add(Conquer_Online_Server.Game.Enums.SkillIDs S)
           {
               Interfaces.ISkill New = new Network.GamePackets.Spell(true);
               New.ID = (ushort)S;
               New.Level = 0;
               New.Experience = 0;
               New.PreviousLevel = 0;
               New.Send(_client);
               Addskill.Add(New.ID, New);
           }

           void WontAdd(Conquer_Online_Server.Game.Enums.SkillIDs S)
           {
               Network.GamePackets.Data data = new Data(true);
               data.UID = _client.Entity.UID;
               data.dwParam = (byte)S;
               data.ID = 109;
               data.Send(_client);

               Interfaces.ISkill New = new Network.GamePackets.Spell(true);
               New.ID = (ushort)S;
               New.Level = 0;
               New.Experience = 0;
               New.PreviousLevel = 0;
               RemoveSkill.Add(New.ID, New);
           }
       }
       #endregion
09/27/2011 19:08 F i n c h i#2
It's not necessary to double post...
09/27/2011 19:33 diedwarrior#3
Mate its so easy lol, just read the middle/last part of the PacketHandler.cs , you'll get to choose the skills you want the reincarnated character to have.
09/29/2011 17:47 aloisioXD#4
isn't after packethandler.cs. Cause isthe reborn with no gained skills and reincarnation too
10/06/2011 04:16 aloisioXD#5
the problem is: i cant gained the skill with the reborn... and reincarnation too. This is the problem!