• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

premium soul

Solution
Haven't tested:
C++:
int32_t LuaInterface::luaDoPlayerSetMaxSoul(lua_State* L)
{
    //doPlayerSetMaxSoul(cid, maxSoul)
    uint32_t maxSoul = popNumber(L);

    ScriptEnviroment* env = getEnv();
    if(Player* player = env->getPlayerByUID(popNumber(L)));
    {
        player->soulMax = std::min((uint32_t)200, maxSoul);
        lua_pushboolean(L, true);
    }
    else
    {
        errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
        lua_pushboolean(L, false);
    }

    return 1;
}

C++:
int32_t LuaInterface::luaGetPlayerMaxSoul(lua_State* L)
{
    //getPlayerMaxSoul(cid)
    ScriptEnviroment* env = getEnv();

    const Player* player = env->getPlayerByUID(popNumber(L));
    if (player) {
        lua_pushnumber(L, player->soulMax))...
Promoted vocations have more soul by default, and require premium by default. Is that good enough? If not, you can always check the players premium status onLogin (creature event) and set their max soul accordingly.
 
Promoted vocations have more soul by default, and require premium by default. Is that good enough? If not, you can always check the players premium status onLogin (creature event) and set their max soul accordingly.
i set all in vocation.xml soul=100 but how i can add max soul 200 in loging ?
 
Just checked the github and it doesn't seem there is a way to set max soul. You will have to add it yourself I suppose :(.
 
Haven't tested:
C++:
int32_t LuaInterface::luaDoPlayerSetMaxSoul(lua_State* L)
{
    //doPlayerSetMaxSoul(cid, maxSoul)
    uint32_t maxSoul = popNumber(L);

    ScriptEnviroment* env = getEnv();
    if(Player* player = env->getPlayerByUID(popNumber(L)));
    {
        player->soulMax = std::min((uint32_t)200, maxSoul);
        lua_pushboolean(L, true);
    }
    else
    {
        errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
        lua_pushboolean(L, false);
    }

    return 1;
}

C++:
int32_t LuaInterface::luaGetPlayerMaxSoul(lua_State* L)
{
    //getPlayerMaxSoul(cid)
    ScriptEnviroment* env = getEnv();

    const Player* player = env->getPlayerByUID(popNumber(L));
    if (player) {
        lua_pushnumber(L, player->soulMax));
    }
    else {
        errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
        lua_pushboolean(L, false);
    }

    return 1;
}

Then you can add in login script:
Lua:
if getPlayerPremiumDays(cid) ~= 0 then
    if getPlayerMaxSoul(cid) ~= 200 then
        doPlayerSetMaxSoul(cid, 200)
        doPlayerAddSoul(cid, getPlayerSoul(cid) + 100)
    end
else
    if getPlayerMaxSoul(cid) ~= 100 then
        doPlayerSetMaxSoul(cid, 100)
        doPlayerAddSoul(cid, -math.min(0, -(getPlayerSoul(cid) - 100)))
    end
end
 
Last edited:
Solution
34722
Haven't tested:
C++:
int32_t LuaInterface::luaDoPlayerSetMaxSoul(lua_State* L)
{
    //doPlayerSetMaxSoul(cid, maxSoul)
    uint32_t maxSoul = popNumber(L);

    ScriptEnviroment* env = getEnv();
    if(Player* player = env->getPlayerByUID(popNumber(L)))
    {
        player->soulMax = std::min((uint32_t)200, maxSoul);
        lua_pushboolean(L, true);
    }
    else
    {
        errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
        lua_pushboolean(L, false);
    }

    return 1;
}

C++:
int32_t LuaInterface::luaGetPlayerMaxSoul(lua_State* L)
{
    //getPlayerMaxSoul(cid)
    ScriptEnviroment* env = getEnv();

    const Player* player = env->getPlayerByUID(popNumber(L))
    if (player) {
        lua_pushnumber(L, player->soulMax));
    }
    else {
        errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
        lua_pushboolean(L, false);
    }

    return 1;
}

Then you can add in login script:
Lua:
if getPlayerPremiumDays(cid) ~= 0 then
    if getPlayerMaxSoul(cid) ~= 200 then
        doPlayerSetMaxSoul(cid, 200)
        doPlayerAddSoul(cid, getPlayerSoul(cid) + 100)
    end
else
    if getPlayerMaxSoul(cid) ~= 100 then
        doPlayerSetMaxSoul(cid, 100)
        doPlayerAddSoul(cid, -math.min(0, -(getPlayerSoul(cid) - 100)))
    end
end
 
Code:
int32_t LuaInterface::luaGetPlayerMaxSoul(lua_State* L)
{
    //getPlayerMaxSoul(cid)
    ScriptEnviroment* env = getEnv();
if(const Player* player = env->getPlayerByUID(popNumber(L)))
        lua_pushnumber(L, player->soulMax);
    else
    {
        errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
        lua_pushboolean(L, false);
    }

    return 1;
}
 
Back
Top