Ir para conteúdo

[Encerrado] Erro no Look, Goback e Catch


Vasto Lord X

Posts Recomendados

Quando Eu Capturo Um Pokemon Não Da Para Dar Look Nem Usar o Pokemon .

Obs : Servidor Com Level System .
Obs²: Não Da Erro Na Hora Que da o Catch .
Obs³: Da Para Usar Os Pokemons Criados no ( /cb ) .

Erro No Look :


[05/01/2016 18:22:44] [Error - CreatureScript Interface]
[05/01/2016 18:22:44] data/creaturescripts/scripts/look.lua:onLook
[05/01/2016 18:22:44] Description:
[05/01/2016 18:22:44] data/creaturescripts/scripts/look.lua:43: bad argument #1 to 'floor' (number expected, got nil)
[05/01/2016 18:22:44] stack traceback:
[05/01/2016 18:22:44] [C]: in function 'floor'
[05/01/2016 18:22:44] data/creaturescripts/scripts/look.lua:43: in function <data/creaturescripts/scripts/look.lua:1>



Look.lua :

 

 


function onLook(cid, thing, position, lookDistance)
 
local str = ""
 
if not isCreature(thing.uid) then
 
local iname = getItemInfo(thing.itemid)
 
if isPokeball(thing.itemid) then
 
local unique = getItemAttribute(thing.uid, "unique")  --alterado v2.6
 
local pokename = getItemAttribute(thing.uid, "poke")
local item = getItemInfo(thing.itemid)
str = "You see "..item.article.." "..item.name.."." --alterado v2.6
if unique and unique == getCreatureName(cid) then
  str = str.." It's an unique item."   --alterado v2.6
            end
str = str.."\nIt contains "..getArticle(pokename).." "..pokename.." [level "..getItemAttribute(thing.uid, "level").."].\n" --alterado v2.6
 
            --alterado v2.6 
               
local boost = getItemAttribute(thing.uid, "boost") or 0
local boostshow = ""
 
if boost > 0 then
str = str.."Boost level: +"..boost..".\n"
end
 
if getItemAttribute(thing.uid, "nick") then
str = str.."It's nickname is: "..getItemAttribute(thing.uid, "nick")..".\n"
end
 
if getItemAttribute(thing.uid, "gender") == SEX_MALE then
str = str.."It is male."
elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then
str = str.."It is female."
else
str = str.."It is genderless."
end
 
str = str.."\n--- Status ---"
str = str.."\nOffense: "..math.floor(getItemAttribute(thing.uid, "offense")).." Defense: "..math.floor(getItemAttribute(thing.uid, "defense")).."\n"
str = str.."Agility: "..math.floor(getItemAttribute(thing.uid, "speed")).." Sp. Attack: "..math.floor(getItemAttribute(thing.uid, "specialattack")).."\n"
str = str.."Vitality: "..math.floor(getItemAttribute(thing.uid, "vitality")).."" 
 
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
 
return false
 
elseif string.find(iname.name, "fainted") or string.find(iname.name, "defeated") then
 
str = "You see a "..string.lower(iname.name).." ["..getItemAttribute(thing.uid, "level").."].\n"
 
if getItemAttribute(thing.uid, "gender") == SEX_MALE then
str = str.."It is male."
elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then
str = str.."It is female."
else
str = str.."It is genderless."
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
 
return false
 
else
 
return true
 
end
end
 
local NPCBattle = {
["Brock"] = {artig = "He is", cidbat = "Pewter"},
["Misty"] = {artig = "She is", cidbat = "Cerulean"}, 
}  
                                                       --edited npc name
NPCname = {"Brock", "Misty"}
 
local npcname = getCreatureName(thing.uid)
if not isPlayer(thing.uid) and not isMonster(thing.uid) and isInArray(NPCname, npcname) then
   str = "You see "..npcname..". "..NPCBattle[npcname].artig.." a pokemon trainer from "..NPCBattle[npcname].cidbat.."."
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
   return false
end
 
if not isPlayer(thing.uid) and not isMonster(thing.uid) then    
   str = "You see "..getCreatureName(thing.uid).."."
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
   return false
end
 
look = {
[1] = {"a Volcanic Spark", "a Volcanic Flame","a Volcanic Firetamer","a Volcanic Pyromancer","a Volcanic Master"},
[2] = {"a Seavell Drop", "a Seavell Icelake","a Seavell Waterfall","a Seavell Frost","a Seavell Master"},
[3] = {"an Orebound Sand", "an Orebound Rock","an Orebound Solid","an Orebound Hardskin","an Orebound Hero"},
[4] = {"a Wingeon Cloud", "a Wingeon Wind","a Wingeon Sky","a Wingeon Falcon","a Wingeon Dragon"},
[5] = {"a Malefic Troublemaker", "a Malefic Venomancer","a Malefic Spectre","a Malefic Nightwalker","a Malefic Master"},
[6] = {"a Gardestrike Fist", "a Gardestrike Tamer","a Gardestrike Fighter","a Gardestrike DeathHand","a Gardestrike Champion"},
[7] = {"a Psycraft Mind", "a Psycraft Brain","a Psycraft Scholar","a Psycraft Telepath","a Psycraft Medium"},
[8] = {"a Naturia Seed", "a Naturia Sprout","a Naturia Webhead","a Naturia Woodtrunk","a Naturia Keeper"},
[9] = {"a Raibolt Shock", "a Raibolt Watt","a Raibolt Electrician","a Raibolt Overcharged","a Raibolt Legend"},
}
 
youAre = {
[3] = "a Senior Tutor",
[4] = "a Game Master",
[5] = "a Sub",                     --alterado v2.3
[6] = "a GOD"
}
 
if thing.uid == cid then
      
   if getPlayerStorageValue(thing.uid, 86228) <= 0 then
      if getPlayerGroupId(thing.uid) >= 3 and getPlayerGroupId(thing.uid) <= 6 then    --alterado v2.3
          pos = getCreaturePosition(thing.uid)
          ocupacao = youAre[getPlayerGroupId(thing.uid)]          --alterado v2.3
          str = "You see yourself. You are "..ocupacao..".\n"
          str = str.."Pos: {x = "..pos.x..", y = "..pos.y..", z = "..pos.z.."}."
      else
          str = "You see yourself. You are a Pokemon Trainer."
      end
      
   else
      vocation = getPlayerStorageValue(thing.uid, 86228)
      rank = getPlayerStorageValue(thing.uid, 862281)
      promote = look[vocation][rank] 
      if getPlayerGroupId(thing.uid) >= 3 and getPlayerGroupId(thing.uid) <= 6 then
          pos = getCreaturePosition(thing.uid)
          ocupacao = youAre[getPlayerGroupId(thing.uid)]          --alterado v2.3
          str = "You see yourself. You are "..ocupacao.." and "..promote..".\n"
          str = str.."Pos: {x = "..pos.x..", y = "..pos.y..", z = "..pos.z.."}."
      else
          str = "You see yourself. You are "..promote.."."
      end
   end
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
 
return false
end 
                                                                    --edited clan system
 
 
if isPlayer(thing.uid) and thing.uid ~= cid then
 
   vocation2 = getPlayerStorageValue(thing.uid, 86228) 
   rank2 = getPlayerStorageValue(thing.uid, 862281)
 
   if getPlayerStorageValue(thing.uid, 86228) <= 0 then
      promote2 = "a Pokemon Trainer"
   else
      promote2 = look[vocation2][rank2]
   end
 
   if getPlayerSex(thing.uid) == 1 then
      artic = "He is" 
   elseif getPlayerSex(thing.uid) == 0 then
      artic = "She is"
   end 
   
   if getPlayerGroupId(thing.uid) >= 3 and getPlayerGroupId(thing.uid) <= 6 then   --alterado v2.3
       pos = getCreaturePosition(thing.uid)
       ocupacao = youAre[getPlayerGroupId(thing.uid)]          --alterado v2.3
       str = "You see "..getCreatureName(thing.uid)..". "..artic.." "..ocupacao.." and "..promote2..".\n"
       str = str.."Poss: {x = "..pos.x..", y = "..pos.y..", z = "..pos.z.."}."
   else
       str = "You see "..getCreatureName(thing.uid)..". "..artic.." "..promote2.."."
   end
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
          
return false
end
 
if getCreatureName(thing.uid) == "Evolution" then return false end
 
if not isSummon(thing.uid) then
local str = "You see a wild "..string.lower(getCreatureName(thing.uid)).." [level "..getPokemonLevel(thing.uid).."].\n"
if getPokemonGender(thing.uid)  == SEX_MALE then
str = str.."It is male."
elseif getPokemonGender(thing.uid)  == SEX_FEMALE then
str = str.."It is female."
else
str = str.."It is genderless."
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
return false
elseif isSummon(thing.uid) and not isPlayer(thing.uid) then
 
local boostlevel = getItemAttribute(getPlayerSlotItem(getCreatureMaster(thing.uid), 8).uid, "boost") or 0
local boostshow = " + "..boostlevel.."]"
 
if showBoostSeparated then
boostshow = "] [+"..boostlevel.."]"
end
 
local levelinfo = "["..getPokemonLevel(thing.uid)..""..boostshow..""
 
if getCreatureMaster(thing.uid) == cid then
local myball = getPlayerSlotItem(cid, 8).uid
local nexp = getItemAttribute(myball, "nextlevelexp")
 
local string = "You see your "..string.lower(getCreatureName(thing.uid)).." "..levelinfo.."."
string = string.."\nHit points: "..getCreatureHealth(thing.uid).."/"..getCreatureMaxHealth(thing.uid).."."
string = string.."\n"..getPokemonHappinessDescription(thing.uid)
if getItemAttribute(myball, "level") <= 99 then
string = string.."\nExperience needed to level up: "..nexp.."."
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see a "..string.lower(getCreatureName(thing.uid)).." "..levelinfo..".\nIt belongs to "..getCreatureName(getCreatureMaster(thing.uid))..".")
end
 
 
return false
end
 
return true
end 

 



Erro No Goback :


[05/01/2016 18:22:34] [Error - Action Interface]
[05/01/2016 18:22:34] data/actions/scripts/goback.lua:onUse
[05/01/2016 18:22:34] Description:
[05/01/2016 18:22:34] data/lib/level system.lua:456: attempt to perform arithmetic on a nil value
[05/01/2016 18:22:34] stack traceback:
[05/01/2016 18:22:34] data/lib/level system.lua:456: in function 'adjustStatus'
[05/01/2016 18:22:34] data/actions/scripts/goback.lua:211: in function <data/actions/scripts/goback.lua:8>



Goback.lua :

 

 

 

local EFFECTS = {
--[OutfitID] = {Effect}
["Magmar"] = 35,   
["Jynx"] = 17,          --alterado v2.5
["Shiny Jynx"] = 17,    
}
 
function onUse(cid, item, frompos, item2, topos)
 
if exhaustion.get(cid, 6666) and exhaustion.get(cid, 6666) > 0 then return true end
 
--alterado v2.6 sistema de firstpoke retirado
if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 then
return true
end
-------------------------------------------------------
ballName = getItemAttribute(item.uid, "poke")
                                               
   btype = getPokeballType(item.itemid)
   usando = pokeballs[btype].use
 
local effect = pokeballs[btype].effect
if not effect then
effect = 21
end
----------------------------------------------------------
if item.itemid == usando then                           
 
if getPlayerStorageValue(cid, 990) == 1 then -- GYM
doPlayerSendCancel(cid, "You can't return your pokemon during gym battles.")
return true
end
 
---------------------------------------------------------------------------------------
if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then     --alterado v2.6
       if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then  
          BackTeam(cid)       
       end
    end 
    -----------------------------------------------------------------------------------------
    if #getCreatureSummons(cid) == 2 and getPlayerStorageValue(cid, 212124) >= 1 then
       doPlayerSendCancel(cid, "You can't do that while is controling a mind")
       return true     --alterado v2.5
    end
    ---------------------------------------------------------------------------------------
    
if #getCreatureSummons(cid) <= 0 then
if isInArray(pokeballs[btype].all, item.itemid) then
doTransformItem(item.uid, pokeballs[btype].off)
doItemSetAttribute(item.uid, "hp", 0)
doPlayerSendCancel(cid, "This pokemon is fainted.")
   return true
end
end
 
    local cd = getCD(item.uid, "blink", 30)
    if cd > 0 then
       setCD(item.uid, "blink", 0)
    end
    
local z = getCreatureSummons(cid)[1]
 
if getCreatureCondition(z, CONDITION_INVISIBLE) and not isGhostPokemon(z) then
return true
end
--doPlayerSendCancel(cid, '12//,hide')
doReturnPokemon(cid, z, item, effect)
 
elseif item.itemid == pokeballs[btype].on then
 
if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then
doPlayerSendCancel(cid, "You must put your pokeball in the correct place!")
return TRUE
end
 
local status = {}
status.poke = getItemAttribute(item.uid,"poke")
status.offense = getItemAttribute(item.uid,"offense")
status.defense = getItemAttribute(item.uid,"defense")
status.specialattack = getItemAttribute(item.uid,"specialattack")
status.speed = getItemAttribute(item.uid,"speed")
status.vitality = getItemAttribute(item.uid,"vitality")
 
setPlayerStorageValue(cid,8866,status) --status do pokemon
setPlayerStorageValue(cid,8867,15) --points
 
 
local thishp = getItemAttribute(item.uid, "hp")
 
if thishp <= 0 then
if isInArray(pokeballs[btype].all, item.itemid) then
doTransformItem(item.uid, pokeballs[btype].off)
doItemSetAttribute(item.uid, "hp", 0)
doPlayerSendCancel(cid, "This pokemon is fainted.")
   return true
end
end
 
local pokemon = getItemAttribute(item.uid, "poke")
 
if not pokes[pokemon] then
return true
end
 
----------------------- Sistema de nao poder carregar mais que 3 pokes lvl baixo e + q 1 poke de lvl medio/alto ---------------------------------
if not isInArray({5, 6}, getPlayerGroupId(cid)) then
local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
local lowPokes = {"Rattata", "Caterpie", "Weedle", "Oddish", "Pidgey", "Paras", "Poliwag", "Bellsprout", "Magikarp", "Hoppip", "Sunkern"}
local low = {}
local lw = 1
for e, f in pairs(pokeballs) do
    for times = 1, 3 do
        local items = getItemsInContainerById(bp.uid, pokeballs[e].all[times]) 
        if #items >= 1 then                                                                 --alterado v2.6
           for _, uid in pairs(items) do
               local nome1 = getItemAttribute(uid, "poke")
               if not isInArray(lowPokes, pokemon) and nome1 == pokemon then
                  return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry two pokemons equals!")
               elseif isInArray(lowPokes, pokemon) then
                  if nome1 == pokemon then
                     table.insert(low, lw, nome1)
                     lw = lw +1
                  end
               end
           end
        end
    end
end
if #low >= 3 then
   return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry more than three pokemons equals of low level!")
end  
end
---------------------------------------------------------------------------------------------------------------------------------------------------
 
local x = pokes[pokemon]
local boosts = getItemAttribute(item.uid, "boost") or 0
local pok_lvl_t = getItemAttribute(item.uid, "level") == nil and 0 or getItemAttribute(item.uid, "level")  
if (getPlayerLevel(cid) + pokemonMaxLevelAbovePlayer) < (pok_lvl_t + boosts) then
doPlayerSendCancel(cid, "Your pokemon's level is much higher than yours, you can't use him.")
return true
end
 
--------------------------------------------------------------------------------------
shinysClan = {
["Shiny Fearow"] = {4, "Wingeon"},
["Shiny Flareon"] = {1, "Volcanic"},
["Shiny Vaporeon"] = {2, "Seavel"}, 
["Shiny Jolteon"] = {9, "Raibolt"},
["Shiny Hypno"] = {7, "Psycraft"},          
["Shiny Golem"] = {3, "Orebound"},
["Shiny Vileplume"] = {8, "Naturia"},
["Shiny Nidoking"] = {5, "Malefic"},
["Shiny Hitmontop"] = {6, "Gardestrike"},   --alterado v2.4
}
 
if shinysClan[pokemon] and (getPlayerGroupId(cid) < 3 or getPlayerGroupId(cid) > 6) then
  if getPlayerStorageValue(cid, 86228) ~= shinysClan[pokemon][1] then
     doPlayerSendCancel(cid, "You need be a member of the clan "..shinysClan[pokemon][2].." to use this pokemon!")
     return true   
       elseif getPlayerStorageValue(cid, 862281) ~= 5 then
          doPlayerSendCancel(cid, "You need be atleast rank 5 to use this pokemon!")
     return true
       end
    end
    --------------------------------------------------------------------------------------
    
--doPlayerSendCancel(cid, '12//,show')
doSummonMonster(cid, pokemon)
setPlayerStorageValue(cid,8868,10)
local pk = getCreatureSummons(cid)[1]
if not isCreature(pk) then return true end
------------------------passiva hitmonchan------------------------------
if isSummon(pk) then
       local nameHIT = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")
       local hands = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "hands")
       if nameHIT == "Shiny Hitmonchan" or nameHIT == "Hitmonchan" then
          if getItemAttribute(getPlayerSlotItem(cid, 8).uid, "hands") then
             doSetCreatureOutfit(pk, {lookType = hitmonchans[nameHIT][hands].out}, -1)
          else
              doPlayerSendTextMessage(cid, 27, "Contact a GameMaster! Error in passive system! Attribute \"hands\" missing")  
          end
       end
    end
-------------------------------------------------------------------------
    ---------movement magmar, jynx-------------
    if EFFECTS[getCreatureName(pk)] then             
       markPosEff(pk, getThingPos(pk))
       sendMovementEffect(pk, EFFECTS[getCreatureName(pk)], getThingPos(pk)) --alterado v2.5
    end
    --------------------------------------------------------------------------      
 
if getCreatureName(pk) == "Ditto" then
 
local left = getItemAttribute(item.uid, "transLeft")
local name = getItemAttribute(item.uid, "transName")
 
if left and left > 0 then
setPlayerStorageValue(pk, 1010, name)
doSetCreatureOutfit(pk, {lookType = getItemAttribute(item.uid, "transOutfit")}, -1)
addEvent(deTransform, left * 1000, pk, getItemAttribute(item.uid, "transTurn"))
doItemSetAttribute(item.uid, "transBegin", os.clock())
else
setPlayerStorageValue(pk, 1010, "Ditto")
end
end
 
if isGhostPokemon(pk) then doTeleportThing(pk, getPosByDir(getThingPos(cid), math.random(0, 7)), false) end
 
doCreatureSetLookDir(pk, 2)
 
adjustStatus(pk, item.uid, true, false, true)
doAddPokemonInOwnList(cid, pokemon)
 
doTransformItem(item.uid, item.itemid+1)
 
local pokename = getItemAttribute(item.uid, "nick") or getCreatureName(pk) 
 
local mgo = gobackmsgs[math.random(1, #gobackmsgs)].go:gsub("doka", pokename)
doCreatureSay(cid, mgo, TALKTYPE_SAY)
doSendMagicEffect(getCreaturePosition(pk), effect)
 
else
 
    doPlayerSendCancel(cid, "This pokemon is fainted.")
 
end
 
if useKpdoDlls then
doUpdateMoves(cid)
end
return true
end 


Catch.lua :

local ballcatch = {                    --id normal, id da ball shiy
[2394] = {cr = 3, on = 24, off = 23, ball = {11826, 11737}, send = 47, typeee = "normal"},  --alterado v2.9  \/
[2391] = {cr = 6, on = 198, off = 197, ball = {11832, 11740}, send = 48, typeee = "great"},
[2393] = {cr = 10, on = 202, off = 201, ball = {11835, 11743}, send = 46, typeee = "super"},
[2392] = {cr = 15, on = 200, off = 199, ball = {11829, 11746}, send = 49, typeee = "ultra"},
[12617] = {cr = 3, on = 204, off = 203, ball = {10975, 12621}, send = 35, typeee = "saffari"}, 
}
 
function onUse(cid, item, frompos, item3, topos)
 
local item2 = getTopCorpse(topos)
if item2 == null then
return true
end
 
if getItemAttribute(item2.uid, "catching") == 1 then
   return true
end
 
if getItemAttribute(item2.uid, "golden") and getItemAttribute(item2.uid, "golden") == 1 then
   return doPlayerSendCancel(cid, "You can't try to catch a pokemon in the Golden Arena!")   --alterado v2.6
end
 
local name = string.lower(getItemNameById(item2.itemid))  --alterado v2.9 \/
      name = string.gsub(name, "fainted ", "")
      name = string.gsub(name, "defeated ", "")
      name = doCorrectPokemonName(name)
local x = pokecatches[name]
 
 
local storage = newpokedex[doCorrectPokemonName(name)].stoCatch            --alterado v2.9 \/
if getPlayerStorageValue(cid, storage) == -1 or not string.find(getPlayerStorageValue(cid, storage), ";") then  
   setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0;")              
end    
    
if not x then return true end
 
local owner = getItemAttribute(item2.uid, "corpseowner")
 
if owner and isCreature(owner) and isPlayer(owner) and cid ~= owner then  --alterado v2.5
   doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")
   return true
end
 
local newidd = isShinyName(name) and ballcatch[item.itemid].ball[2] or ballcatch[item.itemid].ball[1] --alterado v2.9       
local typeee = ballcatch[item.itemid].typeee
       
local catchinfo = {}
catchinfo.rate = ballcatch[item.itemid].cr
catchinfo.catch = ballcatch[item.itemid].on
catchinfo.fail = ballcatch[item.itemid].off
catchinfo.newid = newidd                      
catchinfo.name = doCorrectPokemonName(name)
catchinfo.topos = topos
catchinfo.chance = x.chance
 
doSendDistanceShoot(getThingPos(cid), topos, ballcatch[item.itemid].send)
doRemoveItem(item.uid, 1)
 
local d = getDistanceBetween(getThingPos(cid), topos)
                                              
if getPlayerStorageValue(cid, 98796) >= 1 and getPlayerItemCount(cid, 12617) <= 0 then --alterado v2.9 
   setPlayerStorageValue(cid, 98796, -1) 
   setPlayerStorageValue(cid, 98797, -1)                                              
   doTeleportThing(cid, SafariOut, false)
   doSendMagicEffect(getThingPos(cid), 21)
   doPlayerSendTextMessage(cid, 27, "You spend all your 'saffari balls', good luck in the next time...")
end
        
addEvent(doSendPokeBall, d * 70 + 100 - (d * 14) , cid, catchinfo, false, false, typeee)
addEvent(doSendMagicEffect, (d * 70 + 100 - (d * 14)) - 100, topos, 3)
return true
end 

 

 

 

Level System :

 

 

 

function getPokemonBaseStatus(name, multiplier)
local a = pokes[name]
local m = 1
if not a then return false end
if not a.offense then return false end
if multiplier then m = multiplier end
local ret = {}
ret.off = a.offense * m
ret.offense = ret.off
 
ret.def = a.defense * m
ret.defense = ret.def
 
ret.agi = a.agility * m
ret.agility = ret.agi
 
ret.spatk = a.specialattack * m
ret.specialattack = ret.spatk
 
ret.vit = a.vitality * m
ret.vitality = ret.vit
return ret
end
 
function getPokemonStatus(name, multiplier)
local a = pokes[name]
local m = 1
if not a then return false end
if not a.offense then return false end
if multiplier then m = multiplier end
local ret = {}
ret.off = a.offense * m
ret.offense = ret.off
 
ret.def = a.defense * m
ret.defense = ret.def
 
ret.agi = a.agility * m
ret.agility = ret.agi
 
ret.spatk = a.specialattack * m
ret.specialattack = ret.spatk
 
ret.vit = a.vitality * m
ret.vitality = ret.vit
return ret
end
 
function getPokeballStatus(owner,pokeball)
local a = getItemAttribute(owner,pokeball.uid,"poke")
if not a then return false end
local ret = {}
ret.off = getItemAttribute(owner,pokeball.uid,"offense")
ret.offense = getItemAttribute(owner,pokeball.uid,"offense")
 
ret.def = getItemAttribute(owner,pokeball.uid,"defense")
ret.defense = getItemAttribute(owner,pokeball.uid,"defense")
 
ret.agi = getItemAttribute(owner,pokeball.uid,"speed")
ret.agility = getItemAttribute(owner,pokeball.uid,"speed")
 
ret.spatk = getItemAttribute(owner,pokeball.uid,"specialattack")
ret.specialattack = getItemAttribute(owner,pokeball.uid,"specialattack")
 
ret.vit = getItemAttribute(owner,pokeball.uid,"vitality")
ret.vitality = getItemAttribute(owner,pokeball.uid,"vitality")
return ret
end
 
function getPokemonXMLOutfit(name)
local johto = false
for i = 209, 308 do       --alterado v2.6
  if oldpokedex[i][1] and oldpokedex[i][1] == name then
     johto = true
  end
end
    if isShinyName(name) then
  a = "data/monster/pokes/Shiny/"..name..".xml"
    elseif johto then
       a = "data/monster/pokes/geracao 2/"..name..".xml"    --edited pra melhorar a pasta monster
    else
       a = "data/monster/pokes/geracao 1/"..name..".xml"
    end 
local b = io.open(a, "a+")
local c = b:read("*all")
b:close()
local d, e = c:find('look type="(.-)"')
c = string.sub(c, d + 11, e - 1)
return tonumber(c)
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 doStartEvolution(cid, evolution, seconds)
if not isCreature(cid) then return true end
local a = getPlayerStorageValue(cid, 1007)
local b = getCreatureHealth(cid) / getCreatureMaxHealth(cid)
local d = getThingPos(cid)
local e = getCreatureMaster(cid)
if getHappinessRate(cid) < 1 then return true end
local f = getCreatureOutfit(cid).lookType
local g = getItemAttribute(getPlayerSlotItem(e, 8).uid, "nick") or getCreatureName(cid)
local h = getPokemonXMLOutfit(evolution)
doItemSetAttribute(getPlayerSlotItem(e, 8).uid, "hp", b)
doCreatureSay(e, "What? My "..g.." is evolving!", TALKTYPE_SAY)
doSummonMonster(e, "Evolution")
doReturnPokemon(e, cid, getPlayerSlotItem(e, 8), 0, true)
local evo = getCreatureSummons(e)[1]
doEvolutionOutfit(evo, h, f)
doCreatureSetHideHealth(evo, true)
doCreatureSetLookDir(evo, 2)
setPlayerStorageValue(evo, 1007, g)
doTeleportThing(evo, d, false)
addEvent(sendSSJEffect, 250, evo)
doSendAnimatedText(getThingPos(evo), "EVOLUTION", COLOR_GRASS)
doSendEvolutionEffect(evo, getThingPos(evo), evolution, 20, false, false, f, h)
end
 
function doSendEvolutionEffect(cid, pos, evolution, turn, ssj, evolve, f, h)
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
 
function doEvolvePokemon(cid, item2, theevo, stone1, stone2)
 
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)
local pokeball = getPlayerSlotItem(cid, 8)
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..".")
 
doPlayerSendTextMessage(cid, 27, "Congratulations! Your "..getPokeName(item2.uid).." evolved into a "..theevo.."!") 
 
doSendMagicEffect(getThingPos(item2.uid), 18)
doTransformItem(getPlayerSlotItem(cid, 7).uid, fotos[theevo])
doSendMagicEffect(getThingPos(cid), 173)
 
local oldpos = getThingPos(item2.uid)
local oldlod = getCreatureLookDir(item2.uid)
local oldlvl = getPokemonLevel(item2.uid)
doRemoveCreature(item2.uid)
 
doSummonMonster(cid, theevo)
local pk = getCreatureSummons(cid)[1]
 
doTeleportThing(pk, oldpos, false)
doCreatureSetLookDir(pk, oldlod)
 
sendFinishEvolutionEffect(pk, true)
addEvent(sendFinishEvolutionEffect, 550, pk, true)
addEvent(sendFinishEvolutionEffect, 1050, pk)
 
doPlayerRemoveItem(cid, stone1, 1)
doPlayerRemoveItem(cid, stone2, 1)
 
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)
end
end
 
 
 
 
 
function givePokemonExp(cid, item, expe, pct, rarecandy)
 
if expe <= 0 or not isCreature(cid) then return true end
 
local leveltable = getPokemonExperienceTable(getPokeballName(item.uid, true))
 
if getItemAttribute(item.uid, "exp") + expe > leveltable[100] then
givePokemonExp(cid, item, leveltable[100] - getItemAttribute(item.uid, "exp"))
return true
end
 
doItemSetAttribute(item.uid, "exp", tonumber(getItemAttribute(item.uid, "exp")) + expe)
doItemSetAttribute(item.uid, "happy", getItemAttribute(item.uid, "happy") + 1)
doItemSetAttribute(item.uid, "nextlevelexp", getItemAttribute(item.uid, "nextlevelexp") - expe)
 
 
if pct then
doPlayerSendTextMessage(cid, 27, "Your "..getPokeballName(item.uid).." has received "..expe.." experience points ("..pct.."%).")
else
if getItemAttribute(item.uid, "nextlevelexp") > 0 then
doPlayerSendTextMessage(cid, 27, "Your "..getPokeballName(item.uid).." ["..getItemAttribute(item.uid, "level").."] has received "..expe.." experience points ("..getItemAttribute(item.uid, "nextlevelexp").." to next level).")
else
doPlayerSendTextMessage(cid, 27, "Your "..getPokeballName(item.uid).." ["..getItemAttribute(item.uid, "level").."] has received "..expe.." experience points and has leveled up!")
end
end
 
if isBeingUsed(item.itemid) then
doSendAnimatedText(getThingPos(getCreatureSummons(cid)[1]), expe, 215)
end
 
if getItemAttribute(item.uid, "nextlevelexp") <= 0 then
local summon = getCreatureSummons(cid)[1]
 
if not isCreature(summon) then return true end
 
doSendFlareEffect(getThingPos(summon))
doSendAnimatedText(getThingPos(summon), "Level up!", 215)
 
adjustPokemonLevel(item.uid, cid, item.itemid)
   doCreatureAddHealth(summon, getCreatureMaxHealth(summon))
end
end
 
 
function givePokemonExpInBp(cid, item, expe, ballid, pct, hidemessage)
 
if expe <= 0 or not isCreature(cid) then return true end
 
local leveltable = getPokemonExperienceTable(getPokeballName(item, true))
 
if getItemAttribute(item, "exp") + expe > leveltable[100] then
givePokemonExpInBp(cid, item, leveltable[100] - getItemAttribute(item, "exp"), ballid)
return true
end
 
doItemSetAttribute(item, "exp", getItemAttribute(item, "exp") + expe)
doItemSetAttribute(item, "happy", getItemAttribute(item, "happy") + 1)
doItemSetAttribute(item, "nextlevelexp", getItemAttribute(item, "nextlevelexp") - expe)
 
if not hidemessage then
if pct then
doPlayerSendTextMessage(cid, 27, "Your "..getPokeballName(item).." has received "..expe.." experience points ("..pct.."%).")
else
if getItemAttribute(item, "nextlevelexp") > 0 then
doPlayerSendTextMessage(cid, 27, "Your "..getPokeballName(item).." ["..getItemAttribute(item, "level").."] has received "..expe.." experience points inside his pokeball ("..getItemAttribute(item, "nextlevelexp").." to next level).")
else
doPlayerSendTextMessage(cid, 27, "Your "..getPokeballName(item).." ["..getItemAttribute(item, "level").."] has received "..expe.." experience points and has leveled up inside his pokeball.")
adjustPokemonLevel(item, cid, ballid)
end
end
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 adjustPokemonLevel(item, cid, id, rarecandy)
 
if not isCreature(cid) then return true end
 
local exp = getItemAttribute(item, "exp")
local level = getItemAttribute(item, "level")
local leveltable = getPokemonExperienceTable(getPokeballName(item, true))
local newlevel = 1
 
for x = 1, 100 do
if exp >= leveltable[x] and exp < leveltable[x+1] then
newlevel = x
end
end
 
if newlevel <= 1 then return true end
 
local levelsup = (newlevel - level)
local pokemon = getItemAttribute(item, "poke")
local happy = getItemAttribute(item, "happy")
local rate = happy / 100
local newhappiness = happy
 
if happy >= 250 then
newhappiness = 255
elseif happy >= 230 then
newhappiness = happy + 4
elseif happy >= 210 then
newhappiness = happy + 6
elseif happy >= 180 then
newhappiness = happy + 8
elseif happy >= 140 then
newhappiness = happy + 10
elseif happy >= 110 then
newhappiness = happy + 12
else
newhappiness = happy + 15
end
doItemSetAttribute(item, "level", newlevel)
 
if not rarecandy then
doItemSetAttribute(item, "happy", newhappiness)
end
 
local nextexp = leveltable[newlevel + 1] - exp
doItemSetAttribute(item, "nextlevelexp", nextexp)
 
if newlevel > getPlayerLevel(cid) + pokemonMaxLevelAbovePlayer then
addEvent(doPlayerSendTextMessage, 30, cid, 18, "Warning: Your "..getPokeballName(item).."'s ["..newlevel.."] level is much higher than yours, so you will not be able to call him to battles.")
end
 
if isCreature(cid) and id >= 1 and isBeingUsed(id) then
adjustStatus(getCreatureSummons(cid)[1], item, false, true)
doPlayerSendTextMessage(cid, 27, "• Level: "..newlevel.." (+"..levelsup..")  • Offense: +"..doMathDecimal(off).."  • Defense: +"..doMathDecimal(def).."  • Spc. Atk: +"..doMathDecimal(spatk).."  • Agility: +"..doMathDecimal(agi).."  • Vitality: +"..doMathDecimal(vit).."")
 
if happy < minHappyToEvolve then return true end
 
if pokemonsCanEvolveByLevel then
 
local summon = getCreatureSummons(cid)[1]
 
local reqlevel = poevo[getCreatureName(summon)] and poevo[getCreatureName(summon)].level or -1
local level = getItemAttribute(item, "level")
local evolution = "none"
local name = getCreatureName(summon)
 
if name == "Tyrogue" and level >= 20 then
if getOffense(summon) == getDefense(summon) then
evolution = "Hitmontop"
elseif getOffense(summon) > getDefense(summon) then
evolution = "Hitmonlee"
else
evolution = "Hitmonchan"
end
elseif name == "Eevee" then
if happy >= maxHappyToEvolve then
if isDay() then
evolution = "Espeon"
else
evolution = "Umbreon"
end
end
elseif name == "Slowpoke" and level >= 28 then
evolution = "Slowbro"
elseif name == "Poliwhirl" and level >= 36 then
evolution = "Poliwrath"
elseif reqlevel > 4 and level >= reqlevel then
evolution = poevo[getCreatureName(summon)].evolution
elseif reqlevel == 2 and happy >= maxHappyToEvolve then
evolution = poevo[getCreatureName(summon)] and poevo[getCreatureName(summon)].evolution or "none"
end
 
if evolution ~= "none" then
doStartEvolution(summon, evolution, 4)
end
end
end
end
 
function doAdjustWithDelay(cid, pk, health, vit, status)
if isCreature(cid) then                                   --alterado v2.5
   if not isCreature(cid) then return true end
   adjustStatus(pk, getPlayerSlotItem(cid, 8).uid, health, vir, status)
end
end
 
function adjustStatus(pk, item, health, vite, conditions)
 
if not isCreature(pk) then return true end
 
local bonusoffense = getItemAttribute(item, boffense) or 0
local bonusdefense = getItemAttribute(item, bdefense) or 0
local bonusagility = getItemAttribute(item, bagility) or 0
local bonussattack = getItemAttribute(item, bsattack) or 0
 
setPlayerStorageValue(pk, 1000, getItemAttribute(item, "level"))
setPlayerStorageValue(pk, 1001, getItemAttribute(item, "offense") + bonusoffense)
setPlayerStorageValue(pk, 1002, getItemAttribute(item, "defense") + bonusdefense)
setPlayerStorageValue(pk, 1003, getItemAttribute(item, "speed") + bonusagility)
setPlayerStorageValue(pk, 1005, getItemAttribute(item, "specialattack") + bonussattack)
 
local gender = getItemAttribute(item, "gender") and getItemAttribute(item, "gender") or 0
doCreatureSetSkullType(pk, gender)
 
if vite == true then
local pct = getCreatureHealth(pk) / getCreatureMaxHealth(pk)
local vit = getItemAttribute(item, "vitality") - getPlayerStorageValue(pk, 1004)
setCreatureMaxHealth(pk, getCreatureMaxHealth(pk) + ( vit * HPperVIT ))
doCreatureAddHealth(pk, pct * vit * HPperVIT)
end
 
setPlayerStorageValue(pk, 1004, getItemAttribute(item, "vitality"))
 
doRegainSpeed(pk)
 
local nick = getItemAttribute(item, "poke")
 
if string.find(tostring(nick), "Shiny") then
  nick = tostring(nick):match("Shiny (.*)")
    end
 
if getItemAttribute(item, "nick") then
nick = getItemAttribute(item, "nick")
end
 
setPlayerStorageValue(pk, 1007, nick)
 
local boostlevel = getItemAttribute(item, "boost") or 0
local boostshow = hideBoost and "]" or " + "..boostlevel.."]"
local lvlstr = ""
 
if showBoostSeparated then
boostshow = hideBoost and "]" or "] [+"..boostlevel.."]"
end
 
if hideSummonsLevel then
if not hideBoost then
nick = nick.." [+"..boostlevel.."]"
end
else
nick = nick.." ["..getItemAttribute(item, "level")..""..boostshow..""
end
 
--doCreatureSetNick(pk, nick)
 
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 = getCreatureMaxHealth(pk) + HPperVIT * 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                        --alterado v2.5 daki pra baixo!!
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)                                                --alterado v2.5
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 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
 
    if getItemAttribute(item, "boost") and getItemAttribute(item, "boost") == 50 and getItemAttribute(item, "aura") then
       sendAuraEffect(pk, auraSyst[getItemAttribute(item, "aura")])        --edited aura system
    end
    
    if getPlayerStorageValue(getCreatureMaster(pk), 6598754) >= 1 then
        setPlayerStorageValue(pk, 6598754, 1)                               --edited pvp system
    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
if optionalLevel <= 100 then
levelRange = optionalLevel
else
levelRange = 100
end
elseif getCreatureOutfit(cid).lookHead and getCreatureOutfit(cid).lookBody and getCreatureOutfit(cid).lookHead <= getCreatureOutfit(cid).lookBody then
levelRange = math.random(getCreatureOutfit(cid).lookHead, getCreatureOutfit(cid).lookBody)
else
levelRange = math.random(20, 30)
end
 
local status = getPokemonBaseStatus(this)
if status then
off = status.off
def = status.def
agi = status.agi
vit = status.vit
spatk = status.spatk
end
 
setPlayerStorageValue(cid, 1000, levelRange)
 
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 * 1.2))
setPlayerStorageValue(cid, 1002, 5 + math.random(def * levelRange * 0.9, def * levelRange * 1.2))
setPlayerStorageValue(cid, 1003, math.random(agi * levelRange * 0.9, agi * levelRange * 1.2))
setPlayerStorageValue(cid, 1004, math.random(vit * levelRange * 0.9, vit * levelRange * 1.2))
setPlayerStorageValue(cid, 1005, 5 + math.random(spatk * levelRange * 0.9, spatk * levelRange * 1.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 getPlayerStorageValue(cid, 3894) >= 1 then
return tonumber(getPlayerStorageValue(cid, 1001)) / 2
end ]]
 
return tonumber(getPlayerStorageValue(cid, 1001))
end
 
function getDefense(cid)
if not isCreature(cid) then return 0 end
 
--[[ if getPlayerStorageValue(cid, 3894) >= 1 then
return tonumber(getPlayerStorageValue(cid, 1002)) / 2
end  ]]
 
return tonumber(getPlayerStorageValue(cid, 1002))
end
 
function getSpeed(cid)
if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1003))
end
 
function getVitality(cid)
if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1004))
end
 
function getSpecialAttack(cid)
if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1005))
end
 
function getHappiness(cid)
if not isCreature(cid) then return 0 end
return tonumber(getPlayerStorageValue(cid, 1008))
end
 
function getSpecialDefense(cid)
if not isCreature(cid) then return 0 end
return getSpecialAttack(cid) * 0.85 + getDefense(cid) * 0.2
end
 
function getWildPokemonExp(cid)
return getPlayerStorageValue(cid, 1006)
end
 
function getWildPokemonLevel(cid)
return getPlayerStorageValue(cid, 1000)
end
 
function getLevel(cid)
if isSummon(cid) then
return getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "level")
end
return getPlayerStorageValue(cid, 1000)
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 getMasterLevel(poke)
    if not isSummon(poke) then return 0 end
return getPlayerLevel(getCreatureMaster(poke)) --alterado v2.5
end
 
function getPokemonBoost(poke)
    if not isSummon(poke) then return 0 end       --alterado v2.5
return getItemAttribute(getPlayerSlotItem(getCreatureMaster(poke), 8).uid, "boost") or 0
end
 
function getPokemonLevelByName(name)
if tostring(name) then                       --alterado v2.5
   return pokes[name].level
end
return 0
end
 
function getPokemonLevel(cid)
if not isCreature(cid) then return 0 end
return getPlayerStorageValue(cid, 1000)
end
 
function getPokemonGender(cid)
return getCreatureSkullType(cid)
end

 

 

Editado por Vasto Lord X
Link para o comentário
Compartilhar em outros sites

Só peço para colocar em Code o script, para visualizar melhor, e ter mais facilidade em te ajudar.

 

 

Assim xD

 

ou também em Spoiler

 

 

Assim

 

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

Não Sei Colocar Em Code .

@UP

 

Code seria assim: [ code ] é só juntar depois [ / code ].. tire os espaços e junte, e dentro do code coloque o que quer. só não esqueça de fechar usando o /.

Link para o comentário
Compartilhar em outros sites

  • 2 years later...
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...