MaxHitpoints bug

07/16/2013 05:58 Garedx#1
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
07/16/2013 06:20 shadowman123#2
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
07/16/2013 06:56 Garedx#3
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
07/16/2013 07:05 pro4never#4
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.
07/16/2013 07:14 shadowman123#5
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
}
07/16/2013 07:20 Garedx#6
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 :/
07/16/2013 07:29 pro4never#7
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)
07/16/2013 07:30 Garedx#8
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 ...
07/16/2013 07:33 pro4never#9
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.
07/16/2013 07:33 Garedx#10
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
07/16/2013 07:38 pro4never#11
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.
07/16/2013 07:40 Garedx#12
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 :D