Solutions
-
Elwyn's post in (Resolvido)[Problema] creaturescript/login.lua was marked as the answer
-
Elwyn's post in (Resolvido)Tile que enxe stamina was marked as the answereventsId = {} local function rechargeStamina(cid) if not isPlayer(cid) then eventsId[cid] = nil return end doPlayerSetStamina(cid, getPlayerStamina(cid) + 1) eventsId[cid] = addEvent(rechargeStamina, 60 * 1000, cid) end function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if isPlayer(cid) then eventsId[cid] = addEvent(rechargeStamina, 60 * 1000, cid) end return true end function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor) if isPlayer(cid) then stopEvent(eventsId[cid]) eventsId[cid] = nil end return true end
Agora ele só adicionará a cada minuto.
-
Elwyn's post in (Resolvido)Duvida Shared Exp was marked as the answerVeja em party.cpp na função onShareExperience
-
Elwyn's post in (Resolvido)math.random was marked as the answerif getPlayerStorageValue(cid, 3509) > 0 then math.randomseed(os.time()) local rand = math.random(1,45) if rand == 1 then doPlayerAddItem(cid, 2488, 1) -- Crown Legs doSendMagicEffect(getPlayerPosition(cid), 12) end end
-
Elwyn's post in (Resolvido)[Pedido] Não usar mount com certo outfit was marked as the answerVocê tem a source, certo?
Veja em creaturescripts.cpp ou creatureevents.cpp e procure por onDeath, vai ter junto de onDeath outras callbacks. Copie todas elas aqui.
Crie o hábito de procurar como funciona tal coisa no OT, mesmo que você não entenda muito de programação. Leia o básico de Lua e C++ e procure terra firme, se não você vai ficar perdido (por mais de 2 semanas) sempre que tiver uma dúvida.
-
Elwyn's post in (Resolvido)[AJUDA] Spell de imortalidade tfs 1.0 was marked as the answerCopia exatamente desse jeito:
local condition = Condition(CONDITION_ATTRIBUTES) condition:setParameter(CONDITION_PARAM_TICKS, 10000) condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setCondition(condition) function onCastSpell(creature, var) creature:registerEvent("CustomSpell") local cid = creature:getId() addEvent( function() local player = Player(cid) if player then player:unregisterEvent("CustomSpell") end end, 10*1000 ) return combat:execute(creature, var) end
Acabei de testar no TFS 1.0, deveria estar funcionando corretamente. Tem certeza que está usando o script que eu postei?
-
Elwyn's post in (Resolvido)[Duvida] Como funciona o exp? was marked as the answerSão números quebrados, toda a iteração com exp do player foi feita pensando em números inteiros então não recomendo usar essa fórmula, mas ficaria assim:
static uint64_t getExpForLevel(int32_t lv) { lv--; return static_cast<uint64_t>(std::ceil(std::pow(1.6180339, lv) - std::pow(-0.6180339, lv))/std::sqrt(5)); } Esse cálculo tem bastante arredondamento. Dois na potencia, outro no resultado da subtração, outro no resultado da raiz de 5, outro no resultado da divisão e outro para dar cast de double para uint64_t
-
Elwyn's post in (Resolvido)ip change 10.41 para linux was marked as the answerhttps://github.com/gugahoa/ipchanger-otbr
Você vai precisar de python 3.4 e python-ptrace, que pode ser instalado usando pip3.
Se você usa Ubuntu então python3.4 e pip3 já vem instalado, pra instalar python-ptrace é só executar:
$ sudo pip3 install python-ptrace
Baixe o cliente para Linux, depois usando o terminal vá até a pasta do repositório e execute:
$ python3.4 main.py
Depois é só alterar o ip e dar "Change Ip". Esse ip-changer funciona para todas versões existentes de Tibia, apesar que ele não altera a porta para outra além de 7171.
-
Elwyn's post in (Resolvido)HELP NPC was marked as the answerlocal keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) if msgcontains(msg, "help") then if npcHandler.topic[cid] == 0 then npcHandler.topic[cid] = 1 npcHandler:say("Yeah yeah, you can help me actually. You know, I feel some bad vibes coming out of the earth, recently. I think there's something wrong with the creatures of the deep. Care to join me?", cid) else npcHandler:say('I don\'t know what you are talking about.', cid) end elseif msgcontains(msg, 'yes') then if npcHandler.topic[cid] == 1 then npcHandler.topic[cid] = 2 npcHandler:say({ 'Great, great. There is something going on, you know? I can feel it in my bones. There really are some bad spirits down there. ...', 'See, a long time ago I acquired these nets. They are called soul nets. Do you know what they can do? Neither do I. ...', 'What I know is they vibrate when evil is near. Yeah, vibration man. ...', 'They also let evil glow in a deep red. Glowing red stuff. So next time you go down there, just take one with you and when you find evil spirits - catch them with the net. ...', 'They will vanish in an instant. But - you will have to take care that all bad spirits in the near vicinity vanish almost instantaneously or they will regenerate. ...', 'So you might need some help down there, my friend. Ready to do this?' }, cid) elseif npcHandler.topic[cid] == 2 and player:getStorageValue(15433) ~= 1 then player:setStorageValue(15433, 1) player:addItem(15433, 1) npcHandler:say("Good, I hope this will help you keeping the spirits away.", cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:setMessage(MESSAGE_GREET, "Hi there |PLAYERNAME|, and welcome to the gray island.") npcHandler:setMessage(MESSAGE_FAREWELL, "See you, |PLAYERNAME|.") npcHandler:setMessage(MESSAGE_WALKAWAY, "See you, |PLAYERNAME|.") npcHandler:addModule(FocusModule:new())
Você tinha dois elseifs iguais, então o segundo nunca era checado na prática.
-
Elwyn's post in (Resolvido)IPChanger - Ptrace was marked as the answerResolvido. A versão correta estava em outra parte da memória. O executável fica em duas partes da memória, creio que um seja o esqueleto e outro seja o corpo atual do programa.
08048000-0841f000 r-xp 00000000 08:04 9438516 /home/gugah/devel/cpp/tibia/tibia-client/860/Tibia 0841f000-08420000 rw-p 003d7000 08:04 9438516 /home/gugah/devel/cpp/tibia/tibia-client/860/Tibia
Em 0841f000-08420000 fica o corpo do programa depois de substituir todos %s e %d se eu estiver correto.
Um pequeno programa em python mostrando o funcionamento:
import ptrace import os import binascii process = os.popen("pidof -s Tibia") pid = process.readlines() pid = int(pid[0]) print pid ptrace.attach(pid) base_addr = 0x841f000 data = ptrace.peekdata(pid, base_addr + 0x9213 + 8) data = hex(data) data = binascii.unhexlify(data[2:]) data = ''.join(reversed(data)) data = data[:4] print data ptrace.detach(pid, 18) -
Elwyn's post in (Resolvido)[AJUDA] PROBLEMA COM NPCS [tfs 1.0] was marked as the answerhttps://gist.github.com/gugahoa/be77c5d37cd6e8f96a3c
Se quiser eu coloco o código aqui.
O player vai receber o aviso de "You don't have enought capacity." enquanto estiver com exhaust. Eu botei o exhaust para durar 1s, se quiser por mais é só alterar em:
Player(cid):setStorageValue(11002, os.time() + 1)
Você está usando isso porque comprar muito item com container em pouco tempo trava o servidor? Se sim, talvez eu tenha uma solução melhor.