Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 10:24

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



How to edit PK Mode System Message like Real Conquer Online .- TQ.Elgahed

Discussion on How to edit PK Mode System Message like Real Conquer Online .- TQ.Elgahed within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
TQ-Challenger's Avatar
 
elite*gold: 0
Join Date: Apr 2012
Posts: 4
Received Thanks: 0
How to edit PK Mode System Message like Real Conquer Online .- TQ.Elgahed

By the name of the god



========================



lets open PacketHandler.cs



and search this code :



PHP Code:
        static void ChangePKMode(Data generalDataClient.GameState client)

        {

            
client.Entity.AttackPacket null;

            
client.Entity.PKMode = (Game.Enums.PKMode)(byte)generalData.dwParam;

            
client.Send(generalData);

        } 




Then replace it with this code





PHP Code:
        #region ChangePKMode

        
static void ChangePKMode(Data generalDataClient.GameState client)

        {

            
client.Entity.AttackPacket null;

            
client.Entity.PKMode = (Game.Enums.PKMode)(byte)generalData.dwParam;

            
client.Send(generalData);

            if (
client.Entity.PKMode == Game.Enums.PKMode.PK)

            {

                
client.Send(new Message("Free PK mode. You can attack monster and all players."System.Drawing.Color.RedMessage.Talk));

            }

            if (
client.Entity.PKMode == Game.Enums.PKMode.Capture)

            {

                
client.Send(new Message("Capture PK mode. You can only attack monsters, black-name and blue-name players."System.Drawing.Color.RedMessage.Talk));

            }

            if (
client.Entity.PKMode == Game.Enums.PKMode.Peace)

            {

                
client.Send(new Message("Peace mode. You can only attack monsters."System.Drawing.Color.RedMessage.Talk));

            }

            if (
client.Entity.PKMode == Game.Enums.PKMode.Team)

            {

                
client.Send(new Message("Team PK mode. You can attack monster and all players except your teammates."System.Drawing.Color.RedMessage.Talk));

            }

        }

        
#endregion 


Done .
TQ-Challenger is offline  
Old 04/16/2012, 18:48   #2
 
nTL3fTy's Avatar
 
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
This is definitely one of those times you use an if-else if (at least):
Code:
if (client.Entity.PKMode == Game.Enums.PKMode.PK) 
{ 
    client.Send(new Message("Free PK mode. You can attack monster and all players.", System.Drawing.Color.Red, Message.Talk)); 
} 
else if (client.Entity.PKMode == Game.Enums.PKMode.Capture) 
{ 
    client.Send(new Message("Capture PK mode. You can only attack monsters, black-name and blue-name players.", System.Drawing.Color.Red, Message.Talk)); 
} 
else if (client.Entity.PKMode == Game.Enums.PKMode.Peace) 
{ 
    client.Send(new Message("Peace mode. You can only attack monsters.", System.Drawing.Color.Red, Message.Talk)); 
} 
else if (client.Entity.PKMode == Game.Enums.PKMode.Team) 
{ 
    client.Send(new Message("Team PK mode. You can attack monster and all players except your teammates.", System.Drawing.Color.Red, Message.Talk)); 
}
nTL3fTy is offline  
Thanks
1 User
Old 04/16/2012, 18:58   #3
 
Mr_PoP's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 759
Received Thanks: 285
Quote:
Originally Posted by nTL3fTy View Post
This is definitely one of those times you use an if-else if (at least):
Code:
if (client.Entity.PKMode == Game.Enums.PKMode.PK) 
{ 
    client.Send(new Message("Free PK mode. You can attack monster and all players.", System.Drawing.Color.Red, Message.Talk)); 
} 
else if (client.Entity.PKMode == Game.Enums.PKMode.Capture) 
{ 
    client.Send(new Message("Capture PK mode. You can only attack monsters, black-name and blue-name players.", System.Drawing.Color.Red, Message.Talk)); 
} 
else if (client.Entity.PKMode == Game.Enums.PKMode.Peace) 
{ 
    client.Send(new Message("Peace mode. You can only attack monsters.", System.Drawing.Color.Red, Message.Talk)); 
} 
else if (client.Entity.PKMode == Game.Enums.PKMode.Team) 
{ 
    client.Send(new Message("Team PK mode. You can attack monster and all players except your teammates.", System.Drawing.Color.Red, Message.Talk)); 
}
or switch() case{} ?
Mr_PoP is offline  
Thanks
3 Users
Old 04/16/2012, 19:19   #4
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
was just gonna say...

USE SWITCH!

That being said, he did say at LEAST use if/elseif which makes him correct anyways :P
pro4never is offline  
Old 04/16/2012, 20:35   #5


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Don't use a switch, switches perform worse than if/else at lower iterations like this.
Korvacs is offline  
Thanks
1 User
Old 04/16/2012, 21:13   #6
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
Or... just have one statement and use a string array to tell the client what message to display.
Spirited is offline  
Old 04/16/2012, 21:37   #7
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by Korvacs View Post
Don't use a switch, switches perform worse than if/else at lower iterations like this.
Interesting, at what point does switch become more efficient? or is it one of those things used more for aesthetic appeal then actual performance? I for some reason had it in my mind that switch became more efficient after a fairly low number of if/else if statements but I'm probably wrong.
pro4never is offline  
Old 04/16/2012, 22:37   #8
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
Quote:
Originally Posted by pro4never View Post
Interesting, at what point does switch become more efficient? or is it one of those things used more for aesthetic appeal then actual performance? I for some reason had it in my mind that switch became more efficient after a fairly low number of if/else if statements but I'm probably wrong.
Here's my opinion on it:
I did a little research, and in the long run (depending on how many cases the statement is checking...) if else statements perform the worst. In situations where there are less than 5 cases being checked, an if-else structure performs the best. However, when you're dealing with that little of a switch, you should always consider how to write it as one statement.

This is how I'd do it:
client.Send(new ClientMessage(PkNotifications[generalAction.PrimaryAction], ChatTone.System).ToPointer());
Spirited is offline  
Old 04/16/2012, 22:53   #9
 
nTL3fTy's Avatar
 
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
Quote:
Originally Posted by Fаng View Post
This is how I'd do it:
client.Send(new ClientMessage(PkNotifications[generalAction.PrimaryAction], ChatTone.System).ToPointer());
What happens if I'm on a proxy and send PKMode 50?
nTL3fTy is offline  
Thanks
1 User
Old 04/16/2012, 23:13   #10
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by nTL3fTy View Post
What happens if I'm on a proxy and send PKMode 50?
While I'm sure he'd account for this... it does make it a less elegant solution when you add in all sorts of error checking.
pro4never is offline  
Old 04/16/2012, 23:45   #11
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
Quote:
Originally Posted by nTL3fTy View Post
What happens if I'm on a proxy and send PKMode 50?
I check the range before I even assign it. I'm showing you the message line, not how I assign everything.
Spirited is offline  
Old 04/17/2012, 00:01   #12
 
nTL3fTy's Avatar
 
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
Quote:
Originally Posted by Fаng View Post
I check the range before I even assign it. I'm showing you the message line, not how I assign everything.
I was going on the assumption that generalData was your packet instance and PrimaryAction was a field in the packet. Considering that, it seemed as though you were just taking the field from the packet with no range checks. If this isn't correct, I'm clearly confused.
nTL3fTy is offline  
Old 04/17/2012, 00:08   #13
 
Mr_PoP's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 759
Received Thanks: 285
well use switch.
In the worst case the compiler will generate the same code as a if-else chain, so you don't lose anything. If in doubt put the most common cases first into the switch statement.

In the best case the optimizer may find a better way to generate the code. Common things a compiler does is to build a binary decision tree (saves compares and jumps in the average case) or simply build a jump-table (works without compares at all).
Mr_PoP is offline  
Old 04/17/2012, 00:11   #14


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by pro4never View Post
Interesting, at what point does switch become more efficient? or is it one of those things used more for aesthetic appeal then actual performance? I for some reason had it in my mind that switch became more efficient after a fairly low number of if/else if statements but I'm probably wrong.
Test i've read show that it varies under different circumstance, and your own benchmark will also show this most likely, the general rule of thumb is that if the number of conditions is 5 or more then use a switch as the switch will use a Hashtable which adds a reasonable amount of overhead (lookup + jump), otherwise in basically all cases if/else would be preferred.
Korvacs is offline  
Old 04/17/2012, 00:31   #15
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
Quote:
Originally Posted by nTL3fTy View Post
I was going on the assumption that generalData was your packet instance and PrimaryAction was a field in the packet. Considering that, it seemed as though you were just taking the field from the packet with no range checks. If this isn't correct, I'm clearly confused.
That's correct. I'm using the general packet like everyone else does ... I error check it BEFORE I handle it. If it's correct, I use the data in the packet. Problem?
Spirited is offline  
Reply


Similar Threads Similar Threads
Conquer Online BGM Edit
11/27/2012 - CO2 Guides & Templates - 3 Replies
Hello, this is my first guide. :D In this guide I will show you how to change the BGM for conquer online. (official co or private server) The only program you need is notepad (or a other type of txt reader), lol. FIRST: Go to your conquer folder. Go to the folder named "ini". Scroll down and open "MusicRegion". This will be for the music configuration.
[Info KS4] Captain Mode|Map:Old Moon|Message System
12/12/2010 - S4 League - 50 Replies
Hallo lieber Epvpers-Community, ich bin's Mal wieder =) Heute gibt's brisante News zur kommenden KS4 Update, ich glaube, dass es nicht lange dauern wird (Meine Prognose:Winter Set=99,9%, Map~75%, Mode~50%, Nachrichtensystem < 30%) bis es auch bei uns ankommt: Neue Mode:Captain Mode http://boardr.pmang.com/files/pm/attach3/cmboard/ 323/b6/24-/04-/53-/24045346./captain.jpg http://boardr.pmang.com/files/pm/attach3/cmboard/ 323/b6/24-/04-/53-/24045346./mode_shot_2.jpg...
Conquer Ghost Mode edit.. need help.
08/04/2010 - Conquer Online 2 - 0 Replies
Alright so basically I'm trying to get into the oh so famous "ghost mode" of Conquer. Pretty much the Conquer realm is always in Enlightenment Mode but without the pointy finger. The reason I want to do this is to have the ability to log in more miners than my current limit. As I'm trying this I have 27 clients logged and mining. The way I'm able to log in 27 is right click to start mining than press the Tab key however Enlightenment Mode gets rid of alot of other garbage. I would just right...



All times are GMT +1. The time now is 10:27.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.