Register for your free account! | Forgot your password?

You last visited: Today at 22:56

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

Advertisement



MaxHitpoints bug

Discussion on MaxHitpoints bug within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2013
Posts: 18
Received Thanks: 0
MaxHitpoints bug

calculated max hitpoints is for example 8k what a char see in the hp bar is max 9.2k but i can only use potions up to 8k

i can guess i'm sending a falsy packet to client only without updating it into the database ... so where do i have access to that?

also the 1.2 k diff is due to addition of wrangler which is automatically done to all chars without even activating it?!?!

upon opening the subclass option in status the hitpoints rise like if you are leveling wrangler up till max then it goes down again and repeats every time you open the subclass in status is like giving a lvl to wrangler


thnx in advance
Garedx is offline  
Old 07/16/2013, 06:20   #2
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
use Checker like that
if (client.Entity.HitPoints > client.Entity.MaxHitPoints)
{
client.Entity.HitPoints = client.Entity.MaxHitPoints
}

Or

client.Entity.HitPoints = (uint)Math.Min(client.Entity.HitPoints, client.Entity.MaxHitPoints);

and about subclass you should Work on Subclass Part in PacketHandler cuz it needs Alot of Modifications
shadowman123 is offline  
Thanks
1 User
Old 07/16/2013, 06:56   #3
 
elite*gold: 0
Join Date: Jun 2013
Posts: 18
Received Thanks: 0
I have both checkers and that sucks!
My subclass system do that for wrangler only
I had a problem in calculatehp bonus but i fixed it ... (it was calculating itemhp twice)
now am stuck with maxhp viewed != maxhp of client because of wrangler hp which in the stats windows says hp +1200 wrangler but when you click the subclass button (open the packet) it returns normal
then openning the packet again it rises in leves
hp + 100 wrangler
next click
hp+200 wrangler and so on

so If i had to guess ...
an initial value is sent of 1200
that value changes everytime i use the packet case 0:
but am stuck with no further clue
Garedx is offline  
Old 07/16/2013, 07:05   #4
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
Take a look at how your source calculates stats. When recalculating max hp you need to take into account all boosting sources (such as subclasses).

Once that is done you can breakpoint to determine what the server thinks the client max hp is. Assuming that matches the client then you should be done and be able to heal properly but if not then the code controlling recalculation of stats is incorrect and needs to be corrected server side.
pro4never is offline  
Old 07/16/2013, 07:14   #5
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
you can make it Through Boolean Checker like

when the player Opens Subclass Interface he gains Hp as he is in Wrangler everytime he Opens the Interface so here you are

bool GotHp = false
if (!GotHp)
{
Increase the players Hp by w.e then set the GotHop Boolean variable to true by that he will gain Hp just One time
}
shadowman123 is offline  
Old 07/16/2013, 07:20   #6
 
elite*gold: 0
Join Date: Jun 2013
Posts: 18
Received Thanks: 0
Quote:
Originally Posted by pro4never View Post
Take a look at how your source calculates stats. When recalculating max hp you need to take into account all boosting sources (such as subclasses).
I have no idea where does the subclass +stat comefrom ... I can't find the code for it

I already checked
It do the basic hp
then calculates itemsHP and gems (Enchantment, and pluses work pretty fine)
But about subclasses .... I have no idea where their increments are :/
Garedx is offline  
Old 07/16/2013, 07:29   #7
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
Quote:
Originally Posted by Garedx View Post
I have no idea where does the subclass +stat comefrom ... I can't find the code for it

I already checked
It do the basic hp
then calculates itemsHP and gems (Enchantment, and pluses work pretty fine)
But about subclasses .... I have no idea where their increments are :/
You have to create their increments. That's your whole problem.

Look in the client (or search the official co website) to see what bonus hp each level of the class gets. You can then create a table of class type, bonus value, etc (if you don't already have one) and then you can use the character's class to run your character stat calculations to assign bonus stats properly.

That or just write a basic calculation that describes how much bonus hp you get and if your subclass is the right type run it to boost max hp.

Quote:
Originally Posted by shadowman123 View Post
you can make it Through Boolean Checker like

when the player Opens Subclass Interface he gains Hp as he is in Wrangler everytime he Opens the Interface so here you are

bool GotHp = false
if (!GotHp)
{
Increase the players Hp by w.e then set the GotHop Boolean variable to true by that he will gain Hp just One time
}


<facepalm>

Opening the subclass page does not and cannot effect your max hp. You should ONLY calculate max hp when you login or when it's possibly changed (base stats, profession, items or subclass are changed)
pro4never is offline  
Old 07/16/2013, 07:30   #8
 
elite*gold: 0
Join Date: Jun 2013
Posts: 18
Received Thanks: 0
PHP Code:
case 2320:
                            {
                                
byte[] Packet null;
                                switch (
packet[4])
                                {
                                    
//9 = learn 10= upgrade pro
                                    #region [Restore/Switch]
                                    
case 0:
                                        
byte To packet[6];
                                        
Packet = new byte[0];
                                        
client.Send(packet);
                                        if (
To 0)//Switch
                                        
{
                                            
Packet = new byte[0];
                                            
Packet = new SubClassShowFull(true) { ID 1, Class = ToLevel client.Entity.SubClasses.Classes[To].Phase }.ToArray();//client.Entity.SubClasses.Classes[To].Phase
                                            
client.Send(Packet);
                                            
//Packet = new SubClass(client.Entity).ToArray();
                                            //client.Send(Packet);
                                           
client.Entity.SubClass To;
                                            
/// client.Entity.SubClassLevel = client.Entity.SubClasses.Classes[To].Level;
                                            
client.Entity.SubClasses.Active To;
                                           
client.Entity.SubClassesActive To;
                                            
// Console.WriteLine("s " + To + "");
                                        
}
                                        else
//Restore
                                        
{
                                            
client.Entity.SubClass 0;
                                            
//client.Entity.SubClassLevel = 0;
                                            
client.Entity.SubClasses.Active 0;
                                            
client.Entity.SubClassesActive 0;
                                            
Packet = new SubClassShowFull(true) { ID }.ToArray();
                                            
client.Send(Packet);
                                        }
                                        
client.SendScreen(client.Entity.SpawnPacketfalse);
                                        break; 
the code for the packet in zero case

Btw i noticed the 1 case is missing by checking the subclasses.cs 1 is for activation ... dunno
am not an expert with packets or enums ...
Garedx is offline  
Old 07/16/2013, 07:33   #9
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
It has nothing to do with packets, it has to do with your stat calculation method as I already mentioned.

You found where it calculates based on stats and items, add a check in there that checks your current subclass type and level and then write a calculation that takes that and gives you the correct stats based on it

Lets say that you got 100 bonus hp for every level you had in wrangler then you could use a calculation such as...
if(SubClass.Type == SubClass.Wrangler)
MaxHp += Subclass.Level * 100;

Now, look in the client or on their website to see how much hp you get for each level in it and you can EASILY edit it.
pro4never is offline  
Old 07/16/2013, 07:33   #10
 
elite*gold: 0
Join Date: Jun 2013
Posts: 18
Received Thanks: 0
Quote:
Originally Posted by pro4never View Post

<facepalm>

Opening the subclass page does not and cannot effect your max hp. You should ONLY calculate max hp when you login or when it's possibly changed (base stats, profession, items or subclass are changed)
It doesn't change maxhp it changes max hp displayed

U still can heal to the real max hp only ....


I mean why does the client assume any char to start with the +1200 hp of wrangler then?
I guess you are saying it's client sided, right?
the appearant change is client sided?
It still means my client is bugged for that button thing
Garedx is offline  
Old 07/16/2013, 07:38   #11
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
No, I'm saying you have to calculate it server side so that the server side value for Max Hp matches up with what is visible in the client.

Assuming you've sent server>client confirmation of your subclass type and level then the client will automatically boost the visible max hp value. You NEED to calculate the same value server side in order to make it so you can heal up to the proper amount.
pro4never is offline  
Old 07/16/2013, 07:40   #12
 
elite*gold: 0
Join Date: Jun 2013
Posts: 18
Received Thanks: 0
Quote:
Originally Posted by pro4never View Post
No, I'm saying you have to calculate it server side so that the server side value for Max Hp matches up with what is visible in the client.

Assuming you've sent server>client confirmation of your subclass type and level then the client will automatically boost the visible max hp value. You NEED to calculate the same value server side in order to make it so you can heal up to the proper amount.
again "server side" i have no such record of even learning that subclass
still my client shows the 1200 bonus hp ....

that if condition you mentioned will make sure that when learned and used it would match

Btw where do i find that in the client?

but am not even at that point now
Garedx is offline  
Reply




All times are GMT +2. The time now is 22:56.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.