Ir para conteúdo
  • 0

[AJUDA] Level systen


rafersiq

Pergunta

ola galera do forun eu tou presisando de ajuda a arumar um bug do lvl systen ao abrir o server

 

da esse erro

Citar

[Error - CreatureScript Interface]
In a timer event called from:
data/creaturescripts/scripts/spawn.lua:onSpawn
Description:
data/lib/level system.lua:5: attempt to call global 'getMonsterLevel' (a nil value)
stack traceback:
        data/lib/level system.lua:5: in function <data/lib/level system.lua:1>

 

Link para o comentário
Compartilhar em outros sites

15 respostass a esta questão

Posts Recomendados

  • 0
1 hora atrás, Deadpool disse:

posta seu script. data/lib/level system.lua

ok

 

Citar

function adjustWildPoke(cid, health) -- Balanceamento dos selvagens
----------------------------------------------
if isMonster(cid) and pokes[getCreatureName(cid)] then
    ----------------------------------------------
    local level = getMonsterLevel(cid)
    ------------BALANCEAMENTO-SELVAGEM------------
    ---(Os status são multiplicados com o wildlvl, você irá ajustar as multiplições adicionais com as informações abaixo.)---
    local basic = 1 ---Ataques basicos +20%
    local defesa = 1.1 ---Defesa -20% (Use numeros abaixo do 0 para diminuir a multiplica??o.)
    local agilidade =  1.3 ----Agilidade +10%
    local vida = 1.2 ---Vida +20%
    local move = 20 ----movimento especial +400% (Essa foi inalterada j? estava assim)
    ----------------------------------------------
    
    -- * 1 = normal
    -- * 1.4 = 40% mais forte
    -- * 0.7 = 30% mais fraco (pq é 1 - 0.3)
    
    
    local wildOff = (pokes[getCreatureName(cid)].offense * level * basic) * 1.2 -- 20%
    local wildDef = (pokes[getCreatureName(cid)].defense * defesa) * 1.2 -- 10%
    local wildAgility = (pokes[getCreatureName(cid)].agility * agilidade) * 0.8
    local wildVit = (pokes[getCreatureName(cid)].vitality * level * vida)
    local wildSpAtk = (pokes[getCreatureName(cid)].specialattack * (move + level))* 3
    
    
    setPlayerStorageValue(cid, 1000, level) --alterado v1.8
    setPlayerStorageValue(cid, 1001, wildOff)
    setPlayerStorageValue(cid, 1002, wildDef)
    setPlayerStorageValue(cid, 1003, wildAgility)                                  
    setPlayerStorageValue(cid, 1004, wildVit)
    setPlayerStorageValue(cid, 1005, wildSpAtk)
    ----------------------------------------------
    --vv---------------PARTE DE BAIXO NãO FOI MECHIDA---------------vv--
    doRegainSpeed(cid)         --alterado!
    setCreatureMaxHealth(cid, (getVitality(cid) * HPperVITwild))
    
    local curhealth = health or getCreatureMaxHealth(cid)
    doCreatureAddHealth(cid,  - getCreatureHealth(cid) + curhealth)
    -- doCreatureSetNick(pk, getCreatureName(cid).." ["..level.."]")
    
    registerCreatureEvent(cid, "WildEvolve")
    
    if pokes[getCreatureName(cid)].exp then
       local exp = pokes[getCreatureName(cid)].exp * baseExpRate + pokes[getCreatureName(cid)].vitality * pokemonExpPerLevelRate
       setPlayerStorageValue(cid, 1006, (exp * generalExpRate/2)*10)
       if getPlayerStorageValue(cid, 22546) == 1 then
          setPlayerStorageValue(cid, 1006, 750)
          doSetCreatureDropLoot(cid, false)      
       end   
    end
end
end       

function getPokemonXMLOutfit(name)                --alterado v1.9 \/
local path = "data/monster/pokes/Shiny/"..name..".xml"
local tpw = io.type(io.open(path))

if not tpw then
   path = "data/monster/pokes/geracao 2/"..name..".xml"
   tpw = io.type(io.open(path))
end
if not tpw then
   path = "data/monster/pokes/geracao 1/"..name..".xml"
   tpw = io.type(io.open(path))
end
if not tpw then
   path = "data/monster/pokes/"..name..".xml"
   tpw = io.type(io.open(path))
end   
if not tpw then
   return print("[getPokemonXMLOutfit] Poke with name: "..name.." ins't in any paste on monster/pokes/") and 2
end
   local arq = io.open(path, "a+")
   local txt = arq:read("*all")
   arq:close()
   local a, b = txt:find('look type="(.-)"')
   txt = string.sub(txt, a + 11, b - 1)
return tonumber(txt)
end 

function doEvolutionOutfit(cid, oldout, outfit)
    if not isCreature(cid) then return true end
        if getCreatureOutfit(cid).lookType == oldout then
            doSetCreatureOutfit(cid, {lookType = outfit}, -1)
        else
            doSetCreatureOutfit(cid, {lookType = oldout}, -1)
        end
end

function doSendEvolutionEffect(cid, pos, evolution, turn, ssj, evolve)
    if not isCreature(cid) then
        doSendAnimatedText(pos, "CANCEL", 215)
        return true 
    end
    if evolve then
        doEvolvePokemon(getCreatureMaster(cid), {uid = cid}, evolution, 0, 0)
    return true
    end
    doSendMagicEffect(pos, 18)
        if ssj then
            sendSSJEffect(evo)
        end
    --doEvolutionOutfit(cid, f, h)
    addEvent(doSendEvolutionEffect, math.pow(1900, turn/20), cid, getThingPos(cid), evolution, turn - 1, turn == 19, turn == 2, f, h)
end

function sendSSJEffect(cid)
    if not isCreature(cid) then return true end
    local pos1 = getThingPos(cid)
    local pos2 = getThingPos(cid)
    pos2.x = pos2.x + math.random(-1, 1)
    pos2.y = pos2.y - math.random(1, 2)
    doSendDistanceShoot(pos1, pos2, 37)
    addEvent(sendSSJEffect, 45, cid)
end

function sendFinishEvolutionEffect(cid, alternate)
    if not isCreature(cid) then return true end
    local pos1 = getThingPos(cid)

    if alternate then
        local pos = {
        [1] = {-2, 0},
        [2] = {-1, -1},
        [3] = {0, -2},
        [4] = {1, -1},
        [5] = {2, 0},
        [6] = {1, 1},
        [7] = {0, 2},
        [8] = {-1, 1}}
        for a = 1, 8 do
            local pos2 = getThingPos(cid)
            pos2.x = pos2.x + pos[a][1]
            pos2.y = pos2.y + pos[a][2]
            local pos = getThingPos(cid)
            doSendDistanceShoot(pos2, pos, 37)
            addEvent(doSendDistanceShoot, 300, pos, pos2, 37)
        end
    else
        for a = 0, 3 do
            doSendDistanceShoot(pos1, getPosByDir(pos1, a), 37)
        end
        for a = 4, 7 do
            addEvent(doSendDistanceShoot, 600, pos1, getPosByDir(pos1, a), 37)
        end
    end
end

-- Tradução: doEvolvePokemon(player, cid(poke), evolução, stone1, stone2)
function doEvolvePokemon(cid, item2, theevo, stone1, stone2, count1, count2) -- item2 é uma tabela, item.uid == cid (item2.uid é o poke q está evoluindo, gamb)

    if not isCreature(cid) then return true end
    
    if not pokes[theevo] or not pokes[theevo].offense then
    doReturnPokemon(cid, item2.uid, getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect, false, true)
    return true
    end

    local owner = getCreatureMaster(item2.uid) -- getCreatureMatser(cid) -- gamb proposital
    local pokeball = getPlayerSlotItem(cid, ?
    local description = "Contains a "..theevo.."."
    local pct = getCreatureHealth(item2.uid) / getCreatureMaxHealth(item2.uid)

        doItemSetAttribute(pokeball.uid, "hp", pct)

        doItemSetAttribute(pokeball.uid, "poke", theevo)
        doItemSetAttribute(pokeball.uid, "description", "Contains a "..theevo..".")
        doItemSetAttribute(pokeball.uid, "current_addon", "normal")
        doItemSetAttribute(pokeball.uid, "addons", "{}")

        local str = "Contains a "..getItemAttribute(pokeball.uid, "poke").."."
        if getItemAttribute(pokeball.uid, "nick") then
            str = str.."\nIt's nickname is: "..getItemAttribute(pokeball.uid, "nick").."."
        end
        doItemSetAttribute(pokeball.uid, "description", str.."\n")

        doPlayerSendTextMessage(cid, 27, "Parabéns! Seu "..getPokeName(item2.uid).." evoluiu para um "..theevo.."!")        

        doSendMagicEffect(getThingPos(item2.uid), 18)
        doItemSetAttribute(pokeball.uid, "tadport", fotos[theevo])
        doUpdatePokemonsBar(cid)
        doTransformItem(getPlayerSlotItem(cid, 7).uid, fotos[theevo])
        doSendMagicEffect(getThingPos(cid), 173)

        local oldpos = getThingPos(item2.uid)
        local oldlod = getCreatureLookDir(item2.uid)
        local poke_infos = {level = getMonsterLevel(item2.uid), exp = getMonsterExperience(item2.uid)}
        doRemoveCreature(item2.uid)

        doSummonMonster(cid, theevo)
        local pk = getCreatureSummons(cid)[1]

        doMonsterSetLevel(pk, poke_infos.level, poke_infos.exp)
        doTeleportThing(pk, oldpos, false)
        doCreatureSetLookDir(pk, oldlod)

        sendFinishEvolutionEffect(pk, true)
        addEvent(sendFinishEvolutionEffect, 550, pk, true)
        addEvent(sendFinishEvolutionEffect, 1050, pk)
        
        if stone1 then
            doPlayerRemoveItem(cid, stone1, count1 and count1 or 1)
        end
        if stone2 then
            if count2 and tonumber(count2) > 0 then
                doPlayerRemoveItem(cid, stone2, count2)
            elseif isInArray(specialevo, theevo) then
                doPlayerRemoveItem(cid, stone2, 1)
            end    
        end

        doAddPokemonInOwnList(cid, theevo)

        local happy = getItemAttribute(pokeball.uid, "happy")

        doItemSetAttribute(pokeball.uid, "happy", happy + happyGainedOnEvolution)

        if happy + happyGainedOnEvolution > 255 then
            doItemSetAttribute(pokeball.uid, "happy", 255)
        end

        adjustStatus(pk, pokeball.uid, true, false)

        if useKpdoDlls then
            doUpdateMoves(cid)
            doPlayerSendCancel(owner, "")
            doPlayerSave(cid)
        end
end

function doMathDecimal(number, casas)

    if math.floor(number) == number then return number end

    local c = casas and casas + 1 or 3

    for a = 0, 10 do
        if math.floor(number) < math.pow(10, a) then
            local str = string.sub(""..number.."", 1, a + c)
            return tonumber(str)    
        end
    end

return number
end

function doAdjustWithDelay(cid, pk, health, vit, status)
if isCreature(cid) then                                   
   adjustStatus(pk, getPlayerSlotItem(cid, 8).uid, health, vir, status)
end
end

function adjustStatus(pk, item, health, vite, conditions) -- Balanceamento dos pokes de player  -- slk voce é o cara msm kkkk

    if not isCreature(pk) then return true end

    local gender = getItemAttribute(item, "gender") and getItemAttribute(item, "gender") or 0
--    addEvent(doCreatureSetSkullType, 10, pk, gender)
    
    --[[if getMasterLevel(pk) > 600 then
        pokemonLevel = 600
    else
        pokemonLevel = getMasterLevel(pk)
    end]]
    local pokemonLevel = getMonsterLevel(pk) -- OrochiElf
    
    local statusReduction = 1 -- sem redução
    if getItemAttribute(item, "statusReduction") and tonumber(getItemAttribute(item, "statusReduction")) > 0 then -- SL
        statusReduction = 1 - (tonumber(getItemAttribute(item, "statusReduction"))/100) -- De 4% a 10% de redução de status ao evoluir antecipadamente    
    end

    
    
    local sttsOffense = math.ceil( ( pokes[getCreatureName(pk)].offense * ((pokemonLevel + getPokemonBoost(pk))/1.6) ) * statusReduction )
    local sttsDefense = math.ceil( ( pokes[getCreatureName(pk)].defense * 1.4 ) * statusReduction )
    local sttsAgility = math.ceil( ( pokes[getCreatureName(pk)].agility + pokemonLevel / 2 ) * statusReduction )
    local sttsVitality = math.ceil( ( pokes[getCreatureName(pk)].vitality * (85 + pokemonLevel) ) * statusReduction )
    local sttsSpecialAttack = math.ceil( ( pokes[getCreatureName(pk)].specialattack * (pokemonLevel / 1.45 + getPokemonBoost(pk) )*9 ) * statusReduction )
    
    
    setPlayerStorageValue(pk, 1001, sttsOffense)
    setPlayerStorageValue(pk, 1002, sttsDefense)             
    setPlayerStorageValue(pk, 1003, sttsAgility)
    setPlayerStorageValue(pk, 1004, sttsVitality)
    setPlayerStorageValue(pk, 1005, sttsSpecialAttack)
    
    if vite == true then
        local pct = getCreatureHealth(pk) / getCreatureMaxHealth(pk)
        local vit = getVitality(pk)
        setCreatureMaxHealth(pk, math.ceil( vit * HPperVITsummon ))
        doCreatureAddHealth(pk, pct * vit * HPperVITsummon)
    end
                                                                      
    doRegainSpeed(pk)  

    local nick = getItemAttribute(item, "poke")

    if isGhostPokemon(pk) then
       setPlayerStorageValue(pk, 8981, 1)
       updateGhostWalk(pk)
    end
        

    if getItemAttribute(item, "nick") then
        nick = getItemAttribute(item, "nick")
    end

    setPlayerStorageValue(pk, 1007, nick)
    
    local lvl = getItemAttribute(item, "level") or 0
    nick = nick
    
    -- doCreatureSetNick(pk, nick.." [+ "..boost.."]")

    if not getItemAttribute(item, "happy") then
        doItemSetAttribute(item, "happy", 120)
    end

    if not getItemAttribute(item, "hunger") then
        doItemSetAttribute(item, "hunger", 5)
    end

    local happy = getItemAttribute(item, "happy")
        if happy < 0 then
            happy = 1
        end
    setPlayerStorageValue(pk, 1008, happy)

    local hunger = getItemAttribute(item, "hunger")
    setPlayerStorageValue(pk, 1009, hunger)

    if health == true then
        local mh = HPperVITsummon * getVitality(pk)
        local rd = 1 - (tonumber(getItemAttribute(item, "hp")))
        setCreatureMaxHealth(pk, mh)                                  
        doCreatureAddHealth(pk, getCreatureMaxHealth(pk))
        doCreatureAddHealth(pk, -(getCreatureMaxHealth(pk) * rd))
    end

    if isSummon(pk) and conditions then
        local burn = getItemAttribute(item, "burn")   
        if burn and burn >= 0 then
           local ret = {id = pk, cd = burn, check = false, damage = getItemAttribute(item, "burndmg"), cond = "Burn"}
           addEvent(doCondition2, 3500, ret)
        end

        local poison = getItemAttribute(item, "poison")
        if poison and poison >= 0 then
           local ret = {id = pk, cd = poison, check = false, damage = getItemAttribute(item, "poisondmg"), cond = "Poison"}
           addEvent(doCondition2, 1500, ret)
        end

        local confuse = getItemAttribute(item, "confuse")
        if confuse and confuse >= 0 then
           local ret = {id = pk, cd = confuse, check = false, cond = "Confusion"}
           addEvent(doCondition2, 1200, ret)                                                
        end

        local sleep = getItemAttribute(item, "sleep")
        if sleep and sleep >= 0 then
           local ret = {id = pk, cd = sleep, check = false, first = true, cond = "Sleep"}
           doCondition2(ret)
        end
        
        local freeze = getItemAttribute(item, "Freeze")
        if freeze and freeze >= 0 then
           local ret = {id = pk, cd = freeze, check = false, first = true, cond = "Freeze"}
           doCondition2(ret)
        end
        
        local miss = getItemAttribute(item, "miss")     
        if miss and miss >= 0 then      
          local ret = {id = pk, cd = miss, eff = getItemAttribute(item, "missEff"), check = false, spell = getItemAttribute(item, "missSpell"), cond = "Miss"}
          doCondition2(ret)
        end
        
        local fear = getItemAttribute(item, "fear")
        if fear and fear >= 0 then
           local ret = {id = pk, cd = fear, check = false, skill = getItemAttribute(item, "fearSkill"), cond = "Fear"}
           doCondition2(ret)
        end
        
        local silence = getItemAttribute(item, "silence")
        if silence and silence >= 0 then      
           local ret = {id = pk, cd = silence, eff = getItemAttribute(item, "silenceEff"), check = false, cond = "Silence"}
           doCondition2(ret)
        end                                     
        
        local stun = getItemAttribute(item, "stun")
        if stun and stun >= 0 then
           local ret = {id = pk, cd = stun, eff = getItemAttribute(item, "stunEff"), check = false, spell = getItemAttribute(item, "stunSpell"), cond = "Stun"}
           doCondition2(ret)
        end 
                                                       
        local paralyze = getItemAttribute(item, "paralyze")
        if paralyze and paralyze >= 0 then
           local ret = {id = pk, cd = paralyze, eff = getItemAttribute(item, "paralyzeEff"), check = false, first = true, cond = "Paralyze"}
           doCondition2(ret)
        end  
                                                     
        local slow = getItemAttribute(item, "slow")
        if slow and slow >= 0 then
           local ret = {id = pk, cd = slow, eff = getItemAttribute(item, "slowEff"), check = false, first = true, cond = "Slow"}
           doCondition2(ret)
        end                                              
        
        local leech = getItemAttribute(item, "leech")
        if leech and leech >= 0 then
           local ret = {id = pk, cd = leech, attacker = 0, check = false, damage = getItemAttribute(item, "leechdmg"), cond = "Leech"}
           doCondition2(ret)
        end                               
        
        for i = 1, 3 do
            local buff = getItemAttribute(item, "Buff"..i)
            if buff and buff >= 0 then
               local ret = {id = pk, cd = buff, eff = getItemAttribute(item, "Buff"..i.."eff"), check = false, 
               buff = getItemAttribute(item, "Buff"..i.."skill"), first = true, attr = "Buff"..i}
               doCondition2(ret)
            end
        end
               
    end
                                                                          --alterado v1.9
    if getItemAttribute(item, "boost") and getItemAttribute(item, "boost") >= 50 and getItemAttribute(item, "aura") then
       sendAuraEffect(pk, auraSyst[getItemAttribute(item, "aura")])        
    end
    
    if getPlayerStorageValue(getCreatureMaster(pk), 6598754) >= 1 then
        setPlayerStorageValue(pk, 6598754, 1)                               
    elseif getPlayerStorageValue(getCreatureMaster(pk), 6598755) >= 1 then
        setPlayerStorageValue(pk, 6598755, 1)
    end

return true
end

function setWildPokemonLevel(cid, optionalLevel, optionalStatus, optionalNick, optionalExtraExp)

    if not isCreature(cid) then return true end
    if not pokes[getCreatureName(cid)] then return true end  --alterado v2.6

    local levelRange = 0
    local off = 0
    local def = 0
    local agi = 0
    local spatk = 0
    local vit = 0
    local this = getCreatureName(cid)
    local ee = 1

    if optionalExtraExp then
        ee = optionalExtraExp
    end


    if optionalLevel and tonumber(optionalLevel) >= 1 then                --alterado v2.8\/
        levelRange = optionalLevel
    else
        levelRange = math.random(pokes[this].wildLvlMin, pokes[this].wildLvlMax) 
    end                                                                                          

    local status = getPokemonStatus(this)
        if status then
            off = status.off
            def = status.def
            agi = status.agi
            vit = status.vit
            spatk = status.spatk
        end

    setPlayerStorageValue(cid, 1000, (levelRange > 100 and 100 or levelRange)) --alterado v2.8

    if optionalStatus and optionalStatus.off then
        setPlayerStorageValue(cid, 1001, optionalStatus.offense)
        setPlayerStorageValue(cid, 1002, optionalStatus.defense)
        setPlayerStorageValue(cid, 1003, optionalStatus.agility)
        setPlayerStorageValue(cid, 1004, optionalStatus.vitality)
        setPlayerStorageValue(cid, 1005, optionalStatus.specialattack)
        setPlayerStorageValue(cid, 1011, optionalStatus.offense)
        setPlayerStorageValue(cid, 1012, optionalStatus.defense)
        setPlayerStorageValue(cid, 1013, optionalStatus.agility)
        setPlayerStorageValue(cid, 1014, optionalStatus.vitality)
        setPlayerStorageValue(cid, 1015, optionalStatus.specialattack)
    else
        setPlayerStorageValue(cid, 1001, 5 + math.random(off * levelRange * 0.9, off * levelRange * 2.8))
        setPlayerStorageValue(cid, 1002, 5 + math.random(def * levelRange * 0.9, def * levelRange * 1.8))
        setPlayerStorageValue(cid, 1003, math.random(agi * levelRange * 0.9, agi * levelRange * 1.8))
        setPlayerStorageValue(cid, 1004, math.random(vit * levelRange * 0.9, vit * levelRange * 2.0))
        setPlayerStorageValue(cid, 1005, 5 + math.random(spatk * levelRange * 0.9, spatk * levelRange * 2.2))
        setPlayerStorageValue(cid, 1011, getPlayerStorageValue(cid, 1001))
        setPlayerStorageValue(cid, 1012, getPlayerStorageValue(cid, 1002))
        setPlayerStorageValue(cid, 1013, getPlayerStorageValue(cid, 1003))
        setPlayerStorageValue(cid, 1014, getPlayerStorageValue(cid, 1004))
        setPlayerStorageValue(cid, 1015, getPlayerStorageValue(cid, 1005))
    end

    doRegainSpeed(cid)

    setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + getPlayerStorageValue(cid, 1004) * HPperVIT * vitReductionForWild)
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
    
    if pokes[getCreatureName(cid)].exp then
        --getMonsterInfo(getCreatureName(cid)).experience
        local exp = (50 + pokes[getCreatureName(cid)].exp) * baseExpRate + pokes[getCreatureName(cid)].vitality * levelRange * pokemonExpPerLevelRate
        setPlayerStorageValue(cid, 1006, exp * generalExpRate * ee)
        if getPlayerStorageValue(cid, 22546) == 1 then
          setPlayerStorageValue(cid, 1006, 750)
          doSetCreatureDropLoot(cid, false)         --edited golden arena
       end  
    end

    local wildshow = wildBeforeNames and "Wild " or ""
    if optionalNick then
        if hideWildsLevel then
            doCreatureSetNick(cid, optionalNick)
        else
            doCreatureSetNick(cid, optionalNick.." ["..getWildPokemonLevel(cid).."]")
        end
    else
        if hideWildsLevel then
            doCreatureSetNick(cid, ""..wildshow..""..getCreatureName(cid).."")
        else
            doCreatureSetNick(cid, ""..wildshow..""..getCreatureName(cid).." ["..getWildPokemonLevel(cid).."]")
        end
    end
end

function getOffense(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1001) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1001))
end

function getDefense(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1002) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1002))
end

function getSpeed(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1003) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1003))
end

function getVitality(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1004) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1004))
end

function getSpecialAttack(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1005) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1005))
end

function getHappiness(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1008) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1008))
end

function getSpecialDefense(cid)
    if not isCreature(cid) then return 0 end
return math.ceil(tonumber(getSpecialAttack(cid) * 0.85 + getDefense(cid) * 0.2))     
end

function getPokemonLevel(cid, dex)
if not isCreature(cid) then return 0 end 
    if not dex then                      --alterado v1.9
       if ehMonstro(cid) and getPlayerStorageValue(cid, 1000) > 0 then  
          return getPlayerStorageValue(cid, 1000)
       elseif ehMonstro(cid) then 
          return pokes[getCreatureName(cid)].wildLvl             
       end
    end   
return pokes[getCreatureName(cid)].level
end

function getPokemonLevelByName(name)
return pokes[name] and pokes[name].level or 0  --alterado v1.9
end

function getMasterLevel(poke)
    if not isSummon(poke) then return 0 end
return getPlayerLevel(getCreatureMaster(poke))
end

function getPokemonBoost(poke)
    if not isSummon(poke) then return 0 end
return getItemAttribute(getPlayerSlotItem(getCreatureMaster(poke), 8).uid, "boost") or 0
end

function getPokeballBoost(ball)
    if not isPokeball(ball.itemid) then return 0 end  --alterado v1.8
return getItemAttribute(ball.uid, "boost") or 0
end

function getPokeName(cid)
    if not isSummon(cid) then return getCreatureName(cid) end
    if getCreatureName(cid) == "Evolution" then return getPlayerStorageValue(cid, 1007) end
    
local item = getPlayerSlotItem(getCreatureMaster(cid), ?
    if getItemAttribute(item.uid, "nick") then
       return getItemAttribute(item.uid, "nick")
    end
return getCreatureName(cid)
end

function getPokeballName(item, truename)
if not truename and getItemAttribute(item, "nick") then
return getItemAttribute(item, "nick")
end
return getItemAttribute(item, "poke")
end

function getPokemonName(cid)
return getCreatureName(cid)
end

function getPokemonGender(cid) --alterado v1.9
return getCreatureSkullType(cid)
end

function setPokemonGender(cid, gender)
if isCreature(cid) and gender then        --alterado v1.8
   doCreatureSetSkullType(cid, gender)
   return true
end
return false
end

function getWildPokemonExp(cid)
return getPlayerStorageValue(cid, 1006)
end

ta ai o scripts

Link para o comentário
Compartilhar em outros sites

  • 0
Spoiler



function adjustWildPoke(cid, health) -- Balanceamento dos selvagens
----------------------------------------------
if isMonster(cid) and pokes[getCreatureName(cid)] then
    ----------------------------------------------
    local level = getPokemonLevel(cid) * 2.0
    ------------BALANCEAMENTO-SELVAGEM------------
    ---(Os status são multiplicados com o wildlvl, você irá ajustar as multiplições adicionais com as informações abaixo.)---
    local basic = 1 ---Ataques basicos +20%
    local defesa = 1.1 ---Defesa -20% (Use numeros abaixo do 0 para diminuir a multiplica??o.)
    local agilidade =  1.3 ----Agilidade +10%
    local vida = 1.2 ---Vida +20%
    local move = 20 ----movimento especial +400% (Essa foi inalterada j? estava assim)
    ----------------------------------------------
    
    -- * 1 = normal
    -- * 1.4 = 40% mais forte
    -- * 0.7 = 30% mais fraco (pq é 1 - 0.3)
    
    
    local wildOff = (pokes[getCreatureName(cid)].offense * level * basic) * 1.2 -- 20%
    local wildDef = (pokes[getCreatureName(cid)].defense * defesa) * 1.2 -- 10%
    local wildAgility = (pokes[getCreatureName(cid)].agility * agilidade) * 0.8
    local wildVit = (pokes[getCreatureName(cid)].vitality * level * vida)
    local wildSpAtk = (pokes[getCreatureName(cid)].specialattack * (move + level))* 3
    
    
    setPlayerStorageValue(cid, 1000, level) --alterado v1.8
    setPlayerStorageValue(cid, 1001, wildOff)
    setPlayerStorageValue(cid, 1002, wildDef)
    setPlayerStorageValue(cid, 1003, wildAgility)                                  
    setPlayerStorageValue(cid, 1004, wildVit)
    setPlayerStorageValue(cid, 1005, wildSpAtk)
    ----------------------------------------------
    --vv---------------PARTE DE BAIXO NãO FOI MECHIDA---------------vv--
    doRegainSpeed(cid)         --alterado!
    setCreatureMaxHealth(cid, (getVitality(cid) * HPperVITwild))
    
    local curhealth = health or getCreatureMaxHealth(cid)
    doCreatureAddHealth(cid,  - getCreatureHealth(cid) + curhealth)
    -- doCreatureSetNick(pk, getCreatureName(cid).." ["..level.."]")
    
    registerCreatureEvent(cid, "WildEvolve")
    
    if pokes[getCreatureName(cid)].exp then
       local exp = pokes[getCreatureName(cid)].exp * baseExpRate + pokes[getCreatureName(cid)].vitality * pokemonExpPerLevelRate
       setPlayerStorageValue(cid, 1006, (exp * generalExpRate/2)*10)
       if getPlayerStorageValue(cid, 22546) == 1 then
          setPlayerStorageValue(cid, 1006, 750)
          doSetCreatureDropLoot(cid, false)      
       end   
    end
end
end       

function getPokemonXMLOutfit(name)                --alterado v1.9 \/
local path = "data/monster/pokes/Shiny/"..name..".xml"
local tpw = io.type(io.open(path))

if not tpw then
   path = "data/monster/pokes/geracao 2/"..name..".xml"
   tpw = io.type(io.open(path))
end
if not tpw then
   path = "data/monster/pokes/geracao 1/"..name..".xml"
   tpw = io.type(io.open(path))
end
if not tpw then
   path = "data/monster/pokes/"..name..".xml"
   tpw = io.type(io.open(path))
end   
if not tpw then
   return print("[getPokemonXMLOutfit] Poke with name: "..name.." ins't in any paste on monster/pokes/") and 2
end
   local arq = io.open(path, "a+")
   local txt = arq:read("*all")
   arq:close()
   local a, b = txt:find('look type="(.-)"')
   txt = string.sub(txt, a + 11, b - 1)
return tonumber(txt)
end 

function doEvolutionOutfit(cid, oldout, outfit)
    if not isCreature(cid) then return true end
        if getCreatureOutfit(cid).lookType == oldout then
            doSetCreatureOutfit(cid, {lookType = outfit}, -1)
        else
            doSetCreatureOutfit(cid, {lookType = oldout}, -1)
        end
end

function doSendEvolutionEffect(cid, pos, evolution, turn, ssj, evolve)
    if not isCreature(cid) then
        doSendAnimatedText(pos, "CANCEL", 215)
        return true 
    end
    if evolve then
        doEvolvePokemon(getCreatureMaster(cid), {uid = cid}, evolution, 0, 0)
    return true
    end
    doSendMagicEffect(pos, 18)
        if ssj then
            sendSSJEffect(evo)
        end
    --doEvolutionOutfit(cid, f, h)
    addEvent(doSendEvolutionEffect, math.pow(1900, turn/20), cid, getThingPos(cid), evolution, turn - 1, turn == 19, turn == 2, f, h)
end

function sendSSJEffect(cid)
    if not isCreature(cid) then return true end
    local pos1 = getThingPos(cid)
    local pos2 = getThingPos(cid)
    pos2.x = pos2.x + math.random(-1, 1)
    pos2.y = pos2.y - math.random(1, 2)
    doSendDistanceShoot(pos1, pos2, 37)
    addEvent(sendSSJEffect, 45, cid)
end

function sendFinishEvolutionEffect(cid, alternate)
    if not isCreature(cid) then return true end
    local pos1 = getThingPos(cid)

    if alternate then
        local pos = {
        [1] = {-2, 0},
        [2] = {-1, -1},
        [3] = {0, -2},
        [4] = {1, -1},
        [5] = {2, 0},
        [6] = {1, 1},
        [7] = {0, 2},
        [8] = {-1, 1}}
        for a = 1, 8 do
            local pos2 = getThingPos(cid)
            pos2.x = pos2.x + pos[a][1]
            pos2.y = pos2.y + pos[a][2]
            local pos = getThingPos(cid)
            doSendDistanceShoot(pos2, pos, 37)
            addEvent(doSendDistanceShoot, 300, pos, pos2, 37)
        end
    else
        for a = 0, 3 do
            doSendDistanceShoot(pos1, getPosByDir(pos1, a), 37)
        end
        for a = 4, 7 do
            addEvent(doSendDistanceShoot, 600, pos1, getPosByDir(pos1, a), 37)
        end
    end
end

-- Tradução: doEvolvePokemon(player, cid(poke), evolução, stone1, stone2)
function doEvolvePokemon(cid, item2, theevo, stone1, stone2, count1, count2) -- item2 é uma tabela, item.uid == cid (item2.uid é o poke q está evoluindo, gamb)

    if not isCreature(cid) then return true end
    
    if not pokes[theevo] or not pokes[theevo].offense then
    doReturnPokemon(cid, item2.uid, getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect, false, true)
    return true
    end

    local owner = getCreatureMaster(item2.uid) -- getCreatureMatser(cid) -- gamb proposital
    local pokeball = getPlayerSlotItem(cid, ?
    local description = "Contains a "..theevo.."."
    local pct = getCreatureHealth(item2.uid) / getCreatureMaxHealth(item2.uid)

        doItemSetAttribute(pokeball.uid, "hp", pct)

        doItemSetAttribute(pokeball.uid, "poke", theevo)
        doItemSetAttribute(pokeball.uid, "description", "Contains a "..theevo..".")
        doItemSetAttribute(pokeball.uid, "current_addon", "normal")
        doItemSetAttribute(pokeball.uid, "addons", "{}")

        local str = "Contains a "..getItemAttribute(pokeball.uid, "poke").."."
        if getItemAttribute(pokeball.uid, "nick") then
            str = str.."\nIt's nickname is: "..getItemAttribute(pokeball.uid, "nick").."."
        end
        doItemSetAttribute(pokeball.uid, "description", str.."\n")

        doPlayerSendTextMessage(cid, 27, "Parabéns! Seu "..getPokeName(item2.uid).." evoluiu para um "..theevo.."!")        

        doSendMagicEffect(getThingPos(item2.uid), 18)
        doItemSetAttribute(pokeball.uid, "tadport", fotos[theevo])
        doUpdatePokemonsBar(cid)
        doTransformItem(getPlayerSlotItem(cid, 7).uid, fotos[theevo])
        doSendMagicEffect(getThingPos(cid), 173)

        local oldpos = getThingPos(item2.uid)
        local oldlod = getCreatureLookDir(item2.uid)
        local poke_infos = {level = getMonsterLevel(item2.uid), exp = getMonsterExperience(item2.uid)}
        doRemoveCreature(item2.uid)

        doSummonMonster(cid, theevo)
        local pk = getCreatureSummons(cid)[1]

        doMonsterSetLevel(pk, poke_infos.level, poke_infos.exp)
        doTeleportThing(pk, oldpos, false)
        doCreatureSetLookDir(pk, oldlod)

        sendFinishEvolutionEffect(pk, true)
        addEvent(sendFinishEvolutionEffect, 550, pk, true)
        addEvent(sendFinishEvolutionEffect, 1050, pk)
        
        if stone1 then
            doPlayerRemoveItem(cid, stone1, count1 and count1 or 1)
        end
        if stone2 then
            if count2 and tonumber(count2) > 0 then
                doPlayerRemoveItem(cid, stone2, count2)
            elseif isInArray(specialevo, theevo) then
                doPlayerRemoveItem(cid, stone2, 1)
            end    
        end

        doAddPokemonInOwnList(cid, theevo)

        local happy = getItemAttribute(pokeball.uid, "happy")

        doItemSetAttribute(pokeball.uid, "happy", happy + happyGainedOnEvolution)

        if happy + happyGainedOnEvolution > 255 then
            doItemSetAttribute(pokeball.uid, "happy", 255)
        end

        adjustStatus(pk, pokeball.uid, true, false)

        if useKpdoDlls then
            doUpdateMoves(cid)
            doPlayerSendCancel(owner, "")
            doPlayerSave(cid)
        end
end

function doMathDecimal(number, casas)

    if math.floor(number) == number then return number end

    local c = casas and casas + 1 or 3

    for a = 0, 10 do
        if math.floor(number) < math.pow(10, a) then
            local str = string.sub(""..number.."", 1, a + c)
            return tonumber(str)    
        end
    end

return number
end

function doAdjustWithDelay(cid, pk, health, vit, status)
if isCreature(cid) then                                   
   adjustStatus(pk, getPlayerSlotItem(cid, 8).uid, health, vir, status)
end
end

function adjustStatus(pk, item, health, vite, conditions) -- Balanceamento dos pokes de player  -- slk voce é o cara msm kkkk

    if not isCreature(pk) then return true end

    local gender = getItemAttribute(item, "gender") and getItemAttribute(item, "gender") or 0
--    addEvent(doCreatureSetSkullType, 10, pk, gender)
    
    --[[if getMasterLevel(pk) > 600 then
        pokemonLevel = 600
    else
        pokemonLevel = getMasterLevel(pk)
    end]]
    local pokemonLevel = getMonsterLevel(pk) -- OrochiElf
    
    local statusReduction = 1 -- sem redução
    if getItemAttribute(item, "statusReduction") and tonumber(getItemAttribute(item, "statusReduction")) > 0 then -- SL
        statusReduction = 1 - (tonumber(getItemAttribute(item, "statusReduction"))/100) -- De 4% a 10% de redução de status ao evoluir antecipadamente    
    end

    
    
    local sttsOffense = math.ceil( ( pokes[getCreatureName(pk)].offense * ((pokemonLevel + getPokemonBoost(pk))/1.6) ) * statusReduction )
    local sttsDefense = math.ceil( ( pokes[getCreatureName(pk)].defense * 1.4 ) * statusReduction )
    local sttsAgility = math.ceil( ( pokes[getCreatureName(pk)].agility + pokemonLevel / 2 ) * statusReduction )
    local sttsVitality = math.ceil( ( pokes[getCreatureName(pk)].vitality * (85 + pokemonLevel) ) * statusReduction )
    local sttsSpecialAttack = math.ceil( ( pokes[getCreatureName(pk)].specialattack * (pokemonLevel / 1.45 + getPokemonBoost(pk) )*9 ) * statusReduction )
    
    
    setPlayerStorageValue(pk, 1001, sttsOffense)
    setPlayerStorageValue(pk, 1002, sttsDefense)             
    setPlayerStorageValue(pk, 1003, sttsAgility)
    setPlayerStorageValue(pk, 1004, sttsVitality)
    setPlayerStorageValue(pk, 1005, sttsSpecialAttack)
    
    if vite == true then
        local pct = getCreatureHealth(pk) / getCreatureMaxHealth(pk)
        local vit = getVitality(pk)
        setCreatureMaxHealth(pk, math.ceil( vit * HPperVITsummon ))
        doCreatureAddHealth(pk, pct * vit * HPperVITsummon)
    end
                                                                      
    doRegainSpeed(pk)  

    local nick = getItemAttribute(item, "poke")

    if isGhostPokemon(pk) then
       setPlayerStorageValue(pk, 8981, 1)
       updateGhostWalk(pk)
    end
        

    if getItemAttribute(item, "nick") then
        nick = getItemAttribute(item, "nick")
    end

    setPlayerStorageValue(pk, 1007, nick)
    
    local lvl = getItemAttribute(item, "level") or 0
    nick = nick
    
    -- doCreatureSetNick(pk, nick.." [+ "..boost.."]")

    if not getItemAttribute(item, "happy") then
        doItemSetAttribute(item, "happy", 120)
    end

    if not getItemAttribute(item, "hunger") then
        doItemSetAttribute(item, "hunger", 5)
    end

    local happy = getItemAttribute(item, "happy")
        if happy < 0 then
            happy = 1
        end
    setPlayerStorageValue(pk, 1008, happy)

    local hunger = getItemAttribute(item, "hunger")
    setPlayerStorageValue(pk, 1009, hunger)

    if health == true then
        local mh = HPperVITsummon * getVitality(pk)
        local rd = 1 - (tonumber(getItemAttribute(item, "hp")))
        setCreatureMaxHealth(pk, mh)                                  
        doCreatureAddHealth(pk, getCreatureMaxHealth(pk))
        doCreatureAddHealth(pk, -(getCreatureMaxHealth(pk) * rd))
    end

    if isSummon(pk) and conditions then
        local burn = getItemAttribute(item, "burn")   
        if burn and burn >= 0 then
           local ret = {id = pk, cd = burn, check = false, damage = getItemAttribute(item, "burndmg"), cond = "Burn"}
           addEvent(doCondition2, 3500, ret)
        end

        local poison = getItemAttribute(item, "poison")
        if poison and poison >= 0 then
           local ret = {id = pk, cd = poison, check = false, damage = getItemAttribute(item, "poisondmg"), cond = "Poison"}
           addEvent(doCondition2, 1500, ret)
        end

        local confuse = getItemAttribute(item, "confuse")
        if confuse and confuse >= 0 then
           local ret = {id = pk, cd = confuse, check = false, cond = "Confusion"}
           addEvent(doCondition2, 1200, ret)                                                
        end

        local sleep = getItemAttribute(item, "sleep")
        if sleep and sleep >= 0 then
           local ret = {id = pk, cd = sleep, check = false, first = true, cond = "Sleep"}
           doCondition2(ret)
        end
        
        local freeze = getItemAttribute(item, "Freeze")
        if freeze and freeze >= 0 then
           local ret = {id = pk, cd = freeze, check = false, first = true, cond = "Freeze"}
           doCondition2(ret)
        end
        
        local miss = getItemAttribute(item, "miss")     
        if miss and miss >= 0 then      
          local ret = {id = pk, cd = miss, eff = getItemAttribute(item, "missEff"), check = false, spell = getItemAttribute(item, "missSpell"), cond = "Miss"}
          doCondition2(ret)
        end
        
        local fear = getItemAttribute(item, "fear")
        if fear and fear >= 0 then
           local ret = {id = pk, cd = fear, check = false, skill = getItemAttribute(item, "fearSkill"), cond = "Fear"}
           doCondition2(ret)
        end
        
        local silence = getItemAttribute(item, "silence")
        if silence and silence >= 0 then      
           local ret = {id = pk, cd = silence, eff = getItemAttribute(item, "silenceEff"), check = false, cond = "Silence"}
           doCondition2(ret)
        end                                     
        
        local stun = getItemAttribute(item, "stun")
        if stun and stun >= 0 then
           local ret = {id = pk, cd = stun, eff = getItemAttribute(item, "stunEff"), check = false, spell = getItemAttribute(item, "stunSpell"), cond = "Stun"}
           doCondition2(ret)
        end 
                                                       
        local paralyze = getItemAttribute(item, "paralyze")
        if paralyze and paralyze >= 0 then
           local ret = {id = pk, cd = paralyze, eff = getItemAttribute(item, "paralyzeEff"), check = false, first = true, cond = "Paralyze"}
           doCondition2(ret)
        end  
                                                     
        local slow = getItemAttribute(item, "slow")
        if slow and slow >= 0 then
           local ret = {id = pk, cd = slow, eff = getItemAttribute(item, "slowEff"), check = false, first = true, cond = "Slow"}
           doCondition2(ret)
        end                                              
        
        local leech = getItemAttribute(item, "leech")
        if leech and leech >= 0 then
           local ret = {id = pk, cd = leech, attacker = 0, check = false, damage = getItemAttribute(item, "leechdmg"), cond = "Leech"}
           doCondition2(ret)
        end                               
        
        for i = 1, 3 do
            local buff = getItemAttribute(item, "Buff"..i)
            if buff and buff >= 0 then
               local ret = {id = pk, cd = buff, eff = getItemAttribute(item, "Buff"..i.."eff"), check = false, 
               buff = getItemAttribute(item, "Buff"..i.."skill"), first = true, attr = "Buff"..i}
               doCondition2(ret)
            end
        end
               
    end
                                                                          --alterado v1.9
    if getItemAttribute(item, "boost") and getItemAttribute(item, "boost") >= 50 and getItemAttribute(item, "aura") then
       sendAuraEffect(pk, auraSyst[getItemAttribute(item, "aura")])        
    end
    
    if getPlayerStorageValue(getCreatureMaster(pk), 6598754) >= 1 then
        setPlayerStorageValue(pk, 6598754, 1)                               
    elseif getPlayerStorageValue(getCreatureMaster(pk), 6598755) >= 1 then
        setPlayerStorageValue(pk, 6598755, 1)
    end

return true
end

function setWildPokemonLevel(cid, optionalLevel, optionalStatus, optionalNick, optionalExtraExp)

    if not isCreature(cid) then return true end
    if not pokes[getCreatureName(cid)] then return true end  --alterado v2.6

    local levelRange = 0
    local off = 0
    local def = 0
    local agi = 0
    local spatk = 0
    local vit = 0
    local this = getCreatureName(cid)
    local ee = 1

    if optionalExtraExp then
        ee = optionalExtraExp
    end


    if optionalLevel and tonumber(optionalLevel) >= 1 then                --alterado v2.8\/
        levelRange = optionalLevel
    else
        levelRange = math.random(pokes[this].wildLvlMin, pokes[this].wildLvlMax) 
    end                                                                                          

    local status = getPokemonStatus(this)
        if status then
            off = status.off
            def = status.def
            agi = status.agi
            vit = status.vit
            spatk = status.spatk
        end

    setPlayerStorageValue(cid, 1000, (levelRange > 100 and 100 or levelRange)) --alterado v2.8

    if optionalStatus and optionalStatus.off then
        setPlayerStorageValue(cid, 1001, optionalStatus.offense)
        setPlayerStorageValue(cid, 1002, optionalStatus.defense)
        setPlayerStorageValue(cid, 1003, optionalStatus.agility)
        setPlayerStorageValue(cid, 1004, optionalStatus.vitality)
        setPlayerStorageValue(cid, 1005, optionalStatus.specialattack)
        setPlayerStorageValue(cid, 1011, optionalStatus.offense)
        setPlayerStorageValue(cid, 1012, optionalStatus.defense)
        setPlayerStorageValue(cid, 1013, optionalStatus.agility)
        setPlayerStorageValue(cid, 1014, optionalStatus.vitality)
        setPlayerStorageValue(cid, 1015, optionalStatus.specialattack)
    else
        setPlayerStorageValue(cid, 1001, 5 + math.random(off * levelRange * 0.9, off * levelRange * 2.8))
        setPlayerStorageValue(cid, 1002, 5 + math.random(def * levelRange * 0.9, def * levelRange * 1.8))
        setPlayerStorageValue(cid, 1003, math.random(agi * levelRange * 0.9, agi * levelRange * 1.8))
        setPlayerStorageValue(cid, 1004, math.random(vit * levelRange * 0.9, vit * levelRange * 2.0))
        setPlayerStorageValue(cid, 1005, 5 + math.random(spatk * levelRange * 0.9, spatk * levelRange * 2.2))
        setPlayerStorageValue(cid, 1011, getPlayerStorageValue(cid, 1001))
        setPlayerStorageValue(cid, 1012, getPlayerStorageValue(cid, 1002))
        setPlayerStorageValue(cid, 1013, getPlayerStorageValue(cid, 1003))
        setPlayerStorageValue(cid, 1014, getPlayerStorageValue(cid, 1004))
        setPlayerStorageValue(cid, 1015, getPlayerStorageValue(cid, 1005))
    end

    doRegainSpeed(cid)

    setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + getPlayerStorageValue(cid, 1004) * HPperVIT * vitReductionForWild)
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
    
    if pokes[getCreatureName(cid)].exp then
        --getMonsterInfo(getCreatureName(cid)).experience
        local exp = (50 + pokes[getCreatureName(cid)].exp) * baseExpRate + pokes[getCreatureName(cid)].vitality * levelRange * pokemonExpPerLevelRate
        setPlayerStorageValue(cid, 1006, exp * generalExpRate * ee)
        if getPlayerStorageValue(cid, 22546) == 1 then
          setPlayerStorageValue(cid, 1006, 750)
          doSetCreatureDropLoot(cid, false)         --edited golden arena
       end  
    end

    local wildshow = wildBeforeNames and "Wild " or ""
    if optionalNick then
        if hideWildsLevel then
            doCreatureSetNick(cid, optionalNick)
        else
            doCreatureSetNick(cid, optionalNick.." ["..getWildPokemonLevel(cid).."]")
        end
    else
        if hideWildsLevel then
            doCreatureSetNick(cid, ""..wildshow..""..getCreatureName(cid).."")
        else
            doCreatureSetNick(cid, ""..wildshow..""..getCreatureName(cid).." ["..getWildPokemonLevel(cid).."]")
        end
    end
end

function getOffense(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1001) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1001))
end

function getDefense(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1002) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1002))
end

function getSpeed(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1003) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1003))
end

function getVitality(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1004) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1004))
end

function getSpecialAttack(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1005) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1005))
end

function getHappiness(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1008) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1008))
end

function getSpecialDefense(cid)
    if not isCreature(cid) then return 0 end
return math.ceil(tonumber(getSpecialAttack(cid) * 0.85 + getDefense(cid) * 0.2))     
end

function getPokemonLevel(cid, dex)
if not isCreature(cid) then return 0 end 
    if not dex then                      --alterado v1.9
       if ehMonstro(cid) and getPlayerStorageValue(cid, 1000) > 0 then  
          return getPlayerStorageValue(cid, 1000)
       elseif ehMonstro(cid) then 
          return pokes[getCreatureName(cid)].wildLvl             
       end
    end   
return pokes[getCreatureName(cid)].level
end

function getPokemonLevelByName(name)
return pokes[name] and pokes[name].level or 0  --alterado v1.9
end

function getMasterLevel(poke)
    if not isSummon(poke) then return 0 end
return getPlayerLevel(getCreatureMaster(poke))
end

function getPokemonBoost(poke)
    if not isSummon(poke) then return 0 end
return getItemAttribute(getPlayerSlotItem(getCreatureMaster(poke), 8).uid, "boost") or 0
end

function getPokeballBoost(ball)
    if not isPokeball(ball.itemid) then return 0 end  --alterado v1.8
return getItemAttribute(ball.uid, "boost") or 0
end

function getPokeName(cid)
    if not isSummon(cid) then return getCreatureName(cid) end
    if getCreatureName(cid) == "Evolution" then return getPlayerStorageValue(cid, 1007) end
    
local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
    if getItemAttribute(item.uid, "nick") then
       return getItemAttribute(item.uid, "nick")
    end
return getCreatureName(cid)
end

function getPokeballName(item, truename)
if not truename and getItemAttribute(item, "nick") then
return getItemAttribute(item, "nick")
end
return getItemAttribute(item, "poke")
end

function getPokemonName(cid)
return getCreatureName(cid)
end

function getPokemonGender(cid) --alterado v1.9
return getCreatureSkullType(cid)
end

function setPokemonGender(cid, gender)
if isCreature(cid) and gender then        --alterado v1.8
   doCreatureSetSkullType(cid, gender)
   return true
end
return false
end

function getWildPokemonExp(cid)
return getPlayerStorageValue(cid, 1006)
end

 

 

Link para o comentário
Compartilhar em outros sites

  • 0
37 minutos atrás, Deadpool disse:
  Mostrar conteúdo oculto




function adjustWildPoke(cid, health) -- Balanceamento dos selvagens
----------------------------------------------
if isMonster(cid) and pokes[getCreatureName(cid)] then
    ----------------------------------------------
    local level = getPokemonLevel(cid) * 2.0
    ------------BALANCEAMENTO-SELVAGEM------------
    ---(Os status são multiplicados com o wildlvl, você irá ajustar as multiplições adicionais com as informações abaixo.)---
    local basic = 1 ---Ataques basicos +20%
    local defesa = 1.1 ---Defesa -20% (Use numeros abaixo do 0 para diminuir a multiplica??o.)
    local agilidade =  1.3 ----Agilidade +10%
    local vida = 1.2 ---Vida +20%
    local move = 20 ----movimento especial +400% (Essa foi inalterada j? estava assim)
    ----------------------------------------------
    
    -- * 1 = normal
    -- * 1.4 = 40% mais forte
    -- * 0.7 = 30% mais fraco (pq é 1 - 0.3)
    
    
    local wildOff = (pokes[getCreatureName(cid)].offense * level * basic) * 1.2 -- 20%
    local wildDef = (pokes[getCreatureName(cid)].defense * defesa) * 1.2 -- 10%
    local wildAgility = (pokes[getCreatureName(cid)].agility * agilidade) * 0.8
    local wildVit = (pokes[getCreatureName(cid)].vitality * level * vida)
    local wildSpAtk = (pokes[getCreatureName(cid)].specialattack * (move + level))* 3
    
    
    setPlayerStorageValue(cid, 1000, level) --alterado v1.8
    setPlayerStorageValue(cid, 1001, wildOff)
    setPlayerStorageValue(cid, 1002, wildDef)
    setPlayerStorageValue(cid, 1003, wildAgility)                                  
    setPlayerStorageValue(cid, 1004, wildVit)
    setPlayerStorageValue(cid, 1005, wildSpAtk)
    ----------------------------------------------
    --vv---------------PARTE DE BAIXO NãO FOI MECHIDA---------------vv--
    doRegainSpeed(cid)         --alterado!
    setCreatureMaxHealth(cid, (getVitality(cid) * HPperVITwild))
    
    local curhealth = health or getCreatureMaxHealth(cid)
    doCreatureAddHealth(cid,  - getCreatureHealth(cid) + curhealth)
    -- doCreatureSetNick(pk, getCreatureName(cid).." ["..level.."]")
    
    registerCreatureEvent(cid, "WildEvolve")
    
    if pokes[getCreatureName(cid)].exp then
       local exp = pokes[getCreatureName(cid)].exp * baseExpRate + pokes[getCreatureName(cid)].vitality * pokemonExpPerLevelRate
       setPlayerStorageValue(cid, 1006, (exp * generalExpRate/2)*10)
       if getPlayerStorageValue(cid, 22546) == 1 then
          setPlayerStorageValue(cid, 1006, 750)
          doSetCreatureDropLoot(cid, false)      
       end   
    end
end
end       

function getPokemonXMLOutfit(name)                --alterado v1.9 \/
local path = "data/monster/pokes/Shiny/"..name..".xml"
local tpw = io.type(io.open(path))

if not tpw then
   path = "data/monster/pokes/geracao 2/"..name..".xml"
   tpw = io.type(io.open(path))
end
if not tpw then
   path = "data/monster/pokes/geracao 1/"..name..".xml"
   tpw = io.type(io.open(path))
end
if not tpw then
   path = "data/monster/pokes/"..name..".xml"
   tpw = io.type(io.open(path))
end   
if not tpw then
   return print("[getPokemonXMLOutfit] Poke with name: "..name.." ins't in any paste on monster/pokes/") and 2
end
   local arq = io.open(path, "a+")
   local txt = arq:read("*all")
   arq:close()
   local a, b = txt:find('look type="(.-)"')
   txt = string.sub(txt, a + 11, b - 1)
return tonumber(txt)
end 

function doEvolutionOutfit(cid, oldout, outfit)
    if not isCreature(cid) then return true end
        if getCreatureOutfit(cid).lookType == oldout then
            doSetCreatureOutfit(cid, {lookType = outfit}, -1)
        else
            doSetCreatureOutfit(cid, {lookType = oldout}, -1)
        end
end

function doSendEvolutionEffect(cid, pos, evolution, turn, ssj, evolve)
    if not isCreature(cid) then
        doSendAnimatedText(pos, "CANCEL", 215)
        return true 
    end
    if evolve then
        doEvolvePokemon(getCreatureMaster(cid), {uid = cid}, evolution, 0, 0)
    return true
    end
    doSendMagicEffect(pos, 18)
        if ssj then
            sendSSJEffect(evo)
        end
    --doEvolutionOutfit(cid, f, h)
    addEvent(doSendEvolutionEffect, math.pow(1900, turn/20), cid, getThingPos(cid), evolution, turn - 1, turn == 19, turn == 2, f, h)
end

function sendSSJEffect(cid)
    if not isCreature(cid) then return true end
    local pos1 = getThingPos(cid)
    local pos2 = getThingPos(cid)
    pos2.x = pos2.x + math.random(-1, 1)
    pos2.y = pos2.y - math.random(1, 2)
    doSendDistanceShoot(pos1, pos2, 37)
    addEvent(sendSSJEffect, 45, cid)
end

function sendFinishEvolutionEffect(cid, alternate)
    if not isCreature(cid) then return true end
    local pos1 = getThingPos(cid)

    if alternate then
        local pos = {
        [1] = {-2, 0},
        [2] = {-1, -1},
        [3] = {0, -2},
        [4] = {1, -1},
        [5] = {2, 0},
        [6] = {1, 1},
        [7] = {0, 2},
        [8] = {-1, 1}}
        for a = 1, 8 do
            local pos2 = getThingPos(cid)
            pos2.x = pos2.x + pos[a][1]
            pos2.y = pos2.y + pos[a][2]
            local pos = getThingPos(cid)
            doSendDistanceShoot(pos2, pos, 37)
            addEvent(doSendDistanceShoot, 300, pos, pos2, 37)
        end
    else
        for a = 0, 3 do
            doSendDistanceShoot(pos1, getPosByDir(pos1, a), 37)
        end
        for a = 4, 7 do
            addEvent(doSendDistanceShoot, 600, pos1, getPosByDir(pos1, a), 37)
        end
    end
end

-- Tradução: doEvolvePokemon(player, cid(poke), evolução, stone1, stone2)
function doEvolvePokemon(cid, item2, theevo, stone1, stone2, count1, count2) -- item2 é uma tabela, item.uid == cid (item2.uid é o poke q está evoluindo, gamb)

    if not isCreature(cid) then return true end
    
    if not pokes[theevo] or not pokes[theevo].offense then
    doReturnPokemon(cid, item2.uid, getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect, false, true)
    return true
    end

    local owner = getCreatureMaster(item2.uid) -- getCreatureMatser(cid) -- gamb proposital
    local pokeball = getPlayerSlotItem(cid, ?
    local description = "Contains a "..theevo.."."
    local pct = getCreatureHealth(item2.uid) / getCreatureMaxHealth(item2.uid)

        doItemSetAttribute(pokeball.uid, "hp", pct)

        doItemSetAttribute(pokeball.uid, "poke", theevo)
        doItemSetAttribute(pokeball.uid, "description", "Contains a "..theevo..".")
        doItemSetAttribute(pokeball.uid, "current_addon", "normal")
        doItemSetAttribute(pokeball.uid, "addons", "{}")

        local str = "Contains a "..getItemAttribute(pokeball.uid, "poke").."."
        if getItemAttribute(pokeball.uid, "nick") then
            str = str.."\nIt's nickname is: "..getItemAttribute(pokeball.uid, "nick").."."
        end
        doItemSetAttribute(pokeball.uid, "description", str.."\n")

        doPlayerSendTextMessage(cid, 27, "Parabéns! Seu "..getPokeName(item2.uid).." evoluiu para um "..theevo.."!")        

        doSendMagicEffect(getThingPos(item2.uid), 18)
        doItemSetAttribute(pokeball.uid, "tadport", fotos[theevo])
        doUpdatePokemonsBar(cid)
        doTransformItem(getPlayerSlotItem(cid, 7).uid, fotos[theevo])
        doSendMagicEffect(getThingPos(cid), 173)

        local oldpos = getThingPos(item2.uid)
        local oldlod = getCreatureLookDir(item2.uid)
        local poke_infos = {level = getMonsterLevel(item2.uid), exp = getMonsterExperience(item2.uid)}
        doRemoveCreature(item2.uid)

        doSummonMonster(cid, theevo)
        local pk = getCreatureSummons(cid)[1]

        doMonsterSetLevel(pk, poke_infos.level, poke_infos.exp)
        doTeleportThing(pk, oldpos, false)
        doCreatureSetLookDir(pk, oldlod)

        sendFinishEvolutionEffect(pk, true)
        addEvent(sendFinishEvolutionEffect, 550, pk, true)
        addEvent(sendFinishEvolutionEffect, 1050, pk)
        
        if stone1 then
            doPlayerRemoveItem(cid, stone1, count1 and count1 or 1)
        end
        if stone2 then
            if count2 and tonumber(count2) > 0 then
                doPlayerRemoveItem(cid, stone2, count2)
            elseif isInArray(specialevo, theevo) then
                doPlayerRemoveItem(cid, stone2, 1)
            end    
        end

        doAddPokemonInOwnList(cid, theevo)

        local happy = getItemAttribute(pokeball.uid, "happy")

        doItemSetAttribute(pokeball.uid, "happy", happy + happyGainedOnEvolution)

        if happy + happyGainedOnEvolution > 255 then
            doItemSetAttribute(pokeball.uid, "happy", 255)
        end

        adjustStatus(pk, pokeball.uid, true, false)

        if useKpdoDlls then
            doUpdateMoves(cid)
            doPlayerSendCancel(owner, "")
            doPlayerSave(cid)
        end
end

function doMathDecimal(number, casas)

    if math.floor(number) == number then return number end

    local c = casas and casas + 1 or 3

    for a = 0, 10 do
        if math.floor(number) < math.pow(10, a) then
            local str = string.sub(""..number.."", 1, a + c)
            return tonumber(str)    
        end
    end

return number
end

function doAdjustWithDelay(cid, pk, health, vit, status)
if isCreature(cid) then                                   
   adjustStatus(pk, getPlayerSlotItem(cid, 8).uid, health, vir, status)
end
end

function adjustStatus(pk, item, health, vite, conditions) -- Balanceamento dos pokes de player  -- slk voce é o cara msm kkkk

    if not isCreature(pk) then return true end

    local gender = getItemAttribute(item, "gender") and getItemAttribute(item, "gender") or 0
--    addEvent(doCreatureSetSkullType, 10, pk, gender)
    
    --[[if getMasterLevel(pk) > 600 then
        pokemonLevel = 600
    else
        pokemonLevel = getMasterLevel(pk)
    end]]
    local pokemonLevel = getMonsterLevel(pk) -- OrochiElf
    
    local statusReduction = 1 -- sem redução
    if getItemAttribute(item, "statusReduction") and tonumber(getItemAttribute(item, "statusReduction")) > 0 then -- SL
        statusReduction = 1 - (tonumber(getItemAttribute(item, "statusReduction"))/100) -- De 4% a 10% de redução de status ao evoluir antecipadamente    
    end

    
    
    local sttsOffense = math.ceil( ( pokes[getCreatureName(pk)].offense * ((pokemonLevel + getPokemonBoost(pk))/1.6) ) * statusReduction )
    local sttsDefense = math.ceil( ( pokes[getCreatureName(pk)].defense * 1.4 ) * statusReduction )
    local sttsAgility = math.ceil( ( pokes[getCreatureName(pk)].agility + pokemonLevel / 2 ) * statusReduction )
    local sttsVitality = math.ceil( ( pokes[getCreatureName(pk)].vitality * (85 + pokemonLevel) ) * statusReduction )
    local sttsSpecialAttack = math.ceil( ( pokes[getCreatureName(pk)].specialattack * (pokemonLevel / 1.45 + getPokemonBoost(pk) )*9 ) * statusReduction )
    
    
    setPlayerStorageValue(pk, 1001, sttsOffense)
    setPlayerStorageValue(pk, 1002, sttsDefense)             
    setPlayerStorageValue(pk, 1003, sttsAgility)
    setPlayerStorageValue(pk, 1004, sttsVitality)
    setPlayerStorageValue(pk, 1005, sttsSpecialAttack)
    
    if vite == true then
        local pct = getCreatureHealth(pk) / getCreatureMaxHealth(pk)
        local vit = getVitality(pk)
        setCreatureMaxHealth(pk, math.ceil( vit * HPperVITsummon ))
        doCreatureAddHealth(pk, pct * vit * HPperVITsummon)
    end
                                                                      
    doRegainSpeed(pk)  

    local nick = getItemAttribute(item, "poke")

    if isGhostPokemon(pk) then
       setPlayerStorageValue(pk, 8981, 1)
       updateGhostWalk(pk)
    end
        

    if getItemAttribute(item, "nick") then
        nick = getItemAttribute(item, "nick")
    end

    setPlayerStorageValue(pk, 1007, nick)
    
    local lvl = getItemAttribute(item, "level") or 0
    nick = nick
    
    -- doCreatureSetNick(pk, nick.." [+ "..boost.."]")

    if not getItemAttribute(item, "happy") then
        doItemSetAttribute(item, "happy", 120)
    end

    if not getItemAttribute(item, "hunger") then
        doItemSetAttribute(item, "hunger", 5)
    end

    local happy = getItemAttribute(item, "happy")
        if happy < 0 then
            happy = 1
        end
    setPlayerStorageValue(pk, 1008, happy)

    local hunger = getItemAttribute(item, "hunger")
    setPlayerStorageValue(pk, 1009, hunger)

    if health == true then
        local mh = HPperVITsummon * getVitality(pk)
        local rd = 1 - (tonumber(getItemAttribute(item, "hp")))
        setCreatureMaxHealth(pk, mh)                                  
        doCreatureAddHealth(pk, getCreatureMaxHealth(pk))
        doCreatureAddHealth(pk, -(getCreatureMaxHealth(pk) * rd))
    end

    if isSummon(pk) and conditions then
        local burn = getItemAttribute(item, "burn")   
        if burn and burn >= 0 then
           local ret = {id = pk, cd = burn, check = false, damage = getItemAttribute(item, "burndmg"), cond = "Burn"}
           addEvent(doCondition2, 3500, ret)
        end

        local poison = getItemAttribute(item, "poison")
        if poison and poison >= 0 then
           local ret = {id = pk, cd = poison, check = false, damage = getItemAttribute(item, "poisondmg"), cond = "Poison"}
           addEvent(doCondition2, 1500, ret)
        end

        local confuse = getItemAttribute(item, "confuse")
        if confuse and confuse >= 0 then
           local ret = {id = pk, cd = confuse, check = false, cond = "Confusion"}
           addEvent(doCondition2, 1200, ret)                                                
        end

        local sleep = getItemAttribute(item, "sleep")
        if sleep and sleep >= 0 then
           local ret = {id = pk, cd = sleep, check = false, first = true, cond = "Sleep"}
           doCondition2(ret)
        end
        
        local freeze = getItemAttribute(item, "Freeze")
        if freeze and freeze >= 0 then
           local ret = {id = pk, cd = freeze, check = false, first = true, cond = "Freeze"}
           doCondition2(ret)
        end
        
        local miss = getItemAttribute(item, "miss")     
        if miss and miss >= 0 then      
          local ret = {id = pk, cd = miss, eff = getItemAttribute(item, "missEff"), check = false, spell = getItemAttribute(item, "missSpell"), cond = "Miss"}
          doCondition2(ret)
        end
        
        local fear = getItemAttribute(item, "fear")
        if fear and fear >= 0 then
           local ret = {id = pk, cd = fear, check = false, skill = getItemAttribute(item, "fearSkill"), cond = "Fear"}
           doCondition2(ret)
        end
        
        local silence = getItemAttribute(item, "silence")
        if silence and silence >= 0 then      
           local ret = {id = pk, cd = silence, eff = getItemAttribute(item, "silenceEff"), check = false, cond = "Silence"}
           doCondition2(ret)
        end                                     
        
        local stun = getItemAttribute(item, "stun")
        if stun and stun >= 0 then
           local ret = {id = pk, cd = stun, eff = getItemAttribute(item, "stunEff"), check = false, spell = getItemAttribute(item, "stunSpell"), cond = "Stun"}
           doCondition2(ret)
        end 
                                                       
        local paralyze = getItemAttribute(item, "paralyze")
        if paralyze and paralyze >= 0 then
           local ret = {id = pk, cd = paralyze, eff = getItemAttribute(item, "paralyzeEff"), check = false, first = true, cond = "Paralyze"}
           doCondition2(ret)
        end  
                                                     
        local slow = getItemAttribute(item, "slow")
        if slow and slow >= 0 then
           local ret = {id = pk, cd = slow, eff = getItemAttribute(item, "slowEff"), check = false, first = true, cond = "Slow"}
           doCondition2(ret)
        end                                              
        
        local leech = getItemAttribute(item, "leech")
        if leech and leech >= 0 then
           local ret = {id = pk, cd = leech, attacker = 0, check = false, damage = getItemAttribute(item, "leechdmg"), cond = "Leech"}
           doCondition2(ret)
        end                               
        
        for i = 1, 3 do
            local buff = getItemAttribute(item, "Buff"..i)
            if buff and buff >= 0 then
               local ret = {id = pk, cd = buff, eff = getItemAttribute(item, "Buff"..i.."eff"), check = false, 
               buff = getItemAttribute(item, "Buff"..i.."skill"), first = true, attr = "Buff"..i}
               doCondition2(ret)
            end
        end
               
    end
                                                                          --alterado v1.9
    if getItemAttribute(item, "boost") and getItemAttribute(item, "boost") >= 50 and getItemAttribute(item, "aura") then
       sendAuraEffect(pk, auraSyst[getItemAttribute(item, "aura")])        
    end
    
    if getPlayerStorageValue(getCreatureMaster(pk), 6598754) >= 1 then
        setPlayerStorageValue(pk, 6598754, 1)                               
    elseif getPlayerStorageValue(getCreatureMaster(pk), 6598755) >= 1 then
        setPlayerStorageValue(pk, 6598755, 1)
    end

return true
end

function setWildPokemonLevel(cid, optionalLevel, optionalStatus, optionalNick, optionalExtraExp)

    if not isCreature(cid) then return true end
    if not pokes[getCreatureName(cid)] then return true end  --alterado v2.6

    local levelRange = 0
    local off = 0
    local def = 0
    local agi = 0
    local spatk = 0
    local vit = 0
    local this = getCreatureName(cid)
    local ee = 1

    if optionalExtraExp then
        ee = optionalExtraExp
    end


    if optionalLevel and tonumber(optionalLevel) >= 1 then                --alterado v2.8\/
        levelRange = optionalLevel
    else
        levelRange = math.random(pokes[this].wildLvlMin, pokes[this].wildLvlMax) 
    end                                                                                          

    local status = getPokemonStatus(this)
        if status then
            off = status.off
            def = status.def
            agi = status.agi
            vit = status.vit
            spatk = status.spatk
        end

    setPlayerStorageValue(cid, 1000, (levelRange > 100 and 100 or levelRange)) --alterado v2.8

    if optionalStatus and optionalStatus.off then
        setPlayerStorageValue(cid, 1001, optionalStatus.offense)
        setPlayerStorageValue(cid, 1002, optionalStatus.defense)
        setPlayerStorageValue(cid, 1003, optionalStatus.agility)
        setPlayerStorageValue(cid, 1004, optionalStatus.vitality)
        setPlayerStorageValue(cid, 1005, optionalStatus.specialattack)
        setPlayerStorageValue(cid, 1011, optionalStatus.offense)
        setPlayerStorageValue(cid, 1012, optionalStatus.defense)
        setPlayerStorageValue(cid, 1013, optionalStatus.agility)
        setPlayerStorageValue(cid, 1014, optionalStatus.vitality)
        setPlayerStorageValue(cid, 1015, optionalStatus.specialattack)
    else
        setPlayerStorageValue(cid, 1001, 5 + math.random(off * levelRange * 0.9, off * levelRange * 2.8))
        setPlayerStorageValue(cid, 1002, 5 + math.random(def * levelRange * 0.9, def * levelRange * 1.8))
        setPlayerStorageValue(cid, 1003, math.random(agi * levelRange * 0.9, agi * levelRange * 1.8))
        setPlayerStorageValue(cid, 1004, math.random(vit * levelRange * 0.9, vit * levelRange * 2.0))
        setPlayerStorageValue(cid, 1005, 5 + math.random(spatk * levelRange * 0.9, spatk * levelRange * 2.2))
        setPlayerStorageValue(cid, 1011, getPlayerStorageValue(cid, 1001))
        setPlayerStorageValue(cid, 1012, getPlayerStorageValue(cid, 1002))
        setPlayerStorageValue(cid, 1013, getPlayerStorageValue(cid, 1003))
        setPlayerStorageValue(cid, 1014, getPlayerStorageValue(cid, 1004))
        setPlayerStorageValue(cid, 1015, getPlayerStorageValue(cid, 1005))
    end

    doRegainSpeed(cid)

    setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + getPlayerStorageValue(cid, 1004) * HPperVIT * vitReductionForWild)
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
    
    if pokes[getCreatureName(cid)].exp then
        --getMonsterInfo(getCreatureName(cid)).experience
        local exp = (50 + pokes[getCreatureName(cid)].exp) * baseExpRate + pokes[getCreatureName(cid)].vitality * levelRange * pokemonExpPerLevelRate
        setPlayerStorageValue(cid, 1006, exp * generalExpRate * ee)
        if getPlayerStorageValue(cid, 22546) == 1 then
          setPlayerStorageValue(cid, 1006, 750)
          doSetCreatureDropLoot(cid, false)         --edited golden arena
       end  
    end

    local wildshow = wildBeforeNames and "Wild " or ""
    if optionalNick then
        if hideWildsLevel then
            doCreatureSetNick(cid, optionalNick)
        else
            doCreatureSetNick(cid, optionalNick.." ["..getWildPokemonLevel(cid).."]")
        end
    else
        if hideWildsLevel then
            doCreatureSetNick(cid, ""..wildshow..""..getCreatureName(cid).."")
        else
            doCreatureSetNick(cid, ""..wildshow..""..getCreatureName(cid).." ["..getWildPokemonLevel(cid).."]")
        end
    end
end

function getOffense(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1001) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1001))
end

function getDefense(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1002) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1002))
end

function getSpeed(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1003) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1003))
end

function getVitality(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1004) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1004))
end

function getSpecialAttack(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1005) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1005))
end

function getHappiness(cid)
    if not isCreature(cid) then return 0 end
    if not getPlayerStorageValue(cid, 1008) then
        return 0
    end    
return tonumber(getPlayerStorageValue(cid, 1008))
end

function getSpecialDefense(cid)
    if not isCreature(cid) then return 0 end
return math.ceil(tonumber(getSpecialAttack(cid) * 0.85 + getDefense(cid) * 0.2))     
end

function getPokemonLevel(cid, dex)
if not isCreature(cid) then return 0 end 
    if not dex then                      --alterado v1.9
       if ehMonstro(cid) and getPlayerStorageValue(cid, 1000) > 0 then  
          return getPlayerStorageValue(cid, 1000)
       elseif ehMonstro(cid) then 
          return pokes[getCreatureName(cid)].wildLvl             
       end
    end   
return pokes[getCreatureName(cid)].level
end

function getPokemonLevelByName(name)
return pokes[name] and pokes[name].level or 0  --alterado v1.9
end

function getMasterLevel(poke)
    if not isSummon(poke) then return 0 end
return getPlayerLevel(getCreatureMaster(poke))
end

function getPokemonBoost(poke)
    if not isSummon(poke) then return 0 end
return getItemAttribute(getPlayerSlotItem(getCreatureMaster(poke), 8).uid, "boost") or 0
end

function getPokeballBoost(ball)
    if not isPokeball(ball.itemid) then return 0 end  --alterado v1.8
return getItemAttribute(ball.uid, "boost") or 0
end

function getPokeName(cid)
    if not isSummon(cid) then return getCreatureName(cid) end
    if getCreatureName(cid) == "Evolution" then return getPlayerStorageValue(cid, 1007) end
    
local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
    if getItemAttribute(item.uid, "nick") then
       return getItemAttribute(item.uid, "nick")
    end
return getCreatureName(cid)
end

function getPokeballName(item, truename)
if not truename and getItemAttribute(item, "nick") then
return getItemAttribute(item, "nick")
end
return getItemAttribute(item, "poke")
end

function getPokemonName(cid)
return getCreatureName(cid)
end

function getPokemonGender(cid) --alterado v1.9
return getCreatureSkullType(cid)
end

function setPokemonGender(cid, gender)
if isCreature(cid) and gender then        --alterado v1.8
   doCreatureSetSkullType(cid, gender)
   return true
end
return false
end

function getWildPokemonExp(cid)
return getPlayerStorageValue(cid, 1006)
end

 

 

Eu troco o scripts por esse?

Link para o comentário
Compartilhar em outros sites

  • 0
Agora, Deadpool disse:

exato

vou ver aki se vai funcionar e te falo

9 minutos atrás, Deadpool disse:

exato

deu esse erro

 

Citar

[Error - LuaScriptInterface::loadFile] data/lib/level system.lua:161: unexpected symbol near '?'
[Warning - LuaScriptInterface::initState] Cannot load data/lib/

 

e esse erro

Citar

[Error - CreatureScript Interface]
data/creaturescripts/scripts/spawn.lua:onSpawn
Description:
data/creaturescripts/scripts/spawn.lua:103: attempt to call global 'isSummon' (a nil value)
stack traceback:
        data/creaturescripts/scripts/spawn.lua:103: in function <data/creaturescripts/scripts/spawn.lua:96>

 

Link para o comentário
Compartilhar em outros sites

  • 0
4 horas atrás, rafersiq disse:

vou ver aki se vai funcionar e te falo

deu esse erro

 

 

e esse erro

 

A linha 161 está com um emoji, basta corrigir:

local pokeball = getPlayerSlotItem(cid, 8)

 

Link para o comentário
Compartilhar em outros sites

  • 0
44 minutos atrás, lSainty disse:

A linha 161 está com um emoji, basta corrigir:

ou eu arumei esse bug mas 

agora acontece na parte ao lougar no personagen 

da esse erro

Citar

Account Manager has logged in.

[Error - CreatureScript Interface]
data/creaturescripts/scripts/login.lua:onLogin
Description:
data/creaturescripts/scripts/login.lua:39: attempt to call global 'doUpdatePokemonsBar' (a nil value)
stack traceback:
        data/creaturescripts/scripts/login.lua:39: in function <data/creaturescripts/scripts/login.lua:7>
Account Manager has logged out.

 

Link para o comentário
Compartilhar em outros sites

  • 0
1 hora atrás, rafersiq disse:

ou eu arumei esse bug mas 

agora acontece na parte ao lougar no personagen 

da esse erro

Comenta ou apaga a linha 39 do login.lua, seu servidor não possui a função doUpdatePokemonsBar

Link para o comentário
Compartilhar em outros sites

  • 0
2 minutos atrás, lSainty disse:

Comenta ou apaga a linha 39 do login.lua, seu servidor não possui a função doUpdatePokemonsBar

você sabe como add essa função?

 

e que a base que eu tenho aki tem pokebar

Link para o comentário
Compartilhar em outros sites

  • 0
35 minutos atrás, rafersiq disse:

você sabe como add essa função?

 

e que a base que eu tenho aki tem pokebar

Para estar dando esse erro, provavelmente sua pokebar usa outra função. Salvo engano, essa função do erro era usada apenas no PDA. Caso queira a função mesmo assim, baixe qualquer servidor base PDA e pegue a função na lib xD

Editado por lSainty
Link para o comentário
Compartilhar em outros sites

  • 0
Agora, rafersiq disse:

qual e o nome do arquivo na lib?

Não tenho nem ideia, faz tempo que não mecho com servidor desse tipo, mas deve ser algo relacionado a pokebar ou cooldown bar

Link para o comentário
Compartilhar em outros sites

  • 0
1 minuto atrás, lSainty disse:

pokebar ou cooldown bar

eu acho que e cooldown bar porque nem pokebar.lua tem kkkk

2 minutos atrás, lSainty disse:

Não tenho nem ideia, faz tempo que não mecho com servidor desse tipo, mas deve ser algo relacionado a pokebar ou cooldown bar

vou tentar add aqui e te falo se funcionou

Eu consegui mudar e entra mas o mapa inteiro fica preto vc sabe pq isso ocorre?

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

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