(Request) Quest .EXP Command

Hello.

A friend of mine developered me a .EXP command, that gave each character/player just the amount of Exp they wanted:

FX: .exp 4 and your experince would then be 4. While it to other players maybe could be 5 or 6.

I haven’t found a way to merge my code into the trinity core, so maybe someone could make one?

The code by my friend was made for Mangos-Zero.

Can you post the script so we can see how it works?

Something like this stuck to a command scripts possibly works fine: (basically just the GiveXp function with few things taken out)


void example(uint32 xp, Player* player)

{

if (xp < 1)

	 return;

if (!player->isAlive() && !player->GetBattlegroundId())

	 return;

uint8 level = player->getLevel();

if (level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))

	 return;

uint32 curXP = player->GetUInt32Value(PLAYER_XP);

uint32 nextLvlXP = player->GetUInt32Value(PLAYER_NEXT_LEVEL_XP);

while (xp >= nextLvlXP && level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) // Auto levels the player up if current level's XP limit is maxed

{

	 xp -= nextLvlXP;

	 if (level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) // Not likely needed. Checked in while loop.

		 player->GiveLevel(level + 1);

	 level = player->getLevel();

	 nextLvlXP = player->GetUInt32Value(PLAYER_NEXT_LEVEL_XP);

}

player->SetUInt32Value(PLAYER_XP, xp);

}

All the activity thats been going on, is linked here to my repo, maybe someone kind person knows how to read it.

https://github.com/S…le?tab=activity and translate it into Trinity so I can use it, thank you /emoticons/default_smile.png