[CoEmu]1st Reborn

08/20/2009 20:37 1supertao#1
Im working on reborn for CoEmu, I will release it when im done... it would help me if someone could post the code on here... to make the items to go to 15 when reborn.. and the code to change level to 15... and i will do the skills,NPC.. and other stuff ones i get those two codes
08/20/2009 21:32 12tails#2
lol... for level make:

Code:
CSocket.Client.Level == 15;
and them send stats of level : X
08/20/2009 22:43 samehvan#3
here is my simple code , i am sure u need to add some stuff to get it to work , like the Etirnity Npc or whoever u will have it as the reborn Npc
maybe u will also need to add variables to the character.cs as needed ,i don't really remember which ones i exactly added ,so here u are and inform me with errors u will have

Code:
#region RebornMan //Etirnity At Market **** By Me Mano
                case 436:
                    {
                        if (CSocket.Client.Reborn < 1)
                        {
                            bool CanReb=false;
                            if (((int)CSocket.Client.Class > 130 && (int)CSocket.Client.Class < 139) && CSocket.Client.Level > 109) CanReb = true;
                            else if (CSocket.Client.Level > 119) CanReb = true;
                            if (CanReb)
                            {

                                if (LinkBack == 0)
                                {
                                    Text("Hey sweety, tired of ur boorin life i can give u another life to live", CSocket);
                                    Text("so if u are pwoer enough and have a CelestialStone i'll do it", CSocket);
                                    Link("Good deal", 1, CSocket);
                                    Link("Nuh i enjoy my life", 255, CSocket);
                                    End(CSocket);
                                }
                                else if (LinkBack == 1)
                                {
                                    if (HasItem(721259, 1, CSocket))
                                    {
                                        Text("Cool now choose your reborn Gift ", CSocket);
                                        Link("SuperGem", 2, CSocket);
                                        Link("Bless Reborn", 3, CSocket);
                                        End(CSocket);
                                    }
                                    else
                                    {
                                        Text("Sorry u dont have the stone i need", CSocket);
                                        Link("Oh sorry be r8 back", 255, CSocket);
                                        End(CSocket);
                                    }
                                }
                                else if (LinkBack == 2)
                                {

                                    Text("Allright choose the Gem ", CSocket);
                                    Link("Dragon", 21, CSocket);
                                    Link("Phoenix", 22, CSocket);
                                    Link("RainBow", 23, CSocket);
                                    Link("Fury", 24, CSocket);
                                    Link("Moon", 25, CSocket);
                                    Link("Violet", 26, CSocket);
                                    End(CSocket);

                                }
                                else if (LinkBack > 20 && LinkBack < 27)
                                {//Using the last class as a break point to determine the Gem
                                    if (LinkBack == 21) CSocket.Client.LastClass = 13;
                                    else if (LinkBack == 22) CSocket.Client.LastClass = 3;
                                    else if (LinkBack == 23) CSocket.Client.LastClass = 33;
                                    else if (LinkBack == 24) CSocket.Client.LastClass = 23;
                                    else if (LinkBack == 25) CSocket.Client.LastClass = 63;
                                    else if (LinkBack == 26) CSocket.Client.LastClass = 53;
                                    Text("So what do u wish your next life job to be ?", CSocket);
                                    Link("Trojan", 31, CSocket);
                                    Link("Archer", 32, CSocket);
                                    Link("Worrior", 33, CSocket);
                                    Link("FireTao", 34, CSocket);
                                    Link("WaterTao", 35, CSocket);
                                    Link("Ninja", 36, CSocket);
                                    End(CSocket);
                                }
                                else if (LinkBack > 30)
                                {
                                    if (HasItem(721259, 1, CSocket))
                                    {
                                        DeleteItem(721259, 1, CSocket);
                                        if (CSocket.Client.LastClass > 0) AddItem((700000 + CSocket.Client.LastClass), 0, 0, 0, 0, 0, 0, 0, 0, 0, CSocket, 1);
                                        else PutBless(CSocket);
                                        CSocket.Client.LastClass = (byte)CSocket.Client.Class;
                                        CSocket.Client.Skills.Clear(); CSocket.Client.Profs.Clear();
                                        #region SendNewSkills
                                        if (CSocket.Client.LastClass < 16)
                                        {
                                            if (LinkBack == 31) //To tro
                                            {
                                                LearnSkill((int)Struct.SkillIds.CruelShade, 0, CSocket);
                                            }
                                            LearnSkill((int)Struct.SkillIds.SpiritHealing, 1, CSocket);
                                            LearnSkill((int)Struct.SkillIds.Robot, 1, CSocket);
                                            LearnSkill((int)Struct.SkillIds.Cyclone, 0, CSocket);
                                        }
                                        else if (CSocket.Client.LastClass > 15 && CSocket.Client.LastClass < 26) //Was worrior
                                        {
                                            LearnSkill((int)Struct.SkillIds.Reflect, 0, CSocket);
                                            if (LinkBack == 31) //To Trojan
                                            {
                                                LearnSkill((int)Struct.SkillIds.Roar, 0, CSocket);
                                                LearnSkill((int)Struct.SkillIds.FlyingMoon, 0, CSocket);
                                                LearnSkill((int)Struct.SkillIds.Accuracy, 1, CSocket);
                                            }
                                            else if (LinkBack == 32)//To archer
                                            {
                                                LearnSkill((int)Struct.SkillIds.Roar, 0, CSocket);
                                                LearnSkill((int)Struct.SkillIds.Shield, 0, CSocket);
                                            }
                                            else if (LinkBack == 35)//To Water
                                            {
                                                LearnSkill((int)Struct.SkillIds.Roar, 0, CSocket);
                                                LearnSkill((int)Struct.SkillIds.Shield, 0, CSocket);
                                                LearnSkill((int)Struct.SkillIds.Cyclone, 0, CSocket);
                                            }
                                            else if (LinkBack == 34)//To Fire
                                            {
                                                LearnSkill((int)Struct.SkillIds.Roar, 0, CSocket);
                                                LearnSkill((int)Struct.SkillIds.Shield, 0, CSocket);
                                            }
                                        }
                                        else if (CSocket.Client.LastClass > 35 && CSocket.Client.LastClass < 46) //Was an archer
                                        {
                                            //LearnSkill(SkillId.FreezingArrows, 0, CSocket);
                                            //LearnSkill(SkillId.PoisonousArrows, 0, CSocket);
                                        }
                                        else if (CSocket.Client.LastClass > 130 && CSocket.Client.LastClass < 136) //Was a Water
                                        {
                                            LearnSkill((int)Struct.SkillIds.Cure, 0, CSocket);
                                            LearnSkill((int)Struct.SkillIds.StarofAccuracy, 0, CSocket);
                                            LearnSkill((int)Struct.SkillIds.MagicShield, 0, CSocket);
                                            LearnSkill((int)Struct.SkillIds.Stigma, 0, CSocket);
                                            LearnSkill((int)Struct.SkillIds.Meditation, 0, CSocket);
                                            LearnSkill((int)Struct.SkillIds.Pervade, 0, CSocket);
                                        }
                                        else if (CSocket.Client.LastClass > 140 && CSocket.Client.LastClass < 146) //Was a Fire
                                        {
                                            LearnSkill((int)Struct.SkillIds.Cure, 0, CSocket);
                                            LearnSkill((int)Struct.SkillIds.Dodge, 0, CSocket);
                                            LearnSkill((int)Struct.SkillIds.Thunder, 0, CSocket);
                                            LearnSkill((int)Struct.SkillIds.Fire, 0, CSocket);
                                            LearnSkill((int)Struct.SkillIds.Meditation, 0, CSocket);
                                        }
                                        #endregion
                                        #region Calculate Points after reb
                                        byte AddPoints = 65;
                                        if (CSocket.Client.LastClass > 130 && CSocket.Client.LastClass < 136)
                                        {
                                            switch (CSocket.Client.Level)
                                            {
                                                case 110:
                                                case 111:
                                                case 112:
                                                    {
                                                        AddPoints++;
                                                        break;
                                                    }
                                                case 114:
                                                case 115:
                                                    {
                                                        AddPoints += 3;
                                                        break;
                                                    }
                                                case 116:
                                                case 117:
                                                    {
                                                        AddPoints += 6;
                                                        break;
                                                    }
                                                case 118:
                                                case 119:
                                                    {
                                                        AddPoints += 10;
                                                        break;
                                                    }
                                                case 120:
                                                case 121: { AddPoints += 15; break; }
                                                case 122:
                                                case 123: { AddPoints += 21; break; }
                                                case 124:
                                                case 125: { AddPoints += 28; break; }
                                                case 126:
                                                case 127: { AddPoints += 36; break; }
                                                case 128:
                                                case 129: { AddPoints += 45; break; }
                                                case 130: { AddPoints += 55; break; }
                                            }
                                        }
                                        else
                                        {
                                            switch (CSocket.Client.Level)
                                            {
                                                case 121: { AddPoints += 1; break; }
                                                case 122: { AddPoints += 3; break; }
                                                case 123: { AddPoints += 6; break; }
                                                case 144: { AddPoints += 10; break; }
                                                case 125: { AddPoints += 15; break; }
                                                case 126: { AddPoints += 21; break; }
                                                case 127: { AddPoints += 28; break; }
                                                case 128: { AddPoints += 36; break; }
                                                case 129: { AddPoints += 45; break; }
                                                case 130: { AddPoints += 55; break; }
                                            }
                                        }
                                        #endregion
                                        CSocket.Client.Dexterity = 2; CSocket.Client.Vitality = 5;
                                        CSocket.Client.StatPoints = AddPoints; CSocket.Client.Level = 15; CSocket.Client.Exp = 0;
                                        if (LinkBack == 34 || LinkBack == 35)
                                        {
                                            CSocket.Client.Strength = 0; CSocket.Client.Spirit = 3;
                                        }
                                        else
                                        {
                                            CSocket.Client.Strength = 3; CSocket.Client.Spirit = 0;
                                        }
                                        if (LinkBack == 31) CSocket.Client.Class = Struct.ClassType.Trojan;
                                        if (LinkBack == 32) CSocket.Client.Class = Struct.ClassType.Archer;
                                        if (LinkBack == 33) CSocket.Client.Class = Struct.ClassType.Warrior;
                                        if (LinkBack == 34) CSocket.Client.Class = Struct.ClassType.FireTaoist;
                                        if (LinkBack == 35) CSocket.Client.Class = Struct.ClassType.WaterTaoist;
                                        if (LinkBack == 36) CSocket.Client.Class = Struct.ClassType.Ninja;
                                        RebItems(CSocket);
                                        RebClient(CSocket);
                                    }
                                    else
                                    {
                                        Text("Sorry u dont have the stone i need", CSocket);
                                        Link("Oh sorry be r8 back", 255, CSocket);
                                        End(CSocket);
                                    }
                                }
                            }
                            else
                            {
                                Text("Sorry you are not pwoer enough yet , train harder", CSocket);
                                Link("Oh,bad ", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        else
                        {
                            Text("Are u kidding you are reborned already", CSocket);
                            Link("k,never mind then", 255, CSocket);
                            End(CSocket);
                        }
                        break;
                    }
                #endregion RebornMan
AHA , remembered u will need those Funcs as well
put them at npctalk.cs


Code:
private static void RebClient(ClientSocket CSocket)
        {
            CSocket.Client.Reborn += 1;
            CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.Strength, Struct.StatusTypes.StrengthStatPoints));
            CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.Dexterity, Struct.StatusTypes.DexterityStatPoints));
            CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.Vitality, Struct.StatusTypes.VitalityStatPoints));
            CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.Spirit, Struct.StatusTypes.ManaStatPoints));
            CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.StatPoints, Struct.StatusTypes.AttributePoints));
            CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.Level, Struct.StatusTypes.Level));
            CSocket.Send(ConquerPacket.Status(CSocket, 2, (int)CSocket.Client.Class, Struct.StatusTypes.Job));
            CSocket.Send(ConquerPacket.SpawnCharacter(CSocket));
            Calculation.Vitals(CSocket, false);Calculation.Attack(CSocket);
            ConquerPacket.ToLocal(ConquerPacket.SpawnCharacter(CSocket), CSocket.Client.X, CSocket.Client.Y, (int)CSocket.Client.Map, 0, 0);
            ConquerPacket.ToServer(ConquerPacket.Chat(0, "SYSTEM", "ALLUSERS", "CONGRATULATIONS! " + CSocket.Client.Name + " has just been Reborned!", Struct.ChatType.Center), 0);
            ConquerPacket.ToLocal(ConquerPacket.Effect(CSocket.Client.ID, "firework-like"), CSocket.Client.X, CSocket.Client.Y, (int)CSocket.Client.Map, 0, 0);
        }

        private static void RebItems(ClientSocket CSocket)
        {
            string CurItemId = "";//1=HeadG 2=NickG 3=Armor 4=RH 5=LH 6=Ring 7=MagicBottels 8=Boots 9=Garments
            if (CSocket.Client.Equipment.ContainsKey(1))
            {
                CurItemId = Convert.ToString(CSocket.Client.Equipment[1].ItemID);
                string Qual = CurItemId.Remove(0, CurItemId.Length - 1);
                if (CurItemId == "118")
                {
                    string Main = CurItemId.Remove(3, 3);
                    CurItemId = "11800" + Qual;
                }
                else
                {
                    string Main = CurItemId.Remove(4, 2);
                    CurItemId = Main + "0" + Qual; CSocket.Client.Equipment[1].ItemID = int.Parse(CurItemId);
                }
            }
            if (CSocket.Client.Equipment.ContainsKey(2))
            {
                CurItemId = Convert.ToString(CSocket.Client.Equipment[2].ItemID);
                string Qual = CurItemId.Remove(0, CurItemId.Length - 1); string Main = CurItemId.Remove(3, 3);
                CurItemId = Main + "00" + Qual; CSocket.Client.Equipment[2].ItemID = int.Parse(CurItemId);
            }
            if (CSocket.Client.Equipment.ContainsKey(3))
            {
                CurItemId = Convert.ToString(CSocket.Client.Equipment[3].ItemID);
                string Qual = CurItemId.Remove(0, CurItemId.Length - 1); string Main = CurItemId.Remove(4, 2);
                if (int.Parse(Main) > 129 && int.Parse(Main) < 135)
                {
                    CurItemId = Main + "0" + Qual; CSocket.Client.Equipment[3].ItemID = int.Parse(CurItemId);
                }
                else
                {
                    CurItemId = Convert.ToString((int.Parse(Main) - 50)) + "0" + Qual; CSocket.Client.Equipment[3].ItemID = int.Parse(CurItemId);
                }
            }
            if (CSocket.Client.Equipment.ContainsKey(4))
            {
                CurItemId = Convert.ToString(CSocket.Client.Equipment[4].ItemID);
                string Qual = CurItemId.Remove(0, CurItemId.Length - 1); string Main = CurItemId.Remove(3, 3);
                CurItemId = Main + "02" + Qual; CSocket.Client.Equipment[4].ItemID = int.Parse(CurItemId);
            }
            if (CSocket.Client.Equipment.ContainsKey(5))
            {
                CurItemId = Convert.ToString(CSocket.Client.Equipment[5].ItemID);
                string Qual = CurItemId.Remove(0, CurItemId.Length - 1); string Main = CurItemId.Remove(4, 2);
                if (Main.StartsWith("900"))//Shield
                {
                    CurItemId = Main + "0" + Qual; CSocket.Client.Equipment[5].ItemID = int.Parse(CurItemId);
                }
                else if (Main.StartsWith("4") || Main.StartsWith("5"))
                {
                    Main = CurItemId.Remove(3, 3);
                    CurItemId = Convert.ToString((int.Parse(Main) - 50)) + "02" + Qual; CSocket.Client.Equipment[5].ItemID = int.Parse(CurItemId);
                }
            }
            if (CSocket.Client.Equipment.ContainsKey(6))
            {
                CurItemId = Convert.ToString(CSocket.Client.Equipment[6].ItemID);
                string Qual = CurItemId.Remove(0, CurItemId.Length - 1); string Main = CurItemId.Remove(3, 3);
                CurItemId = Main + "01" + Qual; CSocket.Client.Equipment[6].ItemID = int.Parse(CurItemId);
            }
            if (CSocket.Client.Equipment.ContainsKey(8))
            {
                CurItemId = Convert.ToString(CSocket.Client.Equipment[8].ItemID);
                string Qual = CurItemId.Remove(0, CurItemId.Length - 1); string Main = CurItemId.Remove(3, 3);
                CurItemId = Main + "01" + Qual; CSocket.Client.Equipment[8].ItemID = int.Parse(CurItemId);
            }
            for (byte gg=1;gg<9;gg++)
            {
                if (CSocket.Client.Equipment.ContainsKey(gg))
                {
                    int Uid_ = CSocket.Client.Equipment[gg].UID;
                    ItemUnequip(gg, Uid_, CSocket);
                    ItemEquip(gg, Uid_, CSocket);
                }
            }

        }

        private static void PutBless(ClientSocket CSocket)
        {
            foreach (Struct.ItemInfo EquipItem in CSocket.Client.Equipment.Values)
            {
                if (EquipItem.Bless < 1) 
                {
                    EquipItem.Bless = 1;
                    ItemUnequip(EquipItem.Position, EquipItem.UID, CSocket);
                    ItemEquip(EquipItem.Position, EquipItem.UID, CSocket);
                    break;
                }
            }
        }
08/20/2009 22:58 1supertao#4
Ty... I think im just going to create a new one.. but ur post helped... im going to determine what class gets wat skills
08/20/2009 23:11 12tails#5
omg samehven its amazing xD

u already done all this skills?
08/20/2009 23:13 f0am#6
wont be that hard to add the learning of the skills good job same
08/20/2009 23:37 samehvan#7
Quote:
Originally Posted by 1supertao View Post
Ty... I think im just going to create a new one.. but ur post helped... im going to determine what class gets wat skills
i think i made it as Co2 as possible but of course u r free to do it as u c
08/20/2009 23:46 1supertao#8
Lol, ty same... im gonna make it perfect.. then want me to release it? And ya.. lol everytime i see you... i click Thanks.. no matter wat it is haha
08/20/2009 23:55 samehvan#9
of course i don't mind to release whatever help ppl, it's my happiness :p
08/21/2009 03:00 1supertao#10
What do i do about this?
Quote:
Error 2 'CoEmu_v2_GameServer.Entities.Character' does not contain a definition for 'LastClass' and no extension method 'LastClass' accepting a first argument of type 'CoEmu_v2_GameServer.Entities.Character' could be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\M@tt0\Desktop\CoEmu v2\CoEmu v2 GameServer\Handlers\NpcTalk.cs 2508 72 CoEmu v2 GameServer
08/21/2009 04:24 f0am#11
Quote:
Originally Posted by 1supertao View Post
What do i do about this?

go into character.cs and create a defintion for LastClass like umm

public byte LastClass = 0;
08/21/2009 07:39 gad-legion#12
i get this error :
Code:
Error	1	No overload for method 'AddItem' takes '12' arguments	D:\CoEmu v2\CoEmu v2 GameServer\Handlers\NpcTalk.cs	1337	75	CoEmu v2 GameServer
on line :
Code:
                                        if (CSocket.Client.LastClass > 0) AddItem((700000 + CSocket.Client.LastClass), 0, 0, 0, 0, 0, 0, 0, 0, 0, CSocket, 1);
08/21/2009 07:52 1supertao#13
delete those two lines... that will fix it.. but bless wont wont on the reborn npc
.. ty foam.. but already did that haha... learnin alot today..
08/21/2009 08:09 gad-legion#14
i deleted the 1 after CSocket and i have no errors but idk if bless will work
08/21/2009 10:00 samehvan#15
Quote:
Originally Posted by gad-legion View Post
i get this error :
Code:
Error	1	No overload for method 'AddItem' takes '12' arguments	D:\CoEmu v2\CoEmu v2 GameServer\Handlers\NpcTalk.cs	1337	75	CoEmu v2 GameServer
on line :
Code:
                                        if (CSocket.Client.LastClass > 0) AddItem((700000 + CSocket.Client.LastClass), 0, 0, 0, 0, 0, 0, 0, 0, 0, CSocket, 1);
Quote:
Originally Posted by gad-legion View Post
i deleted the 1 after CSocket and i have no errors but idk if bless will work
yea u can delete that number after CSocket or u can replace ur additem with my one (would be better) coz mine allows u to add more than one item at one line ,but u will need to add it to every additem call u have (may be it will be boring but will be much better for next uses)

Bless works perfectly ,u can try it and feed me back if anything went wrong with u