• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    [Pedido] NPC OVERCHARGER

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1default [Pedido] NPC OVERCHARGER el Sáb Dic 31, 2016 9:58 pm

    Andrés Montero

    avatar
    Nuevo Miembro
    Nuevo Miembro
    Buenas, necesito urgentemente un script en el que un npc recargue tu arma overcharged al acabarse, he probado de substituir las soft boots por armas y solo funciona una de toda la lista que he puesto, si me pudiéseis ayudar os lo agradecería, lo que he probado es esto, si este sirve y hay un problema me lo podríais solucionar?

    Código:
     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
    function onThink()            npcHandler:onThink()               end

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"mace of carving"}, msg) then
          npcHandler:say("Do you want to repair your mace of carving for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25975) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25975, 1)
          player:addItem(25978, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end


    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"wand of carving"}, msg) then
          npcHandler:say("Do you want to repair your wand of carving for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25991) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25991, 1)
          player:addItem(25994, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end


    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"slayer of carving"}, msg) then
          npcHandler:say("Do you want to repair your slayer of carving for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25963) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25963, 1)
          player:addItem(25966, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"axe of carving"}, msg) then
          npcHandler:say("Do you want to repair your axe of carving for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25991) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25967, 1)
          player:addItem(25970, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"bow of carving"}, msg) then
          npcHandler:say("Do you want to repair your bow of carving for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25983) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25983, 1)
          player:addItem(25986, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"chopper of carving"}, msg) then
          npcHandler:say("Do you want to repair your chopper of carving for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25971) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25971, 1)
          player:addItem(25974, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"crossbow of carving"}, msg) then
          npcHandler:say("Do you want to repair your crossbow of carving for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25987) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25987, 1)
          player:addItem(25990, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"hammer of carving"}, msg) then
          npcHandler:say("Do you want to repair your hammer of carving for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25979) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25979, 1)
          player:addItem(25982, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"rod of carving"}, msg) then
          npcHandler:say("Do you want to repair your rod of carving for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25995) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25995, 1)
          player:addItem(25998, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"wand of mayhem"}, msg) then
          npcHandler:say("Do you want to repair your wand of mayhem for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25887) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25887, 1)
          player:addItem(25917, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"slayer of mayhem"}, msg) then
          npcHandler:say("Do you want to repair your slayer of mayhem for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25880) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25880, 1)
          player:addItem(25910, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"slayer of mayhem"}, msg) then
          npcHandler:say("Do you want to repair your slayer of mayhem for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25881) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25881, 1)
          player:addItem(25911, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"bow of mayhem"}, msg) then
          npcHandler:say("Do you want to repair your bow of mayhem for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25885) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25885, 1)
          player:addItem(25915, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"chopper of mayhem"}, msg) then
          npcHandler:say("Do you want to repair your chopper of mayhem for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25882) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25882, 1)
          player:addItem(25912, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"crossbow of mayhem"}, msg) then
          npcHandler:say("Do you want to repair your crossbow of mayhem for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25886) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25886, 1)
          player:addItem(25916, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"hammer of mayhem"}, msg) then
          npcHandler:say("Do you want to repair your hammer of mayhem for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25884) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25884, 1)
          player:addItem(25914, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"mace of mayhem"}, msg) then
          npcHandler:say("Do you want to repair your mace of mayhem for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25883) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25883, 1)
          player:addItem(25913, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"rod of mayhem"}, msg) then
          npcHandler:say("Do you want to repair your rod of mayhem for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25888) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25888, 1)
          player:addItem(25918, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"wand of remedy"}, msg) then
          npcHandler:say("Do you want to repair your wand of remedy for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25951) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25951, 1)
          player:addItem(25954, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"slayer of remedy"}, msg) then
          npcHandler:say("Do you want to repair your slayer of remedy for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25923) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25923, 1)
          player:addItem(25926, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"axe of remedy"}, msg) then
          npcHandler:say("Do you want to repair your axe of remedy for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25927) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25927, 1)
          player:addItem(25930, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"bow of remedy"}, msg) then
          npcHandler:say("Do you want to repair your bow of remedy for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25943) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25943, 1)
          player:addItem(25946, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"chopper of remedy"}, msg) then
          npcHandler:say("Do you want to repair your chopper of remedy for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25931) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25931, 1)
          player:addItem(25934, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"crossbow of remedy"}, msg) then
          npcHandler:say("Do you want to repair your crossbow of remedy for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25947) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25947, 1)
          player:addItem(25950, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"hammer of remedy"}, msg) then
          npcHandler:say("Do you want to repair your hammer of remedy for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25939) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25939, 1)
          player:addItem(25942, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"mace of remedy"}, msg) then
          npcHandler:say("Do you want to repair your mace of remedy for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25935) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25935, 1)
          player:addItem(25938, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    local function creatureSayCallback(cid, type, msg)
       if not npcHandler:isFocused(cid) then
          return false
       end
       local player = Player(cid)
       if isInArray({"rod of remedy"}, msg) then
          npcHandler:say("Do you want to repair your rod of remedy for 1000000 gold coins?", cid)
          npcHandler.topic[cid] = 1
       elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          if player:getItemCount(25955) == 0 then
             npcHandler:say("Sorry, you don't have the item.", cid)
             return true
          end

          if not player:removeMoney(1000000) then
             npcHandler:say("Sorry, you don't have enough gold.", cid)
             return true
          end

          player:removeItem(25955, 1)
          player:addItem(25958, 1)
          npcHandler:say("Here you are.", cid)
       elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
          npcHandler.topic[cid] = 0
          npcHandler:say("Ok then.", cid)
          
       
       end
       
       return true
    end

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

    Ver perfil de usuario

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).