32K HP Bug Fix

Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    Quitted MadKnight is offline
    MemberRank
    Feb 2012 Join Date
    Planet VegetaLocation
    443Posts

    32K HP Bug Fix


    Hey guys i just understand the 32.767 HP bug.

    Everytime when the DBServer calls UpdatePlayer it updates all Level, Wis, Str, HP, ... soo and if you have over 32.767 the database returns false (error) and nothing is updated, so you will loose your Level when you logout with over 32.767, because the DB couldnt save. Your Statpoints will updated in another call without HP saving, that is the reason why this works and its the reason for statbugs.

    So my simple stored prod checks if current hp is over 32000 if yes write not the real current hp to database, instead write 32000 and all can be save fine.


    Dbserver changes offset 2BFB0
    Code:
    EXEC UpdatePlayer %d,%d,%d,%I64d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d
    thx to BjornVH for offset


    Code:
    USE [kal_db]
    GO
    /****** Object:  StoredProcedure [dbo].[UpdatePlayer]    Script Date: 04/05/2012 02:25:39 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[UpdatePlayer]
    
    @Level int,
    @Specialty int,
    @Contribute int,
    @Exp int,
    @GRole int,
    @Strength int,
    @Health int,
    @Intelligence int,
    @Wisdom int,
    @Dexterity int,
    @CurHP int,
    @CurMP int,
    @PUPoint int,
    @SUPoint int,
    @Killed int,
    @Map int,
    @X int,
    @Y int,
    @Z int,
    @Rage int,
    @PID int
    
    AS
    
    IF(@CurHP > 32000) 
    BEGIN
    UPDATE Player SET [Level] = @Level, [Specialty] = @Specialty, [Contribute] = @Contribute, [Exp] = @Exp, [GRole] = @GRole, [Strength] = @Strength, [Health] = @Health, [Intelligence] = @Intelligence, [Wisdom] = @Wisdom, [Dexterity] = @Dexterity, [CurHP] = 32000, [CurMP] = @CurMP, [PUPoint] = @PUPoint, [SUPoint] = @SUPoint, [Killed] = @Killed, [Map] = @Map, [X] = @X, [Y] = @Y, [Z] = @Z, [Rage] = @Rage WHERE [PID] = @PID
    END
    ELSE
    BEGIN
    UPDATE Player SET [Level] = @Level, [Specialty] = @Specialty, [Contribute] = @Contribute, [Exp] = @Exp, [GRole] = @GRole, [Strength] = @Strength, [Health] = @Health, [Intelligence] = @Intelligence, [Wisdom] = @Wisdom, [Dexterity] = @Dexterity, [CurHP] = @CurHP, [CurMP] = @CurMP, [PUPoint] = @PUPoint, [SUPoint] = @SUPoint, [Killed] = @Killed, [Map] = @Map, [X] = @X, [Y] = @Y, [Z] = @Z, [Rage] = @Rage WHERE [PID] = @PID
    END
    Have fun :)


  2. #2
    Banned BabyGirl is offline
    BannedRank
    Jun 2010 Join Date
    34Posts

    Re: 32K HP Bug Fix

    yeah thanks but this was already released before and the one released didnt work either. you still have rollbacks with it.

  3. #3
    Quitted MadKnight is offline
    MemberRank
    Feb 2012 Join Date
    Planet VegetaLocation
    443Posts

    Re: 32K HP Bug Fix

    Quote Originally Posted by BabyGirl View Post
    yeah thanks but this was already released before and the one released didnt work either. you still have rollbacks with it.

    Ragezone link to the already released fix?

    What kind of rollbacks?
    If you make now Level up for example from 109 to 110 and have 64 k hp your Level will be automatically saved. Before it wasn't saved because the Data couldn't written to Database (int16 is to small for e.g. 64k HP)

    I tested it on my Server.
    I did level up from 109 to 110 with 33k+ logged out, and i was still 110, before the fix i would be level 109 again.

  4. #4
    Proficient Member SpearoX is offline
    MemberRank
    Apr 2007 Join Date
    HOLLANDLocation
    197Posts

    Re: 32K HP Bug Fix

    works perfect thnx for this

  5. #5

    Re: 32K HP Bug Fix

    That's nice release, will be useful for highrate servers.

  6. #6
    Banned BabyGirl is offline
    BannedRank
    Jun 2010 Join Date
    34Posts

    Re: 32K HP Bug Fix

    to find that post in the pile of posts on ragezone would be almost impossible so ill just put this on here from the post since i still had the files on my pc and this was the "fix" for the 32k overflow but doesnt work as it will still cause rollbacks on server crashes and hard c/ls.

    it works somewhat but not as it should. i suck at posting text and images on ragezone so heres the text below for the one that was released maybe they just made a crap stored procedure before maybe its just a crap fix all the way around maybe its just not the correct stored procedure for the overflow but whatever the problem was heres what i got and was told would fix the overflow.



    and maybe you need to hex edit the dbserver exe

    search for

    UPDATE Player SET [Level] = %d, [Specialty] = %d, [Contribute] = %d, [Exp] = %I64d, [GRole] = %d, [Strength] = %d, [Health] = %d, [Intelligence] = %d, [Wisdom] = %d, [Dexterity] = %d, [CurHP] = %d, [CurMP] = %d, [PUPoint] = %d, [SUPoint] = %d, [Killed] = %d, [Map] = %d, [X] = %d, [Y] = %d, [Z] = %d, [Rage] = %d WHERE [PID] = %d



    and replace it with


    EXEC sirlvl %d,%d,%d,%I64d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d









    CREATE PROCEDURE [dbo].[sirlvl]
    @Level tinyint,
    @Specialty tinyint,
    @Contribute smallint,
    @Exp bigint,
    @GRole tinyint,
    @Strength tinyint,
    @Health tinyint,
    @Intelligence tinyint,
    @Wisdom tinyint,
    @Dexterity tinyint,
    @CurHP smallint,
    @CurMP smallint,
    @PUPoint smallint,
    @SUPoint smallint,
    @Killed tinyint,
    @Map tinyint,
    @X int,
    @Y int,
    @Z int,
    @Rage int,
    @PID int

    AS

    DECLARE @itemid int


    IF (@CurHP > 30000)
    begin
    UPDATE Player SET [Level] = @Level, [Specialty] = @Specialty, [Contribute] = @Contribute, [Exp] = @Exp, [GRole] = @GRole, [Strength] = @Strength, [Health] = @Health, [Intelligence] = @Intelligence, [Wisdom] = @Wisdom, [Dexterity] = @Dexterity, [CurHP] = '30000', [CurMP] = @CurMP, [PUPoint] = @PUPoint, [SUPoint] = @SUPoint, [Killed] = @Killed, [Map] = @Map, [X] = @X, [Y] = @Y, [Z] = @Z, [Rage] = @Rage WHERE [PID] = @PID
    end

    IF (@CurHP < 30000)
    begin
    UPDATE Player SET [Level] = @Level, [Specialty] = @Specialty, [Contribute] = @Contribute, [Exp] = @Exp, [GRole] = @GRole, [Strength] = @Strength, [Health] = @Health, [Intelligence] = @Intelligence, [Wisdom] = @Wisdom, [Dexterity] = @Dexterity, [CurHP] = @CurHP, [CurMP] = @CurMP, [PUPoint] = @PUPoint, [SUPoint] = @SUPoint, [Killed] = @Killed, [Map] = @Map, [X] = @X, [Y] = @Y, [Z] = @Z, [Rage] = @Rage WHERE [PID] = @PID
    end


    as you can see there are similarities to what you have posted and i will try yours as well since it seems to at least be written a hell of a lot cleaner then the one i have.

  7. #7
    Quitted MadKnight is offline
    MemberRank
    Feb 2012 Join Date
    Planet VegetaLocation
    443Posts

    Re: 32K HP Bug Fix


    @BabyGirl
    I couldnt find the post where your quoted code is released but anyway i can see the fault in this code. There are two checks 1. IF (@CurHP > 30000) so if we are over 30 k hp only write 30000 [CurHP] = '30000'.
    And second: IF (@CurHP < 30000) do all normal.
    But what is when your current HP is exactly 30000?

    With your qouted posted nothing will happens and you even got Level/XP loss if you have exact 30k. So to fix this code you should write:
    IF (@CurHP <= 30000)and 30000 hp will be even saved. But youre right this code is smelly. Why the writer declare itemid DECLARE @itemid int and never use this variable? And why he makes 2 IF querys?

    So my code is clean, better and without bug.

    By the way it can be improved by adding check if EXP is negativ (bug when server have mobs with too much EXP)and when player trys to login he cant because of the negativ EXP Value in Database. Next is if you got over 32K Mana you will get the same bug as HP bug this even can be fixed with little apprehension. I think you can even fix Job Hackers in this Way by checking [Specialty] = @Specialty.

  8. #8
    boo General is offline
    MemberRank
    Sep 2006 Join Date
    at homeLocation
    2,269Posts
    Quote Originally Posted by Daywalker74 View Post

    @BabyGirl
    I couldnt find the post where your quoted code is released but anyway i can see the fault in this code. There are two checks 1. IF (@CurHP > 30000) so if we are over 30 k hp only write 30000 [CurHP] = '30000'.
    And second: IF (@CurHP < 30000) do all normal.
    But what is when your current HP is exactly 30000?

    With your qouted posted nothing will happens and you even got Level/XP loss if you have exact 30k. So to fix this code you should write:
    IF (@CurHP <= 30000)and 30000 hp will be even saved. But youre right this code is smelly. Why the writer declare itemid DECLARE @itemid int and never use this variable? And why he makes 2 IF querys?

    So my code is clean, better and without bug.

    By the way it can be improved by adding check if EXP is negativ (bug when server have mobs with too much EXP)and when player trys to login he cant because of the negativ EXP Value in Database. Next is if you got over 32K Mana you will get the same bug as HP bug this even can be fixed with little apprehension. I think you can even fix Job Hackers in this Way by checking [Specialty] = @Specialty.
    You could try to change the database type to int instead of smallint/tinyint...

    But the mainserver also saves it as a smallint, so that would require programming...
    Posted via Mobile Device

  9. #9
    Banned BabyGirl is offline
    BannedRank
    Jun 2010 Join Date
    34Posts

    Re: 32K HP Bug Fix

    thank you for the help guys ill try this procedure u posted and see what happens

  10. #10
    Valued Member Elsayed x GosT is offline
    MemberRank
    Sep 2011 Join Date
    EgyptLocation
    126Posts

    Re: 32K HP Bug Fix

    good job

  11. #11
    I love RaGEZONE! inika is offline
    MemberRank
    Dec 2008 Join Date
    274Posts

    Re: 32K HP Bug Fix

    I can make with this procedure this?:
    If exp is negative change the exp to positive?

  12. #12
    make Love, not War! HadesKal is offline
    MemberRank
    Feb 2008 Join Date
    PandoraLocation
    535Posts

    Re: 32K HP Bug Fix

    Quote Originally Posted by inika View Post
    I can make with this procedure this?:
    If exp is negative change the exp to positive?
    IF (@Exp < 0)
    begin
    UPDATE [...] Exp='0' [...]

    would it require hard programming to change the vartype to int in the mainsvr?

    Kind regards

  13. #13

    Re: 32K HP Bug Fix

    No.
    Your current Health/Magic Points got 4 bytes in the stack...
    Check the DB call and change the format from "w" to "d".

  14. #14
    Quitted MadKnight is offline
    MemberRank
    Feb 2012 Join Date
    Planet VegetaLocation
    443Posts

    Re: 32K HP Bug Fix

    @UppaCuT

    Yes to change the type you need to code it (this doenst work by hex edit or SP), but i found another way to store higher values in Database, for example:


    UPDATE Player SET [Level] = %d, [Specialty] = %d, [Contribute] = %d, [Exp] = %I64d, [GRole] = %d, [Strength] = %d, [Health] = %d, [Intelligence] = %d, [Wisdom] = %d, [Dexterity] = %d, [CurHP] = %d, [CurMP] = %d, [PUPoint] = %d, [SUPoint] = %d, [Killed] = %d, [Map] = %d, [X] = %d, [Y] = %d, [Z] = %d, [Rage] = %d WHERE [PID] = %d

    Replace this not with a Stored Prod instead replace it with:

    UPDATE Player SET [Level] = %d, [Specialty] = %d, [Contribute] = %d, [Exp] = %I64d, [GRole] = %d, [Strength] = %d, [Health] = %d, [Intelligence] = %d, [Wisdom] = %d, [Dexterity] = %d, [CurHT] = %d, [CurMP] = %d, [PUPoint] = %d, [SUPoint] = %d, [Killed] = %d, [Map] = %d, [X] = %d, [Y] = %d, [Z] = %d, [Rage] = %d WHERE [PID] = %d

    As you can see i changed CurHP to CurHT (name dosent matter but have to be the same length). Now make in your SQL Table dbo.Player an new Value CurHT wich is from Type int.
    Now all HP Values from the Player will be stored in the new CurHT Value and the CurHP value is only used when u create a Character (so dont delete CurHP). This worked better for me instead a Stored Procedure and fixed my 32k HP Bug. Maybe it will work with other Values like EXP (try a new Value EXT ^^).

  15. #15
    Apprentice KainanX is offline
    MemberRank
    May 2012 Join Date
    9Posts

    Re: 32K HP Bug Fix

    Thanks a lot for Release.



Page 1 of 2 12 LastLast

Advertisement