Ir para conteúdo
  • 0

Alterar Escolhas de Dailly


IOWeenI

Pergunta

Olá, quero uma ajudinha com uma pequena possibilidade, gostaria de saber se seria possivel trocar o modo de escolha das Dailly
No lugar dele sortear aleatoriamente o player poderá escolher qual Pokemon da Lista ele quer derrotar
 

Spoiler

killModes = {
    storage = 24000,    
    storage2 = 24001,    

    [1] = {
        name = "basic",
        experience = 250000, -- 70000
        items = {    
            {19221, 5},  --- Catcher Token
        },
        pokemons = {"Caterpie", "Weedle", "Magikarp", "Oddish", "Pidgey", "Spearow", "Paras", "Diglett", "Poliwag", "Tentacool", "Bellsprout", "Voltorb", "Horsea", "Goldeen", "Staryu"}, 
    },
    [2] = {
        name = "very easy",
        experience = 250000, -- 70000
        items = {    
            {19221, 5},  --- Catcher Token
        },
        pokemons = {"Bulbasaur", "Charmander", "Squirtle", "Metapod", "Kakuna", "Pidgeotto", "Ekans", "Sandshrew", "Nidorino", "Nidorina", "Clefairy", "Jigglypuff", "Psyduck", "Growlithe", "Poliwhirl", "Geodude", "Koffing", "Ponyta", "Drowzee", "Gastly", "Cubone", "Rhyhorn", "Eevee"}, 
    },
    [3] = {
        name = "easy",
        experience = 250000, -- 70000
        items = {    
            {19221, 10}, --- Catcher Token
            {15645, 20}, -- devoted token
            {2394, 50}, -- poke ball
        },
        pokemons = {"Butterfree", "Beedrill", "Raticate", "Gloom", "Weepinbell", "Arbok", "Pikachu", "Golbat", "Dugtrio", "Electrode", "Seaking", "Ivysaur", "Charmeleon", "Wartortle", "Parasect", "Graveler", "Haunter", "Seadra", "Kadabra", "Machoke", "Slowbro", "Farfetch'd"}, 
    },
    [4] = {
        name = "medium",
        experience = 500000, -- 150000
        items = {
            {19221, 15}, -- catcher token
            {15645, 50}, -- devoted token
            {2393, 100}, -- great ball
        },
        pokemons = {"Fearow", "Vileplume", "Venomoth", "Persian", "Primeape", "Magneton", "Dodrio", "Onix", "Kingler", "Marowak", "Weezing", "Tangela", "Starmie", "Tauros", "Hypno", "Dewgong", "Cloyster", "Sandslash"},
    },
    [5] = {
        name = "hard",
        experience = 1000000, -- 200000
        items = {    
            {19221, 20}, -- catcher token
            {15645, 100}, -- devoted token
            {2392, 100}, -- super ball
        },
        pokemons = {"Nidoking", "Nidoqueen", "Clefable", "Ninetales", "Wigglytuff", "Golduck", "Victreebel", "Golem", "Rapidash", "Pinsir", "Dragonair", "Vaporeon", "Jolteon", "Flareon"},
    },
    [6] = {
        name = "very hard",
        experience = 2000000, -- 280000
        items = {
            {19221, 25}, -- catcher token
            {15645, 150}, -- devoted token
            {15679, 300}, -- ultra ball
        },
        pokemons = {"Venusaur", "Charizard", "Blastoise", "Pidgeot", "Alakazam", "Tentacruel", "Gengar", "Rhydon", "Kangaskhan", "Scyther", "Jynx", "Electabuzz", "Magmar", "Raichu"},
    },
    [7] = {
        name = "expert",
        experience = 2000000, -- 280000
        items = {
            {19221, 30}, -- catcher token
            {15645, 200}, -- devoted token
            {15679, 50}, -- Premier ball
        },
        pokemons = {"Gyarados", "Arcanine", "Muk", "Exeggutor", "Lapras", "Machamp", "Dragonite"},
    },
}

function getKillMode(cid)
    if isPlayer(cid) then
        if not (tostring(getPlayerStorageValue(cid, killModes.storage)) == "-1") then        
            return tonumber(tostring(getPlayerStorageValue(cid, killModes.storage)):explode("|")[1])
        end
    end
    return 1
end

function getKillCount(cid)
    if isPlayer(cid) then
        if not (tostring(getPlayerStorageValue(cid, killModes.storage)) == "-1") then
            return tonumber(getPlayerStorageValue(cid, killModes.storage):explode("|")[5])
        end
    end    
    return tonumber(0)
end    

function setKillCatched(cid, bool)
    local pokecount = tonumber(getPlayerStorageValue(cid, 24003) <= 0 and 0 or getPlayerStorageValue(cid, 24003))
    setPlayerStorageValue(cid, killModes.storage, "|"..getPlayerStorageValue(cid, killModes.storage):explode("|")[1].."|"..getPlayerStorageValue(cid, killModes.storage):explode("|")[2].."|"..getPlayerStorageValue(cid, killModes.storage):explode("|")[3].."|"..tostring(bool).."|"..pokecount)
end

function getPokemonsToKill(cid)
    if isPlayer(cid) then
        if not (tostring(getPlayerStorageValue(cid, killModes.storage)) == "-1") then
            local string = getPlayerStorageValue(cid, killModes.storage):explode("|")[3]
            return string:explode(";")
        end
    end
    return {"none1", "none2"}
end

function hasKilled(cid)
    if isPlayer(cid) then
        if not (tostring(getPlayerStorageValue(cid, killModes.storage)) == "-1") then
            return (getPlayerStorageValue(cid, killModes.storage):explode("|")[4] == "true")
        end
    end    
    return false
end

function getLastDayKill(cid)
    if isPlayer(cid) then
        if not (tostring(getPlayerStorageValue(cid, killModes.storage)) == "-1") then
            return tostring(getPlayerStorageValue(cid, killModes.storage)):explode("|")[2]
        end
    end
    return "08-00-00"
end

function resetDailyKill(cid)
    if isPlayer(cid) then
        
        local pokemons = killModes[(getCatchMode(cid))].pokemons
        local number1 = math.random(1, #pokemons)
        local number2 = number1
        local count = math.random(getPlayerLevel(cid) * 2)
        
        repeat
            number2 = math.random(1, #pokemons)
        until(not (number1 == number2))
        
        repeat
            count2 = math.random(getPlayerLevel(cid) * 2)
        until(not (count == count2))
        
        if getPlayerLevel(cid) >= 5 and getPlayerLevel(cid) < 50 then
            valor = 1
        elseif getPlayerLevel(cid) >= 50 and getPlayerLevel(cid) < 100 then
            valor = 2
        elseif getPlayerLevel(cid) >= 100 and getPlayerLevel(cid) < 150 then
            valor = 3
        elseif getPlayerLevel(cid) >= 150 and getPlayerLevel(cid) < 200 then
            valor = 4
        elseif getPlayerLevel(cid) >= 200 and getPlayerLevel(cid) < 250 then
            valor = 5
        elseif getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) < 300 then
            valor = 6
        elseif getPlayerLevel(cid) >= 300 then  
            valor = 7
        end
        
        local day = tostring(""..getNumberDay().."-"..getNumberMonth().."-"..getNumberYear().."")
        setPlayerStorageValue(cid, killModes.storage, "|"..valor.."|"..day.."|"..pokemons[number1]..";"..pokemons[number2].."|false|"..count2)
        setPlayerStorageValue(cid, killModes.storage2, -1)
        setPlayerStorageValue(cid, 24003, 0)
    end
end

function nextDailyKill(cid)
    if isPlayer(cid) then
        if getCatchMode(cid) == #killModes then
            setKillCatched(cid, false)
            setPlayerStorageValue(cid, killModes.storage2, "finished")
            return false
        end
        
        local pokemons = killModes[(getCatchMode(cid) + 1)].pokemons
        local number1 = math.random(1, #pokemons)
        local number2 = number1
        local count = math.random(getPlayerLevel(cid) * 2)
        
        repeat
            number2 = math.random(1, #pokemons)
        until(not (number1 == number2))
        
        repeat
            count2 = math.random(getPlayerLevel(cid) * 2)
        until(not (count == count2))
        
        local day = tostring(""..getNumberDay().."-"..getNumberMonth().."-"..getNumberYear().."")
        local text = "|"..(getCatchMode(cid) + 1).."|"..day.."|"..pokemons[number1]..";"..pokemons[number2].."|false|"..count2
        

        setKillCatched(cid, false)
        setPlayerStorageValue(cid, killModes.storage, text)
        setPlayerStorageValue(cid, killModes.storage2, -1)
        setPlayerStorageValue(cid, 24003, 0)
    end    
    return true
end

 

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

  • 0

1.Adicione um comando para escolher o Pokémon: Digamos que você adicione !choosepokemon para configurar o Pokémon que o jogador deseja derrotar.

2.Adapte a função resetDailyKill para usar essa escolha:
 

function choosePokemon(cid, pokemonName)
    if isPlayer(cid) then
        local mode = killModes[(getCatchMode(cid))]
        local pokemons = mode.pokemons
        if table.contains(pokemons, pokemonName) then
            local count = math.random(getPlayerLevel(cid) * 2)
            local day = tostring(""..getNumberDay().."-"..getNumberMonth().."-"..getNumberYear().."")
            setPlayerStorageValue(cid, killModes.storage, "|"..getCatchMode(cid).."|"..day.."|"..pokemonName.."|false|"..count)
            setPlayerStorageValue(cid, killModes.storage2, -1)
            setPlayerStorageValue(cid, 24003, 0)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have chosen: " .. pokemonName .. " as your daily kill target.")
        else
            doPlayerSendCancel(cid, "Invalid Pokémon. Choose from the list.")
        end
    end
end


3.Implementar comando para escolha:
 

function onSay(cid, words, param)
    if param == "" then
        doPlayerSendCancel(cid, "Use: !choosepokemon <pokemon_name>")
        return true
    end

    choosePokemon(cid, param:trim())
    return true
end

 

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

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