[Question]BattlePower

02/16/2012 11:16 coreymills#1
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.

02/16/2012 11:18 I don't have a username#2
1 - BattlePower?

Why o.o
02/16/2012 11:22 coreymills#3
because its part of the source
02/16/2012 11:24 I don't have a username#4
I meant, why 1 and then - it with battlepower o.o
02/16/2012 11:26 coreymills#5
i dont know i was trying to use the other stuff in the code as a template thats why i made this topic
02/16/2012 11:38 I don't have a username#6
damage *= 1
Is the same as damage, but you always calculate on the right side of the equal sign, so it would be 1 - battlepower. I assume you already know that as it's common math.
However it would be like this (1 - battlepower) it would give a negative result, but 1 above than the actual battlepower result. It would be more reasonable to do it like below.
Code:
damage *= (0 - battlepower);
The 1 is not needed at all. It t's because you needed a negative value, you could just used 0.
02/16/2012 14:34 coreymills#7
#edited
02/17/2012 15:30 coreymills#8
Seriously not a soul on this forum can help me with this problem
02/17/2012 15:36 I don't have a username#9
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.
            }
        }
02/20/2012 05:24 coreymills#10
Quote:
Originally Posted by I don't have a username View Post
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.
            }
        }
it works but when u logout then back on again it stops showing
02/20/2012 10:06 I don't have a username#11
Are you sure you save PKPoints or load them proper?
02/20/2012 14:53 coreymills#12
yes

Logout
Code:
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();
        }
Login
Code:
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);
        }