Ir para conteúdo

georgelxll

Campones
  • Total de itens

    74
  • Registro em

  • Última visita

  • Dias Ganhos

    4

Posts postados por georgelxll

  1. Em 08/11/2021 em 22:07, thepota disse:

     

    Essa função já existe:

     

    doAddPokeball(cid, name, level, boost, ballKey, dp, msg)

    cid = id do player (player:getId() caso tenha o objeto player)

    name = nome do poke

    ballKey = "pokeball", "greatball", etc

    dp = se tenta criar no player ou manda direto para o CP (false cria no player)

    msg = "parabens, voce encontrou um poke"

     

    exemplo:

    doAddPokeball(player:getId(), "Rattata", 5, 0, "pokeball", false, "parabens, voce encontrou um poke")

     

    Porém, para seu uso específico como item de quest, basta criar uma nova entrada no dicionário quests do arquivo newfunctions.lua (data/lib/core). Exemplo:

     

     

    questinicial = {
    	prizes = {
    		[1] = {
    			uid = 85000,
    			items = {
    				[1] = {item = "crystal coin", count = 5}
    			},
    			pokes = {                    
    				[1] = {name = "Shiny Electabuzz", level = 35, boost = 5}
    			},
    			badges = {}
    		}
    	},
    	level = 10,
    	teleportCP = 0
    },

     

     

    85000 é o uniqueID que deve colocar no baú pelo editor de mapa, level = 10 é o nível mínimo para fazer a quest. teleportCP = 0 significa que o player n é teleportado para o CP após abrir o baú. Esse código deve ir na linha 105 do arquivo newfunctions.lua. Pronto!

     

    Eu vi hoje mais cedo, estava estudando a base, obrigado amigo.

    Em 08/11/2021 em 14:52, lSainty disse:

    O sistema dessa base 10.98 é completamente diferente, não tem nada haver com PDA, não tem pq adaptar. Analise o sistema de catch e veja se há uma função que faça o mesmo, ou o comando usado para criar pokemons (em talkactions).

    Eu poderia ter adaptado se eu quisesse a partir dessa função, eu só não tenho conhecimento suficiente ... 

  2. Opa gente, boa tarde, beleza?

     

    Antes de tudo, TFS 1.2

    Versão 10.98

     

    Seguinte, tava aqui montando meu poketibia de boa, ai fui montar um scriptzinho básico de baú inicial para o player pegar o teu pokemon, porém, não tem a função addPokeToPlayer no meu servidor, cheguei a tentar adicionar ela porém dá muitos erros, e como não tenho conhecimento em TFS 1.2 fica meio dificil de mexer, gostaria de saber se algum de vocês poderia me ajudar com isso, vou estar deixando a função de addPokeToPlayer do PDA aqui para vocês...

     

    function addPokeToPlayer.lua

     

    O server que eu utilizo não possui o sistema de Gender(Gêneros), peço que desconsiderem essa parte.

     

    Estou com dificuldade em converter dessa versão 0.3.6 para a TFS 1.2

  3. Em 04/11/2021 em 22:32, thepota disse:

    Servidor vscode, tem tutorial no github do theforgottenserver: https://github.com/otland/forgottenserver/wiki/Compiling-on-Windows


    o client n lembro pq compilei há muito tempo, mas devo ter seguido o tutorial do github do otclient

     

    Entendi, então beleza cara, tava fazendo algumas mudanças na source do cliente pra deixar ela arrumadinha e ai quando fui compilar com os programas que eu uso eu parei e pensei ... será que vai funcionar??? KKKK, mas vlw

     

  4. 17 horas atrás, R e d disse:

    Aparece isto no momento em que uso cut e no momento em que o arbusto cresce novamente:

     

      Ocultar conteúdo

    [02/11/2021 21:08:56] [Error - Action Interface] 
    [02/11/2021 21:08:56] In a timer event called from: 
    [02/11/2021 21:08:56] data/actions/scripts/order.lua:onUse
    [02/11/2021 21:08:56] Description: 
    [02/11/2021 21:08:56] (luaGetThingPosition) Thing not found

     

    [02/11/2021 21:08:56] [Error - Action Interface] 
    [02/11/2021 21:08:56] In a timer event called from: 
    [02/11/2021 21:08:56] data/actions/scripts/order.lua:onUse
    [02/11/2021 21:08:56] Description: 
    [02/11/2021 21:08:56] (luaDoTransformItem) Item not found

     

    [02/11/2021 21:08:56] [Error - Action Interface] 
    [02/11/2021 21:08:56] In a timer event called from: 
    [02/11/2021 21:08:56] data/actions/scripts/order.lua:onUse
    [02/11/2021 21:08:56] Description: 
    [02/11/2021 21:08:56] (luaGetThingPosition) Thing not found

     

    [02/11/2021 21:08:56] [Error - Action Interface] 
    [02/11/2021 21:08:56] In a timer event called from: 
    [02/11/2021 21:08:56] data/actions/scripts/order.lua:onUse
    [02/11/2021 21:08:56] Description: 
    [02/11/2021 21:08:56] (luaDoTransformItem) Item not found

     

    [02/11/2021 21:09:11] [Error - Action Interface] 
    [02/11/2021 21:09:11] In a timer event called from: 
    [02/11/2021 21:09:11] data/actions/scripts/order.lua:onUse
    [02/11/2021 21:09:11] Description: 
    [02/11/2021 21:09:11] (luaDoTransformItem) Item not found

     

    [02/11/2021 21:09:11] [Error - Action Interface] 
    [02/11/2021 21:09:11] In a timer event called from: 
    [02/11/2021 21:09:11] data/actions/scripts/order.lua:onUse
    [02/11/2021 21:09:11] Description: 
    [02/11/2021 21:09:11] (luaDoTransformItem) Item not found
     

     

    Thing not Found e Item not found, você passou os ID's corretos?

  5. 3 horas atrás, rafersiq disse:

    bom dia galera do fórum xtibia eu to aqui pra pedir um ajuda com o remeres map editor 

    sempre que eu abro um mapa nele ele não carrega o monster.xml e o npc.xml

    umas prints pra dar uma melhor explicação do erro

    outra print

     

    esse e o erro ai eu procuro aonde esta dando o erro e tento resolver e sempre da o msm erro

     

    Esse failed to load Spawns e houses não tem a ver com o monster.xml ou o npc.xml, tem a ver com o Spawn e house que ficam na pasta World, deve ter dado alguma zoada em algum Spawn específico, quando vc abrir o seu servidor tenta dar uma olhada pra ver se não tem nenhum erro de Spawn lá por gentileza, me retorna aqui depois pra eu saber

  6. Abra o seu Spell.xml e vá na linha 2340, provavelmente haverá algum erro próximo a essa linha ou nela mesma ...

    [15/09/2021 15:50:26] Reloaded spells.
    [15/09/2021 15:52:55] [Warning - BaseEvents::loadFromXml] Cannot open spells.xml file.
    [15/09/2021 15:52:55] Line: 2340, Info: Extra content at the end of the document
    [15/09/2021 15:52:56] [Error - Game::reloadInfo] Failed to reload spells.

    Ou seja ... tem coisas a mais no arquivo que o fazem dar esse erro, só que como o arquivo XML tá com vc n tem muito o que eu fazer ... mas da uma olhada próximo a essa linha de erro ou até mesmo no fim do arquivo assim como o erro diz

  7. Existe 2 formas colocar ele pra abrir em interface.otmod ou mudar o pokemon.otmod ver imagem abaixo.

    Depois no cliente existe icon:setImageSource('pokes/'..t[2]..'.png') que no caso na pasta pokes ele pega o .png do nome do pokemon que foi passado e esta em t[2], e como mandar isso? no servidor ao colocar o pokemon no slot, ao logar etc... se passa algo assim

    doPlayerSendCancel(player, "#NewInfo,"..COLOCA_PRA_PEGAR_NOME_POKEMON_ATRIBUTOBALL_AO_SUMONADO)

     

    mudar o interface.otmod o correto.

     

    Screenshot_1.thumb.png.d8a95ae13e911c487dadddfbbb715bed.png

     

    mudar o pokemon.otmod tem que testar.

     

    Screenshot_2.png.4d7579048a56ead470662742cd54e589.png

  8. Opa cara, blz? acho que está no lugar certo, mas acho que deve ter algum tópico aqui no XTibia mesmo relacionado a isso que você quer, porém, vamos lá, tem esse vídeo, bem antigo que eu encontrei, veja se te ajuda ... 

     

     

     

     

    Se ajudar, poderia dar um REP + por favor?

  9. Em 09/10/2021 em 22:45, DanijoBR disse:

    Moto.Lua 

    function onUse(cid, item)
        if (getPlayerSlotItem(cid, PLAYER_SLOT_KEY_ITEM).uid ~= item.uid) then
            doPlayerSendCancel(cid, "To use this bike, put in the correct slot.")
        elseif (not isBiking(cid)) then
            if (isPokemonOnline(cid)) then
                inUseBall(cid, getPlayerSlotItem(cid, PLAYER_SLOT_BALL))
            end

            if (isPokemonOnline(cid) or getPlayerMounted(cid) or isFishing(cid) or isPlayerOnPvpArena(cid)) then
                doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
            else
                doPlayerRideBike(cid, item)
            end
        else
            doPlayerDeRideBike(cid, item)
        end
        return true
    end
     

     

    Player. lua

     

    -- Local vars
    local OUTFIT_BIKE_MALE = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(OUTFIT_BIKE_MALE, CONDITION_PARAM_TICKS, -1)
    addOutfitCondition(OUTFIT_BIKE_MALE, { lookType = 1744 })

    local OUTFIT_BIKE_FEMALE = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(OUTFIT_BIKE_FEMALE, CONDITION_PARAM_TICKS, -1)
    addOutfitCondition(OUTFIT_BIKE_FEMALE, { lookType = 1743 })

    local UNLOCKED_MACH_BIKE_ID = 13218
    local LOCKED_MACH_BIKE_ID = 13480

    local EMPTY_PORTRAIT_ID = 12853
    local EVOLVE_ICON_OFF_ID = 13205
    local ORDER_ICON_OFF_ID = 13206
    local DUEL_ICON_OFF_ID = 13207
    local EVOLVE_ICON_ID = 13204
    local ORDER_ICON_ID = 7730
    local DUEL_ICON_ID = 13016
    local PORTRAIT_CONTAINER_SIZE = 9
    local EMPTY_SKILL_ID = 13442
    --[[local UNLOCKED_OXYGEN_MASK_ID = 13299
    local LOCKED_OXYGEN_MASK_ID = 13300]]

    -- Get
    function getPlayerPokemon(cid)
        return getCreatureStorage(cid, playersStorages.pokemonUid)
    end

    function getPlayerPokemonName(cid, referenceName)
        local pokemon = getPlayerPokemon(cid)
        if (isCreature(pokemon)) then
            if (referenceName and isPokemonTransformed(pokemon)) then
                return getPokemonCurrentTransformation(pokemon)
            end
            return getCreatureName(pokemon)
        end

        if (referenceName) then
            local ball = getPlayerBall(cid)
            if (isItem(ball)) then
                local transform = getBallCurrentTransform(ball.uid)
                if (transform) then
                    return transform
                end
            end
        end

        return getCreatureStorage(cid, playersStorages.pokemonName)
    end

    function getPlayerPokemonNickname(cid)
        local pokemon = getPlayerPokemon(cid)
        if (isCreature(pokemon)) then
            return getCreatureNickname(pokemon)
        end

        local ball = getPlayerBall(cid)
        if (isItem(ball)) then
            local nick = getBallPokemonNickname(ball.uid)
            if (nick and nick ~= -1) then
                return nick
            end
        end

        return getCreatureStorage(cid, playersStorages.pokemonName)
    end

    function getPlayerBall(cid)
        return getPlayerSlotItem(cid, CONST_SLOT_FEET)
    end

    function getPlayerPokemonLevel(cid)
        return getBallPokemonLevel(getPlayerBall(cid).uid)
    end

    function getPlayerPokemonExperience(cid)
        return getBallPokemonExp(getPlayerBall(cid).uid)
    end

    function getPlayerPokemonNickname(cid)
        return getBallPokemonNickname(getPlayerBall(cid).uid) or getBallPokemonName(getPlayerBall(cid).uid)
    end

    function getPlayerTotalBattleWin(cid)
        return getPlayerSkillLevel(cid, PLAYER_SKILL_BATTLE_WIN)
    end

    function getPlayerTotalBattleLoss(cid)
        return getPlayerSkillLevel(cid, PLAYER_SKILL_BATTLE_LOSS)
    end

    function getPlayerRespect(cid)
        return getPlayerSoul(cid)
    end

    function getPlayerBackPosition(cid)
        local t = string.explode(getCreatureStorage(cid, playersStorages.tradeBackPosition), ";")
        if (t) then
            local pos = { x = t[2], y = t[3], z = t[4] }
            if (isWalkable(cid, pos)) then
                return pos
            end
        end

        return getTownTemplePosition(getPlayerTown(cid))
    end

    --[[
    function getPlayerPvpArenaBackPosition(cid)
        local pvpArenaBackPositionTable = string.explode(getCreatureStorage(cid, playersStorages.pvpArenaBackPosition), ";")
        return {x = pvpArenaBackPositionTable[2], y = pvpArenaBackPositionTable[3], z = pvpArenaBackPositionTable[4]}
    end
    ]]
    function getPlayerAllBallsWithPokemon(cid)
        local ballsWithPokemon = {}

        local ballSlotItem = getPlayerSlotItem(cid, PLAYER_SLOT_BALL)
        if (isItem(ballSlotItem) and isBallWithPokemon(ballSlotItem.uid)) then
            table.insert(ballsWithPokemon, ballSlotItem)
        end

        local playerBackpack = getPlayerSlotItem(cid, PLAYER_SLOT_BACKPACK)
        if (isItem(playerBackpack) and isContainer(playerBackpack.uid)) then
            local items = getContainerItems(playerBackpack.uid)
            local i = #items
            local currentItem

            while (i > 0) do
                currentItem = items[i]

                if (isContainer(currentItem.uid)) then
                    items = table_concat(items, getContainerItems(currentItem.uid))
                elseif (isBallWithPokemon(currentItem.uid)) then
                    table.insert(ballsWithPokemon, currentItem)
                end

                table.remove(items, i)
                i = #items
            end
        end

        return ballsWithPokemon
    end

    -- Is
    function isPlayerOnPvpArena(cid)
        return getPlayerPvpArena(cid)
    end

    function isExhaust(cid)
        return hasCondition(cid, CONDITION_EXHAUST)
    end

    function isPokemonOnline(cid)
        return isCreature(getPlayerPokemon(cid))
    end

    function isSurfing(cid)
        return getCreatureStorage(cid, playersStorages.isSurfing) > -1
    end

    function isRiding(cid)
        return getCreatureStorage(cid, playersStorages.isRiding) > -1
    end

    function isFlying(cid)
        return getCreatureStorage(cid, playersStorages.isFlying) > -1
    end

    function isLevitating(cid)
        return getCreatureStorage(cid, playersStorages.isLevitating) > -1
    end

    function isFishing(cid)
        return getCreatureStorage(cid, playersStorages.isFishing) > -1
    end

    function isDueling(cid)
        return getPlayerDueling(cid) --getCreatureStorage(cid, playersStorages.canDuel) > -1
    end

    function isEvolving(cid)
        return getCreatureStorage(cid, playersStorages.isEvolving) > -1
    end

    function isBiking(cid)
        return getCreatureStorage(cid, playersStorages.isBiking) > -1
    end

    function isDiving(cid)
        return getCreatureStorage(cid, playersStorages.isDiving) > -1
    end

    function isUnderwater(cid)
        return getCreatureStorage(cid, playersStorages.isUnderwater) > -1
    end

    function isPlayerWithBackpackFull(playerUid)
        local playerBackpackUid = getPlayerSlotItem(playerUid, PLAYER_SLOT_BACKPACK).uid
        return getContainerCap(playerBackpackUid) == getContainerSize(playerBackpackUid)
    end

    function getSafariZone(cid)
        return getCreatureStorage(cid, playersStorages.safariZone) > -1
    end

    -- Set
    function setSafariZone(cid, status)
        doCreatureSetStorage(cid, playersStorages.safariZone, (status and 1 or -1))
    end

    --[[
    function setPlayerPvpArena(cid, status, team, backPosition)
        if (status) then
            doCreatureSetStorage(cid, playersStorages.isOnPvpArena, 1)
        else
            doCreatureSetStorage(cid, playersStorages.isOnPvpArena, -1)
        end
        doCreatureSetStorage(cid, playersStorages.pvpArenaTeam, team)
        doCreatureSetStorage(cid, playersStorages.pvpArenaBackPosition, ";" .. backPosition.x .. ";" .. backPosition.y .. ";" .. backPosition.z)
        doPlayerSetPvpArena(cid, status, team)
    end
    ]]

    function setFishingStatus(cid, status)
        doCreatureSetStorage(cid, playersStorages.isFishing, (status and 1 or -1))
    end

    function setSurfingStatus(cid, status)
        doCreatureSetStorage(cid, playersStorages.isSurfing, (status and 1 or -1))
    end

    function setRidingStatus(cid, status)
        doCreatureSetStorage(cid, playersStorages.isRiding, (status and 1 or -1))
    end

    function setFlyingStatus(cid, status)
        doCreatureSetStorage(cid, playersStorages.isFlying, (status and 1 or -1))
    end

    function setLevitatingStatus(cid, status)
        doCreatureSetStorage(cid, playersStorages.isLevitating, (status and 1 or -1))
    end

    function setDivingStatus(cid, status)
        doCreatureSetStorage(cid, playersStorages.isDiving, (status and 1 or -1))
    end

    function setBikingStatus(cid, status)
        doCreatureSetStorage(cid, playersStorages.isBiking, (status and 1 or -1))
    end

    function setUnderwaterStatus(cid, status)
        doCreatureSetStorage(cid, playersStorages.isUnderwater, (status and 1 or -1))
    end

    function setPlayerVulnerable(cid, vulnerable)
        local playerGroupId = getPlayerGroupId(cid)

        if (playerGroupId == 1 and not vulnerable) then -- Player vulnerable coming unvulnerable
            setPlayerGroupId(cid, 7)

        elseif (playerGroupId == 7 and vulnerable) then -- Player unvulnerable coming vulnerable
            setPlayerGroupId(cid, 1)

        elseif (playerGroupId == 2 and not vulnerable) then -- Tutor vulnerable coming unvulnerable
            setPlayerGroupId(cid, ?

        elseif (playerGroupId == 8 and vulnerable) then -- Tutor unvulnerable coming vulnerable
            setPlayerGroupId(cid, 2)

        elseif (playerGroupId == 3 and not vulnerable) then -- Tutor vulnerable coming unvulnerable
            setPlayerGroupId(cid, 9)

        elseif (playerGroupId == 9 and vulnerable) then -- Tutor unvulnerable coming vulnerable
            setPlayerGroupId(cid, 3)
        end
    end

    function setPlayerPokemonNickname(cid, newNickname, removing)
        local ball = getPlayerBall(cid)

        setBallPokemonNickname(ball.uid, newNickname, removing)
        doBallUpdateDescription(ball.uid)

        if (isPokemonOnline(cid)) then
            setCreatureNickname(getPlayerPokemon(cid), newNickname)
        end
    end

    function setPlayerBackPosition(cid, newPos)
        doCreatureSetStorage(cid, playersStorages.tradeBackPosition, string.concat(";", newPos.x, ";",
            newPos.y, ";", newPos.z))
    end

    -- Can
    function canBlink(cid)
        local time = doMasteryAdvantageCheck(cid, MASTERY_ADVANTAGES.BLINK_COOLDOWN) and 7 or 10
        return getCreatureStorage(cid, playersStorages.blink) == -1 or
                (os.time() - getCreatureStorage(cid, playersStorages.blink)) >= time
    end

    function canLove(cid)
        return getCreatureStorage(cid, playersStorages.love) == -1 or
                (os.time() - getCreatureStorage(cid, playersStorages.love)) >= 5 * 60
    end

    -- Do
    function doPlayerUseBallOnSlot(cid)
        if (isPlayer(cid)) then
            local item = getPlayerSlotItem(cid, PLAYER_SLOT_BALL)
            if (isItem(item)) then
                doPlayerUseItem(cid, item.uid)
            end
        end
    end

    function doPlayerRemoveAbilitySpeedCondition(cid)
        return doRemoveCondition(cid, CONDITION_HASTE, CONDITION_SUBID.HASTE.ABILITIES)
    end

    function doPlayerUpdateOutfit(cid)
        doUpdateAbilityOutfitCondition(cid)
        doPlayerRemoveAbilitySpeedCondition(cid)
        local speedCondition = getAbilitySpeedCondition(cid)
        if (speedCondition) then
            doAddCondition(cid, speedCondition)
        end
    end

    function doAddExhaust(cid)
        doAddCondition(cid, delayCondition)
    end

    function doPlayerAddBattleWin(cid)
        doPlayerAddSkill(cid, PLAYER_SKILL_BATTLE_WIN, 1, true)
    end

    function doPlayerAddBattleLoss(cid)
        doPlayerAddSkill(cid, PLAYER_SKILL_BATTLE_LOSS, 1, true)
    end

    function doPlayerAddRespect(cid, amount)
        local current = getPlayerSoul(cid)
        if (amount > 0) then
            if (current < PLAYER_RESPECT_MAX) then
                if ((current + amount) < PLAYER_RESPECT_MAX) then
                    return doPlayerAddSoul(cid, amount)
                else
                    return doPlayerAddSoul(cid, PLAYER_RESPECT_MAX - current)
                end
            end
        else
            return doPlayerAddSoul(cid, amount)
        end
        return false
    end

    function doPlayerUpdatePokemonLevelPercent(cid, currentExp, currentLevel)
        local TotalExpToNextLevel = getExperienceForLevel(currentLevel + 1)
        local TotalExpToCurrentLevel = getExperienceForLevel(currentLevel)
        local ExpBetweenLevels = TotalExpToNextLevel - TotalExpToCurrentLevel
        local onePercent = math.ceil(ExpBetweenLevels / 100)

        setPlayerMagicLevelPercent(cid, math.ceil((currentExp - TotalExpToCurrentLevel) / onePercent))
    end

    local function doPlayerSendPokemonSkillWindowData(cid, ballUid, moves, pokemonName, showAllMoves)
        if (ballUid == 0) then
            return -- This occur when a never used ball is put on the slot. getPlayerBall() is called before a ball exists there. Dont worry, this gonna be called again after the fail try. Yes, this is an ungly hack.
        end

        if (not pokemonName) then
            pokemonName = getBallPokemonName(ballUid)
        end

        if (not moves) then
            moves = getPokemonSkills(pokemonName, ballUid)
        end

        if (not showAllMoves) then -- Eg.: When use Transform ability
            local pokemonLevel = getBallPokemonLevel(ballUid)
            local eggMoveSlot = getBallEggMoveSlot(ballUid)
            local tm1Slot = getBallTmSlot(ballUid, 1)
            local tm2Slot = getBallTmSlot(ballUid, 2)
            for k, move in ipairs(moves) do
                if (getPokemonSkillRequiredLevel(pokemonName, move) > pokemonLevel and
                        ((not eggMoveSlot or k > eggMoveSlot) and
                                (not tm1Slot or k > tm1Slot) and
                                (not tm2Slot or k > tm2Slot))) then
                    moves[k] = nil
                end
            end
        end

        local icons = {}
        for _, move in pairs(moves) do
            icons[#icons + 1] = getPokemonSkillClientIconId(move)
        end

        doPlayerSendPokemonSkills(cid, getPokemonFastcallPortraitId(pokemonName), icons)
    end

    local function doSendPlayerPokemonCooldowns(cid, ball, moves)
        for _, move in pairs(moves) do
            local cooldown = getBallSkillCooldown(ball.uid, move)
            if (cooldown > 0) then
                doPlayerSendPokemonSkillCooldown(cid, getPokemonSkillClientIconId(move), cooldown)
            end
        end
    end

    function doPlayerPokemonAddExperience(player, pokemon, expAmount, multiplier, referenceItem) -- When receive referenceItem(ball), pokemon is ignored
        if (expAmount > 0) then
            if (multiplier == nil) then
                multiplier = true
            end

            local ball = isItem(referenceItem) and referenceItem or getPlayerBall(player)
            if (getBallFromNpc(ball.uid)) then
                return false
            end

            local currentLevel = getBallPokemonLevel(ball.uid)
            local currentExtraPoints = getBallPokemonExtraPoints(ball.uid)

            local pokemonName = getBallPokemonName(ball.uid)
            local maxExtraPoints = isShinyName(pokemonName) and (POKEMON_EXTRA_POINT_MAX - 10) or POKEMON_EXTRA_POINT_MAX

            PokemonHeldItem.onGainExperience(player, pokemon, ball, expAmount)

            if (currentLevel < POKEMON_LEVEL_MAX or currentExtraPoints < maxExtraPoints) then
                if (multiplier) then -- Pokemon Exp Stage
                    if (currentLevel <= 10) then
                        expAmount = expAmount * 42
                    elseif (currentLevel <= 15) then
                        expAmount = expAmount * 30
                    elseif (currentLevel <= 20) then
                        expAmount = expAmount * 16
                    elseif (currentLevel <= 25) then
                        expAmount = expAmount * 9
                    elseif (currentLevel <= 30) then
                        expAmount = expAmount * 5
                    elseif (currentLevel <= 50) then
                        expAmount = expAmount * 3
                    elseif (currentLevel <= 70) then
                        expAmount = expAmount * 2
                    else
                        expAmount = expAmount * 1.5
                    end

                    expAmount = expAmount * 1.25
                    expAmount = expAmount + math.floor(expAmount * getPlayerExtraExpRate(player))
                end

                local oldExperience = getBallPokemonExp(ball.uid)
                local newExperience = oldExperience + expAmount
                local nextLevelExp = ((50 * (currentLevel) * (currentLevel) * (currentLevel)) - (150 * (currentLevel) * (currentLevel)) + (400 * (currentLevel))) / 3
                local gainLevel = 0

                if (newExperience >= nextLevelExp and currentLevel - getPlayerLevel(player) >= MAX_LEVEL_DIFF_BETWEEN_PLAYER_POKEMON) then
                    doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_BLUE, string.format(__L(player, "Your Pokemon is %s levels higher than you and is no longer receiving experience as this difference exists."), MAX_LEVEL_DIFF_BETWEEN_PLAYER_POKEMON))
                    return false
                end

                setBallPokemonExp(ball.uid, newExperience)
                doSendAnimatedText(getCreaturePosition(pokemon and pokemon or player), string.concat("+", expAmount, " EXP"), COLOR_GREEN)
                doPlayerSendTextMessage(player, MESSAGE_EVENT_DEFAULT, string.format(__L(player, "Your %s received %s experience point%s."), pokemonName, expAmount, (expAmount > 0 and "s" or "")))

                while (newExperience >= nextLevelExp) do
                    gainLevel = gainLevel + 1
                    nextLevelExp = ((50 * (currentLevel + gainLevel) * (currentLevel + gainLevel) * (currentLevel + gainLevel)) - (150 * (currentLevel + gainLevel) * (currentLevel + gainLevel)) + (400 * (currentLevel + gainLevel))) / 3
                end

                if (gainLevel > 0) then
                    if (currentLevel < POKEMON_LEVEL_MAX) then
                        local pokemonPosition = getCreaturePosition(pokemon and pokemon or player)
                        local maxEnergy = getCreatureMaxMana(player)
                        local energy = getCreatureMana(player)
                        local pokemonNickname = getBallPokemonNickname(ball.uid)
                        local pokemonExtraPoints = getBallPokemonExtraPoints(ball.uid) + gainLevel
                        local newLevel = currentLevel + gainLevel
                        local messageClass = getPlayerUsingOtClient(player) and MESSAGE_EVENT_DEFAULT or MESSAGE_EVENT_ADVANCE

                        if (pokemonNickname ~= nil and pokemonNickname ~= -1) then
                            doBallUpdateDescription(ball.uid, getBallPokemonSex(ball.uid), pokemonName, pokemonNickname, newLevel, pokemonExtraPoints)
                            doPlayerSendTextMessage(player, messageClass,
                                string.format(__L(player, "Congratulations! Your %s advanced from level %s to level %s."), pokemonNickname, currentLevel, newLevel))
                        else
                            doBallUpdateDescription(ball.uid, getBallPokemonSex(ball.uid), pokemonName, nil, newLevel, pokemonExtraPoints)
                            doPlayerSendTextMessage(player, messageClass,
                                string.format(__L(player, "Congratulations! Your %s advanced from level %s to level %s."), pokemonName, currentLevel, newLevel))
                        end

                        if (pokemon) then
                            setMonsterExtraPoints(pokemon, pokemonExtraPoints)
                            setMonsterLevel(pokemon, newLevel)
                            doCreatureAddHealth(pokemon, (getCreatureMaxHealth(pokemon) - getCreatureHealth(pokemon)))
                            setCreatureMaxMana(player, maxEnergy + POKEMON_GAIN_ENERGY * gainLevel)
                            doCreatureAddMana(player, (maxEnergy - energy) + POKEMON_GAIN_ENERGY * gainLevel)
                            setPlayerMagicLevel(player, newLevel)
                        else
                            doBallHeal(player, ball)
                        end

                        doSendMagicEffect(pokemonPosition, EFFECT_GREEN_BUFF)
                        doSendMagicEffect(pokemonPosition, EFFECT_LEVEL_UP)

                        setBallPokemonLevel(ball.uid, newLevel)
                        setBallPokemonMaxEnergy(ball.uid, maxEnergy + POKEMON_GAIN_ENERGY * gainLevel)
                        setBallPokemonExtraPoints(ball.uid, pokemonExtraPoints)

                        doDatalogPokemonLevelUp(player, getPokemonNumberByName(pokemonName), currentLevel,
                            newLevel, os.time(), pokemonPosition)

                        local moves = getPokemonSkills(pokemonName, ball.uid)
                        local sendCooldowns = nil
                        local newMoves = {}
                        for _, move in pairs(moves) do
                            if (getPokemonSkillRequiredLevel(pokemonName, move) <= newLevel and
                                    getPokemonSkillRequiredLevel(pokemonName, move) > currentLevel) then
                                doPlayerSendTextMessage(player, messageClass, string.format(__L(player, "Your %s learned a new move: %s."), pokemonName, move))
                                if (pokemon) then
                                    doPlayerSendPokemonSkillWindowData(player, ball.uid) -- Show the new move
                                    sendCooldowns = true
                                end
                                newMoves[#newMoves + 1] = getPokemonSkillClientIconId(move)
                            end
                        end

                        if (sendCooldowns) then
                            doSendPlayerPokemonCooldowns(player, ball, moves)
                        end

                        for _, evolution in ipairs(getPokemonEvolutions(pokemonName)) do
                            if (evolution.requiredLevel <= newLevel and evolution.requiredLevel > currentLevel) then
                                doPlayerSendTextMessage(player, messageClass, string.format(__L(player, "Your %s reached the required level to evolve! Check your Pokedex."), pokemonName))
                                break
                            end
                        end

                        currentLevel = currentLevel + gainLevel
                        doPlayerSendPokemonLevelUp(player, getPokemonNumberByName(pokemonName), currentLevel, newMoves)

                    else -- We are at Extra Point up mode
                        local pokemonPosition = getCreaturePosition(pokemon and pokemon or player)
                        local maxEnergy = getCreatureMaxMana(player)
                        local energy = getCreatureMana(player)
                        local pokemonNickname = getBallPokemonNickname(ball.uid)
                        local pokemonExtraPoints = getBallPokemonExtraPoints(ball.uid) + gainLevel

                        if (pokemonNickname ~= nil and pokemonNickname ~= -1) then
                            doBallUpdateDescription(ball.uid, getBallPokemonSex(ball.uid), pokemonName,
                                pokemonNickname, currentLevel, pokemonExtraPoints)
                            doPlayerSendTextMessage(player, MESSAGE_EVENT_ADVANCE,
                                string.format(__L(player, "Congratulations! Your %s upgraded his extra points from level %s to level %s."), pokemonNickname, pokemonExtraPoints - gainLevel, pokemonExtraPoints))
                        else
                            doBallUpdateDescription(ball.uid, getBallPokemonSex(ball.uid), pokemonName, nil,
                                currentLevel, pokemonExtraPoints)
                            doPlayerSendTextMessage(player, MESSAGE_EVENT_ADVANCE,
                                string.format(__L(player, "Congratulations! Your %s upgraded his extra points from level %s to level %s."), pokemonName, pokemonExtraPoints - gainLevel, pokemonExtraPoints))
                        end

                        if (pokemon) then
                            setMonsterExtraPoints(pokemon, pokemonExtraPoints)
                            setMonsterLevel(pokemon, currentLevel)
                            doCreatureAddHealth(pokemon, (getCreatureMaxHealth(pokemon) - getCreatureHealth(pokemon)))
                            setCreatureMaxMana(player, maxEnergy + POKEMON_GAIN_ENERGY * gainLevel)
                            doCreatureAddMana(player, (maxEnergy - energy) + POKEMON_GAIN_ENERGY * gainLevel)
                            setPlayerMagicLevel(player, currentLevel)
                        end

                        doSendMagicEffect(pokemonPosition, EFFECT_GREEN_BUFF)
                        doSendMagicEffect(pokemonPosition, EFFECT_LEVEL_UP)

                        if (not isBallPokemonFromEgg(ball.uid)) then
                            setBallIsNotPokemonFromEgg(ball.uid, true)
                        end

                        setBallPokemonExp(ball.uid, getExperienceForLevel(currentLevel))
                        setBallPokemonExtraPoints(ball.uid, pokemonExtraPoints)
                    end

                    doPlayerAchievementCheck(player, ACHIEVEMENT_IDS.POKEMON_LEVEL_100, currentLevel)
                end

                if (pokemon) then
                    doPlayerUpdatePokemonLevelPercent(player, newExperience, currentLevel)
                end
            end
        end
        return true
    end

    function doPlayerUpdatePokemonMoves(cid, ballUid, moves, pokemonName, showAllMoves)
        doPlayerSendPokemonSkillWindowData(cid, ballUid, moves, pokemonName, showAllMoves)
        doPlayerSendPokemonSkillContainerOpen(cid)
    end

    function doPlayerUpdatePokemonIcons(cid, pokemonName, showAllMoves)
        if (isItem(getPlayerSlotItem(cid, PLAYER_SLOT_PORTRAIT))) then
            doRemoveItem(getPlayerSlotItem(cid, PLAYER_SLOT_PORTRAIT).uid)
        end

        local portraitContainer, ball = doPlayerAddItem(cid, getPokemonPortraitId(pokemonName)), getPlayerBall(cid)
        local pokemonSkills = (isItem(ball) and getPokemonSkills(pokemonName, ball.uid) or getPokemonDefaultSkills(pokemonName))

        doPlayerUpdatePokemonMoves(cid, ball.uid, pokemonSkills, pokemonName, showAllMoves)

        if (isItem(ball)) then -- Sometimes this is called but the ball doesn't exist
            doSendPlayerPokemonCooldowns(cid, ball, pokemonSkills)
        end
    end

    function setPlayerIcons(cid, ball, status)
        if (status) then
            local pokemonLevel = getBallPokemonLevel(ball.uid)

            setPlayerMagicLevel(cid, pokemonLevel)
            doPlayerUpdatePokemonLevelPercent(cid, getBallPokemonExp(ball.uid), pokemonLevel)

            doTransformItem(getPlayerSlotItem(cid, PLAYER_SLOT_EVOLVE).uid, EVOLVE_ICON_ID)
            doTransformItem(getPlayerSlotItem(cid, PLAYER_SLOT_ORDER).uid, ORDER_ICON_ID)
            doPlayerUpdatePokemonIcons(cid, getBallPokemonName(ball.uid))

            if (not isDueling(cid)) then
                doTransformItem(getPlayerSlotItem(cid, PLAYER_SLOT_DUEL).uid, DUEL_ICON_ID)
            end

        else
            setPlayerMagicLevel(cid, 0)
            setPlayerMagicLevelPercent(cid, 0)
            doRemoveItem(getPlayerSlotItem(cid, PLAYER_SLOT_PORTRAIT).uid)
            doTransformItem(getPlayerSlotItem(cid, PLAYER_SLOT_EVOLVE).uid, EVOLVE_ICON_OFF_ID)
            doTransformItem(getPlayerSlotItem(cid, PLAYER_SLOT_ORDER).uid, ORDER_ICON_OFF_ID)
            --doTransformItem(getPlayerSlotItem(cid, PLAYER_SLOT_DUEL).uid, DUEL_ICON_OFF_ID)
            --New
            doPlayerSendPokemonSkillContainerClose(cid)
        end
    end

    local BIKE_SPEED_CONDITION = createConditionObject(CONDITION_HASTE, -1, -1, CONDITION_SUBID.HASTE.BIKE)
    setConditionParam(BIKE_SPEED_CONDITION, CONDITION_PARAM_SPEED, 120)

    function doPlayerRideBike(cid, item)
        doTransformItem(item.uid, LOCKED_MACH_BIKE_ID)
        doAddCondition(cid, BIKE_SPEED_CONDITION)
        setBikingStatus(cid, true)

        local outfit = getCreatureOutfit(cid)
        if (getPlayerSex(cid) == PLAYERSEX_FEMALE) then
            outfit.lookType = 1743
            doSetCreatureOutfit(cid, outfit, -1, CONDITION_SUBID.OUTFITS.BIKE)
        else
            outfit.lookType = 1744
            doSetCreatureOutfit(cid, outfit, -1, CONDITION_SUBID.OUTFITS.BIKE)
        end
        doSendMagicEffect(getCreaturePosition(cid), EFFECT_POFF)
    end

    function doPlayerDeRideBike(cid, item)
        doRemoveCondition(cid, CONDITION_HASTE, CONDITION_SUBID.HASTE.BIKE)
        setBikingStatus(cid, false)
        doTransformItem(item.uid, UNLOCKED_MACH_BIKE_ID)
        doRemoveCondition(cid, CONDITION_OUTFIT, CONDITION_SUBID.OUTFITS.BIKE)
        doSendMagicEffect(getCreaturePosition(cid), EFFECT_POFF)
    end

    --[[ Is not used anymore
    -- function doPlayerResetSpeed(cid)
        for i = 0, 15 do -- try to remove all haste conditions
            if (hasCondition(cid, CONDITION_HASTE)) then
                doRemoveCondition(cid, CONDITION_HASTE)
            else
                break
            end
        end

        for i = 0, 15 do -- try to remove all paralyze conditions
            if (hasCondition(cid, CONDITION_PARALYZE)) then
                doRemoveCondition(cid, CONDITION_PARALYZE)
            else
                break
            end
        end

        doChangeSpeed(cid, -(getCreatureSpeed(cid) - getCreatureBaseSpeed(cid)))
    end]]

    -- Others
    function getPlayerLastOpponent(cid)
        return getCreatureStorage(cid, playersStorages.lastOpponent)
    end

    function setPlayerLastOpponent(cid, _lastOpponent)
        doCreatureSetStorage(cid, playersStorages.lastOpponent, _lastOpponent)
    end

    function getPlayerLastMaxPokemon(cid)
        return getCreatureStorage(cid, playersStorages.lastMaxPokemon)
    end

    function setPlayerLastMaxPokemon(cid, _lastMaxPokemon)
        doCreatureSetStorage(cid, playersStorages.lastMaxPokemon, _lastMaxPokemon)
    end

    function getPlayerLastMaxMembers(cid)
        return getCreatureStorage(cid, playersStorages.lastMaxMembers)
    end

    function setPlayerLastMaxMembers(cid, _lastMaxMembers)
        doCreatureSetStorage(cid, playersStorages.lastMaxMembers, _lastMaxMembers)
    end

    -- Main items related
    function doPlayerAddMainItems(cid)
        setItemUniqueOwner(doPlayerAddItem(cid, 12157, 100, false), cid) -- 100x Empty poke ball
        setItemUniqueOwner(doPlayerAddItem(cid, 2687, 100, false), cid) -- 100x Cookie
        setItemUniqueOwner(doPlayerAddItem(cid, 12244, 20, false), cid) -- 20x Pokemon health potion
        setItemUniqueOwner(doPlayerAddItem(cid, 2120, 1, false), cid) -- 1x Rope
        setItemUniqueOwner(doPlayerAddItem(cid, 12292, 1, false), cid) -- 1x Old Fishing Rood
    end

    function getPlayerFirstPokemon(cid)
        local dbResult = db.getResult("SELECT `firstpokemon`  FROM `players` WHERE `id` = '" .. getPlayerGUID(cid) .. " LIMIT 1';")
        local firstPokemonId = dbResult:getDataInt('firstpokemon')
        if (firstPokemonId == 0) then
            return "Bulbasaur"
        elseif (firstPokemonId == 1) then
            return "Charmander"
        elseif (firstPokemonId == 2) then
            return "Squirtle"
        elseif (firstPokemonId == 3) then
            return "Chikorita"
        elseif (firstPokemonId == 4) then
            return "Cyndaquil"
        elseif (firstPokemonId == 5) then
            return "Totodile"
        end
        return "Bulbasaur"
    end

    --function getPlayerFirstPokemonSex(cid)
    --    local dbResult = db.getResult("SELECT `pokemon_sex`  FROM `player_first_pokemon` WHERE `id` = '".. getPlayerGUID(cid) .." LIMIT 1';")
    --  if (dbResult == -1) then
    --    return table.random({POKEMON_SEX_FEMALE, POKEMON_SEX_MALE})
    --  end
    --    local pokemonSex = dbResult:getDataInt('pokemon_sex')
    --  if (not pokemonSex or (pokemonSex ~= POKEMON_SEX_FEMALE and pokemonSex ~= POKEMON_SEX_MALE)) then
    --    return table.random({POKEMON_SEX_FEMALE, POKEMON_SEX_MALE})
    --  end
    --  return pokemonSex
    --end

    function getPlayerPokemonCaughts(cid, pokemonName)
        local r = getCreatureStorage(cid, getPokemonCatchStorage(pokemonName))
        return r > -1 and r or 0
    end

    function setPlayerPokemonCaughts(cid, pokemonName, caughts)
        doCreatureSetStorage(cid, getPokemonCatchStorage(pokemonName), caughts)

        if (caughts == 1) then -- First
            setPlayerIndividualCaughts(cid, getPlayerIndividualCaughts(cid) + 1)
        end
    end

    function getPlayerCaughts(cid)
        local r = tonumber(getCreatureStorage(cid, playersStorages.caughts))
        return r > -1 and r or 0
    end

    function setPlayerCaughts(cid, caughts)
        doCreatureSetStorage(cid, playersStorages.caughts, caughts)
    end

    function setPlayerIndividualCaughts(cid, v)
        doCreatureSetStorage(cid, playersStorages.individualCaughts, v)
    end

    function getPlayerIndividualCaughts(cid)
        local r = getCreatureStorage(cid, playersStorages.individualCaughts)
        if (r == EMPTY_STORAGE) then
            r = 0
            if (getPlayerCaughts(cid) > 0) then -- Otherwise this is a new player
                for i = 1, POKEMON_NUMBER do
                    if (getPlayerPokemonCaughts(cid, getPokemonNameByNumber(i)) > 0) then
                        r = r + 1
                    end
                end
            end

            setPlayerIndividualCaughts(cid, r)
        end

        return r
    end

    function getPlayerExtraExpRateTime(cid)
        local r = getCreatureStorage(cid, playersStorages.extraExpRateTime)
        return r > -1 and r or 0
    end

    function setPlayerExtraExpRateTime(cid, value)
        doCreatureSetStorage(cid, playersStorages.extraExpRateTime, value)
    end

    function getPlayerExtraExpRateValue(cid)
        local r = tonumber(getCreatureStorage(cid, playersStorages.extraExpRateValue))
        return r > -1 and r or 0
    end

    function setPlayerExtraExpRateValue(cid, value)
        doCreatureSetStorage(cid, playersStorages.extraExpRateValue, value)
    end

    function getPlayerMasteryDungeon(cid)
        return getCreatureStorage(cid, playersStorages.masteryDungeon)
    end

    function setPlayerMasteryDungeon(cid, masteryDungeon)
        doCreatureSetStorage(cid, playersStorages.masteryDungeon, masteryDungeon)
    end

    function getPlayerLastDungeonDate(cid)
        return getCreatureStorage(cid, playersStorages.lastDungeonDate)
    end

    function setPlayerLastDungeonDate(cid, value)
        doCreatureSetStorage(cid, playersStorages.lastDungeonDate, value)
    end

    function getPlayerLastSafariZoneDate(cid)
        return getCreatureStorage(cid, playersStorages.lastSafariZoneDate)
    end

    function setPlayerLastSafariZoneDate(cid, value)
        doCreatureSetStorage(cid, playersStorages.lastSafariZoneDate, value)
    end

    function getPlayerSafariZonePass(cid)
        local r = getCreatureStorage(cid, playersStorages.safariZonePass)
        return r > -1 and r or 0
    end

    function setPlayerSafariZonePass(cid, value)
        doCreatureSetStorage(cid, playersStorages.safariZonePass, value)
    end

    --
    function getPlayerLastUsedTm(cid)
        return getPlayerItemByAttribute(cid, true, ITEM_ATTRIBUTES.LAST_USED_TM_MARK,
            getCreatureStorage(cid, playersStorages.lastUsedTmMark))
    end

    function setPlayerLastUsedTm(cid, itemUid)
        local v = getCurrentTimeInSeconds()
        doItemSetAttribute(itemUid, ITEM_ATTRIBUTES.LAST_USED_TM_MARK, v)
        doCreatureSetStorage(cid, playersStorages.lastUsedTmMark, v)
    end

    function getPlayerLastUsedTmBall(cid)
        return getPlayerItemByAttribute(cid, true, ITEM_ATTRIBUTES.LAST_USED_TM_BALL_MARK,
            getCreatureStorage(cid, playersStorages.lastUsedTmBallMark))
    end

    function setPlayerLastUsedTmBall(cid, itemUid)
        local v = getCurrentTimeInSeconds()
        doItemSetAttribute(itemUid, ITEM_ATTRIBUTES.LAST_USED_TM_BALL_MARK, v)
        doCreatureSetStorage(cid, playersStorages.lastUsedTmBallMark, v)
    end

    function isPlayerAutoWalking(cid)
        return getCreatureStorage(cid, playersStorages.isAutoWalking) > 0
    end

    function setPlayerAutoWalking(cid, value)
        doCreatureSetStorage(cid, playersStorages.isAutoWalking, value and 1 or 0)
    end

    function getPlayerFrontierIsland(cid)
        return getCreatureStorage(cid, playersStorages.frontierIsland) > 0
    end

    function setPlayerFrontierIsland(cid, value)
        doCreatureSetStorage(cid, playersStorages.frontierIsland, value and 1 or 0)
    end

    function getPlayerLastBattleTowerTwenty(cid)
        return getCreatureStorage(cid, playersStorages.lastBattleTowerTwenty)
    end

    function setPlayerLastBattleTowerTwenty(cid, value)
        doCreatureSetStorage(cid, playersStorages.lastBattleTowerTwenty, value)
    end

    function getPlayerLastBattleTowerFifteen(cid)
        return getCreatureStorage(cid, playersStorages.lastBattleTowerFifteen)
    end

    function setPlayerLastBattleTowerFifteen(cid, value)
        doCreatureSetStorage(cid, playersStorages.lastBattleTowerFifteen, value)
    end

    function getPlayerLastBattleTowerTen(cid)
        return getCreatureStorage(cid, playersStorages.lastBattleTowerTen)
    end

    function setPlayerLastBattleTowerTen(cid, value)
        doCreatureSetStorage(cid, playersStorages.lastBattleTowerTen, value)
    end

    function getPlayerOrangeArchipelagoAccess(cid)
        local v = getCreatureStorage(cid, playersStorages.orangeArchipelagoAccess)
        return v > 0 and v or 1
    end

    local ORANGE_ARCHIPELAGO_ISLANDS_PER_ACCESS = {
        [2] = "Valencia, Pinkan and Pummelo",
        [3] = "Tarroco, Hamlin and Kumquat",
        [4] = "Mandarin North, Butwal and Navel",
        [5] = "Ascorbia, The Seven Grapefruit and Moro",
        [6] = "Shamouti, Murcott and Mandarin South"
    }

    function setPlayerOrangeArchipelagoAccess(cid, value)
        local old = getPlayerOrangeArchipelagoAccess(cid)
        doCreatureSetStorage(cid, playersStorages.orangeArchipelagoAccess, value)

        if (value > old) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,
                string.format(__L(cid, "Your Orange Archipelago access has increased! Your new unlocked islands: %s."), __L(cid, ORANGE_ARCHIPELAGO_ISLANDS_PER_ACCESS[value])))
        end
    end

    function getPlayerBoughtRareCandy(cid)
        local v = getAccountStorage(getPlayerAccountId(cid), ACCOUNT_STORAGES.BOUGHT_RARE_CANDY) --getCreatureStorage(cid, playersStorages.boughtRareCandy)
        return v > -1 and v or 0
    end

    function setPlayerBoughtRareCandy(cid, value)
        --doCreatureSetStorage(cid, playersStorages.boughtRareCandy, value)
        setAccountStorage(getPlayerAccountId(cid), ACCOUNT_STORAGES.BOUGHT_RARE_CANDY, value)
    end

    function getPlayerLastDexedTmItemId(cid)
        local v = getCreatureStorage(cid, playersStorages.lastDexedTmItemId)
        return v > -1 and v or 0
    end

    function setPlayerLastDexedTmItemId(cid, value)
        doCreatureSetStorage(cid, playersStorages.lastDexedTmItemId, value)
    end

    --
    --[[
    function doPlayerOxygenMaskLock(cid)
        local item = getPlayerSlotItem(cid, PLAYER_SLOT_KEY_ITEM)
        if (isItem(item) and item.itemid == UNLOCKED_OXYGEN_MASK_ID) then
            doTransformItem(item.uid, LOCKED_OXYGEN_MASK_ID)
            return true
        end
        return false
    end

    function doPlayerOxygenMaskUnlock(cid)
        local item = getPlayerSlotItem(cid, PLAYER_SLOT_KEY_ITEM)
        if (isItem(item) and item.itemid == LOCKED_OXYGEN_MASK_ID) then
            doTransformItem(item.uid, UNLOCKED_OXYGEN_MASK_ID)
            return true
        end
        return false
    end
    ]]

    function doPlayerRemoveFrontierBalls(cid)
        for _, item in pairs(getPlayerAllBallsWithPokemon(cid)) do
            if (ballsNames[item.itemid] == "frontier") then
                doRemoveItem(item.uid)
            end
        end
    end

    function doPlayerRemoveEpicBalls(cid)
        for _, item in pairs(getPlayerAllBallsWithPokemon(cid)) do
            if (ballsNames[item.itemid] == "epic") then
                doRemoveItem(item.uid)
            end
        end
    end

    function doPlayerReset(cid) -- Called by onLogin and onDeath
        setPlayerVulnerable(cid, true)
        setFishingStatus(cid, false)
        doCreatureSetStorage(cid, playersStorages.isEvolving, -1)
        setCreatureMaxMana(cid, 0)
        doPlayerAddMana(cid, -getPlayerMana(cid), false)

        setPokemonBadPoison(cid, false)
        setPokemonPoison(cid, false)
        setPokemonBurn(cid, false)

        doPlayerRemoveSafariZoneItems(cid)
        setSafariZone(cid, false)

        setIsPokemonUsingHealthPotion(cid, false)
        setPlayerAutoWalking(cid, false)
        setPlayerFrontierIsland(cid, false)
        setPlayerTraveling(cid, false)

        if (isBiking(cid)) then
            doPlayerDeRideBike(cid, getPlayerSlotItem(cid, PLAYER_SLOT_KEY_ITEM))
        end
    end

    function doPlayerSendWindowsData(cid, sendMoves)
        doPlayerSendPokemonWindowClose(cid) -- reset window icons
        local balls = getPlayerAllBallsWithPokemon(cid)
        for _, ball in ipairs(balls) do
            doFastcallLink(cid, ball.uid)
        end

        if (sendMoves) then -- We didn't need to send it if this is called by onLogin, cuz this will be send when onEquip gets called
            local ball = getPlayerBall(cid)
            if (isItem(ball)) then
                doPlayerSendPokemonSkillWindowData(cid, ball.uid)
            end
        end

        doPokedexStatusSend(cid)

        if (#balls > 0) then
            doPlayerSendPokemonSkillContainerOpen(cid)
            doPlayerSendPokemonWindowOpen(cid)
        end
    end

    function getPlayerKeyItem(cid)
        return getPlayerSlotItem(cid, PLAYER_SLOT_KEY_ITEM)
    end

    function getPlayerMounted(cid)
        return isSurfing(cid) or isFlying(cid) or isRiding(cid) or isDiving(cid) or isLevitating(cid)
    end

    function getPlayerBlockLogout(cid)
        return getCreatureStorage(cid, playersStorages.blockLogout) > 0
    end

    function setPlayerBlockLogout(cid, value) -- This will prevent the player logout. If the player forces exit, he will be teleported to Trade Room and this will be setted to false. This will be setted to false also if the player dies or use ability teleport.
        doCreatureSetStorage(cid, playersStorages.blockLogout, (value and 1 or 0))
    end

    function getPlayerGotStarterPokemon(cid)
        return getCreatureStorage(cid, playersStorages.gotStarterPokemon) > 0
    end

    function setPlayerGotStarterPokemon(cid, value)
        doCreatureSetStorage(cid, playersStorages.gotStarterPokemon, (value and 1 or 0))
    end

    function onPlayerWinDuel(cid)
        if (getPlayerTournamentReady(cid)) then
            doPlayerResetBerryCooldown(cid)
        end
    end

    function onPlayerEndDuel(cid) -- Called when win/lose, its duels and battles too
        doRemoveCondition(cid, CONDITION_EXHAUST, CONDITION_SUBID.EXHAUST.POKEMONCALL)
    end

    function getPlayerTraveling(cid)
        return getCreatureStorage(cid, playersStorages.traveling) > -1
    end

    function setPlayerTraveling(cid, value)
        doCreatureSetStorage(cid, playersStorages.traveling, (value and 1 or -1))
    end

    function getPlayerTotalCasedDolls(cid)
        local r = getCreatureStorage(cid, playersStorages.casedDolls)
        return r > -1 and r or 0
    end

    function setPlayerTotalCasedDolls(cid, value)
        doCreatureSetStorage(cid, playersStorages.casedDolls, value)
    end

    function getPlayerLastUsedIncubator(cid)
        return getPlayerItemByAttribute(cid, true, ITEM_ATTRIBUTES.LAST_USED_INCUBATOR_MARK,
            getCreatureStorage(cid, playersStorages.lastUsedIncubatorMark))
    end

    function setPlayerLastUsedIncubator(cid, itemUid)
        local v = getCurrentTimeInSeconds()
        doItemSetAttribute(itemUid, ITEM_ATTRIBUTES.LAST_USED_INCUBATOR_MARK, v)
        doCreatureSetStorage(cid, playersStorages.lastUsedIncubatorMark, v)
    end

    function getPlayerAutoLootSave(cid)
        local r = getCreatureStorage(cid, playersStorages.autoLootSave)
        return r == 1
    end

    function setPlayerAutoLootSave(cid, value)
        doCreatureSetStorage(cid, playersStorages.autoLootSave, value and 1 or 0)
    end

    function getPlayerDeliveredEasterEggs(cid)
        local r = getCreatureStorage(cid, playersStorages.deliveredEasterEggs)
        return r ~= EMPTY_STORAGE and r or 0
    end

    function setPlayerDeliveredEasterEggs(cid, value)
        doCreatureSetStorage(cid, playersStorages.deliveredEasterEggs, value)
    end

    function getPlayerColosseumArenaPaid(cid)
        local r = getCreatureStorage(cid, playersStorages.colosseumnArenaPaid)
        return r ~= EMPTY_STORAGE and r or false
    end

    function setPlayerColosseumArenaPaid(cid, value)
        doCreatureSetStorage(cid, playersStorages.colosseumnArenaPaid, value)
    end

    function getPlayerLastEliteFourTry(cid)
        local r = getCreatureStorage(cid, playersStorages.lastEliteFourTry)
        return r ~= EMPTY_STORAGE and r or -1
    end

    function setPlayerLastEliteFourTry(cid, value)
        doCreatureSetStorage(cid, playersStorages.lastEliteFourTry, value)
    end
     

    id dos player montado na moto

    outfitMale = 2589, -- Outfit male

     

    itemid="30136"   da chave da moto

    outfitFemale = 2590, -- Outfit female

     

     

    Esse seu sistema de bike usa portrait ... quando vc clica na bike pra andar, a chavinha da bike muda alguma coisa ou algo do tipo assim?

     

    Faltou mandar o action da bike, que você usa pra clicar, na pasta Action deve ter alguma coisa relacionada a bike

     

    Fiz a alteração nos dois scripts, tanto do Player quanto da moto, só que para usar, você precisa me passar antes o action que tá faltando, ai mando todos os 3 de uma vez pra vc e já te explico a alteração que fiz

  10. 15 horas atrás, DanijoBR disse:

    Pode me dar uma ajuda pelo discord amigo? Vai ser mais fácil pra mim entender 

    Danijo#9360 meu discord para vc me ajudar 

     

    Cara, é bom fazer aqui pelo Xtibia mesmo, pq assim, outras pessoas que tiverem com essa dúvida poderão entender melhor.

  11. 21 horas atrás, MordekayRalf disse:

    Entao eu estou mechendo com uma base poketibia, Ate entao começou a dar esse erro ao adc novas fotos de pokemons, Tipo eu cheguei a adc umas 10 fotos no maximo, Ai depois meu object builder parou de carregar ate o fim, E no iten editor nao consego achar a foto que tento adc no obj builder, Alguem Sabe o motivo da uma força ai, Agradeço..

    Demonstraçao na foto abaixo..

    Ele nao termina de compila, Depois que fecho e abro novamente ele ate chega aparecer a foto q adc, So que quando pesquiso no itens editor nao acha oq adc795870313_CapturadeTela(155).thumb.png.9c4d400abec279123505c0414ad9fea4.png.

    AJUDE-ME PLIS

     

    Cara ... uma coisa é vc adicionar no Object builder, outra é vc adicionar no Item editor, pra vc adicionar no item editor vc precisa criar um slot novo e no ID do client vc coloca o mesmo id do object builder pra poder adicionar lá

  12. 29 minutos atrás, rafersiq disse:

     

    ou to com mais um problema no remeres

    os montros e npcs nao quer aparecer quando eu abro o mapa no remeres vc sabe me ajudar nisso

    Sei sim cara, vai em import monster e quando abrir o negócio vc vai em monster e seleciona os xml

    e os npc's tbm, vc seleciona os xml dos npcs e reinicia o remeres pra ver :D 

  • Quem Está Navegando   0 membros estão online

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