Heyaa
i got work Exp potion in PowerSourceCO
-Credits for Keving and for me :D
here is the code
in Character.cs search for
now go to Client.cs search
Add new Timer
with
look the image..
Done :bandit:
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;
now in Character.cs search forQuote:
public byte dexp = 0;
public uint dexptime = 0;
above addQuote:
else if (ItemParts[0] == "725013")
nice,Quote:
else if (ItemParts[0] == "723017")
{
dexptime = 3600;
dexp = 1;
MyClient.SendPacket(General.MyPackets.Vital(UID, 19, dexptime));
RemoveItem(ItemUID);
}
now go to Client.cs search
above addQuote:
There = true;
World.SpawnMeToOthers(MyChar, true);
now go to Database.cs search forQuote:
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));
}
}
it's located in "public static void GetCharInfo(Character Charr, string UserName)" and add itQuote:
Charr.RealAgi = Charr.Agi;
now go to General.csQuote:
Charr.dexptime = (uint)DR["dexptime"];
Charr.dexp = Convert.ToByte(DR["dexp"]);
Add new Timer
andQuote:
public static System.Timers.Timer General2;
now go to Character.cs searchQuote:
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));
}
}
}
And replaceQuote:
public bool AddExp(ulong Amount, bool CountMisc)
with
now to save search forQuote:
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;
}
and add the commandQuote:
public static void SaveChar(Character Charr)
now u need add 2 tables in database "characters"Quote:
ExternalDatabase.DatabaseQueue.Enqueue(new MySqlCommand("UPDATE `Characters` SET `dexptime` = " + Charr.dexptime + ", `dexp` = " + Charr.dexp + " WHERE `Account` = '" + Charr.MyClient.Account + "'", ExternalDatabase.Connection));
look the image..
Done :bandit: