Adorius Black
Advanced OT User
- Joined
- Mar 31, 2020
- Messages
- 321
- Solutions
- 3
- Reaction score
- 194
Hi. I have on server one NPC that sell items for Premium Points and I am wonder if there is possible to show in npcwindow.lua modal window CURRENCY as "Premium Points" if NPC is called "Premium NPC" if not then leave CURRENCY as its "gold". I found its in otclient/module/npctrade.lua on line 3 defined CURRENCY = 'gold' so I tried change line 533 from this
to something like this:
but its not enough and i dont know anyway how to get NPC name in OTClient. I tried g_game.getNpcName() but not working. Anyone know how can I do it?

LUA:
function formatCurrency(amount)
if CURRENCY_DECIMAL then
return string.format('%.02f', amount / 100.0) .. ' ' .. CURRENCY
else
return amount .. ' ' .. CURRENCY
end
end
to something like this:
LUA:
function formatCurrency(amount)
local npcName = g_game.getNpcName()
if npcName == "Premium NPC" then
if CURRENCY_DECIMAL then
return string.format('%.02f', amount / 100.0) .. ' Premium Points'
else
return amount .. ' Premium Points'
end
else
if CURRENCY_DECIMAL then
return string.format('%.02f', amount / 100.0) .. ' ' .. CURRENCY
else
return amount .. ' ' .. CURRENCY
end
end
end
but its not enough and i dont know anyway how to get NPC name in OTClient. I tried g_game.getNpcName() but not working. Anyone know how can I do it?

Attachments
-
a1.webp25.8 KB · Views: 3 · VirusTotal