|
You last visited: Today at 10:41
Advertisement
Please a little help with this code
Discussion on Please a little help with this code within the CO2 Private Server forum part of the Conquer Online 2 category.
03/26/2019, 20:13
|
#1
|
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
|
Please a little help with this code
How do I go about updating the character database after he has reborned? Using Albetros source, I've taken my code down.
Nevermind I figured it out
|
|
|
03/29/2019, 13:33
|
#2
|
elite*gold: 0
Join Date: Aug 2010
Posts: 112
Received Thanks: 12
|
Would you mind to share the code you have for now?
|
|
|
03/29/2019, 13:41
|
#3
|
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
|
No I had it posted and got absolutely no reply so I decided to take it down. Besides it needed a lot more work but at least the character reborns now albeit no effects, just does it and tells the server and updates the database. Still working on it I might repost it after I have butchered it
Code:
#region Reborn
case 300500:
switch (linkBack)
{
case 0:
{
var npcPage = new NpcTalk(user, 28);
npcPage.AddTextLine("Welcome traveler. Have you come to unlock my secrets? Only those who have reached the end of their life can begin anew.");
npcPage.AddTextLine(" If you are above level 120 or WaterSaint of 110 I can help you reach the next stage.");
npcPage.AddOption("Tell me more!", 1);
npcPage.AddOption("I am unworthy...", 255);
npcPage.SendFinal();
break;
}
case 1:
{
var npcPage = new NpcTalk(user, 28);
if (user.Level < 120)
{
npcPage.AddTextLine("Please return when you have trained more. You are unworthy to reborn.");
npcPage.AddOption("I'll return.", 255);
npcPage.SendFinal();
}
else if (user.Reborn > 0)
{
npcPage.AddTextLine("You are already on your second life! I cannot help you further.");
npcPage.AddOption("I apologize.", 255);
npcPage.SendFinal();
}
else
{
npcPage.AddTextLine("Reborn is not something to undertake lightly. You will be significantly weakened by the process and must fight your way back up to strength. You may even leave many of your skills behind");
npcPage.AddTextLine(" in your journey. Are you sure you wish to start this trial?");
npcPage.AddOption("I am ready", 2);
npcPage.AddOption("Not yet.", 255);
npcPage.SendFinal();
}
break;
}
case 2:
{
var npcPage = new NpcTalk(user, 28);
npcPage.AddTextLine("In order to unlock your soul and transfer it into a new body, you must first obtain a celestial stone. I can help you create one by combining the powers of every known refined gem in our world.");
npcPage.AddTextLine(" By doing this we can break your soul loose and you can start again.");
npcPage.AddOption("I wish to be reborn", 3);
npcPage.AddOption("I need a Celestial Stone", 10);
npcPage.AddOption("I'm not ready.", 255);
npcPage.SendFinal();
break;
}
case 3://Class choice
{
var npcPage = new NpcTalk(user, 28);
if (!user.HasItem(721259))
{
npcPage.AddTextLine("Please obtain a celestial stone before you ask me this again. If you wish I can help create one by combining one of each refined gem.");
npcPage.AddOption("I need a Celestial Stone", 255);
npcPage.AddOption("I'm not ready.", 255);
npcPage.SendFinal();
}
else//Has stone. Give options!
{
npcPage.AddTextLine("When reborning, we have the opportunity to undo some of our greatest mistakes.");
npcPage.AddTextLine(" If you wish, you can decide to start your new life as a different profession. What profession would you like? ");
npcPage.AddOption("Trojan", 11);
npcPage.AddOption("Warrior", 12);
npcPage.AddOption("Archer", 13);
npcPage.AddOption("Fire Taoist", 14);
npcPage.AddOption("More", 4);
npcPage.AddOption("I'm not ready.", 255);
npcPage.SendFinal();
}
break;
}
case 4://Class choice continued
{
var npcPage = new NpcTalk(user, 28);
if (!user.HasItem(721259))
{
npcPage.AddTextLine("Please obtain a celestial stone before you ask me this again. If you wish I can help create one by combining one of each refined gem.");
npcPage.AddOption("I need a Celestial Stone", 255);
npcPage.AddOption("I'm not ready.", 255);
npcPage.SendFinal();
}
else//Has stone. Give options!
{
npcPage.AddTextLine("When reborning, we have the opportunity to undo some of our greatest mistakes.");
npcPage.AddTextLine(" If you wish, you can decide to start your new life as a different profession. What profession would you like? ");
npcPage.AddOption("Water Taoist", 15);
npcPage.AddOption("Ninja", 16);
npcPage.AddOption("Monk", 17);
npcPage.AddOption("Previous", 3);
npcPage.AddOption("I'm not ready.", 255);
npcPage.SendFinal();
}
break;
}
case 10: //Make celestial stone
{
var npcPage = new NpcTalk(user, 28);
if (user.Level < 120 || user.Reborn > 0)
{
npcPage.AddTextLine("You do not qualify for my help! Please do not try to trick me.");
npcPage.AddOption("I'm sorry.", 255);
npcPage.SendFinal();
}
else
{
if (user.HasItem(700002) &&
user.HasItem(700012) &&
user.HasItem(700022) &&
user.HasItem(700032) &&
user.HasItem(700042) &&
user.HasItem(700052) &&
user.HasItem(700062) &&
user.HasItem(700072))
{
user.RemoveItem(700002);
user.RemoveItem(700012);
user.RemoveItem(700022);
user.RemoveItem(700032);
user.RemoveItem(700042);
user.RemoveItem(700052);
user.RemoveItem(700062);
user.RemoveItem(700072);
user.AddItem(721259);
npcPage.AddTextLine("The stone has now been created!");
npcPage.AddOption("I wish to reborn!", 3);
npcPage.AddOption("Thank you.", 255);
npcPage.SendFinal();
}
else
{
npcPage.AddTextLine("You do not have the gems I require. Come back when you are prepared.");
npcPage.AddOption("I'm sorry.", 255);
npcPage.SendFinal();
}
}
break;
}
// }
//break;
case 11://Trojan Rebirth
{
var npcPage = new NpcTalk(user, 28);
if (user.HasItem(721259))
if (user.Level > 120 || user.Reborn < 0 || user.Profession % 10 == 5 &&
user.Level >= (user.Profession == 135 ? 110 : 120))
{
/*user.RemoveItem(721259);
user.Level = 15;
user.Profession = 11;
Handler.LowerAllItems(user);
user.Reborn = 1;
user.Vitality = 15;
user.Spirit = 0;
user.Agility = 5;
user.Strength = 20;
user.StatPoint = 50;
user.Profession = 1;
npcPage.AddTextLine("Welcome Trojan");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + "got reborn"));
npcPage.SendFinal();
user.Save();*/
}
else if (user.Reborn < 0)
{
user.RemoveItem(721259);
user.Level = 15;
user.Profession = 11;
Handler.LowerAllItems(user);
user.Vitality = 15;
user.Spirit = 0;
user.Agility = 5;
user.Strength = 20;
user.StatPoint = 15;
user.Experience = 0;
user.Reborn = 1;
user.SendToScreen(Packet.StringPacket.Create(StringAction.Fireworks, "", user.UID), true);
npcPage.AddTextLine("Welcome Trojan");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + " " +
"got reborn"));
MySqlCommand command = new MySqlCommand(MySqlCommandType.UPDATE);
command.Update("Characters")
.Set("Reborns", 1)
.Execute();
npcPage.SendFinal();
user.Recalculate();
}
}
break;
// }
// break;
case 12://Warrior Rebirth
{
var npcPage = new NpcTalk(user, 28);
if (user.HasItem(721259))
if (user.Level > 120 || user.Reborn < 0 || user.Profession % 10 == 5 &&
user.Level >= (user.Profession == 135 ? 110 : 120))
{
/*user.RemoveItem(721259);
user.Level = 15;
user.Profession = 11;
Handler.LowerAllItems(user);
user.Reborn = 1;
user.Vitality = 15;
user.Spirit = 0;
user.Agility = 5;
user.Strength = 20;
user.StatPoint = 50;
user.Profession = 1;
npcPage.AddTextLine("Welcome Trojan");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + "got reborn"));
npcPage.SendFinal();
user.Save();*/
}
else
{
user.RemoveItem(721259);
user.Level = 15;
user.Profession = 21;
Handler.LowerAllItems(user);
user.Vitality = 15;
user.Spirit = 0;
user.Agility = 5;
user.Strength = 20;
user.StatPoint = 15;
user.Experience = 0;
user.Reborn = 1;
user.SendToScreen(Packet.StringPacket.Create(StringAction.Fireworks, "", user.UID), true);
npcPage.AddTextLine("Welcome Warrior");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + " " +
"got reborn"));
MySqlCommand command = new MySqlCommand(MySqlCommandType.UPDATE);
command.Update("Characters")
.Set("Reborns", 1)
.Execute();
npcPage.SendFinal();
user.Recalculate();
}
}
break;
case 13://Archer Rebirth
{
var npcPage = new NpcTalk(user, 28);
if (user.HasItem(721259))
if (user.Level > 120 || user.Reborn < 0 || user.Profession % 10 == 5 &&
user.Level >= (user.Profession == 135 ? 110 : 120))
{
/*user.RemoveItem(721259);
user.Level = 15;
user.Profession = 11;
Handler.LowerAllItems(user);
user.Reborn = 1;
user.Vitality = 15;
user.Spirit = 0;
user.Agility = 5;
user.Strength = 20;
user.StatPoint = 50;
user.Profession = 1;
npcPage.AddTextLine("Welcome Trojan");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + "got reborn"));
npcPage.SendFinal();
user.Save();*/
}
else
{
user.RemoveItem(721259);
user.Level = 15;
user.Profession = 41;
Handler.LowerAllItems(user);
user.Vitality = 15;
user.Spirit = 0;
user.Agility = 5;
user.Strength = 20;
user.StatPoint = 15;
user.Experience = 0;
user.Reborn = 1;
user.SendToScreen(Packet.StringPacket.Create(StringAction.Fireworks, "", user.UID), true);
npcPage.AddTextLine("Welcome Archer");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + " " +
"got reborn"));
MySqlCommand command = new MySqlCommand(MySqlCommandType.UPDATE);
command.Update("Characters")
.Set("Reborns", 1)
.Execute();
npcPage.SendFinal();
user.Recalculate();
}
}
break;
case 14://FireTaoist Rebirth
{
var npcPage = new NpcTalk(user, 28);
if (user.HasItem(721259))
if (user.Level > 120 || user.Reborn < 0 || user.Profession % 10 == 5 &&
user.Level >= (user.Profession == 135 ? 110 : 120))
{
/*user.RemoveItem(721259);
user.Level = 15;
user.Profession = 11;
Handler.LowerAllItems(user);
user.Reborn = 1;
user.Vitality = 15;
user.Spirit = 0;
user.Agility = 5;
user.Strength = 20;
user.StatPoint = 50;
user.Profession = 1;
npcPage.AddTextLine("Welcome Trojan");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + "got reborn"));
npcPage.SendFinal();
user.Save();*/
}
else
{
user.RemoveItem(721259);
user.Level = 15;
user.Profession = 142;
Handler.LowerAllItems(user);
user.Vitality = 15;
user.Spirit = 20;
user.Agility = 5;
user.Strength = 0;
user.StatPoint = 15;
user.Experience = 0;
user.Reborn = 1;
user.SendToScreen(Packet.StringPacket.Create(StringAction.Fireworks, "", user.UID), true);
npcPage.AddTextLine("Welcome FireTaoist");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + " " +
"got reborn"));
MySqlCommand command = new MySqlCommand(MySqlCommandType.UPDATE);
command.Update("Characters")
.Set("Reborns", 1)
.Execute();
npcPage.SendFinal();
user.Recalculate();
}
}
break;
case 15://WaterTaoist Rebirth
{
var npcPage = new NpcTalk(user, 28);
if (user.HasItem(721259))
if (user.Level > 120 || user.Reborn < 0 || user.Profession % 10 == 5 &&
user.Level >= (user.Profession == 135 ? 110 : 120))
{
/*user.RemoveItem(721259);
user.Level = 15;
user.Profession = 11;
Handler.LowerAllItems(user);
user.Reborn = 1;
user.Vitality = 15;
user.Spirit = 0;
user.Agility = 5;
user.Strength = 20;
user.StatPoint = 50;
user.Profession = 1;
npcPage.AddTextLine("Welcome Trojan");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + "got reborn"));
npcPage.SendFinal();
user.Save();*/
}
else
{
user.RemoveItem(721259);
user.Level = 15;
user.Profession = 132;
Handler.LowerAllItems(user);
user.Vitality = 15;
user.Spirit = 20;
user.Agility = 5;
user.Strength = 0;
user.StatPoint = 15;
user.Experience = 0;
user.Reborn = 1;
user.SendToScreen(Packet.StringPacket.Create(StringAction.Fireworks, "", user.UID), true);
npcPage.AddTextLine("Welcome WaterTaoist");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + " " +
"got reborn"));
MySqlCommand command = new MySqlCommand(MySqlCommandType.UPDATE);
command.Update("Characters")
.Set("Reborns", 1)
.Execute();
npcPage.SendFinal();
user.Recalculate();
}
}
break;
case 16://Ninja Rebirth
{
var npcPage = new NpcTalk(user, 28);
if (user.HasItem(721259))
if (user.Level > 120 || user.Reborn < 0 || user.Profession % 10 == 5 &&
user.Level >= (user.Profession == 135 ? 110 : 120))
{
/*user.RemoveItem(721259);
user.Level = 15;
user.Profession = 11;
Handler.LowerAllItems(user);
user.Reborn = 1;
user.Vitality = 15;
user.Spirit = 0;
user.Agility = 5;
user.Strength = 20;
user.StatPoint = 50;
user.Profession = 1;
npcPage.AddTextLine("Welcome Trojan");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + "got reborn"));
npcPage.SendFinal();
user.Save();*/
}
else
{
user.RemoveItem(721259);
user.Level = 15;
user.Profession = 51;
Handler.LowerAllItems(user);
user.Vitality = 15;
user.Spirit = 0;
user.Agility = 15;
user.Strength = 10;
user.StatPoint = 15;
user.Experience = 0;
user.Reborn = 1;
user.SendToScreen(Packet.StringPacket.Create(StringAction.Fireworks, "", user.UID), true);
npcPage.AddTextLine("Welcome Ninja");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + " " +
"got reborn"));
MySqlCommand command = new MySqlCommand(MySqlCommandType.UPDATE);
command.Update("Characters")
.Set("Reborns", 1)
.Execute();
npcPage.SendFinal();
user.Recalculate();
}
}
break;
case 17://Monk Rebirth
{
var npcPage = new NpcTalk(user, 28);
if (user.HasItem(721259))
if (user.Level > 120 || user.Reborn < 0 || user.Profession % 10 == 5 &&
user.Level >= (user.Profession == 135 ? 110 : 120))
{
/*user.RemoveItem(721259);
user.Level = 15;
user.Profession = 11;
Handler.LowerAllItems(user);
user.Reborn = 1;
user.Vitality = 15;
user.Spirit = 0;
user.Agility = 5;
user.Strength = 20;
user.StatPoint = 50;
user.Profession = 1;
npcPage.AddTextLine("Welcome Trojan");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + "got reborn"));
npcPage.SendFinal();
user.Save();*/
}
else
{
user.RemoveItem(721259);
user.Level = 15;
user.Profession = 61;
Handler.LowerAllItems(user);
user.Vitality = 15;
user.Spirit = 0;
user.Agility = 5;
user.Strength = 20;
user.StatPoint = 15;
user.Experience = 0;
user.SendToScreen(Packet.StringPacket.Create(StringAction.Fireworks, "", user.UID), true);
npcPage.AddTextLine("Welcome Monk");
npcPage.AddOption("Thank you", 255);
Kernel.SendToServer(new Packet.TalkPacket(ChatType.Center, user.Name + " " +
"got reborn"));
MySqlCommand command = new MySqlCommand(MySqlCommandType.UPDATE);
command.Update("Characters")
.Set("Reborns", 1)
.Execute();
npcPage.SendFinal();
user.Recalculate();
}
}
break;
}
break;
#endregion
Please note it does NOT give a supergem or bless items it simply reborns to a new class it also does not retain previous skills but it does tell the server and it does update the database. Play around with it and update this thread if you want, it's just what I have added to Albetros source. Basic but should work if not then it's because of the extra "user.Profession % 10 == 5 &&
user.Level >= (user.Profession == 135 ? 110 : 120))"
|
|
|
All times are GMT +1. The time now is 10:45.
|
|