Ir para conteúdo

Holograma

Artesão
  • Total de itens

    103
  • Registro em

  • Última visita

  • Dias Ganhos

    8

Posts postados por Holograma

  1. 1.Coloque a pasta game_task na pasta mods do seu cliente OTClient.
    2.No seu servidor, adicione ou edite o arquivo mods.xml para carregar o módulo de task. Adicione o seguinte código dentro das tags <mods>:
     

    <mod name="game_task"/>

     

  2. 1.Abra o Elfbot e vá para a seção de Hotkeys.
    2.Clique em "Adicionar" para criar uma nova hotkey.
    3.Selecione a tecla que você deseja atribuir à sua nova hotkey.
    4.Na parte inferior da janela, você verá uma área chamada "Script". Aqui você pode escrever o script para sua hotkey.
     

    local creatures = getCreatures()
    for i, creature in ipairs(creatures) do
        if creature.name == "NomeDoSeuPet" then
            useitemoncreature(creature.id, "NomeDoItem")
            break
        end
    end

    Neste script, você precisa substituir "NomeDoSeuPet" pelo nome do seu pet (o nome do seu Pokémon) e "NomeDoItem" pelo nome do item que você deseja usar no seu pet.

    Por exemplo, se você quiser usar uma poção de cura no seu pet chamado "Charmander", e suponha que a poção de cura tenha o nome "Health Potion", o script seria assim:

    local creatures = getCreatures()
    for i, creature in ipairs(creatures) do
        if creature.name == "Charmander" then
            useitemoncreature(creature.id, "Health Potion")
            break
        end
    end

    Assim, quando você pressionar a hotkey associada a este script, ele usará a "Health Potion" em seu pet "Charmander".

    Após escrever o script, clique em "Salvar" para salvar a hotkey. Certifique-se de testar a hotkey para garantir que ela funcione conforme esperado.

  3. function onUse(cid, item, fromPosition, itemEx, toPosition)
        local petName = "[PET] NIVEL MAXIMO"
        local storageValue = 83712
        local playerPets = getCreatureSummons(cid)
    
        -- Verifica se o jogador já tem um pet invocado
        if #playerPets <= 0 then
            -- Se não houver pet invocado, invoca um novo
            local newPet = doSummonMonster(cid, petName)
            if newPet then
                setPlayerStorageValue(cid, storageValue, 1)
            end
        else
            -- Se houver pet invocado, verifica se é o pet correto e remove-o
            for _, pet in ipairs(playerPets) do
                if getCreatureName(pet) == petName then
                    doRemoveCreature(pet)
                end
            end
        end
    
        -- Impede que o domador seja afetado pelo ataque em área
        registerCreatureEvent(cid, "Infriendlyfire")
    
        return true
    end



    alem disso, adicione: 
     

    <event type="infriendlyfire" name="Infriendlyfire" event="script" value="infriendlyfire.lua"/>


    e crie um .lua: 
     

    function onInfriendlyfire(cid, attacker, target)
        if isPlayer(attacker) and isPlayer(target) then
            return false -- Impede que jogadores causem dano uns aos outros
        end
        if isPlayer(attacker) and isSummon(target) then
            local master = getCreatureMaster(target)
            if master == attacker then
                return false -- Impede que o domador cause dano ao seu pet
            end
        end
        if isSummon(attacker) then
            local master = getCreatureMaster(attacker)
            if master == target then
                return false -- Impede que o pet cause dano ao seu domador
            end
        end
        return true
    end

     

  4. function onUse(cid, item, fromPosition, itemEx, toPosition)
        local petName = "[PET] NIVEL MAXIMO"
        local requiredStorage1 = 91811
        local requiredStorage2 = 13546
        local storageValue = 83712
        local playerPets = getCreatureSummons(cid)
    
        -- Verificar se o jogador possui as storages necessárias
        if getPlayerStorageValue(cid, requiredStorage1) == 1 and getPlayerStorageValue(cid, requiredStorage2) == 1 then
            -- Verificar se o jogador já possui um pet invocado
            if #playerPets <= 0 then
                -- Se nenhum pet estiver invocado, invocar um novo
                local newPet = doSummonMonster(cid, petName)
                if newPet then
                    setPlayerStorageValue(cid, storageValue, 1)
                end
            else
                -- Se um pet estiver invocado, verificar se é o pet correto e removê-lo
                for _, pet in ipairs(playerPets) do
                    if getCreatureName(pet) == petName then
                        doRemoveCreature(pet)
                    end
                end
            end
        else
            -- Se o jogador não possuir as storages necessárias, enviar uma mensagem de erro
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need both immortality storages to use this item.")
        end
        return true
    end

     

  5. acho que isso resolve:

     

    function onLogin(player)
        local spawnPosition = Position(100, 50, 7) -- Coordenadas do spawn
        local occupied = false
        
        -- Verifica se existe algum jogador na posição de spawn
        for _, otherPlayer in ipairs(Game.getPlayers()) do
            if otherPlayer:getPosition() == spawnPosition then
                occupied = true
                break
            end
        end
        
        -- Se a posição de spawn estiver ocupada, move o jogador para uma posição próxima
        if occupied then
            local newPosition = spawnPosition:getRandomTile(1) -- obtém uma posição aleatória adjacente
            player:teleportTo(newPosition)
        else
            player:teleportTo(spawnPosition)
        end
    end
    
    -- Registra o evento de login para chamar a função onLogin
    function onLoginEvent(player) 
        onLogin(player) 
    end

     

  6. Em 28/04/2024 em 08:40, Muvuka disse:
        experienceShareRadiusX = 65000
        experienceShareRadiusY = 65000
        experienceShareRadiusZ = 15
        experienceShareLevelDifference = 2 / 3
        extraPartyExperienceLimit = 99999
        extraPartyExperiencePercent = 100
        experienceShareActivity = 2 * 60 * 1000

    até aqui ta tudo ok, o erro ta vindo de outro lugar, varia um pouco de uma versao pra outra, mas alguns tebm a opçao em boolean e alguhns requisitos pra funcionar como: distância entre os jogadores], se a diferença de nível está dentro do limite e etc

  7. function onUse(cid, item, fromPosition, itemEx, toPosition)
        local name = "[PET] NIVEL MAXIMO"
        local pet = getCreatureSummons(cid)
        local storedPet = getCreatureSummons(cid, 83712)
    
        -- Se já existe um pet armazenado, remova-o
        if storedPet[1] then
            doRemoveCreature(storedPet[1])
        end
    
        -- Se não houver pet invocado, invoque um novo e armazene-o
        if #pet == 0 then
            local newPet = doSummonMonster(cid, name)
            setPlayerStorageValue(newPet, 83712, 1)
            return true
        end
    
        -- Se já houver um pet invocado, remova-o e invoque um novo, armazenando-o
        doRemoveCreature(pet[1])
        local newPet = doSummonMonster(cid, name)
        setPlayerStorageValue(newPet, 83712, 1)
    
        return true
    end

     

  8. O erro que você está vendo parece indicar que há uma tentativa de concatenar um valor nulo em algum lugar do seu código. Mais especificamente, o erro está na linha 26 do seu código, na função !character.
    Nessa linha, você está tentando verificar se o primeiro elemento da tabela t não é "buy", "sell", "remove", ou "list". Parece que há um erro de lógica aqui. O problema é que você está usando or em vez de and. Como resultado, essa condição sempre será verdadeira, porque t[1] não pode ser todas essas opções simultaneamente. Isso significa que o bloco de código abaixo dessa linha será sempre executado, mesmo quando t[1] for um desses valores, causando a tentativa de acessar um índice nulo em algum lugar.

     

    elseif not t[1] or (t[1] ~= "buy" and t[1] ~= "sell" and t[1] ~= "remove" and t[1] ~= "list") then

    Isso garantirá que a condição seja verdadeira apenas se t[1] não for nenhum desses valores. Isso deve resolver o problema de tentar concatenar um valor nulo.

  9. Se eu não estiver errado quando a gente utiliza atalhos do sistema operacional só é constado nos Logs do próprio SO e nao no servidor de jogo, por exemplo, no Linux, você pode verificar os logs do sistema em '/var/log' e no Windows varia um pouco conforme a versão (desorganizado pra variar), mas geralmente é em 'C:\Windows\System32\LogFiles' ou em Win+R e em seguida no arquivo eventvwr.msc.

  10. puts.. eu ja fui melhor..

     

    function sendMsgCountToItens(cid)
        local item1 = getPlayerStorageValue(cid, 251461):explode("|")
        
        -- Verificar se todos os itens foram entregues
        local allItemsDelivered = getPlayerItemCount(cid, item1[1]) >= tonumber(item1[3]) and
                                  getPlayerItemCount(cid, item1[2]) >= tonumber(item1[4]) and
                                  getPlayerItemCount(cid, item1[5]) >= tonumber(item1[7]) and
                                  getPlayerItemCount(cid, item1[6]) >= tonumber(item1[8])
        
        -- Se todos os itens foram entregues, definir a mensagem como vazia e remover o valor de armazenamento
        if allItemsDelivered then
            setPlayerStorageValue(cid, 251461, -1)
            return false
        end
        
        -- Caso contrário, calcular os valores de contagem dos itens
        local valor1 = math.max(0, tonumber(item1[3]) - getPlayerItemCount(cid, item1[1]))
        local valor2 = math.max(0, tonumber(item1[4]) - getPlayerItemCount(cid, item1[2]))
        local valor3 = math.max(0, tonumber(item1[7]) - getPlayerItemCount(cid, item1[5]))
        local valor4 = math.max(0, tonumber(item1[8]) - getPlayerItemCount(cid, item1[6]))
        
        -- Se a contagem atingir zero, remova o valor de armazenamento
        if valor1 == 0 and valor2 == 0 and valor3 == 0 and valor4 == 0 then
            setPlayerStorageValue(cid, 251461, -1)
        end
        
        -- Enviar mensagem com a contagem dos itens que faltam
        if valor1 > 0 or valor2 > 0 or valor3 > 0 or valor4 > 0 then
            selfSay("Ainda falta você me trazer os seguintes itens ["..valor1.."] "..getItemNameById(item1[1])..", ["..valor2.."] "..getItemNameById(item1[2])..", ["..valor3.."] "..getItemNameById(item1[5])..",  ["..valor4.."] "..getItemNameById(item1[6])..".", cid)        
        end
        
        return true
    end



    tenta assim por gentileza

  11. creio que em todo servidor tenha a função de pegar loot ja imbutida de forma global amigo, geralmente não é algo que é feito dentro de scripts locais visto que é algo muito usado..

     

    -- Função para obter o contêiner pai de um item
    function getContainerParent(container)
        local items = getContainerItems(container)
        if items then
            for i = 1, #items do
                local item = items[i]
                if item.uid ~= container then
                    return container
                end
            end
        end
        return 0
    end
    
    -- Função para adicionar o loot em uma das bags disponíveis
    function addToAvailableBags(loot, player)
        local playerSlotItem = getPlayerSlotItem(player, 3) -- Obtém a mochila do jogador
        local mainBag = playerSlotItem.uid -- UID da mochila principal
    
        -- Verifica se há espaço na mochila principal
        local freeSlotsMainBag = getContainerSlotsFree(mainBag)
        if freeSlotsMainBag >= 1 and freeSlotsMainBag ~= 333 then
            -- Adiciona o loot na mochila principal
            doCorpseAddLoot(getCreatureName(loot), mainBag, player, loot, loot)
            return true -- Retorna true para indicar que o loot foi adicionado com sucesso
        else
            -- Se não houver espaço na mochila principal, envia uma mensagem ao jogador
            player:sendTextMessage(MESSAGE_INFO_DESCR, "Não há espaço disponível na mochila principal para coletar o loot.") 
            return false -- Retorna false para indicar que o loot não foi adicionado
        end
    end
    
    -- Tenta adicionar o loot na mochila principal
    addToAvailableBags(target, getCreatureMaster(cid))

     

  12. é muito provavel que as mensagens que sao enviadas posteriormente estejam fora da classe de estilização.. o idela seria abrir o seu navegador da web e acessar a página onde as novas mensagens são exibidas, clicar em especionar e ver a classe que tem na mensagem a antiga que nao existe na nova

  13. da sim, se eu nao to errado fica no arquivo const.h, procure por constantes que possam estar relacionadas ao limite de shooteffects. Você pode procurar por palavras-chave como SHOOT_EFFECTS, MISSILES, MAX_MISSILES, ou algo similar.
    Se você encontrar uma constante que parece definir o limite de shooteffects, você pode modificá-la para aumentar o limite. Por exemplo, se você encontrar algo como #define MAX_MISSILES 41, você pode alterar o valor 41 para o novo limite desejado.

  14. qual função do seu servidor adicina loot na bag e os parametros dela? deixei pra tu adaptar com comentarios no script dq deve ser alterado:

     

    -- Função para obter o contêiner pai de um item
    function getContainerParent(container)
        local items = getContainerItems(container)
        if items then
            for i = 1, #items do
                local item = items[i]
                if item.uid ~= container then
                    return container
                end
            end
        end
        return 0
    end
    
    -- Função para adicionar o loot em uma das bags disponíveis
    function addToAvailableBags(loot, player)
        local playerSlotItem = getPlayerSlotItem(player, 3) -- Obtém a mochila do jogador
        local bags = {} -- Lista para armazenar as bags disponíveis
    
        -- Adiciona a mochila do jogador à lista de bags
        table.insert(bags, playerSlotItem.uid)
    
        -- Verifica se a mochila do jogador está dentro de outra bag
        local container = playerSlotItem.uid
        while container ~= 0 do
            container = getContainerParent(container)
            if container ~= 0 then
                table.insert(bags, container) -- Adiciona a bag à lista de bags
            end
        end
    
        -- Tenta adicionar o loot em cada bag disponível
        for _, bag in ipairs(bags) do
            local freeSlots = getContainerSlotsFree(bag)
            if freeSlots >= 1 and freeSlots ~= 333 then
                -- Aqui você deve substituir 'doCorpseAddLoot' pela função adequada para adicionar loot na bag
                -- Certifique-se de que a função esteja corretamente definida e acessível no contexto do seu script
                -- doCorpseAddLoot(getCreatureName(loot), bag, player, loot, loot) -- Adiciona o loot na bag
                return true -- Retorna true para indicar que o loot foi adicionado com sucesso
            end
        end
    
        return false -- Retorna false se não foi possível adicionar o loot em nenhuma bag
    end
    
    -- Verifica se o jogador é premium e está usando o auto loot
    if isPremium(getCreatureMaster(cid)) and isCollectAll(getCreatureMaster(cid)) then
        -- Tenta adicionar o loot em uma das bags disponíveis
        if not addToAvailableBags(target, getCreatureMaster(cid)) then
            -- Aqui você deve substituir 'doCorpseAddLoot' pela função adequada para adicionar loot na bag
            -- Certifique-se de que a função esteja corretamente definida e acessível no contexto do seu script
            -- doCorpseAddLoot(getCreatureName(target), corpse, getCreatureMaster(cid), target, corpse) -- Adiciona o loot na bag original se não houver outras disponíveis
        end
    else
        -- Aqui você deve substituir 'doCorpseAddLoot' pela função adequada para adicionar loot na bag
        -- Certifique-se de que a função esteja corretamente definida e acessível no contexto do seu script
        -- doCorpseAddLoot(getCreatureName(target), corpse, getCreatureMaster(cid), target, corpse) -- Adiciona o loot na bag original se o jogador não for premium ou não estiver usando o auto loot
    end

     

  15. Isso pode acontecer se a função não estiver disponível no arquivo de biblioteca onde está o seu script.
    Vamos tentar fazer isso localmente:
     

    -- Função para obter o contêiner pai de um item
    function getContainerParent(container)
        local items = getContainerItems(container)
        if items then
            for i = 1, #items do
                local item = items[i]
                if isInContainer(item.uid) then
                    return container
                end
            end
        end
        return 0
    end
    
    -- Função para adicionar o loot em uma das bags disponíveis
    function addToAvailableBags(loot, player)
        local playerSlotItem = getPlayerSlotItem(player, 3) -- Obtém a mochila do jogador
        local bags = {} -- Lista para armazenar as bags disponíveis
    
        -- Adiciona a mochila do jogador à lista de bags
        table.insert(bags, playerSlotItem.uid)
    
        -- Verifica se a mochila do jogador está dentro de outra bag
        local container = playerSlotItem.uid
        while container ~= 0 do
            container = getContainerParent(container)
            if container ~= 0 then
                table.insert(bags, container) -- Adiciona a bag à lista de bags
            end
        end
    
        -- Tenta adicionar o loot em cada bag disponível
        for _, bag in ipairs(bags) do
            local freeSlots = getContainerSlotsFree(bag)
            if freeSlots >= 1 and freeSlots ~= 333 then
                doCorpseAddLoot(getCreatureName(loot), bag, player, loot, loot) -- Adiciona o loot na bag
                return true -- Retorna true para indicar que o loot foi adicionado com sucesso
            end
        end
    
        return false -- Retorna false se não foi possível adicionar o loot em nenhuma bag
    end
    
    -- Verifica se o jogador é premium e está usando o auto loot
    if isPremium(getCreatureMaster(cid)) and isCollectAll(getCreatureMaster(cid)) then
        -- Tenta adicionar o loot em uma das bags disponíveis
        if not addToAvailableBags(target, getCreatureMaster(cid)) then
            doCorpseAddLoot(getCreatureName(target), corpse, getCreatureMaster(cid), target, corpse) -- Adiciona o loot na bag original se não houver outras disponíveis
        end
    else
        doCorpseAddLoot(getCreatureName(target), corpse, getCreatureMaster(cid), target, corpse) -- Adiciona o loot na bag original se o jogador não for premium ou não estiver usando o auto loot
    end



     

  16. Esse erro geralmente indica que o cliente está recebendo um pacote (mensagem) do servidor com um código de operação (opcode) não reconhecido ou não suportado. Isso pode acontecer se você tentar enviar dados personalizados do servidor para o cliente que o cliente não sabe como processar.

    Se você puder fornecer mais detalhes sobre as alterações específicas que você fez no servidor e no cliente para aumentar o "miss" e como elas estão sendo comunicadas entre si, posso ajudar a identificar a causa específica do erro e sugerir possíveis soluções.

  17. function checkDam(uid, AurAz, st)
        if (isCreature(uid)) and (os.time() - st < L_Soul.auras[AurAz].duration) then
            local p = getThingPos(uid)
            local poz = {
                {x = p.x, y = p.y - 2, z = p.z},
                {x = p.x - 2, y = p.y, z = p.z},
                {x = p.x, y = p.y + 2, z = p.z},
                {x = p.x + 2, y = p.y, z = p.z}
            }
    
            -- Verifica se a tile está protegida
            if (getTileInfo(p).protection) then
                st = st - L_Soul.auras[AurAz].duration
            end
    
            local function getBest(a)
                local pz = poz[1]
                for i, v in pairs(poz) do
                    if (getDistanceBetween(v, getThingPos(a)) < getDistanceBetween(pz, getThingPos(a))) then
                        pz = v
                    end
                end
                return pz
            end
    
            local creat = getUidsInArea({x = p.x - L_Soul.auras[AurAz].raio, y = p.y - L_Soul.auras[AurAz].raio, z = p.z}, {x = p.x + L_Soul.auras[AurAz].raio, y = p.y + L_Soul.auras[AurAz].raio, z = p.z})
            local target = ((isCreature(getCreatureTarget(uid))) and getCreatureTarget(uid)) or 0
    
            local cs = {}
            if (target == 0) then
                for _, v in pairs(creat) do
                    -- Verifica se a criatura é um monstro ou se tem um alvo válido
                    if ((getCreatureTarget(v) == uid) or (isMonster(v) or ((getCreatureSkullType(v) > 2) and (getCreatureTarget(v) == uid))) and (v ~= uid)) then
                        table.insert(cs, v)
                    end
                end
                target = (#cs > 0 and cs[math.random(#cs)]) or 0
            end
    
            -- Verifica se o ataque foi feito pelo jogador
            if (isPlayer(uid)) then
                target = uid
            end
    
            if (target ~= 0) then
                doSendDistanceShoot(getBest(target), getThingPos(target), L_Soul.souls[AurAz].effects.distance)
                doTargetCombatHealth(uid, target, L_Soul.souls[AurAz].combat, -L_Soul.auras[AurAz].damage[1], -L_Soul.auras[AurAz].damage[2], 255)
            end
    
            addEvent(checkDam, L_Soul.auras[AurAz].interval, uid, AurAz, st)
        end
    end
    
    function sendEffect(uid, interval, at, st, AurAz)
        local at = at or 1
    
        if (isCreature(uid)) then
            local p = getThingPos(uid)
    
            if (getTileInfo(p).protection) then
                st = st - L_Soul.auras[AurAz].duration
            end
    
            local poz = {
                {x = p.x, y = p.y - 2, z = p.z},
                {x = p.x - 2, y = p.y, z = p.z},
                {x = p.x, y = p.y + 2, z = p.z},
                {x = p.x + 2, y = p.y, z = p.z}
            }
    
            if (os.time() - st > L_Soul.auras[AurAz].duration) then
                for i, v in ipairs(poz) do
                    doSendDistanceShoot(v, p, L_Soul.souls[AurAz].effects.distance)
                end
                setPlayerStorageValue(uid, L_Soul.auras_sto, -1)
                addEvent(doSendMagicEffect, 250, p, L_Soul.souls[AurAz].effects.eff)
                return true
            end
    
            local next = poz[at + 1] and at + 1 or 1
            doSendDistanceShoot(poz[at], poz[next], L_Soul.souls[AurAz].effects.distance)
            addEvent(sendEffect, interval, uid, interval, next, st, AurAz)
        end
    
        return true
    end
    
    function onSay(cid, words, param)
        domodlib("Soul System[LIB]")
    
        local lan = L_Soul.lang[L_Soul.language]
    
        local AurAz = words:explode(" ")[1]
    
        -- Verifica se a aura é válida
        if not (L_Soul.auras[AurAz]) then
            return false
        end
    
        -- Verifica se o jogador possui pedras de alma suficientes para ativar a aura
        if (#getPlayerSoulStonesByType(cid, AurAz) < L_Soul.auras[AurAz].stones_n) then
            return doPlayerSendCancel(cid, string.format(lan[19], AurAz, L_Soul.auras[AurAz].stones_n))
        end
    
        -- Verifica se o jogador já está sob efeito de uma aura
        if (getPlayerStorageValue(cid, L_Soul.auras_sto) > 0) then
            return doPlayerSendCancel(cid, string.format(lan[20], math.floor(L_Soul.auras[AurAz].duration / 60)))
        end
    
        -- Verifica se o jogador está em uma área protegida
        if (getTileInfo(getThingPos(cid)).protection) then
            return doPlayerSendCancel(cid, lan[21])
        end
    
        -- Define a aura que será ativada quando o jogador atacar
        setPlayerStorageValue(cid, "current_aura", AurAz)
    
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, string.format("Agora você pode atacar para ativar a aura '%s'.", AurAz))
    
        return true
    end
    
    function onCreatureHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
        local auraName = getPlayerStorageValue(attacker, "current_aura")
    
        -- Verifica se o ataque foi feito por um jogador e se uma aura está definida para ser ativada
        if isPlayer(attacker) and auraName then
            -- Ativa a aura quando o jogador atacar um monstro ou outro jogador
            sendEffect(attacker, L_Soul.auras[auraName].speed, nil, os.time(), auraName)
            checkDam(attacker, auraName, os.time())
            setPlayerStorageValue(attacker, "current_aura", nil) -- Limpa a aura após ser ativada
        end
    end

     

    --[[
        System developed by MaXwEllDeN[maxwellden@hotmail.com]
        Version 1.0
    ]]
    
    function onKill(cid, target, lastHit)
        if (getPlayerStorageValue(target, 7148) ~= -1) then
            doCreatureSetDropLoot(target, {})
        end
    
        return registerCreatureEvent(target, "SoulD")
    end
    
    function onLogin(cid)
        setPlayerStorageValue(cid, 7126, -1)
        registerCreatureEvent(cid, "SoulATK")
        setPlayerStorageValue(cid, L_Soul.auras_sto, -1)
        return registerCreatureEvent(cid, "SoulKill")
    end
    
    local function TransformAMerda(cas)
        for a = 0, 255 do
            local pos = cas.pos
            pos.stackpos = a
    
            local item = getThingFromPos(pos)
    
            if (item.uid > 0) and (item.itemid == cas.it.itemid) and (cas.n == getItemAttribute(item.uid, "criaturaS")) and (not getItemAttribute(item.uid, "M_Time")) then
                return doTransformItem(item.uid, cas.nid)
            end
        end
    
        return false
    end
    
    function onDeath(cid, corpse, deathList)
        doItemSetAttribute(corpse.uid, "criaturaS", getCreatureName(cid):formal())
    
        if (getPlayerStorageValue(cid, 7148) ~= -1) then
            addEvent(TransformAMerda, 1, {pos = getThingPos(cid), it = corpse, n = getCreatureName(cid), nid = getMonsterInfo(getPlayerStorageValue(cid, 7148)).lookCorpse})
            return true
        end
    
        doItemSetAttribute(corpse.uid, "M_Time", os.clock())
        return doItemSetAttribute(corpse.uid, "M_Soul", getCreatureName(cid):formal())
    end
    
    local function Atacar(cid)
        if (not isCreature(cid)) then
            return false
        elseif (not isCreature(getCreatureTarget(cid))) then
            setPlayerStorageValue(cid, 7126, -1)
            return false
        end
        local target = getCreatureTarget(cid)
    
        local enc = isWithEnchantedW(cid)
    
        if (enc) then
            if (isWeapon(enc.arma.uid)) and (getDistanceBetween(getThingPos(getCreatureTarget(cid)), getThingPos(cid)) > 1) then
                setPlayerStorageValue(cid, 7126, -1)
                return false
            end
    
            local typ, enchant = L_Soul.souls[L_Soul.creatures[getItemAttribute(enc.arma.uid, "ES_Type")].type:lower()], L_Soul.creatures[getItemAttribute(enc.arma.uid, "ES_Type")].enchant
    
            doTargetCombatHealth(cid, target, typ.combat, -enchant.min, -enchant.max, typ.effects.eff)
            doSendDistanceShoot(getThingPos(cid), getThingPos(target), typ.effects.distance)
    
            if (enc.at == 1) then
                doPlayerSendTextMessage(cid, 27, string.format(lan[17], getItemNameById(enc.arma.itemid)))
                doItemSetAttribute(enc.arma.uid, "description", false)
                doItemSetAttribute(enc.arma.uid, "ES_Charges", false)
            else
                doItemSetAttribute(enc.arma.uid, "description", string.format(lan[16], getItemAttribute(enc.arma.uid, "ES_Type"), enc.at - 1, enchant.charges))
                doItemSetAttribute(enc.arma.uid, "ES_Charges", enc.at - 1)
            end
    
            addEvent(Atacar, enchant.attack_speed, cid)
        else
            setPlayerStorageValue(cid, 7126, -1)
        end
    
    end
    
    function onAttack(cid, target)
    
        if (getPlayerStorageValue(cid, 7126) < 1) then
            setPlayerStorageValue(cid, 7126, 5)
            Atacar(cid)
        end
    
        return true
    end
    
    
    function isWithEnchantedW(uid)
    
        for a = 5, 6 do
            local item = getPlayerSlotItem(uid, a)
            if (item.uid > 2) and (getItemAttribute(item.uid, "ES_Charges")) then
                return {arma = item, at = getItemAttribute(item.uid, "ES_Charges")}
            end
        end
    
        return false
    end



     

    L_Soul = {
        souls = {
            ["dark"] = {effects = {distance = 31, eff = 17}, combat = COMBAT_DEATHDAMAGE},
            ["flame"] = {effects = {distance = 3, eff = 15}, combat = COMBAT_FIREDAMAGE},
            ["frozen"] = {effects = {distance = 36, eff = 43}, combat = COMBAT_ICEDAMAGE},
            ["holy"] = {effects = {distance = 37, eff = 39}, combat = COMBAT_HOLYDAMAGE},
            ["electric"] = {effects = {distance = 35, eff = 11}, combat = COMBAT_ENERGYDAMAGE},
        },
    
        creatures = {
            ["Necromancer"] = {chance = 50, type = "dark",
                                summ = {
                                        hp = {hpb = 50, maxb = 700},
                                        needSoulPoints = 50,
                                        needMana = 0,
                                        needHealth = 20,
                                        minP = 50,
                                        },
                                enchant = {charges = 100, min = 10, max = 60, attack_speed = 250},
                            },
    
            ["Dragon Lord"] = {chance = 100, type = "flame",
                                summ = {
                                        hp = {hpb = 50, maxb = 700},
                                        needSoulPoints = 50,
                                        needMana = 0,
                                        needHealth = 20,
                                        minP = 50,
                                        },
                                enchant = {charges = 200, min = 50, max = 150, attack_speed = 1000},
                            },
    
            ["Frost Dragon"] = {chance = 100, type = "frozen",
                                summ = {
                                        hp = {hpb = 50, maxb = 700},
                                        needSoulPoints = 50,
                                        needMana = 0,
                                        needHealth = 20,
                                        minP = 50,
                                        },
                                enchant = {charges = 200, min = 50, max = 160, attack_speed = 1500},
                            },
    
            ["Wyrm"] = {chance = 100, type = "electric",
                                summ = {
                                        hp = {hpb = 50, maxb = 700},
                                        needSoulPoints = 50,
                                        needMana = 0,
                                        needHealth = 20,
                                        minP = 50,
                                        },
                                enchant = {charges = 200, min = 50, max = 160, attack_speed = 550},
                            },
            ["Monk"] = {chance = 150, type = "holy",
                                summ = {
                                        hp = {hpb = 50, maxb = 700},
                                        needSoulPoints = 50,
                                        needMana = 0,
                                        needHealth = 20,
                                        minP = 50,
                                        },
                                enchant = {charges = 200, min = 50, max = 160, attack_speed = 550},
                            },
        },
    
        ids = {8300},
        max_distance = 5,
        language = "en",
        auras_sto = 77143,
        soul_t = 10, -- Em Minutos
    }
    
    ---------------------- A U R A S ----------------------------
    L_Soul.auras = {
        ["dark"] = {stones_n = 7, damage = {25, 250}, interval = 1200, duration = 120, raio = 4, speed = 150},
        ["flame"] = {stones_n = 5, damage = {250, 650}, interval = 500, duration = 60, raio = 7, speed = 75},
        ["frozen"] = {stones_n = 2, damage = {150, 350}, interval = 750, duration = 60, raio = 2, speed = 150},
        ["electric"] = {stones_n = 5, damage = {150, 350}, interval = 750, duration = 60, raio = 2, speed = 150},
        ["holy"] = {stones_n = 0, damage = {150, 350}, interval = 750, duration = 60, raio = 7, speed = 150},
    }
    
    ------------------- E N C A N T A M E N T O -----------------
    
    L_Soul.enchant = {
        weapons = {
            [2408] = {"dark", "flame", "frozen"}, -- Warlord Sword
            [2190] = {"dark", "holy"}, -- Wand of Vortex
            [2456] = {"dark", "holy"}, -- Bow
            [2400] = {"dark", "holy", "frozen", "flame", "electric"}, -- Magic Sword(SOV)
        },
    }
    
    ------------------ L I N G U A G E M ------------------------
    
    L_Soul.lang = {
        ["en"] = {
            "This soul stone is filled with a %s's %s soul!",
            "This soul stone must be near the creature's corpse.",
            "There's no soul!",
            "Your soul stone didn't supported the soul and broke! This %s's %s soul escaped!",
            "Congratulations, you caught a %s's soul[%s]!",
            "Filled with a %s's %s soul.",
            "This item can't be enchanted.",
            "To summon a %s you must have at least %d soul points.",
            "You can't summon a %s there.",
            "To summon a %s you must have at least %d mana points.",
            "To summon a %s you must have at least %d health points.",
            "The soul stone broke and the corpse was possessed by %s's %s soul!",
            "This corpse doesn't support this %s's powerful %s soul. The soul has escaped and is roaming the world and tormenting people.",
            "A body can't have two souls.",
            "The %s's soul was aprisioned in weapon.",
            "This weapon is enchanted with a %s's soul. Charges: %d/%d.",
            "Your %s lost charm.",
            "This weapon already is enchanted with a soul!",    -- 18
    
                    --> AURAS <--
            "You haven't enought %s souls[%d].",
            "You need wait %d minutes to use an aura protection again.",
            "You can't use an aura protection on protected zones.",
    
            {
                "Alive again!? How!? AH! It doesn't matter, i just want to get my revenge! MUHAUHAUHUAUA!",
                "OH how is sweet live!",
            },
        }
    }
    
    
    function isWeapon(uid) -- Function by Mock the bear.
        local uid = uid or 0
        local f = getItemWeaponType(uid)
    
        return (f == 1 or f == 2 or f == 3) or false
    end
    
    function string:formal()
        local self = self:sub(1, 1):upper() .. self:sub(2, #self)
        while (self:find(" (%l)")) do
            local a = self:find(" (%l)")
            self = self:sub(1, a) .. self:sub(a + 1, a + 1):upper() .. self:sub(a + 2, #self)
        end
    
        return self
    end
    
    function getUidsInArea(ext1, ext2)
       local uids = {}
       for a = 0, ext2.x-ext1.x do
           for b = 0, ext2.y-ext1.y do
              local pos = {x = ext1.x+a, y = ext1.y+b, z = ext1.z, stackpos = 255}
              local cid = getTopCreature(pos).uid
              if (isCreature(cid)) then
                 table.insert(uids, cid)
              end
           end
       end
       return uids
    end
    
    function getItemsInContainerById(container, itemid) -- Function By Kydrai
        local items = {}
        if isContainer(container) and getContainerSize(container) > 0 then
            for slot = 0, getContainerSize(container) - 1 do
                local item = getContainerItem(container, slot)
                if isContainer(item.uid) then
                    for i, v in ipairs (getItemsInContainerById(item.uid, itemid)) do
                        table.insert(items, v)
                    end
                elseif itemid == item.itemid then
                    table.insert(items, item)
                end
            end
        end
        return items
    end
    
    function getAllPlayerItemsById(uid, itemid)
        local items = {}
    
        for a = CONST_SLOT_FIRST, CONST_SLOT_LAST do
            local item = getPlayerSlotItem(uid, a)
            if ((item.uid > 0) and (item.itemid == itemid)) then
                table.insert(items, item)
            end
    
            if ((isContainer(item.uid)) and (getContainerSize(item.uid) > 0)) then
                for i, v in ipairs(getItemsInContainerById(item.uid, itemid)) do
                    table.insert(items, v)
                end
            end
        end
        return items
    end
    
    function getAllPlayerSoulStones(uid, empty)
        local stones = {}
    
        for _, s in ipairs(L_Soul.ids) do
            for _, v in pairs(getAllPlayerItemsById(uid, s)) do
                if not ((empty) and (not getItemAttribute(v.uid, "Soul"))) then
                    table.insert(stones, v)
                end
            end
        end
    
        return stones
    end
    
    function getPlayerSoulStonesByType(uid, type)
        local stones = {}
    
        for _, v in pairs(getAllPlayerSoulStones(uid)) do
            if ((getItemAttribute(v.uid, "Soul")) and (L_Soul.creatures[getItemAttribute(v.uid, "Soul")].type:lower() == type:lower())) then
                table.insert(stones, v)
            end
        end
    
        return stones
    end
    
    function doPlayerRemoveSoulStoneByType(uid, type, ammount)
        local stones = getPlayerSoulStonesByType(uid, type)
        local ammount = ammount or 1
    
        if (#stones < ammount) then
            return false
        end
    
        local a = 0
        for _, v in pairs(stones) do
            if (a ~= ammount) then
                a = a + 1
                doRemoveItem(v.uid, 1)
            else
                break
            end
        end
    
        return true
    end
    
    function getPlayerSoulStonesCount(uid, type)
        return #getPlayerSoulStonesByType(uid, type)
    end
    
    function onCreatureHealthChange(creature, attacker, attackerName, damage, damType, damMsg)
        if isPlayer(attacker) and isCreature(creature) and attackerName ~= creature then
            local auraName = getPlayerStorageValue(attacker, "current_aura")
            if auraName then
                local AuraAz = auraName:lower()
                if L_Soul.auras[AuraAz] and os.time() - creature:getStorageValue("last_hit_" .. AuraAz) > L_Soul.auras[AuraAz].interval then
                    doCreatureSetStorageValue(creature, "last_hit_" .. AuraAz, os.time())
                    doSendDistanceShoot(creature:getPosition(), creature:getPosition(), L_Soul.souls[AuraAz].effects.distance)
                    doTargetCombatHealth(attacker, creature, L_Soul.souls[AuraAz].combat, -L_Soul.auras[AuraAz].damage[1], -L_Soul.auras[AuraAz].damage[2], 255)
                end
            end
        end
    end
    
    function onSay(cid, words, param)
        domodlib("Soul System[LIB]")
    
        local lan = L_Soul.lang[L_Soul.language]
    
        local AuraAz = words:explode(" ")[1]
    
        if not (L_Soul.auras[AuraAz]) then
            return false
        end
    
        if (#getPlayerSoulStonesByType(cid, AuraAz) < L_Soul.auras[AuraAz].stones_n) then
            return doPlayerSendCancel(cid, string.format(lan[19], AuraAz, L_Soul.auras[AuraAz].stones_n))
        end
    
        if (getPlayerStorageValue(cid, L_Soul.auras_sto) > 0) then
            return doPlayerSendCancel(cid, string.format(lan[20], math.floor(L_Soul.auras[AuraAz].duration/60)))
        end
    
        if (getTileInfo(getThingPos(cid)).protection) then
            return doPlayerSendCancel(cid, lan[21])
        end
    
        setPlayerStorageValue(cid, L_Soul.auras_sto, os.time())
        doPlayerRemoveSoulStoneByType(cid, AuraAz, L_Soul.auras[AuraAz].stones_n)
        setPlayerStorageValue(cid, "current_aura", AuraAz) -- Armazena a aura atual do jogador
        return true
    end

     

  18. function sendMsgCountToItens(cid)
        local item1 = getPlayerStorageValue(cid, 251461):explode("|")
        
        -- Verificar se todos os itens foram entregues
        local allItemsDelivered = getPlayerItemCount(cid, item1[1]) >= tonumber(item1[3]) and
                                  getPlayerItemCount(cid, item1[2]) >= tonumber(item1[4]) and
                                  getPlayerItemCount(cid, item1[5]) >= tonumber(item1[7]) and
                                  getPlayerItemCount(cid, item1[6]) >= tonumber(item1[8])
        
        -- Se todos os itens foram entregues, definir a mensagem como vazia e remover o valor de armazenamento
        if allItemsDelivered then
            setPlayerStorageValue(cid, 251461, -1)
            return false
        end
        
        -- Caso contrário, calcular os valores de contagem dos itens
        local valor1 = math.max(0, tonumber(item1[3]) - getPlayerItemCount(cid, item1[1]))
        local valor2 = math.max(0, tonumber(item1[4]) - getPlayerItemCount(cid, item1[2]))
        local valor3 = math.max(0, tonumber(item1[7]) - getPlayerItemCount(cid, item1[5]))
        local valor4 = math.max(0, tonumber(item1[8]) - getPlayerItemCount(cid, item1[6]))
        
        -- Enviar mensagem com a contagem dos itens que faltam
        selfSay("Ainda falta você me trazer os seguintes itens ["..valor1.."] "..getItemNameById(item1[1])..", ["..valor2.."] "..getItemNameById(item1[2])..", ["..valor3.."] "..getItemNameById(item1[5])..",  ["..valor4.."] "..getItemNameById(item1[6])..".", cid)        
        
        return true
    end

     

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...