[Guide]ExpPot

09/21/2008 00:09 reborn666#1
Heyaa
i got work Exp potion in PowerSourceCO
-Credits for Keving and for me :D
here is the code

in Character.cs search for
Quote:
public bool Alive = true;
Quote:
public byte dexp = 0;
public uint dexptime = 0;
now in Character.cs search for
Quote:
else if (ItemParts[0] == "725013")
above add

Quote:
else if (ItemParts[0] == "723017")
{
dexptime = 3600;
dexp = 1;
MyClient.SendPacket(General.MyPackets.Vital(UID, 19, dexptime));
RemoveItem(ItemUID);
}
nice,
now go to Client.cs search
Quote:
There = true;
World.SpawnMeToOthers(MyChar, true);
above add

Quote:
foreach (DictionaryEntry DE in World.AllChars)
{
Character Cli = (Character)DE.Value;
if (Cli.Name == MyChar.Name && Cli.dexp == 1 && Cli.dexptime != 0)
{
int ID = int.Parse("19");
SendPacket(General.MyPackets.Vital((long)MyChar.UI D, ID, MyChar.dexptime));
}
}
now go to Database.cs search for
Quote:
Charr.RealAgi = Charr.Agi;
it's located in "public static void GetCharInfo(Character Charr, string UserName)" and add it

Quote:
Charr.dexptime = (uint)DR["dexptime"];
Charr.dexp = Convert.ToByte(DR["dexp"]);
now go to General.cs
Add new Timer

Quote:
public static System.Timers.Timer General2;
and

Quote:
public static void General_System(object sender, ElapsedEventArgs e)
{
foreach (DictionaryEntry DE in World.AllChars)
{
Character Char = (Character)DE.Value;
if (Char != null && Char.dexp == 1)
{
if (Char.dexptime == 0)
{
Char.dexp = 0;
break;
}
int ID = int.Parse("19");
Char.dexptime -= 1;
Char.MyClient.SendPacket(General.MyPackets.Vital(( long)Char.UID, ID, Char.dexptime));
}
}
}
now go to Character.cs search
Quote:
public bool AddExp(ulong Amount, bool CountMisc)
And replace

with

Quote:
public bool AddExp(ulong Amount, bool CountMisc)
{
ulong dexp_exp1 = 0;
ulong dexp_exp2 = 0;
Ready = false;
if (CountMisc)
{
if (dexp == 1)
{
dexp_exp1 = (ulong)(Amount * ExternalDatabase.ExpRate * AddExpPc * (Convert.ToDouble(Potency) / 100 + 1));
dexp_exp2 = dexp_exp1 / 2;
Exp += dexp_exp2;
}
else
{
Exp += (ulong)(Amount * ExternalDatabase.ExpRate * AddExpPc * (Convert.ToDouble(Potency) / 100 + 1));
}
}
else
{
if (dexp == 1)
{
dexp_exp1 = Amount;
dexp_exp2 = dexp_exp1 / 2;
Exp += dexp_exp2;
}
else
{
Exp += (ulong)(Amount * ExternalDatabase.ExpRate * AddExpPc * (Convert.ToDouble(Potency) / 100 + 1));
}
}
bool Leveled = false;
if (Exp > ExternalDatabase.NeededXP(Level) && Level < 130)
{
Leveled = true;
while (Exp > ExternalDatabase.NeededXP(Level) && Level < 130)
{
Exp -= ExternalDatabase.NeededXP(Level);
Level++;
if (Level == 3)
{
if (Job < 16 && Job > 9)
LearnSkill(1110, 0);
if (Job < 16 && Job > 9 || Job < 26 && Job > 19)
LearnSkill(1015, 0);
if (Job < 26 && Job > 19)
LearnSkill(1025, 0);
}
}
}
if (Leveled)
{
if (MyGuild != null)
MyGuild.Refresh(this);
if (RBCount < 1)
InternalDatabase.GetStats(this);
GetEquipStats(1, true);
GetEquipStats(2, true);
GetEquipStats(3, true);
GetEquipStats(4, true);
GetEquipStats(5, true);
GetEquipStats(6, true);
GetEquipStats(8, true);
MaxHP = BaseMaxHP();
MinAtk = Str;
MaxAtk = Str;
Potency = Level;
GetEquipStats(1, false);
GetEquipStats(2, false);
GetEquipStats(3, false);
GetEquipStats(4, false);
GetEquipStats(5, false);
GetEquipStats(6, false);
GetEquipStats(8, false);

CurHP = MaxHP;

MyClient.SendPacket(General.MyPackets.Vital((long) UID, 13, Level));
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 16, Str));
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 17, Agi));
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 15, Vit));
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 14, Spi));
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 0, CurHP));
World.LevelUp(this);
}
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 5, Exp));
Ready = true;

if (Leveled)
return true;
else
return false;
}
now to save search for
Quote:
public static void SaveChar(Character Charr)
and add the command

Quote:
ExternalDatabase.DatabaseQueue.Enqueue(new MySqlCommand("UPDATE `Characters` SET `dexptime` = " + Charr.dexptime + ", `dexp` = " + Charr.dexp + " WHERE `Account` = '" + Charr.MyClient.Account + "'", ExternalDatabase.Connection));
now u need add 2 tables in database "characters"
look the image..

Done :bandit:
09/21/2008 00:32 Zanzibar#2
Why do you get credits x.x

And the codes are messed up..
09/21/2008 03:57 tao4229#3
Theres already 3-4 freaking guides out..>
STOP POSTING CRAPPY CODE OVER AND OVER AGAIN!
09/21/2008 03:59 Zanzibar#4
Indeedy-do
09/21/2008 04:29 konkizta#5
Nice, but instead of giving me more experience I get less: S

Can I put a guide for loft source?
09/21/2008 04:47 pauldexter#6
Im wandering what is that source, im sure its loft but that has different codes like ExternalDatabase and InternalDatabase.
09/21/2008 10:46 keving#7
You only copyed my Code and with Errors :)
Credits for Keving not for Kevin :)
Use this AddExp:
Code:
public bool AddExp(ulong Amount, bool CountMisc)
{
ulong dexp_exp1 = 0;
ulong dexp_exp2 = 0;
ulong dexp_exp3 = 0;
Ready = false;
if (CountMisc)
{
if (dexp == 1)
{
dexp_exp1 = (ulong)(Amount * DataBase.ExpRate * AddExpPc * (Convert.ToDouble(Potency) / 100 + 1));
dexp_exp2 = dexp_exp1 / 2;
dexp_exp3 = dexp_exp1 + dexp_exp2;
Exp += dexp_exp3;
}
else
{
Exp += (ulong)(Amount * DataBase.ExpRate * AddExpPc * (Convert.ToDouble(Potency) / 100 + 1));
}
}
else
{
if (dexp == 1)
{
dexp_exp1 = Amount;
dexp_exp2 = dexp_exp1 / 2;
dexp_exp3 = dexp_exp1 + dexp_exp2;
Exp += dexp_exp3;
}
else
{
Exp += (ulong)(Amount * DataBase.ExpRate * AddExpPc * (Convert.ToDouble(Potency) / 100 + 1));
}
}
bool Leveled = false;
if (Exp > DataBase.NeededXP(Level) && Level < 130)
{
Leveled = true;
while (Exp > DataBase.NeededXP(Level) && Level < 130)
{
Exp -= DataBase.NeededXP(Level);
Level++;
if (Level == 3)
{
if (Job < 16 && Job > 9)
LearnSkill(1110, 0);
if (Job < 16 && Job > 9 || Job < 26 && Job > 19)
LearnSkill(1015, 0);
if (Job < 26 && Job > 19)
LearnSkill(1025, 0);
}
}
}
if (Leveled)
{
if (MyGuild != null)
MyGuild.Refresh(this);
if (RBCount < 1)
Database.GetStats(this);
GetEquipStats(1, true);
GetEquipStats(2, true);
GetEquipStats(3, true);
GetEquipStats(4, true);
GetEquipStats(5, true);
GetEquipStats(6, true);
GetEquipStats(8, true);
MaxHP = BaseMaxHP();
MinAtk = Str;
MaxAtk = Str;
Potency = Level;
GetEquipStats(1, false);
GetEquipStats(2, false);
GetEquipStats(3, false);
GetEquipStats(4, false);
GetEquipStats(5, false);
GetEquipStats(6, false);
GetEquipStats(8, false);

CurHP = MaxHP;

MyClient.SendPacket(General.MyPackets.Vital((long) UID, 13, Level));
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 16, Str));
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 17, Agi));
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 15, Vit));
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 14, Spi));
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 0, CurHP));
World.LevelUp(this);
}
MyClient.SendPacket(General.MyPackets.Vital((long) UID, 5, Exp));
Ready = true;

if (Leveled)
return true;
else
return false;
}
09/21/2008 11:18 pauldexter#8
i have a source with ExternalDatabase and InternalDatabase but ShadowCO don't have it,
can someone tell me whats that source? i just get it from my friend
09/21/2008 11:21 ~Legend~#9
failed (like my guide) and if it is a guide this is the wrong section
09/21/2008 12:19 keving#10
Quote:
Originally Posted by ~Legend~ View Post
failed (like my guide) and if it is a guide this is the wrong section
You are wrong [Release] is like [Guide]
And this is about PrivateServer
the Guide Section is about Client and the Game
09/23/2008 12:53 lolex#11
The time is not saved and do not go up the experience.

Something is not right in the code.
09/23/2008 13:19 tao4229#12
Quote:
Originally Posted by lolex View Post
The time is not saved and do not go up the experience.

Something is not right in the code.
Maybe because an idiot coded it and two bigger idiots tried to copy it? >_>
09/23/2008 14:30 keving#13
Quote:
Originally Posted by tao4229 View Post
Maybe because an idiot coded it and two bigger idiots tried to copy it? >_>
Shut up your fucking idiot Son of a Bitch
09/23/2008 23:57 Rechocto#14
Keving just turned an argument into a flame war..

Keving.Respect -= 11 * World.Rate;
09/24/2008 00:48 tao4229#15
Quote:
Originally Posted by keving View Post
Shut up your fucking idiot Son of a Bitch
Yes, because that makes total sense.

Quote:
lern2engrish