Ir para conteúdo

Featured Replies

Postado

Este NPC tem o intuito de ser parecido com o do Tibia Global. Você poderá comprar ou vender os mesmos itens, poderá fazer a troca de vials por lottery tickets e pegar o primeiro addon do summoner outfit com um winning lottery ticket.

 

O script para tentar receber um winning lottery ticket está incluso, junto com Ultimate Mana Potion, Ultimate Spirit Potion e Supreme Health Potion (caso seu servidor não possua). 

 

Itens

 

Spoiler

Vende

  • Blood - 15 gps
  • Great Health Potion - 190 gp 
  • Great Mana Potion - 120 gp
  • Great Spirit Potion - 190 gp
  • Health Potion - 45 gp
  • Mana Potion - 50 gp
  • Oil - 20 gp
  • Slime (Liquid) - 12 gp 
  • Strong Health Potion - 100 gp
  • Strong Mana Potion - 80 gp
  • Ultimate Health Potion - 310 gp
  • Urine - 10 gp
  • Water (Liquid) - 8 gp
  • Supreme Health Potion - 500 gp 
  • Ultimate Mana Potion - 350 gp
  • Ultimate Spirit Potion - 350 gp

Compra:

  • Empty Potion Flask (Large) - 5 gp
  • Empty Potion Flask (Medium) - 5 gp
  • Empty Potion Flask (Small) - 5 gp
  • Vial - 5 gps

 

Demonstração

 

Spoiler

GIF.thumb.gif.0fd925971ea47843b63ee16e6304603d.gif

 

Instalação do NPC:

 

data/npc/Sandra.xml

 

Spoiler

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Sandra" script="sandra.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100" />
    <look type="140" head="115" body="95" legs="127" feet="76" addons="1"/>
    <parameters>
        <parameter key="module_shop" value="1" />
        <parameter key="shop_buyable" value="vial of blood,2006,15,2;great health potion,7591,190;great mana potion,7590,120;great spirit potion,8472,190;health potion,7618,45;mana potion,7620,50;vial of oil,2006,20,11;;vial of slime,2006,12,4;strong health potion,7588,100;strong mana potion,7589,80;ultimate health potion,8473,310;vial of urine,2006,10,13;vial of water,2006,8,1;supreme health potion,26031,500;ultimate mana potion,26029,350;supreme spirit potion,26030,350" />
        <parameter key="shop_sellable" value="empty potion flask (large),7635,5;empty potion flask (medium),7634,5;empty potion flask (small),7636,5;vial,2006,5;" />
    </parameters>
</npc>

 

 

data/npc/scripts/sandra.lua

 

Spoiler

local storage = 90128
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid)                end
function onCreatureDisappear(cid)            npcHandler:onCreatureDisappear(cid)                end
function onCreatureSay(cid, type, msg)        npcHandler:onCreatureSay(cid, type, msg)        end

local voices = {
    'Great spirit potions as well as health and mana potions in different sizes!',
    'If you need alchemical fluids like slime and blood, get them here.'
}

local lastSound = 0
function onThink()
    if lastSound < os.time() then
        lastSound = (os.time() + 10)
        if math.random(100) < 20 then
            Npc():say(voices[math.random(#voices)], TALKTYPE_SAY)
        end
    end
    npcHandler:onThink()
end

local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    local player = Player(cid)
    if player:getStorageValue(storage) >= 1 and msgcontains(msg, "bonus") then
        npcHandler:say(" Would you like to leave our bonus system?", cid)
        npcHandler.topic[cid] = 5
    elseif isInArray({"vial", "ticket", "bonus", "deposit"}, msg) then
        if player:getStorageValue(storage) < 1 then
            npcHandler:say("We have a special offer right now for depositing vials. Are you interested in hearing it?", cid)
            npcHandler.topic[cid] = 1
        elseif player:getStorageValue(storage) >= 1 then
            npcHandler:say("Would you like to get a lottery ticket instead of the deposit for your vials?", cid)
            npcHandler.topic[cid] = 3
        end
    elseif msgcontains(msg, "prize") then
        npcHandler:say("Are you here to claim a prize?", cid)
        npcHandler.topic[cid] = 4
    elseif msgcontains(msg, "no") then
        if npcHandler.topic[cid] == 3 then
            npcHandler.topic[cid] = 0
        end
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say({
                "The Edron academy has introduced a bonus system. Each time you deposit 100 vials without claiming the money for it, you will receive a lottery ticket. ...",
                "Some of these lottery tickets will grant you a special potion belt accessory, if you bring the ticket to me. ...",
                "If you join the bonus system now, I will ask you each time you are bringing back 100 or more vials to me whether you claim your deposit or rather want a lottery ticket. ...",
                "Of course, you can leave or join the bonus system at any time by just asking me for the 'bonus'. ...",
                "Would you like to join the bonus system now?"
            }, cid)
            npcHandler.topic[cid] = 2
        elseif npcHandler.topic[cid] == 2 then
            npcHandler:say("Great! I've signed you up for our bonus system. From now on, you will have the chance to win the potion belt addon!", cid)
            player:setStorageValue(storage, 1)
            npcHandler.topic[cid] = 0
        elseif npcHandler.topic[cid] == 3 then
            if player:removeItem(7634, 100) or player:removeItem(7635, 100) or player:removeItem(7636, 100) then
                npcHandler:say("Alright, thank you very much! Here is your lottery ticket, good luck. Would you like to deposit more vials that way?", cid)
                player:addItem(5957, 1)
            else
                npcHandler:say("Sorry I need 100 empty vials from you for a lottery ticket.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 4 then
            if not canPlayerWearOutfit(cid, (getPlayerSex(cid) == 0 and 138 or 133), 1) then
                if player:getStorageValue(storage) == 1 and player:removeItem(5958, 1) then
                    npcHandler:say("Congratulations! Here, from now on you can wear our lovely potion belt as accessory.", cid)
                    player:addOutfitAddon(138, 1)
                    player:addOutfitAddon(133, 1)
                    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
                else
                    npcHandler:say("You don't have any prize to claim!", cid)
                end
            else
                npcHandler:say("Oh, but you have already won a prize and may wear our exclusive potion belt. Maybe you can give the winning lottery ticket to someone else?", cid)
            end
            npcHandler.topic[cid] = 0
        elseif npcHandler.topic[cid] == 5 then
            npcHandler:say("Alright. I removed your name from our list. If you want to join again and get the chance to win a potion belt addon, just ask me forthe 'bonus'.", cid)
            player:setStorageValue(storage, -1)
            npcHandler.topic[cid] = 0
        end
        return true
    end
end

npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|, welcome to the fluid and potion shop of Edron.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye, |PLAYERNAME|, please come back soon.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye, |PLAYERNAME|, please come back soon.")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Of course, just browse through my wares. By the way, if you'd like to join our bonus system for depositing flasks and vial, you have to tell me about that {deposit}.")

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

Instalando o Lottery Ticket:

 

data/actions/actions.xml

 

Spoiler

<action itemid="5957" script="other/lotteryticket.lua" />

 

 

data/actions/scripts/other/lotteryticket.lua

 

Spoiler

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if math.random(1, 100) >= 95 then
        player:addItem(5958, 1, true)
        item:getPosition():sendMagicEffect(CONST_ME_SOUND_YELLOW)
    else
        player:say('Sorry, but you drew a blank.', TALKTYPE_MONSTER_SAY)
        item:getPosition():sendMagicEffect(CONST_ME_POFF)
    end

    item:remove(1)
    return true
end

 

 

Instalando as Potions:

 

data/items/items.xml

 

Spoiler

<item id="26029" article="a" name="ultimate mana potion">
    <attribute key="weight" value="310" />
    <attribute key="description" value="This potion can only be consumed by sorcerer and druid of level 130 or higher." />
</item>
<item id="26030" article="a" name="ultimate spirit potion">
    <attribute key="weight" value="310" />
    <attribute key="description" value="This potion can only be consumed by paladin of level 130 or higher." />
</item>
<item id="26031" article="a" name="supreme health potion">
    <attribute key="weight" value="310" />
    <attribute key="description" value="This potion can only be consumed by knight of level 200 or higher." />
</item>

 

 

Qualquer problema, sugestão, bug ou dúvida utilize este tópico!!!

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 520.1k

Informação Importante

Confirmação de Termo