• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] Player Base mana and base HP value incorrect.

Status
Not open for further replies.

Vitrex

Moderator
Hello, today i met a problem, i wan't to make player base mana and base hp for level 80+ starting from 100.000 but that doesn't seems to work.
i did the following changes :

Changed type of columns basehp & basemana in player_classlevelstats to INT and added values i wanna have.

Code:
INSERT INTO `player_classlevelstats` (`class`, `level`, `basehp`, `basemana`) VALUES (1, 110, 921680, 0);
INSERT INTO `player_classlevelstats` (`class`, `level`, `basehp`, `basemana`) VALUES (2, 110, 880180, 1795000);
INSERT INTO `player_classlevelstats` (`class`, `level`, `basehp`, `basemana`) VALUES (3, 110, 929620, 2065300);
INSERT INTO `player_classlevelstats` (`class`, `level`, `basehp`, `basemana`) VALUES (4, 110, 965880, 0);
INSERT INTO `player_classlevelstats` (`class`, `level`, `basehp`, `basemana`) VALUES (5, 110, 833060, 1562000);
INSERT INTO `player_classlevelstats` (`class`, `level`, `basehp`, `basemana`) VALUES (6, 110, 833060, 0);
INSERT INTO `player_classlevelstats` (`class`, `level`, `basehp`, `basemana`) VALUES (7, 110, 823380, 1795400);
INSERT INTO `player_classlevelstats` (`class`, `level`, `basehp`, `basemana`) VALUES (8, 110, 883860, 1309700);
INSERT INTO `player_classlevelstats` (`class`, `level`, `basehp`, `basemana`) VALUES (9, 110, 873680, 1560600);
INSERT INTO `player_classlevelstats` (`class`, `level`, `basehp`, `basemana`) VALUES (11, 110, 942120, 1418500);

Next i changed in objectmngr.cpp following lines :

Code:
  // Loading levels data (class only dependent)
    TC_LOG_INFO("server.loading", "Loading Player Create Level HP/Mana Data...");
    {
        uint32 oldMSTime = getMSTime();


        //                                                0      1      2       3
        QueryResult result  = WorldDatabase.Query("SELECT class, level, basehp, basemana FROM player_classlevelstats");


        if (!result)
        {
            TC_LOG_ERROR("server.loading", ">> Loaded 0 level health/mana definitions. DB table `player_classlevelstats` is empty.");
            exit(1);
        }


        uint32 count = 0;


        do
        {
            Field* fields = result->Fetch();


            uint32 current_class = fields[0].GetUInt8();
            if (current_class >= MAX_CLASSES)
            {
                TC_LOG_ERROR("sql.sql", "Wrong class %u in `player_classlevelstats` table, ignoring.", current_class);
                continue;
            }


            uint8 current_level = fields[1].GetUInt8();      // Can't be > than STRONG_MAX_LEVEL (hardcoded level maximum) due to var type
            if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
            {
                TC_LOG_INFO("misc", "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_classlevelstats` table, ignoring.", current_level);
                ++count;                                    // make result loading percent "expected" correct in case disabled detail mode for example.
                continue;
            }


            PlayerClassInfo* info = _playerClassInfo[current_class];
            if (!info)
            {
                info = new PlayerClassInfo();
                info->levelInfo = new PlayerClassLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
                _playerClassInfo[current_class] = info;
            }


            PlayerClassLevelInfo& levelInfo = info->levelInfo[current_level-1];


[U][B]            levelInfo.basehealth = fields[2].GetUInt32();[/B][/U]
[U][B]            levelInfo.basemana   = fields[3].GetUInt32();[/B][/U]


            ++count;
        }

from GetUInt8

but still my values in game displays and works only up to 100.000. is there anything else i have to edit? or i did something wrong?
When i hit level where i should have more than 100k of the hp or mana value goes incorrect in game.
 
Last edited:

Rochet2

Moderator / Eluna Dev
you should check if levelinfo.basemana and the health are uint32. if they are not you should change them.
Also you should look around the core for where they are used and fix the code if they are used for example like
uint8 a = levelinfo.basemana
 

Vitrex

Moderator
maybe you have an idea where else it can be? i checked player.cpp, statsystem.cpp couldn't find anything.

I found in player.h

Code:
struct PlayerClassLevelInfo
{
    PlayerClassLevelInfo() : basehealth(0), basemana(0) { }
    uint16 basehealth;
    uint16 basemana;
};

unfortunately that not the problem solve, still same result.

EDIT 2

solved, seems like last piece of code i found was the problem solver, just had to recompile whole core, not only "Game" :)
 
Last edited:
Status
Not open for further replies.
Top