Ir para conteúdo

Featured Replies

Postado
  • Este é um post popular.

Hail, Durin! Fiz esse sisteminha simples baseado na ideia do @Chriistian . Pode ter utilidade para servidores que queiram implementar o RPG, utilizando em quests dando dicas. Testado em TFS 0.4.

 

Funcionamento: Ao usar uma estante de livros, o player ganha um livro.

 

VetqK7p.png

 

Comando !book : Mostra todos os livros que o player conseguiu.

KYmmU9J.png

 

Ao usar outras estantes: 

 

4USABE4.png

 

Comando !book Título_do_livro: Mostra o livro para o player.

 

0Y8mYcA.png

 

[MOD]

 

Spoiler

<?xml version="1.0" encoding="UTF-8"?>
<mod name="Book System" version="1.0" author="Dwarfer" contact="tibiaking.com" enabled="yes">
<config name="Book_func"><![CDATA[
books = {
[1] = {aid = 17710, title = "Criar cerveja", icon = 4839},
[2] = {aid = 17711, title = "Extended Vision", icon = 5898},
[3] = {aid = 17712, title = "Miners Journal", icon = 4874},
[4] = {aid = 17713, title = "Dwarfer, the legend", icon = 2322}
}

stories = {
[1] = {"Nenhum anão pode resistir a uma boa caneca de cerveja de Jimbin e essa magia um dia permitirá a você criar tal cerveja com alguns",
    " ingredientes simples. Colete o cabelo de um troll, um cogumelo de qualquer tipo, um pequeno amontoado de alma do vale do mago louco um pouco",
    " de água dos arredores do vale do mago louco e o silêncio antes do amanhecer. Coloque todos os ingredientes em um frasco de água do vale do mago",
    " louco, tampe-o com uma rolha e ferva-o. Remova a rolha e ponha uma pequena amostra da poção em uma caneca e chacoalhe-a. Agora nós temos que",
    " descobrir como introduzir o silêncio antes do amanhecer de uma maneira apropriada. Você deve então ter uma caneca cheia de cerveja se tudo", 
    " funcionar conforme calculado até aqui. Nós estimamos que uma poção deve ser uma semana de abastecimento de cerveja se você minimizar seu consumo", 
    " para 7 canecas por dia."
},
        
[2] = {"Most dwarves have a excellent eyesight even in dark enviroments but this spell will one day allow you to see nearly twice as far",
    " as you currently do. What's needed is the fire of a fire element, the head of a ghoul,the essence of a red royal blossom, some",
    " water from Blood Bay and the laugh of a mute sinner. Light a fire with the flame of the fire element. Pour the water from Blood",
    " Bay into a cauldron and place it over the fire. Throw in the head of the ghoul and the essence of the red royal Blossom and mix",
    " it untill a grey myst emerges.Take some of the potion and mix it with the laugh while cooling it. Now we only need to find out the",
    " missing catalysts and the magic words to imbue it with energy."
},
        
[3] = {"We've dug that deep, that even we dwarves can hardly see. Fruzek told us stories of a monster making odd sounds from below the earth.",
    " These frightening tales of the basilisk have halted our mining schedule, forcing us to double the guards protecting the miners."
},
        
[4] = {"Everybody knows the legend. The most powerful dwarf ever. His name? HOW COME DON'T YOU KNOW HIS NAME? (Orcs...) DWARFER, sure! Long live Dwarfer!"}
}

function setPlayerStorageTable(cid, storage, tab)
    local tabstr = "&"
    for i,x in pairs(tab) do
        tabstr = tabstr .. i .. "," .. x .. ";"
    end
    setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))
end

function isInTable(cid, bookId)
    for _,i in pairs(getPlayerStorageTable(cid, 17709))do
        if tonumber(i) == tonumber(bookId) then
            return true
        end
    end
    return false
end

function addBookTable(cid, bookId)
    local x = {}
    for i = 1,#getPlayerStorageTable(cid, 17709) do
        table.insert(x,getPlayerStorageTable(cid, 17709)[i])
    end
    if x ~= 0 then
        table.insert(x,tonumber(bookId))
        setPlayerStorageTable(cid, 17709, x)
    else
        setPlayerStorageTable(cid, 17709, {bookId})
    end
end

function getPlayerStorageTable(cid, storage)
    local tabstr = getPlayerStorageValue(cid, storage)
    local tab = {}
    if type(tabstr) ~= "string" then
        return {}
    end
    if tabstr:sub(1,1) ~= "&" then
        return {}
    end
    local tabstr = tabstr:sub(2, #tabstr)
    local a = string.explode(tabstr, ";")
    for i,x in pairs(a) do
    local b = string.explode(x, ",")
    tab[tonumber(b[1]) or b[1]] = tonumber(b[2]) or b[2]
    end
    return tab
end

function ShowLibrary(cid)
    local str,n = "-- [My Library] --\n\n",0
    for i = 1,#getPlayerStorageTable(cid, 17709) do
        n = n + 1
        str = str..""..n.." - "..(getBookInfo(getPlayerStorageTable(cid, 17709)[i]).title).."\n" 
    end
    return doPlayerPopupFYI(cid, str)
end

function getBookInfo(param)
for i, v in pairs(books) do
    if tonumber(param) == v.aid then
        return {id = i, aid = param, title = v.title, icon = v.icon}
    elseif tostring(param) == v.title then     
        return {id = i, aid = v.aid, title = tostring(param), icon = v.icon}
    end
end
return {}
end

function hasAid(item)
for _, v in pairs(books) do
    if item.actionid == v.aid then
        return true
    end
end
return false
end]]></config>

<action itemid="1718;1721" event="script"><![CDATA[
domodlib('Book_func')
if isInTable(cid, item.actionid) then
    return doPlayerSendCancel(cid, "You have already know this book.")
end
if hasAid(item) then
addBookTable(cid, item.actionid) 
doSendMagicEffect(fromPosition, 30)
doCreatureSay(cid, "You have found a mysterious book.", TALKTYPE_ORANGE_1)
end
]]></action>
<talkaction words="!book;/book" event="buffer"><![CDATA[
domodlib('Book_func')
local t = string.explode(string.lower(param), ",")
    if not t[1] then
        ShowLibrary(cid) return true
    elseif tonumber(t[1]) then
        doPlayerSendCancel(cid, "Enter !book Title to read.") return true
    elseif tostring(t[1]) then
        local b = getBookInfo(param)
        if not isInTable(cid, b.aid) then
            doPlayerSendCancel(cid, "There isn't this book in your personal library.") return true
        end
        doShowTextDialog(cid, b.icon, table.concat(stories[b.id])) return true
    end
]]></talkaction>
</mod>

 

 

 

Configuração:

{aid = 17710, title = "Criar cerveja", icon = 4839} --> ActionID da estante, título do livro, ícone que aparecerá no livro

 

stories = {
[1] = {"Escreva a história do book[1] aqui. Separe por vírgulas para facilitar a escrita no script.",

         " Pode ser que o texto seja muito grande, então isso ajudará na visualização."},

 

Coloquei para as estantes de id 1718 e 1721, caso queira colocar outras, adicione na linha:

<action itemid="1718;1721" event="script">

 

That's all folks! B-)

Contato:

 

  • Respostas 6
  • Visualizações 2.6k
  • Created
  • Última resposta

Top Posters In This Topic

Postado

Parabéns, seu tópico de conteúdo foi aprovado!
Muito obrigado pela sua contribuição, nós do Tibia King agradecemos.
Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP.

Spoiler

Congratulations, your content has been approved!
Thank you for your contribution, we of Tibia King we are grateful.
Your content will help many other users, you received +1 REP.

 

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo