Add quest add and remove commands and make questcomplete try satisfy the requirements and act like quest complete command. Merge SetLevel and GiveLevel for player methods.

This commit is contained in:
Rochet2
2015-05-02 02:06:53 +03:00
parent adccf1ef36
commit 564cf2b15b
4 changed files with 274 additions and 38 deletions

View File

@@ -1431,8 +1431,23 @@ namespace LuaUnit
*/
int SetLevel(Eluna* /*E*/, lua_State* L, Unit* unit)
{
uint8 newLevel = Eluna::CHECKVAL<uint8>(L, 2);
unit->SetLevel(newLevel);
uint8 newlevel = Eluna::CHECKVAL<uint8>(L, 2);
if (newlevel < 1)
return 0;
if (newlevel > STRONG_MAX_LEVEL)
newlevel = STRONG_MAX_LEVEL;
if (Player* player = unit->ToPlayer())
{
player->GiveLevel(newlevel);
player->InitTalentForLevel();
player->SetUInt32Value(PLAYER_XP, 0);
}
else
unit->SetLevel(newlevel);
return 0;
}