i have pkpoints sorta working when i kill someone it increases the pkpoints but it doesnt show on the status window of the character but when u go into the friends list it shows there pk points.
damage *= (0 - battlepower);
private ushort pkpoints;
public ushort PkPoints
{
get
{
return pkpoints;
}
set
{
value = (ushort)((value >= 1000) ? 1000 : value);
if (value > 29 && value < 100)
{
this.RemoveFlag1(Effect1.BlackName);
this.AddFlag1(Effect1.RedName);
}
else if (value >= 100)
{
this.RemoveFlag1(Effect1.RedName);
this.AddFlag1(Effect1.BlackName);
}
else if (value >= 0 && value < 30)
{
this.RemoveFlag1(Effect1.RedName);
this.RemoveFlag1(Effect1.BlackName);
}
pkpoints = value;
DB.Update(DBUpdate.PKPoints, pkpoints);
Send(Packet.UpdatePacket.Create(UID, UpdateType.PkPt, pkpoints));//This is the line you need. All you need is sending an update packet with the PKPoints type to the user.
}
}
it works but when u logout then back on again it stops showingQuote:
Something like this.
Code:private ushort pkpoints; public ushort PkPoints { get { return pkpoints; } set { value = (ushort)((value >= 1000) ? 1000 : value); if (value > 29 && value < 100) { this.RemoveFlag1(Effect1.BlackName); this.AddFlag1(Effect1.RedName); } else if (value >= 100) { this.RemoveFlag1(Effect1.RedName); this.AddFlag1(Effect1.BlackName); } else if (value >= 0 && value < 30) { this.RemoveFlag1(Effect1.RedName); this.RemoveFlag1(Effect1.BlackName); } pkpoints = value; DB.Update(DBUpdate.PKPoints, pkpoints); Send(Packet.UpdatePacket.Create(UID, UpdateType.PkPt, pkpoints));//This is the line you need. All you need is sending an update packet with the PKPoints type to the user. } }
public static void Logout(Player player)
{
MySqlCommand command = new MySqlCommand(MySqlCommandType.UPDATE);
command.Update("Characters")
.Set("X", player.X)
.Set("Y", player.Y)
.Set("Map", player.MapID)
.Set("Profession1", player.Profession)
.Set("Level", player.Level)
.Set("Health", player.Health)
.Set("Mana", player.Mana)
.Set("Strength", player.Strength)
.Set("StatPoints", player.StatPoint)
.Set("Agility", player.Agility)
.Set("Spirit", player.Spirit)
.Set("Vitality", player.Vitality)
[B].Set("Pk", player.PkPts)[/B]
.Set("Mesh", player.Body)
.Set("Avatar", player.Face)
.Set("Hair", player.Hair)
.Set("Name", player.Name)
.Set("Money", player.Money)
.Set("Experience", player.Experience)
.Set("Cp", player.CP)
.Set("Title", (byte)player.Title)
.Where("UID", player.UID)
.Execute();
}
public static bool PullLogin(Player user)
{
MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
command.Select("Characters").Where("UID", user.UID);
MySqlReader reader = new MySqlReader(command);
if (reader.Read())
{
user.Spouse = reader.ReadString("Spouse");
user.Name = reader.ReadString("Name");
user.Experience = reader.ReadUInt64("Experience");
user.Profession = reader.ReadByte("Profession1");
user.Level = reader.ReadByte("Level");
user.Strength = reader.ReadUInt16("Strength");
user.Agility = reader.ReadUInt16("Agility");
user.Vitality = reader.ReadUInt16("Vitality");
user.Spirit = reader.ReadUInt16("Spirit");
user.StatPoint = reader.ReadUInt16("StatPoints");
user.Health = reader.ReadUInt16("Health");
user.Mana = reader.ReadUInt16("Mana");
Enum.TryParse(reader.ReadString("Language"), out user.Lang);
user.MapID = reader.ReadUInt32("Map");
user.PreviousMap = reader.ReadUInt32("PreviousMap");
user.X = reader.ReadUInt16("X");
user.Y = reader.ReadUInt16("Y");
[B]user.PkPts = reader.ReadInt16("Pk");[/B]
user.Money = reader.ReadUInt32("Money");
user.WarehouseMoney = reader.ReadUInt32("WhMoney");
user.CP = reader.ReadUInt32("Cp");
user.VirtuePoints = reader.ReadUInt32("VirtuePoints");
user.Body = reader.ReadUInt16("Mesh");
user.Face = reader.ReadUInt16("Avatar");
user.Hair = reader.ReadUInt16("Hair");
user.Title = (PlayerTitle) reader.ReadByte("Title");
user.LastPatch = reader.ReadUInt16("LastPatch");
user.NobilityDonation = reader.ReadInt64("Donation");
try
{
user.ExpBoostEnds = DateTime.Parse(reader.ReadString("ExpTimeExpires"));
user.LuckyTimeEnds = DateTime.Parse(reader.ReadString("LuckyTimeExpires"));
user.BlessingEnds = DateTime.Parse(reader.ReadString("HeavenBlessExpires"));
}
catch { }
PullArenaStatistics(user);
}
return !string.IsNullOrEmpty(user.Name);
}