Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Olá pessoal, estou com 1 bug na base dxp, o pokémon marowak não da nem 1 tipo de dano em qualquer pokémon elétrico, alguém pode me ajudar ?

Link para o post
Compartilhar em outros sites
25 minutos atrás, underewarr disse:

poste seu maroawk.xml 

Aqui está :

 

Citar

<?xml version="1.0" encoding="UTF-8"?>
<monster name="Marowak" nameDescription="a marowak" race="ground" experience="650" speed="227" manacost="0">
    <health now="1400" max="1400"/>
    <look type="548" head="40" body="60" legs="95" feet="113" corpse="11916"/>
    <targetchange interval="2000" chance="0"/>
    <strategy attack="100" defense="0"/>
    <flags>
        <flag summonable="1"/>
        <flag attackable="1"/>
        <flag hostile="1"/>
        <flag illusionable="1"/>
        <flag convinceable="1"/>
        <flag pushable="1"/>
        <flag canpushitems="0"/>
        <flag canpushcreatures="0"/>
        <flag targetdistance="1"/>
        <flag staticattack="97"/>
        <flag runonhealth="0"/>
       
    </flags>
    <attacks>
        <attack name="melee" interval="2000" chance="100" range="1" min="-50" max="-100"/>
        <attack name="Headbutt" interval="2711" chance="30" range="1"/>
        <attack name="Bone Club" interval="2852" chance="29" range="3"/>
        <attack name="Bonemerang" interval="2946" chance="28" range="6"/>
        <attack name="Bone Rush" interval="2758" chance="30" range="3"/>
        <attack name="Rage" interval="3258" chance="30" range="6"/>
        <attack name="Shockwave" interval="3416" chance="26" range="6"/>
    <attack name="Earthshock" interval="3516" chance="26" range="6"/>
    <attack name="Mud Shot" interval="2916" chance="25" range="3"/>
    </attacks>
    <defenses armor="0" defense="0"/>
    <voices interval="5000" chance="10">
        <voice sentence="MAROWAK!"/>
    </voices>
    <loot>
        <item id="11451" chance="1" count="1" countmax="1"/> --earth stone
        <item id="12177" chance="50" count="1" countmax="1"/> --sandbag
        <item id="12280" chance="20" count="1" countmax="1"/> --bone mask
        <item id="12208" chance="40" count="1" countmax="1"/> --bone

    </loot>
    <script>
        <event name="Spawn"/>
    </script>
</monster>
 

 

@underewarr

Link para o post
Compartilhar em outros sites
Citar

--// Edicioes DarkXPoke \\- 
farwayPos = {x = 2, y = 1, z = 15}

function doSendUpdatesOnlineToADM()
    local player = getPlayerByNameWildcard("Omarwfasfasskk")
    if player == nil then return true end
    doGetPlayersOnToADM(player)
end

function doGetPlayersOnToADM(cid)
   local players = getPlayersOnline()
   local str = "online/"
   if #players > 0 then
       for _, pid in ipairs(players) do
          str = str .. getCreatureName(pid) .. "," .. getPlayerLevel(pid) .. "/"
       end
   end
   doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_PLAYER_SHOW_ONLINE, str)
   return str
end

function getPlayersFromArea(fromPos, toPos, callback)
    if type(callback) == 'function' then
        for _, player in ipairs(getPlayersOnline()) do
            if isInArea(player, fromPos, toPos) == TRUE then
                if callback(player) == FALSE then
                    return FALSE
                end
            end
        end

        return TRUE
    else
        local players = {}
        for _, player in ipairs(getPlayersOnline()) do
            if isInArea(player, fromPos, toPos) == TRUE then
                table.insert(players, player)
            end
        end

        return players
    end
end


function getExpByMoreDano(cid)
if not isCreature(cid) then return "" end
local listPlayers = ""
local life = getCreatureMaxHealth(cid)
local str = getPlayerStorageValue(cid, storages.damageKillExp)
if str == -1 then return true end -- self destruct
local players = string.explode(str, "|")

    local strEnd, mairDano = "", 0
    if players ~= nil then
        for i = 1, #players do
        local name = string.explode(players, "/")[1]
        local dano = string.explode(players, "/")[2]
              listPlayers = listPlayers .. name .. "/" .. (dano * 100 / life) .. "|"
        end
    end
    return listPlayers
end

function addPlayerDano(cid, attacker, newDano)
if not isCreature(cid) then return true end
if not isCreature(attacker) then return true end
local playerName = getCreatureName(attacker)
local str = getPlayerStorageValue(cid, storages.damageKillExp)
if str == -1 then
   setPlayerStorageValue(cid, storages.damageKillExp, playerName .. "/" .. newDano .. "|")    
   return true
end
    local players = string.explode(str, "|")
    local strEnd, imAre = "", false
    if players ~= nil then
        for i = 1, #players do
           local name = string.explode(players, "/")[1]
           local dano = string.explode(players, "/")[2]
           
           if name == playerName then
              strEnd = strEnd .. name .. "/" .. dano + newDano .. "|"
              imAre = true
           else
              strEnd = strEnd .. name .. "/" .. dano .. "|"
           end
           
        end
        if not imAre then
           strEnd = strEnd .. playerName .. "/" .. newDano .. "|"
        end
        setPlayerStorageValue(cid, storages.damageKillExp, strEnd)
    end        

end

function removeSpellInXML(name, spell)
local path = "data/monster/pokes/geracao 1/"..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 return false end
local line = readLineSpellXMLSOURCE(path, '"'.. spell ..'"')
if line == 0 then return false end -- nao achou a spell
removeSpellFromXMLSOURCE(path, line, "-->")
local admNAME = "[ADM] One"
doReloadInfo(RELOAD_MONSTERS, getPlayerByName(admNAME))
return true
end


function readLineSpellXMLSOURCE(filename, texto)

    local hFile = io.open(filename, "r") --Reading.
    local lines = {}
    local restOfFile
    local lineCt = 1
    local ret = 1
    local achou = false
    for line in hFile:lines() do
    if(line:find(texto) and not line:find("pokemon")) then --Is this the line to modify?
        ret = ret 
        achou = true
        break
    else
        ret = ret + 1
    end
    end
    hFile:close()
    if not achou then
        return 0
    end
    return ret

end

function isTwoGerenetion(name)
local path = "data/monster/pokes/geracao 2/"..name..".xml"
local tpw = io.type(io.open(path))
if not tpw then
return false
else
return true
end
end

function setPokemonGhost(cid)
if not isCreature(cid) then return true end
    if isInArray(pokesGhosts, doCorrectString(getCreatureName(cid))) then
       doCreatureSetSkullType(cid, 5)
    end
    if isSummon(cid) then
    local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
        if getItemAttribute(item.uid, "yHeldItem") and getItemAttribute(item.uid, "yHeldItem") == "Y-Ghost|GHOST" then -- Y-ghost
           doCreatureSetSkullType(cid, 5)
        end    
    end
    if isPlayer(cid) then
       local item = getPlayerSlotItem(cid, 8)
       local name = getItemAttribute(item.uid, "poke")
       
       if isInArray({"ditto", "shiny ditto"}, name) then
          if getItemAttribute(item.uid, "copyName") then
             name = getItemAttribute(item.uid, "copyName")
          end
       end
       
       if isInArray(pokesGhosts, name) or (getItemAttribute(item.uid, "yHeldItem") and getItemAttribute(item.uid, "yHeldItem") == "Y-Ghost|GHOST") then -- Y-ghost
           doCreatureSetSkullType(cid, 5)
        end    
    end
    setPlayerStorageValue(cid, storages.isPokemonGhost, 1)
end

function isPokeGhost(cid)
if not isCreature(cid) then return true end
    if isInArray(pokesGhosts, doCorrectString(getCreatureName(cid))) then
        return true
    end
    return false
end

------ Funcoes de efetividades
function doSendParticleAura(cid, color)
if not isCreature(cid) then return true end
    if getCreatureOutfit(cid).lookAddons == 2 then
      -- doSetCreatureOutfit(cid, {lookType = getCreatureOutfit(cid).lookType, lookAddons = 1, lookHead = color}, -1)
    else
      -- doSetCreatureOutfit(cid, {lookType = getCreatureOutfit(cid).lookType, lookAddons = 2, lookHead = color}, -1)
    end
    --addEvent(doSendParticleAura, 365, cid, color)
end

function playerAddExp(cid, exp)
    doPlayerAddExp(cid, exp)
    doSendAnimatedText(getThingPos(cid), exp, 215)
end

function getTableMove(name, moveName)
    local x = movestable[doCorrectString(name)]

    if not x then return "" end
    
    local z = "\n"
    local tables = {x.move1, x.move2, x.move3, x.move4, x.move5, x.move6, x.move7, x.move8, x.move9, x.move10, x.move11, x.move12}
    for i = 1, #tables do
        if tables.name == moveName then
           return tables
        end
    end
end 

function getTableMoveSmeargle(name, moveName, cid)
    local x = movestable[doCorrectString(name)]
--------------SMEARGLETABLE
if name == "Smeargle" and isSummon(cid) then
local move1 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "Sketch1")
local move2 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "Sketch2")
local move3 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "Sketch3")
local move4 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "Sketch4")
local move5 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "Sketch5")
local move6 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "Sketch6")
local move7 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "Sketch7")
local move8 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "Sketch8")

local movename1, movecd1, moveforce1, movetype1, movetarget1, movelevel1, movedist1 = string.explode(move1, "|")[1], string.explode(move1, "|")[2], string.explode(move1, "|")[3], string.explode(move1, "|")[4], string.explode(move1, "|")[5], string.explode(move1, "|")[6], string.explode(move1, "|")[7]
local movename2, movecd2, moveforce2, movetype2, movetarget2, movelevel2, movedist2 = string.explode(move2, "|")[1], string.explode(move2, "|")[2], string.explode(move2, "|")[3], string.explode(move2, "|")[4], string.explode(move2, "|")[5], string.explode(move2, "|")[6], string.explode(move2, "|")[7]
local movename3, movecd3, moveforce3, movetype3, movetarget3, movelevel3, movedist3 = string.explode(move3, "|")[1], string.explode(move3, "|")[2], string.explode(move3, "|")[3], string.explode(move3, "|")[4], string.explode(move3, "|")[5], string.explode(move3, "|")[6], string.explode(move3, "|")[7]
local movename4, movecd4, moveforce4, movetype4, movetarget4, movelevel4, movedist4 = string.explode(move4, "|")[1], string.explode(move4, "|")[2], string.explode(move4, "|")[3], string.explode(move4, "|")[4], string.explode(move4, "|")[5], string.explode(move4, "|")[6], string.explode(move4, "|")[7]
local movename5, movecd5, moveforce5, movetype5, movetarget5, movelevel5, movedist5 = string.explode(move5, "|")[1], string.explode(move5, "|")[2], string.explode(move5, "|")[3], string.explode(move5, "|")[4], string.explode(move5, "|")[5], string.explode(move5, "|")[6], string.explode(move5, "|")[7]
local movename6, movecd6, moveforce6, movetype6, movetarget6, movelevel6, movedist6 = string.explode(move6, "|")[1], string.explode(move6, "|")[2], string.explode(move6, "|")[3], string.explode(move6, "|")[4], string.explode(move6, "|")[5], string.explode(move6, "|")[6], string.explode(move6, "|")[7]
local movename7, movecd7, moveforce7, movetype7, movetarget7, movelevel7, movedist7 = string.explode(move7, "|")[1], string.explode(move7, "|")[2], string.explode(move7, "|")[3], string.explode(move7, "|")[4], string.explode(move7, "|")[5], string.explode(move7, "|")[6], string.explode(move7, "|")[7]
local movename8, movecd8, moveforce8, movetype8, movetarget8, movelevel8, movedist8 = string.explode(move8, "|")[1], string.explode(move8, "|")[2], string.explode(move8, "|")[3], string.explode(move8, "|")[4], string.explode(move8, "|")[5], string.explode(move8, "|")[6], string.explode(move8, "|")[7]


local smeargletable = {move1 = {name = movename1, level = tonumber(movelevel1), cd = tonumber(movecd1), dist = tonumber(movedist1), target = tonumber(movetarget1), f = tonumber(moveforce1), t = movetype1},
         move2 = {name = movename2, level = tonumber(movelevel2), cd = tonumber(movecd2), dist = tonumber(movedist2), target = tonumber(movetarget2), f = tonumber(moveforce2), t = movetype2},
         move3 = {name = movename3, level = tonumber(movelevel3), cd = tonumber(movecd3), dist = tonumber(movedist3), target = tonumber(movetarget3), f = tonumber(moveforce3), t = movetype3},
         move4 = {name = movename4, level = tonumber(movelevel4), cd = tonumber(movecd4), dist = tonumber(movedist4), target = tonumber(movetarget4), f = tonumber(moveforce4), t = movetype4},
         move5 = {name = movename5, level = tonumber(movelevel5), cd = tonumber(movecd5), dist = tonumber(movedist5), target = tonumber(movetarget5), f = tonumber(moveforce5), t = movetype5},
         move6 = {name = movename6, level = tonumber(movelevel6), cd = tonumber(movecd6), dist = tonumber(movedist6), target = tonumber(movetarget6), f = tonumber(moveforce6), t = movetype6},
         move7 = {name = movename7, level = tonumber(movelevel7), cd = tonumber(movecd7), dist = tonumber(movedist7), target = tonumber(movetarget7), f = tonumber(moveforce7), t = movetype7},
         move8 = {name = movename8, level = tonumber(movelevel8), cd = tonumber(movecd8), dist = tonumber(movedist8), target = tonumber(movetarget8), f = tonumber(moveforce8), t = movetype8},
          }
          x =smeargletable
end
--------------SMEARGLETABLE
    if not x then return "" end
    
    local z = "\n"
    local tables = {x.move1, x.move2, x.move3, x.move4, x.move5, x.move6, x.move7, x.move8, x.move9, x.move10, x.move11, x.move12}
    for i = 1, #tables do
        if tables.name == moveName then
           return tables
        end
    end
end 

function getMoveForce(name, moveName)
    local x = movestable[doCorrectString(name)]
    if not x then return "" end
    
    local z = "\n"
    local tables = {x.move1, x.move2, x.move3, x.move4, x.move5, x.move6, x.move7, x.move8, x.move9, x.move10, x.move11, x.move12}
    for i = 1, #tables do
        if tables.name == moveName then
           return tables.f
        end
    end
end 

function retireShinyName(str)
   if string.find(str, "Shiny") then
      return str:match("Shiny (.*)")   
   end
   return str
end      

function doPassives(cid)
    
end

function isReflect(cid)
    return getPlayerStorageValue(cid, storages.reflect) >= 1
end

function removeReflect(cid)
          if not isCreature(cid) then return true end
            if getPlayerStorageValue(cid, storages.reflect) >= 1 then -- reflect system
               setPlayerStorageValue(cid, storages.reflect, getPlayerStorageValue(cid, storages.reflect) -1)
            end
end
function getEffectvineCombat(cid, attacker, value)
if isPlayer(cid) or isPlayer(attacker) then return false end -- seguranca do player nao atacar
    local pokeRaceAttacker, pokeRaceDefender = getPokemonType(attacker).type1, getPokemonType(cid).type1
    
    if pokeRaceAttacker == nil or pokeRaceDefender == nil then
    print ("bugado "..cid .." o " ..attacker)
    return 0
    end
    
    if isInArray(typeTable[pokeRaceAttacker].super, pokeRaceDefender) or isInArray(typeTable[pokeRaceAttacker].super, pokeRaceDefender) then -- elemento atacante ser mais forte que os elementos de defesa
        value = value * 1.3
    end
        if isInArray(typeTable[pokeRaceAttacker].week, pokeRaceDefender) or isInArray(typeTable[pokeRaceAttacker].week, pokeRaceDefender) then -- elemento atacante ser mais forte que os elementos de defesa
        value = value
        end
        
        if pokeRaceDefender == "ghost" then -- apenas ghost não toma alguns melees
            if isInArray(typeTable[pokeRaceAttacker].non, pokeRaceDefender) or isInArray(typeTable[pokeRaceAttacker].non, pokeRaceDefender) then -- elemento atacante ser mais forte que os elementos de defesa
                
                value = 0
            end
        end
    if getCreatureName(cid) == "Venusaur" and value ~= 0 and isMega(cid) and isInArray({"ice", "fire"}, pokeRaceAttacker)then -- Passiva thick fat
       value = value / 2
    end

    return value
end

function KecleonColor(cid, element)
local outfit = getCreatureOutfit(cid)
local pos = getThingPos(cid) 

doSendMagicEffect(pos, 13)

if element == "fire" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 75, lookBody = 37, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "normal" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 43, lookBody = 60, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "fighting" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 39, lookBody = 1, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "water" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 49, lookBody = 11, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "flying" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 38, lookBody = 0, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "grass" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 119, lookBody = 81, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "poison" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 72, lookBody = 34, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "electric" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 79, lookBody = 41, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "ground" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 116, lookBody = 78, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "psychic" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 35, lookBody = 24, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "rock" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 76, lookBody = 21, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "ice" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 85, lookBody = 0, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "bug" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 82, lookBody = 94, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "dragon" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 41, lookBody = 3, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "ghost" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 127, lookBody = 51, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "dark" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 114, lookBody = 89, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "steel" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 7, lookBody = 38, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)
elseif element == "fairy" then
doSetCreatureOutfit(cid, {lookType = outfit.lookType, lookHead = 15, lookBody = 12, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet}, -1)

end

end

function getEffectvineSpell(attacker, spellNameFromAttacker, value, cid) -- printar os elementos
    
if(spellNameFromAttacker ~= -1) then -- checagem de efetividades

    
local name = getCreatureName(attacker) -- reflect system
      if isMega(attacker) then
         name = getPlayerStorageValue(attacker, storages.isMega)
      end
local spellRace, pokeElement1, pokeElement2 = getMoveType(name, spellNameFromAttacker), getPokemonType(cid).type1, getPokemonType(cid).type2
    
    if getCreatureName(attacker) == "Smeargle" and isSummon(attacker) then
    spellRace = getMoveTypeSmeargle(getCreatureName(attacker), spellNameFromAttacker, attacker)
    end
    
    if spellNameFromAttacker == "X Elemental" then
    spellRace = getPokemonType(attacker).type1
    end
    
    if getCreatureName(cid) == "Kecleon" then
    local elementospell = spellRace
    KecleonColor(cid, elementospell)
    pokeElement1= getPlayerStorageValue(cid, 21113)
    end

    if getCreatureName(cid) == "Kecleon" and getPlayerStorageValue(cid, 21113) ==nil then
    setPlayerStorageValue(cid, 21113, "normal")
    end
  
  
    if not typeTable[spellRace] then 
        local remover = removeSpellInXML(doCorrectString(name), spellNameFromAttacker)
        if remover then print("Magia: " .. spellNameFromAttacker .. " removida do XML: " .. doCorrectString(name) .. ".xml") end
        return 0
    end

    if spellRace == "poison" and (pokeElement1 == "steel" or pokeElement2 == "steel") then
    value = 0
    end
    if isInArray(typeTable[spellRace].non, pokeElement1) or isInArray(typeTable[spellRace].non, pokeElement2) then -- elemento atacante ser mais forte que os elementos de defesa
        value = 0
        end
    if isInArray(typeTable[spellRace].super, pokeElement1) or isInArray(typeTable[spellRace].super, pokeElement2) then -- elemento atacante ser mais forte que os elementos de defesa
        value = value * 1.3
    end
        if isInArray(typeTable[spellRace].week, pokeElement1) or isInArray(typeTable[spellRace].week, pokeElement2) then -- elemento atacante ser mais forte que os elementos de defesa
        value = value * 0.7
        end
        
    
    if getCreatureName(cid) == "Venusaur" and value ~= 0 and isMega(cid) and isInArray({"ice", "fire"}, spellRace)then -- Passiva thick fat
       value = value / 2
    end
    if getCreatureName(cid) == "Kecleon" then
    local elementospell = spellRace
    setPlayerStorageValue(cid, 21113, elementospell)
    end

    if isSummon(cid) and isSummon(attacker) then 
    value = value /4
    end

end
    
    return value
end

function getMoveType(name, moveName, attacker)
    local x = movestable[doCorrectString(name)]
    if not x then return "" end
    
    local z = "\n"
    local tables = {x.move1, x.move2, x.move3, x.move4, x.move5, x.move6, x.move7, x.move8, x.move9, x.move10, x.move11, x.move12}
    for i = 1, #tables do
        if tables.name == moveName then
           return tables.t
        end
    end
        return true
end 

function getMoveTypeSmeargle(name, moveName, attacker)
    local x = {}
--------------SMEARGLETABLE
if name == "Smeargle" and isSummon(attacker) then
local move1 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, "Sketch1")
local move2 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, "Sketch2")
local move3 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, "Sketch3")
local move4 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, "Sketch4")
local move5 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, "Sketch5")
local move6 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, "Sketch6")
local move7 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, "Sketch7")
local move8 = getItemAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, "Sketch8")

local movename1, movecd1, moveforce1, movetype1, movetarget1, movelevel1, movedist1 = string.explode(move1, "|")[1], string.explode(move1, "|")[2], string.explode(move1, "|")[3], string.explode(move1, "|")[4], string.explode(move1, "|")[5], string.explode(move1, "|")[6], string.explode(move1, "|")[7]
local movename2, movecd2, moveforce2, movetype2, movetarget2, movelevel2, movedist2 = string.explode(move2, "|")[1], string.explode(move2, "|")[2], string.explode(move2, "|")[3], string.explode(move2, "|")[4], string.explode(move2, "|")[5], string.explode(move2, "|")[6], string.explode(move2, "|")[7]
local movename3, movecd3, moveforce3, movetype3, movetarget3, movelevel3, movedist3 = string.explode(move3, "|")[1], string.explode(move3, "|")[2], string.explode(move3, "|")[3], string.explode(move3, "|")[4], string.explode(move3, "|")[5], string.explode(move3, "|")[6], string.explode(move3, "|")[7]
local movename4, movecd4, moveforce4, movetype4, movetarget4, movelevel4, movedist4 = string.explode(move4, "|")[1], string.explode(move4, "|")[2], string.explode(move4, "|")[3], string.explode(move4, "|")[4], string.explode(move4, "|")[5], string.explode(move4, "|")[6], string.explode(move4, "|")[7]
local movename5, movecd5, moveforce5, movetype5, movetarget5, movelevel5, movedist5 = string.explode(move5, "|")[1], string.explode(move5, "|")[2], string.explode(move5, "|")[3], string.explode(move5, "|")[4], string.explode(move5, "|")[5], string.explode(move5, "|")[6], string.explode(move5, "|")[7]
local movename6, movecd6, moveforce6, movetype6, movetarget6, movelevel6, movedist6 = string.explode(move6, "|")[1], string.explode(move6, "|")[2], string.explode(move6, "|")[3], string.explode(move6, "|")[4], string.explode(move6, "|")[5], string.explode(move6, "|")[6], string.explode(move6, "|")[7]
local movename7, movecd7, moveforce7, movetype7, movetarget7, movelevel7, movedist7 = string.explode(move7, "|")[1], string.explode(move7, "|")[2], string.explode(move7, "|")[3], string.explode(move7, "|")[4], string.explode(move7, "|")[5], string.explode(move7, "|")[6], string.explode(move7, "|")[7]
local movename8, movecd8, moveforce8, movetype8, movetarget8, movelevel8, movedist8 = string.explode(move8, "|")[1], string.explode(move8, "|")[2], string.explode(move8, "|")[3], string.explode(move8, "|")[4], string.explode(move8, "|")[5], string.explode(move8, "|")[6], string.explode(move8, "|")[7]


local smeargletable = {move1 = {name = movename1, level = tonumber(movelevel1), cd = tonumber(movecd1), dist = tonumber(movedist1), target = tonumber(movetarget1), f = tonumber(moveforce1), t = movetype1},
         move2 = {name = movename2, level = tonumber(movelevel2), cd = tonumber(movecd2), dist = tonumber(movedist2), target = tonumber(movetarget2), f = tonumber(moveforce2), t = movetype2},
         move3 = {name = movename3, level = tonumber(movelevel3), cd = tonumber(movecd3), dist = tonumber(movedist3), target = tonumber(movetarget3), f = tonumber(moveforce3), t = movetype3},
         move4 = {name = movename4, level = tonumber(movelevel4), cd = tonumber(movecd4), dist = tonumber(movedist4), target = tonumber(movetarget4), f = tonumber(moveforce4), t = movetype4},
         move5 = {name = movename5, level = tonumber(movelevel5), cd = tonumber(movecd5), dist = tonumber(movedist5), target = tonumber(movetarget5), f = tonumber(moveforce5), t = movetype5},
         move6 = {name = movename6, level = tonumber(movelevel6), cd = tonumber(movecd6), dist = tonumber(movedist6), target = tonumber(movetarget6), f = tonumber(moveforce6), t = movetype6},
         move7 = {name = movename7, level = tonumber(movelevel7), cd = tonumber(movecd7), dist = tonumber(movedist7), target = tonumber(movetarget7), f = tonumber(moveforce7), t = movetype7},
         move8 = {name = movename8, level = tonumber(movelevel8), cd = tonumber(movecd8), dist = tonumber(movedist8), target = tonumber(movetarget8), f = tonumber(moveforce8), t = movetype8},
          }
          x =smeargletable
end
--------------SMEARGLETABLE
    if not x then return "" end
    
    local z = "\n"
    local tables = {x.move1, x.move2, x.move3, x.move4, x.move5, x.move6, x.move7, x.move8, x.move9, x.move10, x.move11, x.move12}
    for i = 1, #tables do
        if tables.name == moveName then
           return tables.t
        end
    end
        return true
end 

function isGod(cid)
if isPlayer(cid) then 
  if getPlayerGroupId(cid) >= 6 then
     return true 
  end
  return false
end
end

function isADM(cid)
if isPlayer(cid) then 
  if getPlayerGroupId(cid) >= 15 then
     return true 
  end
  return false
end
end

function getRankStorage(cid, value, max, RankName) -- by vodka
local str =""
str = "--[".. (RankName == nil and "RANK STORAGE" or ""..RankName.."") .."]--\n\n"
local query = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = "..value.." ORDER BY cast(value as UNSIGNED) DESC;")
if (query:getID() ~= -1) then k = 1 repeat if k > max then break end
str = str .. "\n " .. k .. ". "..getPlayerNameByGUID(query:getDataString("player_id")).." - [" .. query:getDataInt("value")+1 .. "]"
k = k + 1 until not query:next() end return doShowTextDialog(cid, 2529, str)
end

function doKillPlayer(cid, attacker, hit)
    if not isCreature(cid) then return true end
    demountPokemon(cid)
    local myName, attackerName =  getCreatureName(cid), getCreatureName(attacker) 
    if canWalkOnPos(getThingPos(cid), false, true, true, true, true) then
    
    if  getPlayerStorageValue(cid, 321322) == 1  then
    setPlayerStorageValue(cid, 321322, -1)
    if getPlayerLevel(cid) < 150 then
        local corpse = doCreateItem(15645, 1, getThingPos(cid))
         doDecayItem(corpse)
    elseif getPlayerLevel(cid) >= 150 and getPlayerLevel(cid) < 250 then
    local corpse = doCreateItem(15644, 1, getThingPos(cid))
         doDecayItem(corpse)
    elseif getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) < 300 then
    local corpse = doCreateItem(15644, 2, getThingPos(cid))
         doDecayItem(corpse)
    elseif getPlayerLevel(cid) >= 300 then
    local corpse = doCreateItem(15646, 1, getThingPos(cid))
         doDecayItem(corpse)
         end
         
    else
        if getPlayerSex(cid) == 1 then
         local corpse = doCreateItem(3058, 1, getThingPos(cid))
         doDecayItem(corpse)
         doItemSetAttribute(corpse, "iname", "\nYou recognize ".. myName ..". He was killed by a ".. attackerName .."")
         elseif getPlayerSex(cid) == 0 then     
         local corpse = doCreateItem(3065, 1, getThingPos(cid))
         doDecayItem(corpse)
         doItemSetAttribute(corpse, "iname", "\nYou recognize ".. myName ..". She was killed by a ".. attackerName .."")
        end
    end
    
end

    --setPlayerStorageValue(cid, storage.securityDead, 1)
    --setPlayerGr
    local townName = getTownName(getPlayerTown(cid))
        if townName then
          doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
        end
    doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
    doRemoveCondition(cid, CONDITION_INFIGHT)
    local experience = -getPlayerExperience(cid)*0.01
 setPlayerStorageValue(cid, 3213211, -1)  
      if  getPlayerStorageValue(cid, 123123) == 1  then
if  getPlayerStorageValue(cid, 321321) == 1 and  getPlayerStorageValue(cid, 3213211)  == -1  then
     experience = 0
setPlayerStorageValue(cid, 321321, -1)
     else
     experience = 0
setPlayerStorageValue(cid, 123123, -1)
end
     end
if  getPlayerStorageValue(cid, 321321) == 1 and getPlayerStorageValue(cid, 3213211)  == -1   then
     experience = 0
setPlayerStorageValue(cid, 321321, -1)
     end
setPlayerStorageValue(cid, 5700, -1)
    setPlayerStorageValue(cid, 3213211, -1)
    doPlayerAddExperience(cid, experience)
    

    doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_PLAYER_DEAD_WINDOW, " morreu|" .. doCorrectString(attackerName) .. "|" .. hit .. "|" .. tostring(getPortraitClientID(attackerName)) .. "|")
    addEvent(doRemoveCreatureWithS, 1, cid)
    return false
end

function doRemoveCreatureWithS(cid)
if not isCreature(cid) then return true end
   doRemoveCreature(cid)
end

function doKillPlayerPokemon(cid)
    local deathtexts = {"Oh no! POKENAME, come back!", "Come back, POKENAME!", "That's enough, POKENAME!", "You did well, POKENAME!", "You need to rest, POKENAME!", "Nice job, POKENAME!", "POKENAME, you are too hurt!"}
    local master = getCreatureMaster(cid)
    local thisball = getPlayerSlotItem(master, 8)
    local ballName = getItemAttribute(thisball.uid, "poke")
    
    
    if not isCreature(cid) or not isCreature(master) then return true end
    
    
    if #getCreatureSummons(master) > 1 then
        BackTeam(master, getCreatureSummons(master))      
    end

    doSendMagicEffect(getThingPos(cid), pokeballs[getPokeballType(thisball.itemid)].effect) -- rever isso aqui
    doTransformItem(thisball.uid, pokeballs[getPokeballType(thisball.itemid)].off)
    
    local say = deathtexts[math.random(#deathtexts)]
          say = string.gsub(say, "POKENAME", getCreatureName(cid))
          doCreatureSay(master, say, TALKTYPE_ORANGE_1)
          
          doItemSetAttribute(thisball.uid, "hpToDraw", 0)
    
end

function getPokemonType(cid)
if isPlayer(cid) then return false end -- seguranca do player nao atacar
    local name = doCorrectString(getCreatureName(cid))
    if not pokes[name] then return print("getPokemonType(cid): O pokemon " .. name .. " nao tem um tipo efetivo.") end
    local types = {}
          types.type1 = pokes[name].type
          types.type2 = pokes[name].type2    
    return types
end

function getElementByCombat(combat)
    local element = "normal"
    for a, b in pairs(typeTable) do
        if(b.damageID == combat)then
          element = a
          break
        end
    end
    return element
end

------ Funcoes de efetividades ----------

function  getPokemonOutfitToSkill(pokeName)
    if flys[pokeName] then
       return flys[pokeName][1]
    elseif rides[pokeName] then
       return rides[pokeName][1]
    else 
       return surfs[pokeName].lookType
    end
end

function  getPokemonSpeedToSkill(pokeName)
    if flys[pokeName] then
       return flys[pokeName][2]
    elseif rides[pokeName] then
       return rides[pokeName][2] * 4.5
    else 
       return surfs[pokeName].speed
    end
end

function getPokemonSkills(pokeName)  
    local str = ""
    for a, b in pairs(specialabilities) do
        for i = 1, #b do
            if(b == pokeName) then
               str = str .. (str == "" and "" or ", ") .. a
            end
        end 
    end
    return str
end

function demountPokemon(cid, kill)
if not isCreature(cid) then return false end
if not isRiderOrFlyOrSurf(cid) then return false end
    doEreasPlayerOrder(cid)
    if not kill then
        local ball = getPlayerSlotItem(cid, 8)
        doTransformItem(ball.uid, pokeballs[getPokeballType(ball.itemid)].off)
    end
end

--// Edicioes DarkXPoke \\--

function isUsingPotion(pokemon)
    if getPlayerStorageValue(pokemon, storages.potion) and getPlayerStorageValue(pokemon, storages.potion) >= 1 then
        return true
    else
        return false
    end
end

function isNumberPair(number)
    return number % 2 == 0 and true or false
end

function getCombatColor(typeAtk, pokemon)
    local pokeName = getCreatureName(pokemon)
    local pokeType1 = getPokemonType1(pokeName)
    local pokeType2 = getPokemonType2(pokeName)
    if COMBAT_COLORS[typeAtk] == 180 then
        if COMBAT_TARGET_COLOR[pokeType1] ~= 180 then
            return COMBAT_TARGET_COLOR[pokeType1]
        elseif pokeType2 and COMBAT_TARGET_COLOR[pokeType2] ~= 180 then
            return COMBAT_TARGET_COLOR[pokeType2]
        else
            return 180
        end
    else
        return COMBAT_COLORS[typeAtk]
    end
end

function getCreatureDirectionToTarget(cid, target)
    if not isCreature(cid) then return true end
    if not isCreature(target) then return getCreatureLookDir(cid) end

    local dirs = {
        [NORTHEAST] = {NORTH, EAST},
        [SOUTHEAST] = {SOUTH, EAST},
        [NORTHWEST] = {NORTH, WEST},
        [SOUTHWEST] = {SOUTH, WEST}
    }

    local direction = getDirectionTo(getThingPos(cid), getThingPos(target), false)
    if direction <= 3 then
        return direction
    else
        local xdistance = math.abs(getThingPos(cid).x - getThingPos(target).x)
        local ydistance = math.abs(getThingPos(cid).y - getThingPos(target).y)
        if xdistance > ydistance then
            return dirs[direction][2]
        elseif ydistance > xdistance then
            return dirs[direction][1]
        elseif isInArray(dirs[direction], getCreatureLookDir(cid)) then
            return getCreatureLookDir(cid)
        else
            return dirs[direction][math.random(1, 2)]
        end
    end
end

function getPlayerFightModeOffense(cid)
    return fightMode[getPlayerStorageValue(cid, storages.fightMode)].offense
end

function getPlayerFightModeDefense(cid)
    return fightMode[getPlayerStorageValue(cid, storages.fightMode)].defense
end

function doOTCSendPokemonHealth(cid)
    local ball = getPlayerSlotItem(cid, CONST_SLOT_FEET)
    local pokemon = getCreatureSummons(cid)
    if not ball.uid or ball.uid <= 1 then
        return doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_POKEMON_HEALTH, "0|0")
    end
    if #pokemon >= 1 then
        return doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_POKEMON_HEALTH, getCreatureHealth(pokemon[1]).."|"..getCreatureMaxHealth(pokemon[1]))
    end
    return doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_POKEMON_HEALTH, getBallHealth(cid, ball).."|"..getBallMaxHealth(cid, ball))
end

function portraitSendLifeOTC(cid, ball)
if not isCreature(cid) then return true end
    if ball.uid and ball.uid ~= 0 then 
       return doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_POKEMON_HEALTH, getBallHealth(cid, ball).."|"..getBallMaxHealth(cid, ball))
    else
       return doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_POKEMON_HEALTH, "0|0")
    end
end

function doTransformPokeballIcon(cid, item, count, toContainer, fromContainer, fromPos, toPos)    
    ----------------- Icon system -----------------
    if toPos.x ~= 65535 then -- jogando no chao    
        if isContainer(item.uid) then
         local bag = item.uid
         for i = 1, #getPokeballsInContainer(bag) do
             local ballNow = getPokeballsInContainer(bag)
             local ids = getPokeballs_ITEMS_ID_InContainer(bag)
        
            if getItemAttributeWithSecurity(ballNow, "unique") == 'true' then
               return true
            end
            
            if not getItemAttribute(ballNow, "reverseIcon")    then -- bug fix
               doItemSetAttribute(ballNow, "reverseIcon", "poke")
            end
        
             if isPokeballOn(ids) then 
                doTransformItem(ballNow, pokeballs[getItemAttributeWithSecurity(ballNow, "reverseIcon")].on)
             elseif isPokeballOff(ids) then
                doTransformItem(ballNow, pokeballs[getItemAttributeWithSecurity(ballNow, "reverseIcon")].off)
             end
             
             doItemSetAttribute(ballNow, "ehDoChao", true)
        end
       elseif isPokeball(item.itemid) then
        
            if getItemAttributeWithSecurity(item.uid, "unique") == 'true' then
               return true
            end
        
            if not getItemAttribute(item.uid, "reverseIcon") then -- bug fix
               doItemSetAttribute(item.uid, "reverseIcon", "poke")
            end
            
            local pokeNamesBall = ""
                if not pokeballs[getItemAttributeWithSecurity(item.uid, "reverseIcon") or "poke"] then    
                   print("Icon bugou: main function.lua [524]")    
                   return true
                end
            
             if isPokeballOn(item) then 
                doTransformItem(item.uid, pokeballs[getItemAttributeWithSecurity(item.uid, "reverseIcon") or "poke"].on)
             elseif isPokeballOff(item) then
                doTransformItem(item.uid, pokeballs[getItemAttributeWithSecurity(item.uid, "reverseIcon") or "poke"].off)
             end
             
             doItemSetAttribute(item.uid, "ehDoChao", true)
       end
    else
       if isContainer(item.uid) then
         local bag = item.uid
         for i = 1, #getPokeballsInContainer(bag) do
             local ballNow = getPokeballsInContainer(bag)
             local pokeName =  string.lower(getItemAttributeWithSecurity(ballNow, "poke"))
             local ids = getPokeballs_ITEMS_ID_InContainer(bag)
        
             if isPokeballOn(ids) then 
                doTransformItem(ballNow, pokeballs[pokeName].on)
             elseif isPokeballOff(ids) then
                doTransformItem(ballNow, pokeballs[pokeName].off)
             end
             doItemSetAttribute(ballNow, "ehDoChao", false)
        end
       elseif isPokeball(item.itemid) then
             local pokeName =  string.lower(getItemAttributeWithSecurity(item.uid, "poke"))
             if isPokeballOn(item) then 
                doTransformItem(item.uid, pokeballs[pokeName].on)
             elseif isPokeballOff(item) then
                doTransformItem(item.uid, pokeballs[pokeName].off)
             end
       end
    end
   ----------------- Icon system -----------------     
end

function doSetAttributesBallsByPokeName(cid, ball, name)
name = doCorrectString(name)
local bTypeName = getItemAttribute(ball, "ball")
if string.find(name, "Shiny") then
   bTypeName = "shiny" .. bTypeName
end
   
doItemSetAttribute(ball, "poke", name)
doItemSetAttribute(ball, "ballEffe", bTypeName)
doItemSetAttribute(ball, "hpToDraw", 0)
doItemSetAttribute(ball, "Icon", name:lower())
doItemSetAttribute(ball, "reverseIcon", bTypeName)
doItemSetAttribute(ball, "pokeDeath", false)
doItemSetAttribute(ball, "initialKit", true)

    if getItemAttribute(ball, "poke") == "Smeargle" then
    doItemSetAttribute(ball, "Sketch1", "Sketch 1|10|0|normal|0|100|1")
    doItemSetAttribute(ball, "Sketch2", "Sketch 2|10|0|normal|0|100|1")
    doItemSetAttribute(ball, "Sketch3", "Sketch 3|10|0|normal|0|100|1")
    doItemSetAttribute(ball, "Sketch4", "Sketch 4|10|0|normal|0|100|1")
    doItemSetAttribute(ball, "Sketch5", "Sketch 5|10|0|normal|0|100|1")
    doItemSetAttribute(ball, "Sketch6", "Sketch 6|10|0|normal|0|100|1")
    doItemSetAttribute(ball, "Sketch7", "Sketch 7|10|0|normal|0|100|1")
    doItemSetAttribute(ball, "Sketch8", "Sketch 8|10|0|normal|0|100|1")
    end
    
if not pokes[name] then
   print("Pokemon nao existe: " .. name)
   return true
end
local pokeLifeMax = pokes[name].life 
local masterLevel = getPlayerLevel(cid)
local lifePercentByLevel = 100 * masterLevel + (pokes[name].vitality * masterLevel)
    if(pokes[name].level < 60) then
        lifePercentByLevel = pokes[name].vitality * masterLevel * ( masterLevel > 60 and 1.5 or 1 )
    end
local life = pokeLifeMax + lifePercentByLevel
setBallHealth(ball, life, life)
end

function getPokeballName(ball)
      return getItemAttribute(ball.uid, "poke")
end   

function getPokeName(cid)
if not isCreature(cid) then return "" end
   return getPlayerStorageValue(cid, 510) or getCreatureName(cid)
end

function isFight(cid)
  if getCreatureCondition(cid, CONDITION_INFIGHT) then
     return true
  end
return false
end

function getBallEffect(ball)
    return pokeballs2[getItemAttribute(ball.uid, "ballEffe")].eff or 376
end 

function getBallType(ball)
    return getItemAttribute(ball.uid, "ballEffe") or "poke"
end 

function setBallHealth(ball, health, maxHealth)
    doItemSetAttribute(ball, "hpNow", health)
    doItemSetAttribute(ball, "hpMax", maxHealth)
end

function getBallHealth(cid, ball)
    for a, b in pairs (pokeballs) do
        if ball.itemid == b.off then
            return 0
        end
    end
    if not getItemAttribute(ball.uid, "hpNow") then
        doSetAttributesBallsByPokeName(cid, ball.uid, getItemAttribute(ball.uid, "poke"))
    end
    local healthNow = getItemAttribute(ball.uid, "hpNow")
    return math.floor(healthNow)
end

function getBallMaxHealthUnique(cid, ball)
    if not getItemAttribute(ball, "hpMax") then
        doSetAttributesBallsByPokeName(cid, ball, getItemAttribute(ball, "poke"))
    end
    local healthNow = getItemAttribute(ball, "hpMax")
    return math.floor(healthNow)
end

function getBallMaxHealth(cid, ball)
    if not getItemAttribute(ball.uid, "hpMax") then
        doSetAttributesBallsByPokeName(cid, ball.uid, getItemAttribute(ball.uid, "poke"))
    end
    local healthNow = getItemAttribute(ball.uid, "hpMax")
    return math.floor(healthNow)
end

function doSetPokeballLifeStatus(item, health, maxHealth)
    doItemSetAttribute(item.uid, "hpNow", health)
    doItemSetAttribute(item.uid, "hpMax", maxHealth)
end

function doSendLifePokeToOTC(cid)
    local ball = getPlayerSlotItem(cid, 8)
    local pk = getCreatureSummons(cid)
          if #pk <= 0 then return true end
          if ball.uid ~= 0 then
        doSetPokeballLifeStatus(ball, getCreatureHealth(pk[1]), getCreatureMaxHealth(pk[1]))
        doOTCSendPokemonHealth(cid)
    end
end

------------------------------------------ Skill Bar OTC
function doOTCSendPlayerSkills(cid)
    local str = {}
    table.insert(str, getPlayerClan(cid))
    table.insert(str, "|"..getPlayerCasinoCoins(cid))
    table.insert(str, "|"..getPlayerKantoCatches(cid).."|"..getPlayerTotalCatches(cid))
    table.insert(str, "|"..getPlayerWins(cid).."|"..getPlayerLoses(cid).."|"..getPlayerOfficialWins(cid).."|"..getPlayerOfficialLoses(cid).."|"..getPlayerPVPScore(cid))
    table.insert(str, "|"..getPlayerBadgeOfLeader(cid, "Brock"))
    table.insert(str, ";"..getPlayerBadgeOfLeader(cid, "Misty"))
    table.insert(str, ";"..getPlayerBadgeOfLeader(cid, "Surge"))
    table.insert(str, ";"..getPlayerBadgeOfLeader(cid, "Erika"))
    table.insert(str, ";"..getPlayerBadgeOfLeader(cid, "Sabrina"))
    table.insert(str, ";"..getPlayerBadgeOfLeader(cid, "Koga"))
    table.insert(str, ";"..getPlayerBadgeOfLeader(cid, "Blaine"))
    table.insert(str, ";"..getPlayerBadgeOfLeader(cid, "Giovanni"))
    return doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_SKILL_BAR, table.concat(str))
end

------------------------------------------ Clan

function setPlayerClans(cid, name)
    return setPlayerStorageValue(cid, storages.playerClan, string.lower(name)) and doOTCSendPlayerSkills(cid)
end

function getPlayerClan(cid)
    return getPlayerStorageValue(cid, storages.playerClan) == -1 and "Pokemon Trainer" or getPlayerStorageValue(cid, storages.playerClan)
end

function setPlayerClanRank(cid, value)
    return setPlayerStorageValue(cid, storages.playerClanRank, value)
end

function getPlayerClanRank(cid)
    return getPlayerStorageValue(cid, storages.playerClanRank) == -1 and 1 or getPlayerStorageValue(cid, storages.playerClanRank)
end

------------------------------------------ Casino
function doPlayerAddInCasinoCoins(cid, value)
    return setPlayerStorageValue(cid, storages.playerCasinoCoins, getPlayerCasinoCoins(cid) + value) and doOTCSendPlayerSkills(cid)
end

function getPlayerCasinoCoins(cid)
    return getPlayerStorageValue(cid, storages.playerCasinoCoins) == -1 and 0 or getPlayerStorageValue(cid, storages.playerCasinoCoins)
end

------------------------------------------ Catches
function doPlayerAddInKantoCatchs(cid, value)
    return setPlayerStorageValue(cid, storages.playerKantoCatches, getPlayerKantoCatches(cid) + value)
end

function getPlayerKantoCatches(cid)
    return getPlayerStorageValue(cid, storages.playerKantoCatches) == -1 and 0 or getPlayerStorageValue(cid, storages.playerKantoCatches)
end

function doPlayerAddInTotalCatchs(cid, value)
    return setPlayerStorageValue(cid, storages.playerTotalCatches, getPlayerTotalCatches(cid) + value) and doOTCSendPlayerSkills(cid)
end

function getPlayerTotalCatches(cid)
    return getPlayerStorageValue(cid, storages.playerTotalCatches) == -1 and 0 or getPlayerStorageValue(cid, storages.playerTotalCatches)
end

------------------------------------------ Duels and PVP
function doPlayerAddInWins(cid, value)
    return setPlayerStorageValue(cid, storages.playerWins, getPlayerWins(cid) + value) and doOTCSendPlayerSkills(cid)
end

function getPlayerWins(cid)
    return getPlayerStorageValue(cid, storages.playerWins) == -1 and 0 or getPlayerStorageValue(cid, storages.playerWins)
end

function doPlayerAddInLoses(cid, value)
    return setPlayerStorageValue(cid, storages.playerLoses, getPlayerLoses(cid) + value) and doOTCSendPlayerSkills(cid)
end

function getPlayerLoses(cid)
    return getPlayerStorageValue(cid, storages.playerLoses) == -1 and 0 or getPlayerStorageValue(cid, storages.playerLoses)
end

function doPlayerAddInOfficialWins(cid, value)
    return setPlayerStorageValue(cid, storages.playerOfficialWins, getPlayerOfficialWins(cid) + value) and doOTCSendPlayerSkills(cid)
end

function getPlayerOfficialWins(cid)
    return getPlayerStorageValue(cid, storages.playerOfficialWins) == -1 and 0 or getPlayerStorageValue(cid, storages.playerOfficialWins)
end

function doPlayerAddInOfficialLoses(cid, value)
    return setPlayerStorageValue(cid, storages.playerOfficialLoses, getPlayerOfficialLoses(cid) + value) and doOTCSendPlayerSkills(cid)
end

function getPlayerOfficialLoses(cid)
    return getPlayerStorageValue(cid, storages.playerOfficialLoses) == -1 and 0 or getPlayerStorageValue(cid, storages.playerOfficialLoses)
end

function doPlayerAddInPVPScore(cid, value)
    return setPlayerStorageValue(cid, storages.playerPVPScore, getPlayerPVPScore(cid) + value) and doOTCSendPlayerSkills(cid)
end

function getPlayerPVPScore(cid)
    return getPlayerStorageValue(cid, storages.playerPVPScore) == -1 and 0 or getPlayerStorageValue(cid, storages.playerPVPScore)
end

------------------------------------------ Badges
function doPlayerAddBadgeOfLeader(cid, leader)
    return setPlayerStorageValue(cid, storages.gynLeaders[leader], 1)
end

function getPlayerBadgeOfLeader(cid, leader)
    return getPlayerStorageValue(cid, storages.gynLeaders[leader]) == -1 and 0 or getPlayerStorageValue(cid, storages.gynLeaders[leader])
end


function getPokeUniqueStorToCatch(poke)
   return pokeballs[string.lower(poke)].on
end

function getPokeUniqueStorToDex(poke)
   return pokeballs[string.lower(poke)].off
end

function isWild(cid)
   if not isCreature(cid) then return false end
      if not isSummon(cid) and isMonster(cid) then
         return true 
      end
   return false
end

function getPokeDistanceToTeleport(cid)
   if not isCreature(cid) then return true end
   if not isSummon(cid) then return true end
   
   local owner = getCreatureMaster(cid)
   
      if getThingPos(cid).z ~= getThingPos(owner).z or math.abs(getThingPos(owner).x - getThingPos(cid).x) > 7 or math.abs(getThingPos(owner).y - getThingPos(cid).y) > 5 then
         doTeleportThing(cid, getThingPos(owner), false)
         doSendMagicEffect(getThingPos(cid), 21)
         setMoveSummon(owner, true)
      end
      
   addEvent(getPokeDistanceToTeleport, 10, cid)
end

function setMoveSummon(cid, canMove)
if not isCreature(cid) then return true end
return canMove == true and setPlayerStorageValue(cid, 500, -1) or setPlayerStorageValue(cid, 500, 1)   
end 

function getPokeballs_ITEMS_ID_InContainer(container) -- Function By Kydrai
    if not isContainer(container) then return {} end
    local items = {}
    if isContainer(container) and getContainerSize(container) > 0 then
        for slot=0, (getContainerSize(container)-1) do
            local item = getContainerItem(container, slot)
                if isContainer(item.uid) then
                    local itemsbag = getPokeballsInContainer(item.uid)
                    for i=0, #itemsbag do
                        table.insert(items, itemsbag)
                    end
                elseif isPokeball(item.itemid) then
                    table.insert(items, item)
                end
        end
    end
return items
end

function getBallNickName(ball)
   return getItemAttribute(ball.uid, "nick") or 0
end

function doCreatureSetNick(cid, nick)

   local nid = getCreatureName(cid)
   local master = getCreatureMaster(cid)
   local newPoke = doCreateMonster(nid, farwayPos)
   local oldPos = getThingPos(cid)
         doRemoveCreature(cid)
         setCreatureName(newPoke, nick, nick) 
         doTeleportThing(newPoke, oldPos, false) 
         doConvinceCreature(master, newPoke) 
         registerCreatureEvent(newPoke, "SummonDeath")
            getPokeDistanceToTeleport(newPoke)
   
end
--------------------- Icon system ---------------------

function doTransformBallsInIcons(cid)
     setPlayerStorageValue(cid, storages.iconSys, 1)
     local bag = getPlayerSlotItem(cid, 3).uid
     for i = 1, #getPokeballsInContainer(bag) do
        local ballNow = getPokeballsInContainer(bag)
        local pokeName =  string.lower(getItemAttribute(ballNow, "pokeName"))
        local ids = getPokeballs_ITEMS_ID_InContainer(bag)
        
        if isPokeballOn(ids) then 
           doTransformItem(ballNow, pokeballs[pokeName].on)
        elseif isPokeballOff(ids) then
           doTransformItem(ballNow, pokeballs[pokeName].off)
        end
        
     end
     
     local legs = getPlayerSlotItem(cid, 8)
    
     if legs.uid > 0 then 
        local pokeName =  string.lower(getItemAttribute(legs.uid, "pokeName"))
        if isPokeballOn(legs) then 
           doTransformItem(legs.uid, pokeballs[pokeName].on)
        elseif isPokeballOff(legs) then
           doTransformItem(legs.uid, pokeballs[pokeName].off)
        end 
     end
     
     local arrow = getPlayerSlotItem(cid, 10)
    
     if arrow.uid > 0 then 
        if not getItemAttribute(arrow.uid, "pokeName") then return true end
        local pokeName =  string.lower(getItemAttribute(arrow.uid, "pokeName"))
        if isPokeballOn(arrow) then 
           doTransformItem(arrow.uid, pokeballs[pokeName].on)
        elseif isPokeballOff(arrow) then
           doTransformItem(arrow.uid, pokeballs[pokeName].off)
        end 
     end
     
     
end

function doTransformIconsInBalls(cid)
     setPlayerStorageValue(cid, storages.iconSys, -1)
     local bag = getPlayerSlotItem(cid, 3).uid
     for i = 1, #getPokeballsInContainer(bag) do
        local ballNow = getPokeballsInContainer(bag)
        local ids = getPokeballs_ITEMS_ID_InContainer(bag)
        
        if isPokeballOn(ids) then 
           doTransformItem(ballNow, pokeballs[getItemAttribute(ballNow, "ballEffe")].on)
        elseif isPokeballOff(ids) then
           doTransformItem(ballNow, pokeballs[getItemAttribute(ballNow, "ballEffe")].off)
        end
        
     end
     
     local legs = getPlayerSlotItem(cid, 8)
     if legs.uid > 0 then 
        if isPokeballOn(legs) then 
           doTransformItem(legs.uid, pokeballs[getItemAttribute(legs.uid, "ballEffe")].on)
        elseif isPokeballOff(legs) then
           doTransformItem(legs.uid, pokeballs[getItemAttribute(legs.uid, "ballEffe")].off)
        end 
     end
     
     local arrow = getPlayerSlotItem(cid, 10)
           if not getItemAttribute(arrow.uid, "pokeName") then return true end
     if arrow.uid > 0 then 
        if isPokeballOn(arrow) then 
           doTransformItem(arrow.uid, pokeballs[getItemAttribute(arrow.uid, "ballEffe")].on)
        elseif isPokeballOff(arrow) then
           doTransformItem(arrow.uid, pokeballs[getItemAttribute(arrow.uid, "ballEffe")].off)
        end 
     end
     
end

function isItemPokeball(item)         --alterado v1.9 \/
if not item then return false end
for a, b in pairs (pokeballs) do
    if b.on == item or b.off == item or b.use == item then return true end
end
return false
end

function isPokeball(item)
return isItemPokeball(item)
end  

function getItensUniquesInContainer(container)    --alterado v1.6
if not isContainer(container) then return {} end
local items = {}
if isContainer(container) and getContainerSize(container) > 0 then
   for slot=0, (getContainerSize(container)-1) do
       local item = getContainerItem(container, slot)
       if isContainer(item.uid) then
          local itemsbag = getItensUniquesInContainer(item.uid)
          for i=0, #itemsbag do
              table.insert(items, itemsbag)
          end
       elseif getItemAttribute(item.uid, "unique") or getItemAttribute(item.uid, "torneio") then
          table.insert(items, item)
       end
   end
end
return items
end

function getPokeballsInContainer(container) -- Function By Kydrai
    if not isContainer(container) then return {} end
    local items = {}
    if isContainer(container) and getContainerSize(container) > 0 then
        for slot=0, (getContainerSize(container)-1) do
            local item = getContainerItem(container, slot)
                if isContainer(item.uid) then
                    local itemsbag = getPokeballsInContainer(item.uid)
                    for i=0, #itemsbag do
                        table.insert(items, itemsbag)
                    end
                elseif isPokeball(item.itemid) then
                    table.insert(items, item.uid)
                end
        end
    end
return items
end

function isWaterTile(id)
return tonumber(id) and id >= 4608 and id <= 4613 --alterado v1.9
end

function isVenomTile(id)
return tonumber(id) and (id >= 4691 and id <= 4712 or id >= 4713 and id <= 4736 or id >= 4749 and id <= 4755 or id >= 4876 and id <= 4882) --alterado v1.9
end

function isUseIconSystem(cid)
   if tonumber(getPlayerStorageValueWithSecurity(cid, storages.iconSys)) and getPlayerStorageValueWithSecurity(cid, storages.iconSys) == 1 then
      return true
   end
   return false 
end

function getPlayerStorageValueWithSecurity(cid, stor)
   if not isCreature(cid) then return true end
   return getPlayerStorageValue(cid, stor) 
end

function getItemAttributeWithSecurity(item, attr)
    if not item == 0 or item == nil then return true end
    return getItemAttribute(item, attr) or 0
end

function unLock(ball)                                                             
if not ball or ball <= 0 then return false end
if getItemAttribute(ball, "lock") and getItemAttribute(ball, "lock") > 0 then
   local vipTime = getItemAttribute(ball, "lock")
   local timeNow = os.time()
   local days = math.ceil((vipTime - timeNow)/(24 * 60 * 60))
   if days <= 0 then
      doItemEraseAttribute(ball, "lock")    
      doItemEraseAttribute(ball, "unique")
      return true
   end
end
return false
end

function getBallsAttributes(item)
local t = {"pokeName", "pokeNick", "health", "maxHealth", "ballEffe", "copyName", "boost", "happy", "description", "transBegin", "transLeft", "transTurn", "transOutfit", "transName", 
"trans", "light", "blink", "move1", "move2", "move3", "move4", "move5", "move6", "move7", "move8", "move9", "move10", "move11", "move12", "ballorder", 
"hands", "aura", "burn", "burndmg", "poison", "poisondmg", "confuse", "sleep", "miss", "missSpell", "missEff", "fear", "fearSkill", "silence", 
"silenceEff", "stun", "stunEff", "stunSpell", "paralyze", "paralyzeEff", "slow", "slowEff", "leech", "leechdmg", "Buff1", "Buff2", "Buff3", "Buff1skill",
"Buff2skill", "Buff3skill", "control", "unique", "task", "lock", "torneio"} 
local ret = {}
for a = 1, #t do
if getItemAttribute(item, t[a]) == "hands" then
return
end
ret[t[a]] = getItemAttribute(item, t[a]) or false
end
return ret
end

--------------------- Icon system ---------------------

--- balls \/
function isPokeballOn(ball)
   for a, b in pairs(pokeballs) do 
       if b.on == ball.itemid then
          return true
       end
   end
return false
end

function isPokeballOff(ball)
   for a, b in pairs(pokeballs) do 
       if b.off == ball.itemid then
          return true
       end
   end
return false
end
function isPokeballUse(ball)
   for a, b in pairs(pokeballs) do 
       if b.use == ball.itemid then
          return true
       end
   end
return false
end

---- PDA functions
function isPlayerSummon(cid, uid)
return getCreatureMaster(uid) == cid  --alterado v1.9
end

function isSummon(sid)
return isCreature(sid) and getCreatureMaster(sid) ~= sid and isPlayer(getCreatureMaster(sid))   --alterado v1.9
end 

function getPlayerDesc(cid, thing, TV)
if (not isCreature(cid) or not isCreature(thing)) and not TV then return "" end

local pos = getThingPos(thing)
local ocup = youAre[getPlayerGroupId(thing)]
local rank = (getPlayerStorageValue(thing, 86228) <= 0) and "Treinador Pokemon" or lookClans[getPlayerStorageValue(thing, 86228)][getPlayerStorageValue(thing, 862281)]
local name = thing == cid and "você mesmo" or getCreatureName(thing)     
local art = thing == cid and "Você é" or (getPlayerSex(thing) == 0 and "Ela é" or "Ele é")
   
local str = {}
table.insert(str, "Você está vendo "..name..". "..art.." ")
if youAre[getPlayerGroupId(thing)] then
   table.insert(str, (ocup).." e "..rank.." de ".. getTownName(getPlayerTown(thing))..".")       
else
   table.insert(str, (rank).." de ".. getTownName(getPlayerTown(thing))..".")
end
if getPlayerGuildId(thing) > 0 then
   table.insert(str, " "..art.." "..getPlayerGuildRank(thing).." do "..getPlayerGuildName(thing)..".")
end
if TV then
   table.insert(str, " "..art.." watching TV.")
end
table.insert(str, ((isPlayer(cid) and youAre[getPlayerGroupId(cid)]) and "\nPosition: [X: "..pos.x.."][Y: "..pos.y.."][Z: "..pos.z.."]" or "")) 

return table.concat(str) 
end

function ehNPC(cid)   --alterado v1.9
return isCreature(cid) and not isPlayer(cid) and not isSummon(cid) and not isMonster(cid)
end

function ehMonstro(cid)   --alterado v1.9
return cid and cid >= AUTOID_MONSTERS and cid < AUTOID_NPCS
end

function isPosEqual(pos1, pos2)
      if pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z then
         return true
      end    
return false
end

function isPosInArray(array, pos)
if not next(array) then return false end
for i = 1, #array do
    if isPosEqual(pos, array) then
       return true
    end
end
return false
end

function canWalkOnPos(pos, creature, pz, water, sqm, proj)
if not pos then return false end
if not pos.x then return false end
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid <= 1 and sqm then return false end
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 919 then return false end
if isInArray({4820, 4821, 4822, 4823, 4824, 4825}, getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid) and water then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if hasSqm(pos) and getTileInfo(pos).protection and pz  then return false end
    local n = not proj and 3 or 2                                    --alterado v1.6
    for i = 0, 255 do
        pos.stackpos = i                           
        local tile = getTileThingByPos(pos)        
        if tile.itemid ~= 0 and i ~= 253 and not isCreature(tile.uid) then     --edited
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end   
return true
end

function isWalkable(pos, creature, proj, pz, water)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if isWaterTile(getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid) and water then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end


conds = {
["Slow"] = 3890,
["Confusion"] = 3891,  
["Burn"] = 3892,
["Poison"] = 3893,
["Fear"] = 3894,
["Stun"] = 3895,
["Paralyze"] = 3896,                              
["Leech"] = 3897,
["Buff1"] = 3898,
["Buff2"] = 3899,
["Buff3"] = 3900,
["Miss"] = 32659,   
["Silence"] = 32698,     
["Sleep"] = 98271,
}
function isSilence(cid)
    if not isCreature(cid) then return false end
    if getPlayerStorageValue(cid, conds["Silence"]) >= 0 then return true end
return false
end

function isParalyze(cid)      
    if not isCreature(cid) then return false end
    if getPlayerStorageValue(cid, conds["Paralyze"]) >= 0 then return true end
return false
end
    
function isSleeping(cid)
    if not isCreature(cid) then return false end
    if getPlayerStorageValue(cid, conds["Sleep"]) >= 0 then return true end
return false
end

function doRegainSpeed(cid)              --alterado v1.9 \/
if not isCreature(cid) then return true end

   local speed = playerSpeed
   if isMonster(cid) then
      speed = getCreatureBaseSpeed(cid)
   elseif isPlayer(cid) and isInArray({4, 5, 6, 15}, getPlayerGroupId(cid)) then
      speed = 500 * getPlayerGroupId(cid) 
   end
   
   doChangeSpeed(cid, -getCreatureSpeed(cid))
   if getCreatureCondition(cid, CONDITION_PARALYZE) == true then
      doRemoveCondition(cid, CONDITION_PARALYZE)
      addEvent(doAddConditionWithProtect, 10, cid, paralizeArea2)             
   end
   
         if getPlayerStorageValue(cid, 20001) > 0 then
              speed = 550
            end
 
       if isADM(cid) then
      speed = 750
   end
   
   
doChangeSpeed(cid, speed)
return speed
end

function doPlayerAddExp_2(cid, exp)
if not isCreature(cid) then return true end
   doPlayerAddExp(cid, exp)
   doSendAnimatedText(getThingPos(cid), exp, 215)
end

function doWalkAgain(cid)
   if not isCreature(cid) then return true end
   if getCreatureTarget(cid) >= 1 then
      setMoveSummon(master, true)
      return true
   end
   local master = getCreatureMaster(cid)
   local pox, poy = getPlayerStorageValue(cid, 505), getPlayerStorageValue(cid, 506)
   
   if pox == -1 and poy == -1 then 
       addEvent(doWalkAgain, 200, cid)
       return true
   end
   
       if getThingPos(master).x ~= pox or getThingPos(master).y ~= poy then
         setMoveSummon(master, true)
       end
   addEvent(doWalkAgain, 200, cid)
end

function doMovePokeToPos(cid, pos)
if not isCreature(cid) then return true end
   doMoveCreatureToPos(cid, pos)
end

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

function isGhost(cid)
      
end

function isGhostPokemon(cid)
    if not isCreature(cid) then return false end
    local ghosts = {"Gastly", "Haunter", "Gengar", "Shiny Gengar", "Misdreavus", "Shiny Abra"}
return isInArray(ghosts, getCreatureName(cid))
end

function updateGhostWalk(cid)
    if not isCreature(cid) then return false end
    local pos = getThingPos(cid)
    pos.x = pos.x + 1
    pos.y = pos.y + 1
    local ret = getThingPos(cid)
    doTeleportThing(cid, pos, false)
    doTeleportThing(cid, ret, false)
return true
end

--- funcs
function getTopCorpse(position)
local pos = position
for n = 1, 255 do
    pos.stackpos = n
    local item = getTileThingByPos(pos)
    if (string.find(getItemNameById(item.itemid), "fainted") or string.find(getItemNameById(item.itemid), "defeated ")) then
       return getTileThingByPos(pos)
    end
end
return null
end


function doCorrectPokemonName(poke)
return doCorrectString(poke)
end

function doCorrectString(str)
local name = str:explode(" ")  --alterado v1.9
local final = {}
for _, s in ipairs(name) do
    table.insert(final, s:sub(1, 1):upper()..s:sub(2, #s):lower())
end
return table.concat(final, (name[2] and " " or ""))
end  

---------------------------------------- Order (Não mexer) ----------------------------------------
function getPokemonName(cid)
   return getCreatureName(cid)
end

function isRiderOrFlyOrSurf(cid)
   if getPlayerStorageValue(cid, orderTalks["surf"].storage) == 1 or getPlayerStorageValue(cid, orderTalks["ride"].storage) == 1 or getPlayerStorageValue(cid, orderTalks["fly"].storage) == 1 then
      return true 
   end
   return false
end

function doEreasPlayerOrder(cid)
   setPlayerStorageValue(cid, orderTalks["surf"].storage, -1)
   setPlayerStorageValue(cid, orderTalks["ride"].storage, -1)
   setPlayerStorageValue(cid, orderTalks["fly"].storage, -1)
end

function isRider(cid)
   if getPlayerStorageValue(cid, orderTalks["ride"].storage) == 1 then
      return true 
   end
   return false
end

function isFly(cid)
   if getPlayerStorageValue(cid, orderTalks["fly"].storage) == 1 then
      return true 
   end
   return false
end

function isSurf(cid)
   if getPlayerStorageValue(cid, orderTalks["surf"].storage) == 1 then
      return true 
   end
   return false
end

function isUsingOrder(cid)
   if getPlayerStorageValue(cid, orderTalks["headbutt"].storage) == 1 or getPlayerStorageValue(cid, orderTalks["dig"].storage) == 1 or getPlayerStorageValue(cid, orderTalks["cut"].storage) == 1 or getPlayerStorageValue(cid, orderTalks["rock"].storage) == 1 then
      return true 
   end
   return false
end

function doEreaseUsingOrder(cid)
   setPlayerStorageValue(cid, orderTalks["dig"].storage, -1)
   setPlayerStorageValue(cid, orderTalks["cut"].storage, -1)
   setPlayerStorageValue(cid, orderTalks["rock"].storage, -1)
   setPlayerStorageValue(cid, orderTalks["headbutt"].storage, -1)
end

function doSendMsg(cid, msg)
    if not isPlayer(cid) then return true end
    doPlayerSendTextMessage(cid, 27, msg)
end

function doCopyPokemon(cid, copy, eff)
    local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
    local sid = getCreatureMaster(cid)
    local pos, dir = getThingPos(cid), getPlayerLookDir(cid)
            local blockToDitto = {"Mega Absol", "Mega Aggron", "Mega Alakazam", "Underworld Rayquaza", "Void Gengar", "Void Gastly", "Void Dusknoir", "Rayquaza", "Mega Ampharos", "Mega Blaziken", "Mega Charizard Y", "Mega Charizard X", "Mega Gardevoir", "Mega Gengar", "Mega Kangaskhan", "Mega Lucario", "Mega Manectric", "Mega Mawile", "Mega Pidgeot", "Mega Sableye", "Mega Sceptile", "Mega Scizor", "Mega Swampert", "Mega Venusaur", "Mega Tyranitar", "Void Gastly", "Void Gengar", "Void Dusknoir", "Mega Blastoise", "Shiny Snorlax", "Unown", "Castform", "Smeargle", "Articuno", "Moltres", "Zapdos", "suicune", "Raikou", "Entei", "Minun And Plusle", "Metagross", "Magmortar", "Milotic", "Tangrowth", "Rhyperior", "Dusknoir", "Slaking", "Salamence", "Electivire", "Kecleon", "Rotom", "Froslass", "Mew", "Mewtwo", "Magnet Electabuzz", "Elder Tyranitar", "Hard Golem", "Iron Steelix", "Brute Rhydon", "Brave Charizard", "Enraged Typhlosion", "Capoteira Hitmontop", "Boxer Hitmonchan", "Taekwondo Hitmonlee", "Dragon Machamp", "Undefeated Machamp", "Elder Charizard", "Lava Magmar", "Elder Arcanine", "Wardog Arcanine", "Furious Mantine", "War Gyarados", "Brave Blastoise", "Brave Venusaur", "Ancient Meganium", "Elder Pinsir", "Elder Tangela", "Tribal Feraligatr", "Charged Raichu", "Furious Ampharos", "Elder Raichu", "Tribal Xatu", "Ancient Alakazam", "Master Alakazam", "Enigmatic Girafarig", "Tribal Scyther", "War Heracross", "Furious Scyther", "Elder Electabuzz", "Metal Scizor", "Brave Nidoqueen", "Brave Nidoking", "Dark Crobat", "Elder Muk", "Trickmaster Gengar", "Elder Gengar", "Banshee Misdreavus", "Hungry Snorlax", "War Granbull", "Brute Ursaring", "Singer Wigglytuff", "Aviator Pidgeot", "Metal Skarmory", "Brave Noctowl", "Elder Pidgeot", "Ancient Dragonite", "Milch-miltank", "Ancient Kingdra", "Psy Jynx", "Elder Jynx", "Evil Cloyster", "Freezing Dewgong", "Furious Sandslash", "Roll Donphan", "Bone Marowak", "Octopus Octillery", "Moon Clefable", "Heavy Piloswine", "Elder Blastoise", "Elder Tentacruel", "Elder Marowak", "Elder Dragonite", "Elder Venusaur", "Punching Bag"}    
                
                if isInArray(blockToDitto, copy) then
                   doSendMsg(sid, "Can't copy this pokemon.")
                   return true
                end
                
                if isInDuel(sid) then
                   doSendMsg(sid, "You can't turn your ditto into a duel.")
                   return true
                end
    
                local nick = retireShinyName(getItemAttribute(item.uid, "poke"))
                      if getItemAttribute(item.uid, "poke") == "Ditto" and isShinyName(copy) then
                         doSendMsg(sid, "Only a Shiny Ditto can turn into Shiny-type pokemons.")
                         return true 
                      end
                
                      if getItemAttribute(item.uid, "nick") then 
                         nick = getItemAttribute(item.uid, "nick") 
                      end
                      
                      if getItemAttribute(item.uid, "copyName") == copy then
                         doSendMsg(sid, "Your ditto is already a copy of " .. copy)
                         return true
                      end
                      
                      if not pokes[copy] then
                         doSendMsg(cid, "This is not a pokemon.")
                         print(">>>>>DittoBUG: " .. copy)
                         return true
                      end
                      
                doPlayerSay(sid, nick..", copy "..retireShinyName(copy)..".")
                
                local heath_toDrawPercent = getCreatureMaxHealth(cid) - getCreatureHealth(cid)
                doRemoveCreature(cid)
                local poke = doCreateMonsterNick(sid, copy, nick, pos, true)
                      doTeleportThing(poke, pos)
             
            setPlayerStorageValue(poke, 510, copy)
            doCreatureSetLookDir(poke, dir)
            doItemSetAttribute(item.uid, "copyName", copy)
            doSendPlayerExtendedOpcode(sid, opcodes.OPCODE_BATTLE_POKEMON, tostring(poke))
            doUpdateMoves(sid)
             getPokeDistanceToTeleport(poke)
             adjustStatus(poke, item.uid, true, heath_toDrawPercent, true)
             setPokemonGhost(poke)
             if eff then
               doSendMagicEffect(pos, 184) 
             end
             
            -- doOTCSendPokemonHealth(sid)
end

function round(num, idp)
  return tonumber(string.format("%." .. (idp or 0) .. "f", num))
end

function doGoPokemonInOrder(cid, item, goMsg)
    if getPlayerSlotItem(cid, 8).uid ~= item.uid then
       return true
    end
    
    item = getPlayerSlotItem(cid, 8)
    if item.uid == 0 then return true end

    
             local name = getItemAttribute(item.uid, "poke")
             local nick = name 
                  if isInArray({"Ditto", "shiny ditto"}, name:lower()) then
                     name = getItemAttribute(item.uid, "copyName")
                  end
            
             local effe = pokeballs[getPokeballType(item.itemid)].effect
       
         
            if getItemAttribute(item.uid, "nick") then
                 nick = getItemAttribute(item.uid, "nick")
            end
            
            pokeSourceCode = doCreateMonsterNick(cid, name, retireShinyName(nick), getThingPos(cid), true)
            if not pokeSourceCode then
               doSendMsg(cid, "Erro. Comunique esse codigo ao GM. [31121994]")
               return true
            end
            
            
             local poke = getCreatureSummons(cid)[1] 
             doTeleportThing(poke, farWayPos)
             doTeleportThing(poke, getThingPos(cid))
             
             
             
             doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_BATTLE_POKEMON, tostring(poke))
             setPlayerStorageValue(poke, 510, name)
             doCreatureSetLookDir(poke, getPlayerLookDir(cid))
             getPokeDistanceToTeleport(poke)
             setMoveSummon(cid, true)
             doUpdateMoves(cid)
             doUpdateCooldowns(cid)

             doItemEraseAttribute(item.uid, "healthChanged")
             adjustStatus(poke, item.uid, true, true, true)
             setPokemonGhost(poke)
             if getCreatureSkullType(cid) == 5 then
                doCreatureSetSkullType(cid, 0)
             end
             --setCreatureMaxHealth(poke, getBallMaxHealth(cid, item))
             --doCreatureAddHealth(poke, -(getCreatureHealth(poke)-1))
             --doCreatureAddHealth(poke, (getBallHealth(cid, item)-1))
             --doItemSetAttribute(item.uid, "healthChanged", getCreatureName(cid))
             --doOTCSendPokemonHealth(cid)
                          local pk = getCreatureSummons(cid)[1] 
                 local pb = getPlayerSlotItem(cid, 8).uid
    local flyAdd = flysAddon[getItemAttribute (pb, "addon")]
    local rideAdd = ridesAddon[getItemAttribute (pb, "addon")]
    
    if flyAdd then
        if getItemAttribute(pb, "addon") > 1 then
            doSetCreatureOutfit(pk, {lookType = getItemAttribute (pb, "addon")}, -1)
        end
    elseif rideAdd then
        if getItemAttribute(pb, "addon") > 1 then
            doSetCreatureOutfit(pk, {lookType = getItemAttribute (pb, "addon")}, -1)
        end
    end
end

 function sendAuraEffect(cid, eff)  --alterado v1.8 \/
----------------
if isPlayer(cid) and (getPlayerStorageValue(cid, orderTalks["fly"].storage) <= 0 and getPlayerStorageValue(cid, orderTalks["ride"].storage) <= 0 and getPlayerStorageValue(cid, orderTalks["surf"].storage) <= 0) then
   setPlayerStorageValue(cid, 42368, -1)
   return true
end
----------------  
if isCreature(cid) and getCreatureOutfit(cid).lookType ~= 2 then  
   setPlayerStorageValue(cid, 42368, 1)
   doSendMagicEffect(getThingPos(cid), eff)
end
----------------
if isCreature(cid) then
   addEvent(sendAuraEffect, 1000, cid, eff)
end
end

function doUp(cid, summon, move)
                     local pokeName = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")
                     local ditto = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "copyName")
                          if ditto and ditto ~= "" then
                             pokeName = ditto
                          end
                     local outfit = getPokemonOutfitToSkill(pokeName)
                     local speed = getPokemonSpeedToSkill(pokeName)
                     addEvent(doRemoveCreature, 10, summon)
                     doSetCreatureOutfit(cid, {lookType = outfit + 351}, -1)
                     
                     doChangeSpeed(cid, -getCreatureSpeed(cid))
                     doChangeSpeed(cid, speed)

                     if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then     --alterado v1.6
                       if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then  
                          BackTeam(cid)       
                       end
                     end
                    
                    if move == "ride" then 
                     setPlayerStorageValue(cid, orderTalks["ride"].storage, 1)
                    elseif move == "fly" then
                     setPlayerStorageValue(cid, orderTalks["fly"].storage, 1)
                    end
                    setPokemonGhost(cid)
                    
                    local boost = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "boost")
                    local aura = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "aura")
                    if boost and boost >= 50 and aura then
                        sendAuraEffect(cid, auraSyst[aura])        
                    end
                    doPlayerSendCancel(cid, '12//,hide') --alterado v1.7
    


                     local pokeName = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")
                     local ditto = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "copyName")
                          if ditto and ditto ~= "" then
                             pokeName = ditto
                          end
                     local outfit = getPokemonOutfitToSkill(pokeName)
                     local speed = getPokemonSpeedToSkill(pokeName)
                     addEvent(doRemoveCreature, 10, summon)
        local pb = getPlayerSlotItem(cid, 8).uid
        
        if getItemAttribute(pb, "addon") < 1 then
                     doSetCreatureOutfit(cid, {lookType = outfit + 351}, -1)
        else
            doSetCreatureOutfit(cid, {lookType = flysAddon[getItemAttribute (pb, "addon")][1]}, -1)
        end
                     
                     doChangeSpeed(cid, -getCreatureSpeed(cid))
                     doChangeSpeed(cid, speed)

                     if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then     --alterado v1.6
                       if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then  
                          BackTeam(cid)       
                       end
                     end
                    
                    if move == "ride" then 
                     setPlayerStorageValue(cid, orderTalks["ride"].storage, 1)
                    elseif move == "fly" then
                     setPlayerStorageValue(cid, orderTalks["fly"].storage, 1)
                    end
                    setPokemonGhost(cid)
                    
                    doPlayerSendCancel(cid, '12//,hide') --alterado v1.7
    
end

function getCylinderTiles(pos, cilinderSize) -- By SmiX
local position = pos
local c = cilinderSize
local pos = {}
for i=-c, c do
        for j=-c, c do
                local posEffect = {x=position.x+i,y=position.y+j,z=position.z}
                  table.insert(pos, posEffect)
        end
end
   return pos
end

function recheck(sid, skill, pos)
    if not isCreature(sid) or not isCreature(getCreatureMaster(sid)) then return end
    if not isUsingOrder(sid) then return true end
    local cid = getCreatureMaster(sid)

    if skill == "cut" then

        local item = getTileItemById(pos, 2767)
        if not item or item.uid <= 0 then return true end
        
        doCreatureSay(sid, "CUT!", TALKTYPE_MONSTER)
        doSendMagicEffect(getThingPos(item.uid), EFFECT_CUT)
        doTransformItem(item.uid, 6216)
        local function growRock()
            doTransformItem(getTileItemById(pos, 6216).uid, 2767)
            end
        addEvent(growRock, tempoPraVoltarAoNormal * 1000)
  
    elseif skill == "rock" then

        local item = getTileItemById(pos, 1285)
        if not item or item.uid <= 0 then return true end
        
        doCreatureSay(sid, "ROCK SMASH!", TALKTYPE_MONSTER)
        doSendMagicEffect(getThingPos(item.uid), EFFECT_DIG)
        doTransformItem(item.uid, 3610)
            local function growRock()
            doTransformItem(getTileItemById(pos, 3610).uid, 1285)
            end
        addEvent(growRock, tempoPraVoltarAoNormal * 1000)
        
 elseif skill == "headbutt" then  --alterado v1.6

    local item = getTileItemById(pos, 2707)    --id do item   arvore normal
        if not item or item.uid <= 0 then return true end
            
    local master = getCreatureMaster(sid)
    local array = {}                           
    local lvl = {25, 40, 60, 80, 150, 1000} --lvls

    for i = 1, #lvl do
        if getPlayerLevel(master) <= lvl then
           array = headbutt[lvl]
           break
        end
    end 
    local rand = array[math.random(#array)]
    for j = 1, rand[2] do        
        local poke = doCreateMonster(rand[1] , getClosestFreeTile(sid, pos))
        --doCreatureSay(sid, rand[1], TALKTYPE_MONSTER)
    end
    doCreatureSay(sid, "HEADBUTT!", TALKTYPE_MONSTER)
    doSendMagicEffect(getThingPos(item.uid), EFFECT_DIG)
    doTransformItem(item.uid, 2702)  --id do item   arvore quebrada
    local function growHead()
          doTransformItem(getTileItemById(pos, 2702).uid, 2707) --id do item  arvore quebrada, arvore normal
    end
    addEvent(growHead, choose(5, 8, 10, 15) * 60 * 1000)   --o tempo pra arvore voltar ao normal varia de 5~30min
end 
   doEreaseUsingOrder(sid)   
end

function choose(...) -- by mock
    local arg = {...}
    return arg[math.random(1,#arg)]
end


function getFreeTile(pos)
   if canWalkOnPos(pos, true, false, false, false, false) then
      return pos
   end
   local tmp
   for dir = 0, 7 do
      tmp = getPosByDir(pos, dir)
      if canWalkOnPos(tmp, true, false, false, false, false) then
         return tmp
      end 
   end
   return farWayPos
end

------------------------ marcar a pos do spawn do poke e retornar ela
function doMarkedSpawnPos(cid)
local pos = getThingPos(cid)
    setPlayerStorageValue(cid, storages.markedPosPoke, "x = "..pos.x..", y = "..pos.y..", z = "..pos.z..";")
end

function doMarkedPos(cid, pos)
    setPlayerStorageValue(cid, storages.markedPosPoke, "x = "..pos.x..", y = "..pos.y..", z = "..pos.z..";")
end

function isInPartyAndSharedExperience(cid)
    if isInParty(cid) and isPartyEnabledExp(cid) then
       return true
    end
    return false
end

function getMarkedSpawnPos(cid)
 local l = {}
 local pos = getPlayerStorageValue(cid, storages.markedPosPoke)
 local strPos = "x = (.-), y = (.-), z = (.-);"
   for a, b, c in pos:gmatch(strPos) do
      l = {x = tonumber(a), y = tonumber(b), z = tonumber(c)}
   end
   return l
end

function doComparePositions(position, positionEx)
return position.x == positionEx.x and position.y == positionEx.y and position.z == positionEx.z
end
------------------------ marcar a pos do spawn do poke e retornar ela

function doPlayerAddPoke(cid, pokeName, ball, unique)
    local ballid = pokeballs[ball]
    local send = false

    if not ballid then
        return print("doPlayerAddPoke: Não foi encontrada a pokebola: "..ball)
    end

    if isUseIconSystem(cid) then
        id = pokeballs[string.lower(pokeName)].on
    else
        id = ballid.on
    end

    if (getPlayerFreeCap(cid) <= 1 and not isInArray({5, 6}, getPlayerGroupId(cid))) or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then
        item = doCreateItemEx(id)
        send = true
    else
        item = addItemInFreeBag(getPlayerSlotItem(cid, 3).uid, id, 1)
    end

    doItemSetAttribute(item, "health", getPokemonHealth(pokeName))
    doItemSetAttribute(item, "maxHealth", getPokemonHealth(pokeName))
    doItemSetAttribute(item, "pokeName", doCorrectString(pokeName))
    doItemSetAttribute(item, "ballEffe", ball)

    if send then
        doPlayerSendMailByName(getCreatureName(cid), item, 1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are already holding six pokeballs, your new pokemon has been sent to the Center Pokémon.")
    end
end

function hasSpaceInContainer(container)                --alterado v1.6
if not isContainer(container) then return false end
if getContainerSize(container) < getContainerCap(container) then return true end

for slot = 0, (getContainerSize(container)-1) do
    local item = getContainerItem(container, slot)
    if isContainer(item.uid) then
       if hasSpaceInContainer(item.uid) then
          return true
       end
    end
end
return false
end

function doSendEffect(cid, effe)
if not isCreature(cid) then return true end
   doSendMagicEffect(getThingPos(cid), effe)  
end

function doSendEffectAndText(cid, effe, text, color)
if not isCreature(cid) then return true end
if not color then color = 215 end
   doSendEffect(cid, effe)
   if text and text ~= "" then
      doSendAnimatedText(getThingPos(cid), text, color) 
   end
end

function setCreatureVisibility(cid, vis)
    if not isCreature(cid) then return true end
    if vis then
        doAddConditionWithProtect(cid, invisiblecondition)
    else
        doRemoveCondition(cid, CONDITION_INVISIBLE)
    end
end

function setCreatureHick(cid, secs, i)
if not isCreature(cid) then return true end
    i = i +1
    local pos2 = getThingPos(cid)
          pos2.x = pos2.x + math.random(1, 4)
          pos2.y = pos2.y + math.random(1, 4)
    if(i < secs) then
      local pos = getPosByDir(pos2, math.random(0, 7))
      local master = getCreatureMaster(cid)
        if(isPlayer(master)) then
           setMoveSummon(master, false)
        end
      doAddConditionWithProtect(cid, bebo)
      doMovePokeToPos(cid, pos)
      pos = getThingPos(cid)
      pos.y = pos.y -1
      doSendMagicEffect(pos, 31)
      addEvent(setCreatureHick, 1000, cid, secs, i)
    else
       doRemoveCondition(cid, CONDITION_DRUNK)
    end
end

function doRemoveConditionWithSecurity(cid, cond)
if not isCreature(cid) then return true end
         doRemoveCondition(cid, cond)
end

function doCanAttackOther(cid, target)

setPlayerStorageValue(cid, storages.teamRed, 1)
setPlayerStorageValue(target, storages.teamBlue, 1)

end

function isInDuel(cid)
if not isCreature(cid) then return false end
   if getPlayerStorageValue(cid, storages.isInDuel) == 1 then
      return true 
    end
   return false
end

-------------- pokedex
function getPokemonVitalityD(name)
    if not pokes[name] then return false end
    return pokes[name].vitality
end

function getPokemonAttackD(name)
    if not pokes[name] then return false end
    return pokes[name].offense
end

function getPokemonDefenseD(name)
    if not pokes[name] then return false end
    return pokes[name].defense
end

function getPokemonSpAttackD(name)
    if not pokes[name] then return false end
    return pokes[name].specialattack
end

function getPokemonLevelD(name)
    if not pokes[name] then return false end
    if pokes[name].level <= 1 then
        return 5
    end
    return pokes[name].level
end

function getPokemonPortraitD(name)
    if not pokes[name] then return false end
    return pokes[name].portrait
end

function getPokemonType1D(name)
    if not pokes[name] then return "normal" end
    return pokes[name].type
end

function getPokemonType2D(name)
    if not pokes[name] or not pokes[name].type2 then return false end
    return pokes[name].type2
end

function getPokemonHealthD(name)                
    if not pokes[name] then return false end
    return getMonsterInfo(name).healthMax
end

function getPokemonExperienceD(name)
    if not pokes[name] then return false end
    return getMonsterInfo(name).experience
end

function getPokemonCatchedStorage(name)
    if not pokes[name] then return false end
    return getMonsterInfo(name).lookCorpse
end

function getPokemonCorpse(name)
    if not pokes[name] then return false end
    return getMonsterInfo(name).lookCorpse
end

 

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por cloudrun2023
      CloudRun - Sua Melhor Escolha para Hospedagem de OTServer!
      Você está procurando a solução definitiva para hospedar seu OTServer com desempenho imbatível e segurança inigualável? Não procure mais! Apresentamos a CloudRun, sua parceira confiável em serviços de hospedagem na nuvem.
       
      Recursos Exclusivos - Proteção DDoS Avançada:
      Mantenha seu OTServer online e seguro com nossa robusta proteção DDoS, garantindo uma experiência de jogo ininterrupta para seus jogadores.
       
      Servidores Ryzen 7 Poderosos: Desfrute do poder de processamento superior dos servidores Ryzen 7 para garantir um desempenho excepcional do seu OTServer. Velocidade e estabilidade garantidas!
       
      Armazenamento NVMe de Alta Velocidade:
      Reduza o tempo de carregamento do jogo com nosso armazenamento NVMe ultrarrápido. Seus jogadores vão adorar a rapidez com que podem explorar o mundo do seu OTServer.
       
      Uplink de até 1GB:
      Oferecemos uma conexão de alta velocidade com até 1GB de largura de banda, garantindo uma experiência de jogo suave e livre de lag para todos os seus jogadores, mesmo nos momentos de pico.
       
      Suporte 24 Horas:
      Estamos sempre aqui para você! Nossa equipe de suporte está disponível 24 horas por dia, 7 dias por semana, para resolver qualquer problema ou responder a qualquer pergunta que você possa ter. Sua satisfação é a nossa prioridade.
       
      Fácil e Rápido de Começar:
      Configurar seu OTServer na CloudRun é simples e rápido. Concentre-se no desenvolvimento do seu jogo enquanto cuidamos da hospedagem.
       
      Entre em Contato Agora!
      Website: https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
      Email: [email protected]
      Telefone: (47) 99902-5147

      Não comprometa a qualidade da hospedagem do seu OTServer. Escolha a CloudRun e ofereça aos seus jogadores a melhor experiência de jogo possível. Visite nosso site hoje mesmo para conhecer nossos planos e começar!
       
      https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
       
      CloudRun - Onde a Velocidade Encontra a Confiabilidade!
       

    • Por FeeTads
      SALVE rapaziada do TK, esses dias vim pensando em novos scripts pro meu OT, e em um deles eu precisava que determinada area não contasse frag pro player que matasse outros, PORÉM eu precisava que os players que morressem nessa area ainda assim tivessem as penalidades da sua morte, procurei por ai, achei alguns scripts que apenas tiravam o SKULL e não realmente o FRAG do player.

      **script atualizado 22/10/2023** - melhorado e otimizado, levei o script pra puxar as infos por .lua / creatureScripts

      vou disponibilizar o code aqui, e o que fazer pra determinada area não contar frag.

      SOURCE OTX 2 / TFS 0.x, Funciona em TFS 1.x mudando as tags e ajeitando as sintaxes.

      vá em creatureevent.cpp

      procure por:
      else if(type == "preparedeath") _type = CREATURE_EVENT_PREPAREDEATH;
      Adiciona abaixo:
      else if(type == "nocountfrag") _type = CREATURE_EVENT_NOCOUNTFRAG;

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "onPrepareDeath";  
      Adicione abaixo: 
      case CREATURE_EVENT_NOCOUNTFRAG: return "noCountFragArea";

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "cid, deathList";
      Adicione abaixo:
      case CREATURE_EVENT_NOCOUNTFRAG: return "cid, target";

      agora no mesmo arquivo, vá até o final do arquivo e adicione essa função:
      uint32_t CreatureEvent::executeNoCountFragArea(Creature* creature, Creature* target) { //noCountFragArea(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::ostringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; if(m_scriptData) scriptstream << *m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::ostringstream desc; desc << creature->getName(); env->setEvent(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::noCountFragArea] Call stack overflow." << std::endl; return 0; } }

      agora vá em creatureevent.h

      procure por:
      CREATURE_EVENT_PREPAREDEATH
      adicione abaixo:
      CREATURE_EVENT_NOCOUNTFRAG

      procure por:
      uint32_t executePrepareDeath(Creature* creature, DeathList deathList);
      Adicione abaixo:
      uint32_t executeNoCountFragArea(Creature* creature, Creature* target);

      agora vá em player.cpp

      procure por:
      bool Player::onKilledCreature(Creature* target, DeathEntry& entry)
      abaixo de:
      War_t enemy; if(targetPlayer->getEnemy(this, enemy)) { if(entry.isLast()) IOGuild::getInstance()->updateWar(enemy); entry.setWar(enemy); }
      Adicione o seguinte código:
      if (targetPlayer){ CreatureEventList killEvents = getCreatureEvents(CREATURE_EVENT_NOCOUNTFRAG); for (const auto &event : killEvents) { if (!event->executeNoCountFragArea(this, target)) { return true; } } }

      //

      Feito isso, tudo completo na sua source, agora é necessário adicionar o creaturescript dentro do servidor

      vá até creaturescripts/scripts
      crie um arquivo chamado, "noCountFragInArea.lua"
      e dentro dele cole o código:
       
      --[[ script feito por feetads / TibiaKing ]]-- --[[ discord: feetads / FeeTads#0246 ]]-- -- Add positions here for which you do not want to count frags local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, -- from = area superior esquerda / to = area inferior direita (formando um quadrado) } local onlyKillerInArea = false -- only killer need to be in area? function noCountFragArea(cid, target) if not isCreature(cid) or not isCreature(target) then return true end local posKiller = getPlayerPosition(cid) local posTarget = getPlayerPosition(target) for i = 1, #areas do local area = areas[i] if isInArea(posKiller, area.from, area.to) then if onlyKillerInArea then return false elseif isInArea(posTarget, area.from, area.to) then return false end end end return true end
      agora em creaturescripts.xml
      <event type="nocountfrag" name="fragarea" event="script" value="noCountFragInArea.lua"/>
      agora em creaturescripts/scripts/login.lua
       procure por OU semelhante a esse:
      registerCreatureEvent(cid, "AdvanceSave")
      e abaixo adicione:
      registerCreatureEvent(cid, "fragarea")

      //


      Agora tudo certo, quando quiser adiciona uma area que não pega frag, vá até o script e apenas coloque a area, igual o demonstrado no script

      Exemplo:
      local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, [2] = {from = {x = 1000, y = 1000, z = 7}, to = {x = 1100, y = 1100, z = 7}}, }
      assim somente colocando a area no script e abrindo o server ou dando /reload, já funcionará a area como não pegar frag.
      Esse sistema pode ser bom pra areas de pvp ativo, onde você ainda quer que o player que morrer perca os atributos, como se fosse uma morte normal, porém não conta frag pra quem matar.
      Bom pra sistemas tipo castle 48h (guild war), onde há diversas mortes e risco de pegar red, atrapalhando a war.

      Façam bom proveito dos scripts, e deixem os créditos no script rsrs

      **Eu fiz as alterações e o simples código por isso vim disponibilizar, créditos meus**
    • Por Muvuka
      Abri canal a força creaturescript acho que funcione no creaturescript cria script creaturescript
       
      <channel id="9" name="HELP" logged="yes"/>
      <channel id="12" name="Report Bugs" logged="yes"/>
      <channel id="13" name="Loot" logged="yes"/>
      <channel id="14" name="Report Character Rules Tibia Rules" logged="yes"/>
      <channel id="15" name="Death Channel"/>
      <channel id="6548" name="DexSoft" level="1"/>
      <channel id="7" name="Reports" logged="yes"/>
       
      antes de 
              if(lastLogin > 0) then adicione isso:
                      doPlayerOpenChannel(cid, CHANNEL_HELP) doPlayerOpenChannel(cid, 1,  2, 3) = 1,2 ,3 Channels, entendeu? NÃO FUNCIONA EU QUERO UM MEIO DE ABRI SEM USA A SOURCE
       
      EU NÃO CONSEGUI ABRI EU NÃO TENHO SOURCE
       
       
    • Por bolachapancao
      Rapaziada seguinte preciso de um script que ao utilizar uma alavanca para até 4 jogadores.
      Os jogadores serão teleportados para hunt durante uma hora e depois de uma hora os jogadores serão teleportados de volta para o templo.
       
      Observação: caso o jogador morra ou saia da hunt o evento hunt é cancelado.

      Estou a base canary
      GitHub - opentibiabr/canary: Canary Server 13.x for OpenTibia community.
       
    • Por RAJADAO
      .Qual servidor ou website você utiliza como base? 
      Sabrehaven 8.0
      Qual o motivo deste tópico? 
      Ajuda com novos efeitos
       
      Olá amigos, gostaria de ajuda para introduzir os seguintes efeitos no meu servidor (usando o Sabrehaven 8.0 como base), adicionei algumas runas novas (avalanche, icicle, míssil sagrado, stoneshower & Thunderstorm) e alguns novos feitiços (exevo mas san, exori san, exori tera, exori frigo, exevo gran mas frigo, exevo gran mas tera, exevo tera hur, exevo frigo hur) mas nenhum dos efeitos dessas magias parece existir no servidor, alguém tem um link para um tutorial ou algo assim para que eu possa fazer isso funcionar?
      Desculpe pelo mau inglês, sou brasileiro.

      Obrigado!


      AVALANCHE RUNE id:3161 \/
      (COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

      STONESHOWER RUNE id:3175 \/
      (COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_STONES)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)

      THUNDERSTORM RUNE id:3202 \/
      (COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_E NERGYHIT)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)

      ICICLE RUNE id:3158 \/
      COMBAT_ICEDAMAGE
      CONST_ME_ICEAREA
      CONST_ANI_ICE

      SANTO MÍSSIL RUNA id:3182 \/
      (COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

      CONST_ME_PLANTATTACK (exevo gran mas tera)
      CONST_ME_ICETORNADO (exevo gran mas frigo)
      CONST_ME_SMALLPLANTS (exevo tera hur)
      CONST_ME_ICEAREA (exevo frigo hur)
      CONST_ME_ICEATTACK (exori frigo)
      CONST_ME_CARNIPHILA (exori tera)

      EXORI SAN \/
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
      CONST_ME_HOLYDAM IDADE

      EXEVO MAS SAN \/
      CONST_ME_HOLYAREA
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo