View Full Version : [SOLVED] Player Base mana and base HP value incorrect.

07-12-2016, 11:04 PM
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.

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 :

// 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.");

uint32 count = 0;

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);

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.

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];

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


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.

07-13-2016, 05:16 AM
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

07-13-2016, 07:46 AM
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

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

unfortunately that not the problem solve, still same result.


solved, seems like last piece of code i found was the problem solver, just had to recompile whole core, not only "Game" :)