src/server/game/Entities/Player/Player.cpp | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 2afa3c7..49a930d 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -1012,7 +1012,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
start_level = gm_level;
}
- SetUInt32Value(UNIT_FIELD_LEVEL, start_level);
+ SetLevel(start_level);
InitRunes();
@@ -16815,7 +16815,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
bytes0 |= Gender << 16; // gender
SetUInt32Value(UNIT_FIELD_BYTES_0, bytes0);
- SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8());
+ SetLevel(fields[6].GetUInt8());
SetUInt32Value(PLAYER_XP, fields[7].GetUInt32());
_LoadIntoDataField(fields[61].GetCString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
src/server/game/Spells/SpellEffects.cpp | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index ce64c2e..8d10bfa 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3102,13 +3102,13 @@ void Spell::EffectTameCreature(SpellEffIndex /*effIndex*/)
uint8 level = (creatureTarget->getLevel() < (m_caster->getLevel() - 5)) ? (m_caster->getLevel() - 5) : creatureTarget->getLevel();
// prepare visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
+ pet->SetLevel(level - 1);
// add to world
pet->GetMap()->AddToMap(pet->ToCreature());
// visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
+ pet->SetLevel(level);
// caster have pet now
m_caster->SetMinion(pet, true);
src/server/game/Chat/Commands/Level2.cpp | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp
index cc63819..fdfdaa1 100755
--- a/src/server/game/Chat/Commands/Level2.cpp
+++ b/src/server/game/Chat/Commands/Level2.cpp
@@ -975,7 +975,7 @@ bool ChatHandler::HandleCreatePetCommand(const char* /*args*/)
}
// prepare visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1);
+ pet->SetLevel(creatureTarget->getLevel()-1);
pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
// this enables pet details window (Shift+P)
@@ -985,7 +985,7 @@ bool ChatHandler::HandleCreatePetCommand(const char* /*args*/)
pet->GetMap()->AddToMap(pet->ToCreature());
// visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel());
+ pet->SetLevel(creatureTarget->getLevel());
player->SetMinion(pet, true);
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
src/server/scripts/Commands/cs_npc.cpp | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index a9959c6..b731f9d 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -1198,13 +1198,13 @@ public:
uint8 level = (creatureTarget->getLevel() < (player->getLevel() - 5)) ? (player->getLevel() - 5) : creatureTarget->getLevel();
// prepare visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
+ pet->SetLevel(level - 1);
// add to world
pet->GetMap()->AddToMap(pet->ToCreature());
// visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
+ pet->SetLevel(level);
// caster have pet now
player->SetMinion(pet, true);
Post that as a tracker-issue please. And include why etc etc etc.
Where can I get more information?
Paste your code in https://github.com/TrinityCore/TrinityCore/issues/new
since it’s a diff in the first line write diff and in last line
It is still not applied? /emoticons/default_huh.png
Take somebody, and push push it to the repository.
I do not use the Git.
Start using it
You haven’t even explained why this is a necessary change, and why you didn’t convert the rest of the ones that are similar to it…
As his subject indicates, he’s changing 8 references to “setuit32Value(UNIT_FIELD_LEVEL, …)” to Setlevel(…)
This is because the SetLevel implementation in unit.cpp has additional behavior for players to set a group_update flag (code snip below). I don’t understand his intended effect, though. 6/8 of the references are for pets and so will not invoke the additional behavior. The other 2 references are for players at init time (create and loadFromDB). I’m not sure if the additional behavior in SetLevel(…) would apply in those situations as well.
Some clarifying comments from the OP would seem to be forthcoming. It looks like very trivial cleanup code to me with no functional effect.
void Unit::SetLevel(uint8 lvl)
{
SetUInt32Value(UNIT_FIELD_LEVEL, lvl);
// group update
if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetGroup())
ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_LEVEL);
}