-
Total de itens
446 -
Registro em
-
Última visita
-
Dias Ganhos
31
Tudo que Tony Araujo postou
-
pOnlines() <-- Checa os players online.
um tópico no fórum postou Tony Araujo Mods, funções e outros
Olá galera, eu estava jogando um servidor, e reparei um sistema bem legal.. Ele mostrava no comando !online , os players e seus leveis. bom , criei uma funçao que voce pode colocar em qualquer lugar que voce quizer. Basta por nas scripts a funçao pOnlines() Bom, ai vai a funçao. (LIB) -- OrochiElf -- function pOnlines() p = getPlayersOnline() for _, i in ipairs(p) do pn = getCreatureName(i) lv = getPlayerLevel(i) doShowTextDialog(cid, 2160, ""..pn.." ["..lv.."]\n") end return true end Espero que seja util . -
--º OrochiElf º-- Função testada na versao TFS 0.3.6pl1 Essa funçao é capaz de setar e remover uma magic level em tempo real, sem precisar relogar para ter resultados. Bom , vamos iniciar a instalaçao , vá em LUASCRIPT.CPP e procure por //doPlayerSetMaxCapacity(cid, cap) lua_register(m_luaState, "doPlayerSetMaxCapacity", LuaScriptInterface::luaDoPlayerSetMaxCapacity); Abaixo adicione : //doPlayerSetMagicLevel(cid, value) lua_register(m_luaState, "doPlayerSetMagicLevel", LuaScriptInterface::luaDoPlayerSetMagicLevel); Procure por int32_t LuaScriptInterface::luaDoPlayerSetMaxCapacity(lua_State* L) { //doPlayerSetMaxCapacity(uid, cap) double cap = popFloatNumber(L); ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) { player->setCapacity(cap); lua_pushboolean(L, true); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } e abaixo adicione int32_t LuaScriptInterface::luaDoPlayerSetMagicLevel(lua_State* L) { //doPlayerSetMagicLevel(uid, value) uint64_t value = popNumber(L); ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) { player->setMagicLevel(value); lua_pushboolean(L, true); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } Agora vá em LUASCRIPT.H e procure por static int32_t luaDoPlayerSetMaxCapacity(lua_State* L); e abaixo adicione static int32_t luaDoPlayerSetMagicLevel(lua_State* L); Agora vá em PLAYER.CPP e procure por void Player::addExperience(uint64_t exp) { uint32_t prevLevel = level; uint64_t nextLevelExp = Player::getExpForLevel(level + 1); if(Player::getExpForLevel(level) > nextLevelExp) { //player has reached max level levelPercent = 0; sendStats(); return; } experience += exp; while(experience >= nextLevelExp) { healthMax += vocation->getGain(GAIN_HEALTH); health += vocation->getGain(GAIN_HEALTH); manaMax += vocation->getGain(GAIN_MANA); mana += vocation->getGain(GAIN_MANA); capacity += vocation->getGainCap(); ++level; nextLevelExp = Player::getExpForLevel(level + 1); if(Player::getExpForLevel(level) > nextLevelExp) //player has reached max level break; } if(prevLevel != level) { updateBaseSpeed(); setBaseSpeed(getBaseSpeed()); g_game.changeSpeed(this, 0); g_game.addCreatureHealth(this); if(getParty()) getParty()->updateSharedExperience(); char advMsg[60]; sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level); sendTextMessage(MSG_EVENT_ADVANCE, advMsg); CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE); for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it) (*it)->executeAdvance(this, SKILL__LEVEL, prevLevel, level); } uint64_t currLevelExp = Player::getExpForLevel(level); nextLevelExp = Player::getExpForLevel(level + 1); levelPercent = 0; if(nextLevelExp > currLevelExp) levelPercent = Player::getPercentLevel(experience - currLevelExp, nextLevelExp - currLevelExp); sendStats(); } E abaixo adicione void Player::setMagicLevel(uint64_t value) { uint64_t old_level = magLevel; magLevel = value; manaSpent = 0; magLevelPercent = 0; CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE); for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it) (*it)->executeAdvance(this, SKILL__MAGLEVEL, old_level, magLevel); sendStats(); } Agora pra finalizar vá em PLAYER.H e procure por virtual int32_t getArmor() const; E "ACIMA" voce adiciona void setSkillLevel(skills_t skill, uint32_t value); ---------------------------------------------------------------- Como usar? doPlayerSetMagicLevel(cid, 10) -- Adiciona 10 pontos de ml doPlayerSetMagicLevel(cid, -10) -- Remove 10 pontos de ml Espero que façam bom uso :3
-
doPlayerSetSkillLevel(cid, skillid, value)
um tópico no fórum postou Tony Araujo Linguagens de Programação
--º By: OrochiElf º-- Função testada na versao TFS 0.3.6pl1 Essa funçao como diz o titulo , adiciona direto os pontos de SKILLS, com o ID escolhidlo. sem precisar "RELOGAR", para atulizar o SQL. Bom ,então vamos começar a instalar. Primeiro vá em LUASCRIPT.CPP, e procure por //doSendAnimatedText(pos, text, color[, player]) lua_register(m_luaState, "doSendAnimatedText", LuaScriptInterface::luaDoSendAnimatedText); E logo abaixo adicione //doPlayerSetSkillLevel(cid, skill, value) /* new */ lua_register(m_luaState, "doPlayerSetSkillLevel", LuaScriptInterface::luaDoPlayerSetSkillLevel); Procure por int32_t LuaScriptInterface::luaDoSendDistanceShoot(lua_State* L) { //doSendDistanceShoot(fromPos, toPos, type[, player]) ScriptEnviroment* env = getEnv(); SpectatorVec list; if(lua_gettop(L) > 3) { if(Creature* creature = env->getCreatureByUID(popNumber(L))) list.push_back(creature); } uint32_t type = popNumber(L); PositionEx toPos, fromPos; popPosition(L, toPos); popPosition(L, fromPos); if(fromPos.x == 0xFFFF) fromPos = env->getRealPos(); if(toPos.x == 0xFFFF) toPos = env->getRealPos(); if(!list.empty()) g_game.addDistanceEffect(list, fromPos, toPos, type); else g_game.addDistanceEffect(fromPos, toPos, type); lua_pushboolean(L, true); return 1; } E abaixo adicione int32_t LuaScriptInterface::luaDoPlayerSetSkillLevel(lua_State* L) { //doPlayerSetSkillLevel(uid, skill, value) uint32_t value = popNumber(L); int32_t skill = popNumber(L); ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) { player->setSkillLevel((skills_t) skill, value); lua_pushboolean(L, true); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } Agora vá em LUASCRIPT.H e procure por static int32_t luaDoCreatureSay(lua_State* L); e abaixo adicione static int32_t luaDoPlayerSetSkillLevel(lua_State* L); agora vá em player.cpp e procure por uint64_t nextReqMana = vocation->getReqMana(magLevel + 1); if(!magLevel) { if (amount > manaSpent) amount = manaSpent; magLevel = 0; manaSpent -= amount; amount = 0; } bool downgrade = false; while(amount > manaSpent) { amount -= manaSpent + 1; magLevel--; nextReqMana = vocation->getReqMana(magLevel + 1); manaSpent = nextReqMana > 0 ? nextReqMana - 1 : nextReqMana; magLevelPercent = 0; char advMsg[50]; sprintf(advMsg, "You downgraded to magic level %d.", magLevel); sendTextMessage(MSG_EVENT_ADVANCE, advMsg); downgrade = true; CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE); for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it) (*it)->executeAdvance(this, SKILL__MAGLEVEL, (magLevel + 1), magLevel); if (!magLevel) { if (amount > manaSpent) amount = manaSpent; magLevel = 0; manaSpent -= amount; amount = 0; break; } } if(amount) manaSpent -= amount; nextReqMana = vocation->getReqMana(magLevel + 1); uint32_t newPercent = Player::getPercentLevel(manaSpent, nextReqMana); if(magLevelPercent != newPercent) { magLevelPercent = newPercent; sendStats(); } else if(downgrade) sendStats(); } E abaixo adicione void Player::setSkillLevel(skills_t skill, uint32_t value) { uint32_t old_level = skills[skill][SKILL_LEVEL]; skills[skill][SKILL_LEVEL] = value; skills[skill][SKILL_TRIES] = 0; skills[skill][SKILL_PERCENT] = 0; CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE); for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it) (*it)->executeAdvance(this, skill, old_level, skills[skill][SKILL_LEVEL]); sendSkills(); } Para finalizar vá em PLAYER.H e procure por bool addUnjustifiedKill(const Player* attacked); E abaixo adicione void setSkillLevel(skills_t skill, uint32_t value); ------------------------------------------------------------------------------------------------------- Exemplo de uso function onUse(cid) if isPlayer(cid) then doPlayerAddSkillTry(cid, 0, 10) -- Isso adicionaria 10 pontos de skill. end return true end -
doPlayerRemoveSkillTry(cid, skillid, n[useMultiplier])
um tópico no fórum postou Tony Araujo Linguagens de Programação
---º BY: OROCHIELF º---- Olá galera, hoje eu vou postar uma funçao de C++, que serve para remover SKILLS. em tempo real , sem precisar "RELOGAR" para atualizar SQL. Então vamos começar as instalaçoes. Função testada na versao TFS 0.3.6pl1 1º Passo. Vá em LUASCRIPT.CPP, procure por //doPlayerAddSkillTry(cid, skillid, n[, useMultiplier]) lua_register(m_luaState, "doPlayerAddSkillTry", LuaScriptInterface::luaDoPlayerAddSkillTry); Adicione abaixo //doPlayerRemoveSkillTry(cid, skillid, n[, useMultiplier]) lua_register(m_luaState, "doPlayerRemoveSkillTry", LuaScriptInterface::luaDoPlayerRemoveSkillTry); Procure por int32_t LuaScriptInterface::luaDoPlayerAddSkillTry(lua_State* L) { //doPlayerAddSkillTry(uid, skillid, n[, useMultiplier]) bool multiplier = true; if(lua_gettop(L) > 3) multiplier = popNumber(L); uint32_t n = popNumber(L), skillid = popNumber(L); ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) { player->addSkillAdvance((skills_t)skillid, n, multiplier); lua_pushboolean(L, true); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } E abaixo adicione : int32_t LuaScriptInterface::luaDoPlayerRemoveSkillTry(lua_State* L) { //doPlayerRemoveSkillTry(uid, skillid, n[, useMultiplier]) bool multiplier = true; if(lua_gettop(L) > 3) multiplier = popNumber(L); int32_t n = popNumber(L), skillid = popNumber(L); ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) { player->removeSkillAdvance((skills_t)skillid, n, multiplier); lua_pushboolean(L, true); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } Agora vá em LUASCRIPT.H, e procure por : static int32_t luaDoPlayerAddSkillTry(lua_State* L); E abaixo adicione : static int32_t luaDoPlayerRemoveSkillTry(lua_State* L); Agora vá em Player.CPP e procure por void Player::addManaSpent(uint64_t amount, bool useMultiplier/* = true*/) { if(!amount) return; uint64_t currReqMana = vocation->getReqMana(magLevel), nextReqMana = vocation->getReqMana(magLevel + 1); if(currReqMana > nextReqMana) //player has reached max magic level return; if(useMultiplier) amount = uint64_t((double)amount * rates[sKILL__MAGLEVEL] * g_config.getDouble(ConfigManager::RATE_MAGIC)); bool advance = false; while(manaSpent + amount >= nextReqMana) { amount -= nextReqMana - manaSpent; manaSpent = 0; magLevel++; char advMsg[50]; sprintf(advMsg, "You advanced to magic level %d.", magLevel); sendTextMessage(MSG_EVENT_ADVANCE, advMsg); advance = true; CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE); for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it) (*it)->executeAdvance(this, SKILL__MAGLEVEL, (magLevel - 1), magLevel); currReqMana = nextReqMana; nextReqMana = vocation->getReqMana(magLevel + 1); if(currReqMana > nextReqMana) { amount = 0; break; } } if(amount) manaSpent += amount; uint32_t newPercent = Player::getPercentLevel(manaSpent, nextReqMana); if(magLevelPercent != newPercent) { magLevelPercent = newPercent; sendStats(); } else if(advance) sendStats(); } E Abaixo Adicione : void Player::removeSkillAdvance(skills_t skill, uint32_t count, bool useMultiplier/* = true*/) { if(!count) return; if(useMultiplier) count = uint32_t((double)count * rates[skill] * g_config.getDouble(ConfigManager::RATE_SKILL)); uint32_t nextReqTries = vocation->getReqSkillTries(skill, skills[skill][sKILL_LEVEL] + 1); if(!skills[skill][sKILL_LEVEL]) { if (count > skills[skill][sKILL_TRIES]) count = skills[skill][sKILL_TRIES]; skills[skill][sKILL_LEVEL] = 0; skills[skill][sKILL_TRIES] -= count; count = 0; } std::stringstream s; while(count > skills[skill][sKILL_TRIES]) { count -= skills[skill][sKILL_TRIES] + 1; skills[skill][sKILL_LEVEL]--; nextReqTries = vocation->getReqSkillTries(skill, skills[skill][sKILL_LEVEL] + 1); skills[skill][sKILL_TRIES] = nextReqTries > 0 ? nextReqTries - 1 : nextReqTries; skills[skill][sKILL_PERCENT] = 0; s.str(""); s << "You downgraded in " << getSkillName(skill); if(g_config.getBool(ConfigManager::ADVANCING_SKILL_LEVEL)) s << " [" << skills[skill][sKILL_LEVEL] << "]"; s << "."; sendTextMessage(MSG_EVENT_ADVANCE, s.str().c_str()); CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE); for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it) (*it)->executeAdvance(this, skill, (skills[skill][sKILL_LEVEL] + 1), skills[skill][sKILL_LEVEL]); if (!skills[skill][sKILL_LEVEL]) { if (count > skills[skill][sKILL_TRIES]) count = skills[skill][sKILL_TRIES]; skills[skill][sKILL_LEVEL] = 0; skills[skill][sKILL_TRIES] -= count; count = 0; break; } } if(count) skills[skill][sKILL_TRIES] -= count; nextReqTries = vocation->getReqSkillTries(skill, skills[skill][sKILL_LEVEL] + 1); uint32_t newPercent = Player::getPercentLevel(skills[skill][sKILL_TRIES], nextReqTries); if(skills[skill][sKILL_PERCENT] != newPercent) { skills[skill][sKILL_PERCENT] = newPercent; sendSkills(); } else if(!s.str().empty()) sendSkills(); } Para finalizar , vá em PLAYER.H, e procure por : void addManaSpent(uint64_t amount, bool useMultiplier = true); E abaixo adicione void removeSkillAdvance(skills_t skill, uint32_t count, bool useMultiplier = true); --------------------------------------------------------------------------------------------------------- Exemplo de Uso : function onUse(cid) if isPlayer(cid) then doPlayerRemoveSkillTry(cid, 0, 10) -- Removeria 10 pontos de FIST return true end -
[PFG] Arton - Alternative Tibia Server [SHOW OFF]
tópico respondeu ao LuckinhaSan de Tony Araujo em Lixeira Pública
Fala ai galera, eu sou o Tony Plyson , atual adiministrador do Arton e progamador. em breve estaremos entrando em um Alpha Test Server. Tudo para agradar e obrigado pelos elogios ao Arton. abrçs.. -
Tah shoow miih <3 . \o/
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.