Ir para conteúdo

[10.31] Elfo Ferreiro V1.0


Nolis

Posts Recomendados

Versão utilizada: 10.31 (tfs 1.0)

Descrição: Você leva uma determinada espada até o npc, fala com ele, ele vai pegar essa espada e ficar com ela por um certo tempo (3min), claro, você irá pagar uma quantia. Ao retornar, sua espada estará melhorada (no caso dos ids utilizados o npc irá trocar o item). Se houver algum bug, reporte que arrumaremos.

Créditos: Jamison, Daaniel.

Conteúdo Oficial: Outro Fórum

Download do Mapa Utilizado (créditos: Daaniel)

 

---------- • ----------

 

Diálogo:

 

22:21 Daniel [250]: hi
22:21 Blacksmith Elf: Hello Daniel! I'm a Blacksmith Elf, I can transform your item!
22:21 Daniel [250]: transform
22:21 Blacksmith Elf: From time to time fate smiles upon those who take great risks and have strong dreams! If you have money, we can try to transform your umbral swords, axes, clubs, bows, crossbows or spellbooks.
22:21 Daniel [250]: club
22:21 Blacksmith Elf: One handed or two handed?
22:21 Daniel [250]: one handed
22:21 Blacksmith Elf: Do you want to spend your money to transform your crude umbral mace, yes or no?
22:21 Daniel [250]: yes
22:21 Blacksmith Elf: Great! Alright, I need a while to finish this club for you. Come ask me later.
22:22 Daniel [250]: hi
22:22 Blacksmith Elf: Hello Daniel! I'm a Blacksmith Elf, I can transform your item!
22:22 Daniel [250]: transform
22:22 Blacksmith Elf: Have you left anything here to transform ?
22:22 Daniel [250]: yes
22:22 Blacksmith Elf: You must wait until : 22:24:49.
22:25 Daniel [250]: hi
22:25 Blacksmith Elf: Hello Daniel! I'm a Blacksmith Elf, I can transform your item!
22:25 Daniel [250]: transform
22:25 Blacksmith Elf: Have you left anything here to transform ?
22:25 Daniel [250]: yes
22:25 Blacksmith Elf: Here you have it.

 

---------- • ----------

Fotos

 

sSzn8Vk.png

 

205sq8J.png

 

cBk1WSN.png

 

---------- • ----------

Script:

data/npc/Blacksmith Elf.lua

 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Blacksmith Elf" script="blacksmith_elf.lua" walkinterval="4000" floorchange="0">
<health now="100" max="100"/>
<look type="63" head="78" body="88" legs="0" feet="88" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|! I'm a Blacksmith Elf, I can {transform} your item!" />
<parameter key="message_walkaway" value="Come back here and tell me what you want!" />
<parameter key="message_farewell" value="Bye bye!" />
</parameters>
</npc>

 

data/npc/scripts/blacksmith_elf.lua

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}


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


function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end


local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid


local playerCap = getPlayerFreeCap(cid)
local itemweight = getItemWeight(trade_item_ID)


local config = {
----Levels----
level_I = 120,
level_II = 250,
level_III = 500, -- não necessário.
----Swords-IDs----
ID_sword_one_I = 22398, --- "one" significa one handed e "two" two handed.
ID_sword_one_II = 22399,
ID_sword_one_III = 22400,
ID_sword_two_I = 22401,
ID_sword_two_II = 22402,
ID_sword_two_III = 22403,
----Axes-IDs----
ID_axe_one_I = 22404,
ID_axe_one_II = 22405,
ID_axe_one_III = 22406,
ID_axe_two_I = 22407,
ID_axe_two_II = 22408,
ID_axe_two_III = 22409,
----Clubs-IDs----
ID_club_one_I = 22410,
ID_club_one_II = 22411,
ID_club_one_III = 22412,
ID_club_two_I = 22413,
ID_club_two_II = 22414,
ID_club_two_III = 22415,
----Bows-IDs----
ID_bow_I = 22416,
ID_bow_II = 22417,
ID_bow_III = 22418,
----Crossbows-IDs----
ID_crossbow_I = 22419,
ID_crossbow_II = 22420,
ID_crossbow_III = 22421,
----Spellbooks-IDs----
ID_spellbook_I = 22422,
ID_spellbook_II = 22423,
ID_spellbook_III = 22424,
----Storage-Armas----
storage_sword_one = 4051,
storage_sword_one_transforming = 4061,
storage_sword_two = 4251,
storage_sword_two_transforming = 4261,
storage_axe_one = 4052,
storage_axe_one_transforming = 4062,
storage_axe_two = 4252,
storage_axe_two_transforming = 4262,
storage_club_one = 4053,
storage_club_one_transforming = 4063,
storage_club_two = 4253,
storage_club_two_transforming = 4263,
storage_bow = 4054,
storage_bow_transforming = 4064,
storage_crossbow = 4055,
storage_crossbow_transforming = 4065,
storage_spellbook = 4056,
storage_spellbook_transforming = 4066,
----Preços----
price_level_I = 1000000, -- 1KK
price_level_II = 5000000, -- 5KK
price_type, price_type2 = "KK", 10000000, -- Aqui você colocará quando "K" será o preço e mudará a numeração em golds, exemplo : se eu boto "K" eu tenho que por a numeração em "1000"; "KK" em "1000000"...
-- price_level_III = 10000000, -- Não necessário até então.
----Tempo/Storage----
storage_time = 4060,
storage_transform = 4059,
storage_transforms = 4058,
time_I = 1 * 1 * 3 * 60, -- 3 minutos
time_II = 1 * 1 * 6 * 60, -- 6 minutos
----Outros---- 
no_cap = "You have found a reward weighing " .. getItemWeight(new_item_ID) .. " oz. It is too heavy or you have not enough space.",
}


if msgcontains(msg, 'transform') and getPlayerStorageValue(cid, config.storage_transforms) <= 0 then
npcHandler:say('From time to time fate smiles upon those who take great risks and have strong dreams! If you have money, we can try to transform your umbral {swords}, {axes}, {clubs}, {bows}, {crossbows} or {spellbooks}.', cid)
talk_state = 1
elseif msgcontains(msg, 'transform') and getPlayerStorageValue(cid, config.storage_transforms) >= 1  then
npcHandler:say('Have you left anything here to transform ?', cid)
talk_state = 7
elseif msgcontains(msg, 'no') and getPlayerStorageValue(cid, config.storage_time) - os.time() <= 0 and talk_state == 7 then
npcHandler:say('So... How can I help you?', cid)
elseif msgcontains(msg, 'yes') and getPlayerStorageValue(cid, config.storage_time) - os.time() <= 0 and talk_state == 7 then
if getPlayerStorageValue(cid, config.storage_sword_one_transforming) >= 1 then
if getPlayerStorageValue(cid, config.storage_sword_one) == -1 then
new_item_ID = config.ID_sword_one_II
elseif getPlayerStorageValue(cid, config.storage_sword_one) >= 0 then
new_item_ID = config.ID_sword_one_III
end
storage_transform = config.storage_sword_one
storage_transforming = config.storage_sword_one_transforming
elseif getPlayerStorageValue(cid, config.storage_sword_two_transforming) >= 1 then
if getPlayerStorageValue(cid, config.storage_sword_two) == -1 then
new_item_ID = config.ID_sword_two_II
elseif getPlayerStorageValue(cid, config.storage_sword_two) >= 0 then
new_item_ID = config.ID_sword_two_III
end
storage_transform = config.storage_sword_two
storage_transforming = config.storage_sword_two_transforming
elseif getPlayerStorageValue(cid, config.storage_axe_one_transforming) >= 1 then
if getPlayerStorageValue(cid, config.storage_axe_one) == -1 then
new_item_ID = config.ID_axe_one_II
elseif getPlayerStorageValue(cid, config.storage_axe_one) == 0 then
new_item_ID = config.ID_axe_one_III
end
storage_transform = config.storage_axe_one
storage_transforming = config.storage_axe_one_transforming
elseif getPlayerStorageValue(cid, config.storage_axe_two_transforming) >= 1 then
if getPlayerStorageValue(cid, config.storage_axe_two) == -1 then
new_item_ID = config.ID_axe_two_II
elseif getPlayerStorageValue(cid, config.storage_axe_two) == 0 then
new_item_ID = config.ID_axe_two_III
end
storage_transform = config.storage_axe_two
storage_transforming = config.storage_axe_two_transforming
elseif getPlayerStorageValue(cid, config.storage_club_one_transforming) >= 1 then
if getPlayerStorageValue(cid, config.storage_club_one) == -1 then
new_item_ID = config.ID_club_one_II
elseif getPlayerStorageValue(cid, config.storage_club_one) == 0 then
new_item_ID = config.ID_club_one_III
end
storage_transform = config.storage_club_one
storage_transforming = config.storage_club_one_transforming
elseif getPlayerStorageValue(cid, config.storage_club_two_transforming) >= 1 then
if getPlayerStorageValue(cid, config.storage_club_two) == -1 then
new_item_ID = config.ID_club_two_II
elseif getPlayerStorageValue(cid, config.storage_club_two) == 0 then
new_item_ID = config.ID_club_two_III
end
storage_transform = config.storage_club_two
storage_transforming = config.storage_club_two_transforming
elseif getPlayerStorageValue(cid, config.storage_bow_transforming) >= 1 then
if getPlayerStorageValue(cid, config.storage_bow) == -1 then
new_item_ID = config.ID_bow_II
elseif getPlayerStorageValue(cid, config.storage_bow) == 0 then
new_item_ID = config.ID_bow_III
end
storage_transform = config.storage_bow
storage_transforming = config.storage_bow_transforming
elseif getPlayerStorageValue(cid, config.storage_crossbow_transforming) >= 1 then
if getPlayerStorageValue(cid, config.storage_crossbow) == -1 then
new_item_ID = config.ID_crossbow_II
elseif getPlayerStorageValue(cid, config.storage_crossbow) == 0 then
new_item_ID = config.ID_crossbow_III
end
storage_transform = config.storage_crossbow
storage_transforming = config.storage_crossbow_transforming
elseif getPlayerStorageValue(cid, config.storage_spellbook_transforming) >= 1 then
if getPlayerStorageValue(cid, config.storage_spellbook) == -1 then
new_item_ID = config.ID_spellbook_II
elseif getPlayerStorageValue(cid, config.storage_spellbook) == 0 then
new_item_ID = config.ID_spellbook_III
end
storage_transform = config.storage_spellbook
storage_transforming = config.storage_spellbook_transforming
else 
npcHandler:say('Here you have it.', cid)
end
doPlayerAddItem(cid, new_item_ID, 1)
npcHandler:say('Here you have it.', cid)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
setPlayerStorageValue(cid, config.storage_transforms, 0)
setPlayerStorageValue(cid, config.storage_transforming, 0)
if getPlayerStorageValue(cid, storage_transform) == -1 then
setPlayerStorageValue(cid, storage_transform, 1)
else
setPlayerStorageValue(cid, storage_transform, -1)
end
elseif msgcontains(msg, 'yes') and getPlayerStorageValue(cid, config.storage_time) - os.time() > 0 and talk_state == 7 then
npcHandler:say("You must wait until : {" .. os.date("%H:%M:%S", getPlayerStorageValue(cid, config.storage_time)) .. "}.", cid)
end
------------------------------Swords------------------------------
if msgcontains(msg, 'swords') or msgcontains(msg, 'sword') and talk_state == 1 then
npcHandler:say('{One handed} or {two handed}?', cid)
talk_state = 2
elseif msgcontains(msg, 'one handed') and talk_state == 2 then 
talk_state = 3
if getPlayerStorageValue(cid, config.storage_sword_one) <= 0 then
trade_item_ID = config.ID_sword_one_I
price_item_ID = config.price_level_I
level_item = config.level_I
new_item_ID = config.ID_sword_one_II
time_transform = config.time_I
elseif getPlayerStorageValue(cid, config.storage_sword_one) == 1 then
trade_item_ID = config.ID_sword_one_II
price_item_ID = config.price_level_II
level_item = config.level_II
new_item_ID = config.ID_sword_one_III
time_transform = config.time_II
end
storage_transform = config.storage_sword_one
storage_transforming = config.storage_sword_one_transforming
item_type = "sword"
npcHandler:say('Do you want to spend your money to transform your {'.. getItemName(trade_item_ID) ..'}, {yes} or {no}?', cid)
elseif msgcontains(msg, 'two handed') and talk_state == 2 then 
talk_state = 3
if getPlayerStorageValue(cid, config.storage_sword_two) <= 0 then
trade_item_ID = config.ID_sword_two_I
price_item_ID = config.price_level_I
level_item = config.level_I
new_item_ID = config.ID_sword_two_II
time_transform = config.time_I
elseif getPlayerStorageValue(cid, config.storage_sword_two) == 1 then
trade_item_ID = config.ID_sword_two_II
price_item_ID = config.price_level_II
level_item = config.level_II
new_item_ID = config.ID_sword_two_III
time_transform = config.time_II
end
storage_transform = config.storage_sword_two
storage_transforming = config.storage_sword_two_transforming
item_type = "sword"
npcHandler:say('Do you want to spend your money to transform your {'.. getItemName(trade_item_ID) ..'}, {yes} or {no}?', cid)
-------------------------------Axes--------------------------------
elseif msgcontains(msg, 'axe') or msgcontains(msg, 'axes') and talk_state == 1 then
npcHandler:say('{One handed} or {two handed}?', cid)
talk_state = 4
elseif msgcontains(msg, 'one handed') and talk_state == 4 then 
talk_state = 3
if getPlayerStorageValue(cid, config.storage_axe_one) <= 0 then
trade_item_ID = config.ID_axe_one_I
price_item_ID = config.price_level_I
level_item = config.level_I
new_item_ID = config.ID_axe_one_II
time_transform = config.time_I
elseif getPlayerStorageValue(cid, config.storage_axe_one) == 1 then
trade_item_ID = config.ID_axe_one_II
price_item_ID = config.price_level_II
level_item = config.level_II
new_item_ID = config.ID_axe_one_III
time_transform = config.time_II
end
storage_transform = config.storage_axe_one
storage_transforming = config.storage_axe_one_transforming
item_type = "axe"
npcHandler:say('Do you want to spend your money to transform your {'.. getItemName(trade_item_ID) ..'}, {yes} or {no}?', cid)
elseif msgcontains(msg, 'two handed') and talk_state == 4 then 
talk_state = 3
if getPlayerStorageValue(cid, config.storage_axe_two) <= 0 then
trade_item_ID = config.ID_axe_two_I
price_item_ID = config.price_level_I
level_item = config.level_I
new_item_ID = config.ID_axe_two_II
time_transform = config.time_I
elseif getPlayerStorageValue(cid, config.storage_axe_two) == 1 then
trade_item_ID = config.ID_axe_two_II
price_item_ID = config.price_level_II
level_item = config.level_II
new_item_ID = config.ID_axe_two_III
time_transform = config.time_II
end
storage_transform = config.storage_axe_two
storage_transforming = config.storage_axe_two_transforming
item_type = "axe"
npcHandler:say('Do you want to spend your money to transform your {'.. getItemName(trade_item_ID) ..'}, {yes} or {no}?', cid)
-------------------------------Clubs--------------------------------
elseif msgcontains(msg, 'club') or msgcontains(msg, 'clubs') and talk_state == 1 then
npcHandler:say('{One handed} or {two handed}?', cid)
talk_state = 5
elseif msgcontains(msg, 'one handed') and talk_state == 5 then 
talk_state = 3
if getPlayerStorageValue(cid, config.storage_club_one) <= 0 then
trade_item_ID = config.ID_club_one_I
price_item_ID = config.price_level_I
level_item = config.level_I
new_item_ID = config.ID_club_one_II
time_transform = config.time_I
elseif getPlayerStorageValue(cid, config.storage_club_one) == 1 then
trade_item_ID = config.ID_club_one_II
price_item_ID = config.price_level_II
level_item = config.level_II
new_item_ID = config.ID_club_one_III
time_transform = config.time_II
end
storage_transform = config.storage_club_one
storage_transforming = config.storage_club_one_transforming
item_type = "club"
npcHandler:say('Do you want to spend your money to transform your {'.. getItemName(trade_item_ID) ..'}, {yes} or {no}?', cid)
elseif msgcontains(msg, 'two handed') and talk_state == 5 then 
talk_state = 3
if getPlayerStorageValue(cid, config.storage_club_two) <= 0 then
trade_item_ID = config.ID_club_two_I
price_item_ID = config.price_level_I
level_item = config.level_I
new_item_ID = config.ID_club_two_II
time_transform = config.time_I
elseif getPlayerStorageValue(cid, config.storage_club_two) == 1 then
trade_item_ID = config.ID_club_two_II
price_item_ID = config.price_level_II
level_item = config.level_II
new_item_ID = config.ID_club_two_III
time_transform = config.time_II
end
storage_transform = config.storage_club_two
storage_transforming = config.storage_club_two_transforming
item_type = "club"
npcHandler:say('Do you want to spend your money to transform your {'.. getItemName(trade_item_ID) ..'}, {yes} or {no}?', cid)
-------------------------------Bows--------------------------------
elseif msgcontains(msg, 'bow') or msgcontains(msg, 'bows') and talk_state == 1 then
talk_state = 3
if getPlayerStorageValue(cid, config.storage_bow) <= 0 then
trade_item_ID = config.ID_bow_I
price_item_ID = config.price_level_I
level_item = config.level_I
new_item_ID = config.ID_bow_II
time_transform = config.time_I
elseif getPlayerStorageValue(cid, config.storage_bow) == 1 then
trade_item_ID = config.ID_bow_II
price_item_ID = config.price_level_II
level_item = config.level_II
new_item_ID = config.ID_bow_III
time_transform = config.time_II
end
storage_transform = config.storage_bow
storage_transforming = config.storage_bow_transforming
item_type = "bow"
npcHandler:say('Do you want to spend your money to transform your {'.. getItemName(trade_item_ID) ..'}, {yes} or {no}?', cid)
-------------------------------Crossbows--------------------------------
elseif msgcontains(msg, 'crossbow') or msgcontains(msg, 'crossbows') and talk_state == 1 then
talk_state = 3
if getPlayerStorageValue(cid, config.storage_crossbow) <= 0 then
trade_item_ID = config.ID_crossbow_I
price_item_ID = config.price_level_I
level_item = config.level_I
new_item_ID = config.ID_crossbow_II
time_transform = config.time_I
elseif getPlayerStorageValue(cid, config.storage_crossbow) == 1 then
trade_item_ID = config.ID_crossbow_II
price_item_ID = config.price_level_II
level_item = config.level_II
new_item_ID = config.ID_crossbow_III
time_transform = config.time_II
end
storage_transform = config.storage_crossbow
storage_transforming = config.storage_crossbow_transforming
item_type = "crossbow"
npcHandler:say('Do you want to spend your money to transform your {'.. getItemName(trade_item_ID) ..'}, {yes} or {no}?', cid)
-------------------------------Spellbook--------------------------------
elseif msgcontains(msg, 'spellbook') or msgcontains(msg, 'spellbooks') and talk_state == 1 then
talk_state = 3
if getPlayerStorageValue(cid, config.storage_spellbook) <= 0 then
trade_item_ID = config.ID_spellbook_I
price_item_ID = config.price_level_I
level_item = config.level_I
new_item_ID = config.ID_spellbook_II
time_transform = config.time_I
elseif getPlayerStorageValue(cid, config.storage_spellbook) == 1 then
trade_item_ID = config.ID_spellbook_II
price_item_ID = config.price_level_II
level_item = config.level_II
new_item_ID = config.ID_spellbook_III
time_transform = config.time_II
end
storage_transform = config.storage_spellbook
storage_transforming = config.storage_spellbook_transforming
item_type = "spellbook"
npcHandler:say('Do you want to spend your money to transform your {'.. getItemName(trade_item_ID) ..'}, {yes} or {no}?', cid)
end




if msgcontains(msg, 'yes') and talk_state == 3 then
if getPlayerItemCount(cid, trade_item_ID) >= 1 then
if getPlayerLevel(cid) >= level_item then
if playerCap >= itemweight then
if doPlayerRemoveMoney(cid, price_item_ID) == TRUE then
doPlayerRemoveItem(cid, trade_item_ID, 1)
time = os.time() + time_transform
setPlayerStorageValue(cid, config.storage_time, time)
setPlayerStorageValue(cid, config.storage_transforming, 1)
setPlayerStorageValue(cid, config.storage_transforms, 1)
npcHandler:say('Great! Alright, I need a while to finish this {'..item_type..'} for you. Come ask me later.', cid)
else
npcHandler:say('You don\'t have enough money ({'.. (price_item_ID/1000000) ..'KK}).', cid)
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.no_cap)
npcHandler:say('You don\'t have enough capacity.', cid)
end
else
npcHandler:say('You don\'t have enough level ({'.. level_item ..'}).', cid)
end
else
npcHandler:say('You don\'t have the necessary item ({'.. getItemName(trade_item_ID) ..'}).', cid)
talk_state = 1
end
elseif msgcontains(msg, 'no') and (talk_state == 2 or talk_state == 3 or talk_state == 4 or talk_state == 5 or talk_state == 6 or talk_state == 7) then
npcHandler:say('So... bye!', cid)
end
return true
end


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

 

Editado por Daaniel
Link para o comentário
Compartilhar em outros sites

É um bom jeito de fazer os umbral itens, só acho que um dawarf iria combinar mais, entretanto isso é questão de opinião.

Acho que ficaria massa também o sistema desses umbral itens por action, você pegava por exemplo o crude umbral blade, usava o cluster of solace e, boom, teria a umbral blade.

Link para o comentário
Compartilhar em outros sites

Muito bom o Npc,

Mim Corrija se estiver errado, esse Npc funciona mais ou menos como o do Global que troca um item Crude+Cruster of Solace por Outro item Crude com mais status.

Editado por Shoguns
Link para o comentário
Compartilhar em outros sites

Mais ou menos, é que eu me baseei nos elfos do J.R.R Tolkien, que são mais detalhados e reais, sem falar que são ótimos em fazer armas, já os anões em cavações de ouro e pedras preciosas.

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...