Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int32_t LuaScriptInterface::luaSetCombatFormula(lua_State* L)
- {
- //setCombatFormula(combat, type, mina, minb, maxa, maxb[, minl, maxl[, minm, maxm[, minc[, maxc]]]])
- ScriptEnviroment* env = getEnv();
- if(env->getScriptId() != EVENT_ID_LOADING)
- {
- errorEx("This function can only be used while loading the script.");
- lua_pushboolean(L, false);
- return 1;
- }
- int32_t params = lua_gettop(L), minc = 0, maxc = 0;
- if(params > 11)
- maxc = popNumber(L);
- if(params > 10)
- minc = popNumber(L);
- double minm = g_config.getDouble(ConfigManager::FORMULA_MAGIC), maxm = minm,
- minl = g_config.getDouble(ConfigManager::FORMULA_LEVEL), maxl = minl;
- if(params > 8)
- {
- maxm = popFloatNumber(L);
- minm = popFloatNumber(L);
- }
- if(params > 6)
- {
- maxl = popFloatNumber(L);
- minl = popFloatNumber(L);
- }
- double maxb = popFloatNumber(L), maxa = popFloatNumber(L),
- minb = popFloatNumber(L), mina = popFloatNumber(L);
- formulaType_t type = (formulaType_t)popNumber(L);
- if(Combat* combat = env->getCombatObject(popNumber(L)))
- {
- combat->setPlayerCombatValues(type, mina, minb, maxa, maxb, minl, maxl, minm, maxm, minc, maxc);
- lua_pushboolean(L, true);
- }
- else
- {
- errorEx(getError(LUA_ERROR_COMBAT_NOT_FOUND));
- lua_pushboolean(L, false);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement