Boa Tarde @davidguimaraesdrum , acredito que dê pra fazer sem alterar nada na source, testa ai, mas antes , faça um BACKUP de todos os arquivos que você irá alterar.
No meu otserv eu possuo uma moda que equivale a 1kk (gold nugget), você precisará fazer alguns passos para que o npc aceite ela como novo gold, vamo lá:
OBS: Se você já fez algum desses processos, pode pular, acredito que pra vc só falta adicionar a tag do 4º passo, mas vou deixar completo caso alguém tenha duvida ou até você mesmo.
1º procure pelo arquivo chamado changegold.lua (provavelmente estará em /data/action/scripts/other), faça um backup desse arquivo, apague tudo de dentro dele e adicione:
local coins = {
[ITEM_GOLD_COIN] = {
to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
},
[ITEM_PLATINUM_COIN] = {
from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
},
[ITEM_CRYSTAL_COIN] = {
from = ITEM_PLATINUM_COIN, to = 2157, effect = TEXTCOLOR_LIGHTBLUE
},
[9971] = {
from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_TEAL
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) then
return false
end
local coin = coins[item.itemid]
if(not coin) then
return false
end
if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, coin.to, 1)
doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
elseif(coin.from ~= nil) then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
end
return true
end
2º vá em /data/action/scripts e crie um arquivo chamado novamoeda.lua e cole isso:
function onUse(cid, item, frompos, item2, topos)
if doRemoveItem(item.uid,1) then
doPlayerSendTextMessage(cid,22,"Voce trocou 1 gold ingot por 1kk.")
doPlayerAddItem(cid,2160,100)
end
end
3º adicione essa tag em data/action.xml
<action itemid="9971" script="novamoeda.lua" />
4º vá em items.xml, procure pelo id 9971 e adicione esta tag:
<attribute key="worth" value="1000000" />
ficará assim:
</item>
<item id="9971" article="a" name="gold ingot">
<attribute key="weight" value="10"/>
<attribute key="worth" value="1000000" />
creio que após isso, qualquer npc reconhecerá ela como uma moeda equivalente a 1kk, essa ultima função em item.xml é que indica o valor.
Se ajudei, REP+ haha