[Release] PK Points

06/06/2009 22:33 Zeroxelli#1
Requested, so I did it. Pretty simple little addition.

to the bottom of Character.cs, under
Code:
public Timer FlashTimer;
Add
Code:
public Timer PkRemove;
Now, in ClientSocket.cs, under
Code:
		public void AddStam()
		{
			if(!Client.Dead)
			{
                if (Client.CurrentStam < 100)
                {
                    Client.CurrentStam += 10;
                    Send(ConquerPacket.Status(this, 2, Client.CurrentStam, Struct.StatusTypes.Stamina));
                }
                else if (Client.CurrentStam > 100)
                    Client.CurrentStam = 100;
			}
		}
Add
Code:
        public void RemPKP()
        {
            if (Client.PkPoints > 0)
            {
                Client.PkPoints -= 1;
                Send(ConquerPacket.Status(this, 2, Client.PkPoints, Struct.StatusTypes.PKPoints));
            }
        }
Last, in PacketProcessor.cs under
Code:
                                        CSocket.Client.UpStam = new System.Timers.Timer();
                                        CSocket.Client.UpStam.Interval = 850;
                                        CSocket.Client.UpStam.Elapsed += delegate { CSocket.AddStam(); };
Add
Code:
                                        CSocket.Client.PkRemove = new System.Timers.Timer();
                                        CSocket.Client.PkRemove.Interval = (60000 * 6);
                                        CSocket.Client.PkRemove.Elapsed += delegate { CSocket.RemPKP(); };
                                        CSocket.Client.PkRemove.Enabled = true;
                                        CSocket.Client.PkRemove.Start();
Done, [Only registered and activated users can see links. Click Here To Register...]
06/06/2009 22:43 mejo33#2
Yes yes, its work thanks :)
06/06/2009 22:46 HunterT#3
Is this server sided?
06/06/2009 22:48 malak2100#4
thanks
06/06/2009 22:49 Zeroxelli#5
Server sided? No o_0

EDIT: Explanation: Your PK points stored in the server are sent every time another client requests the Spawn packet for a character or their info.
06/06/2009 23:15 2coolforu2#6
Thanks for releasing, Zeroxelli you've been really contributing to this source ^_^ +k
06/06/2009 23:45 Zeroxelli#7
@2coolforu2;

No prob :p This is really only a tenth of what I've gotten so far :)
06/07/2009 05:49 BlooD-BoY#8
again, sick release you really contribute to this forum alot but one small suggestion (if you actually can) just add under each line of code what's it purpose is this way it would actually help people who want to learn =)
06/07/2009 06:29 Zeroxelli#9
Code:
public Timer PkRemove; // Add a new Timer, to perform certain actions every time the interval elapses.
Code:
        public void RemPKP() // Create a new VOID function, passing no arguments.
        {
            if (Client.PkPoints > 0) // If we have more than ZERO PK Points
            {
                Client.PkPoints -= 1; // PkPoints = PkPoints - 1
                Send(ConquerPacket.Status(this, 2, Client.PkPoints, Struct.StatusTypes.PKPoints)); // Update the client with the new status and value of PK Points
            }
        }
Code:
                                        CSocket.Client.PkRemove = new System.Timers.Timer(); // Initialize the timer with the basic Timer type
                                        CSocket.Client.PkRemove.Interval = (60000 * 6); // The interval is set to 60000 * 6, 1000 = One Second, thus 60000 = Sixty Seconds (One Minute), * 6 = Six Minutes
                                        CSocket.Client.PkRemove.Elapsed += delegate { CSocket.RemPKP(); }; // The delegate to call the function we defined earlier, every time six minutes elapse.
                                        CSocket.Client.PkRemove.Enabled = true; // Enable the timer, so it ticks.
                                        CSocket.Client.PkRemove.Start(); // Start the timer
06/07/2009 09:12 killerbee#10
thanks, it works for me. how do you make the chars name flashes?
06/07/2009 09:44 Zeroxelli#11
That should already be added to the source.
06/07/2009 12:34 BlooD-BoY#12
Quote:
Originally Posted by Zeroxelli View Post
Code:
public Timer PkRemove; // Add a new Timer, to perform certain actions every time the interval elapses.
Code:
        public void RemPKP() // Create a new VOID function, passing no arguments.
        {
            if (Client.PkPoints > 0) // If we have more than ZERO PK Points
            {
                Client.PkPoints -= 1; // PkPoints = PkPoints - 1
                Send(ConquerPacket.Status(this, 2, Client.PkPoints, Struct.StatusTypes.PKPoints)); // Update the client with the new status and value of PK Points
            }
        }
Code:
                                        CSocket.Client.PkRemove = new System.Timers.Timer(); // Initialize the timer with the basic Timer type
                                        CSocket.Client.PkRemove.Interval = (60000 * 6); // The interval is set to 60000 * 6, 1000 = One Second, thus 60000 = Sixty Seconds (One Minute), * 6 = Six Minutes
                                        CSocket.Client.PkRemove.Elapsed += delegate { CSocket.RemPKP(); }; // The delegate to call the function we defined earlier, every time six minutes elapse.
                                        CSocket.Client.PkRemove.Enabled = true; // Enable the timer, so it ticks.
                                        CSocket.Client.PkRemove.Start(); // Start the timer
yep thats good, hopefully people would read and learn something from every release a lil by lil =)
06/07/2009 13:49 nTL3fTy#13
Just a small note:
Code:
PkRemove.Enabled = true;
is the same as
Code:
PkRemove.Start();
They do the same thing, no need to have both. ;)
06/07/2009 17:19 Zeroxelli#14
Quote:
Originally Posted by nTL3fTy View Post
Just a small note:
Code:
PkRemove.Enabled = true;
is the same as
Code:
PkRemove.Start();
They do the same thing, no need to have both. ;)
I have VS Pro 2008, it always warns me if I don't enable a timer before I start it. And I never release anything that doesn't have 0/0 Error/warns.

Probably wouldn't on C# Express because it doesn't have the entire MSDN to back its intellisense.
07/01/2009 15:46 0105653642#15
thanx u make it work i try to make but i i allwase get errors but i'm still learning i will be something this day will come thanx alot