Skip to content

Commit

Permalink
Adjusted prices and npc jeronimo. (offers will only be shown in game …
Browse files Browse the repository at this point in the history
…store, but isn't purchasable, ONLY IN NPC)
  • Loading branch information
elsongabriel committed Nov 28, 2023
1 parent 3b946c7 commit 35bebfd
Show file tree
Hide file tree
Showing 3 changed files with 462 additions and 245 deletions.
246 changes: 129 additions & 117 deletions data-otservbr-global/npc/jeronimo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ npcConfig.voices = {
interval = 15000,
chance = 50,
{ text = "Change your " .. tournamentCoinName .. " for Items here!" },
{ text = "Visit our Game Store -> Tournament Shopp to check the offers" },
{ text = "Visit our Game Store -> Tournament Shop to check the offers" },
}

local keywordHandler = KeywordHandler:new()
Expand Down Expand Up @@ -59,58 +59,84 @@ npcType.onCloseChannel = function(npc, creature)
npcHandler:onCloseChannel(npc, creature)
end

-- ID, Count, Price, Wrappable, Charges
local eventShopItems = {
["exercise sword"] = { 28552, 1, 25, false, 500 },
["exercise axe"] = { 28553, 1, 25, false, 500 },
["exercise club"] = { 28554, 1, 25, false, 500 },
["exercise bow"] = { 28555, 1, 25, false, 500 },
["exercise rod"] = { 28556, 1, 25, false, 500 },
["exercise wand"] = { 28557, 1, 25, false, 500 },

["baby brain squid"] = { 32909, 1, 800, true },
["baby vulcongra"] = { 32908, 1, 800, true },
["cerberus champion puppy"] = { 31464, 1, 800, true },
["guzzlemaw grub"] = { 32907, 1, 800, true },
["jousting eagle baby"] = { 31462, 1, 800, true },
["demon doll"] = { 32918, 1, 400, true },
["ogre rowdy doll"] = { 32944, 1, 400, true },
["retching horror doll"] = { 32945, 1, 400, true },
["vexclaw doll"] = { 32943, 1, 400, true },

["gilded blessed shield"] = { 37165, 1, 1500, true },
["gilded crown"] = { 34332, 1, 1500, true },
["gilded horned helmet"] = { 38640, 1, 1500, true },
["gilded magic longsword"] = { 36995, 1, 1500, true },
["gilded warlord sword"] = { 39767, 1, 1500, true },

["sublime tournament accolade"] = { 31472, 1, 500, true },
["tournament accolade"] = { 31470, 1, 500, true },

["sublime tournament carpet"] = { 31467, 1, 100, true },
["tournament carpet"] = { 31466, 1, 100, true },

["carved table"] = { 32972, 1, 100, true },
["carved table centre"] = { 32974, 1, 100, true },
["carved table corner"] = { 32969, 1, 100, true },

["cozy couch"] = { 32948, 1, 100, true },
["cozy couch left end"] = { 32948, 1, 100, true },
["cozy couch right end"] = { 32956, 1, 100, true },
["cozy couch corner"] = { 32964, 1, 100, true },

["zaoan chess box"] = { 18339, 1, 200, false },
["pannier backpack"] = { 19159, 1, 150, false },
["green light"] = { 21217, 1, 80, false },
["blood herb"] = { 3734, 3, 30, false },

["cerberus champion"] = { 146, 1, 1250, false, 9999999 },
["jousting eagle"] = { 145, 1, 1250, false, 9999999 },

["full dragon slayer"] = { 1289, 1288, 5000, false, 8888888 },
["full lion of war"] = { 1207, 1206, 1750, false, 8888888 },
["full veteran paladin"] = { 1205, 1204, 750, false, 8888888 },
["full void master"] = { 1203, 1202, 750, false, 8888888 },
local OfferType = {
ExerciseWeapon = 1,
Doll = 2,
House = 3,
Utils = 4,
Outfit = 5,
Mount = 6,
}

--local listShopItems = {
-- ["name"] = { id = x, count = 1, value = x, charges = x, type = OfferType.x },
--}
local listShopItems = {
["exercise sword"] = { id = 28552, count = 1, value = 700, charges = 1500, type = OfferType.ExerciseWeapon },
["exercise axe"] = { id = 28553, count = 1, value = 700, charges = 1500, type = OfferType.ExerciseWeapon },
["exercise club"] = { id = 28554, count = 1, value = 700, charges = 1500, type = OfferType.ExerciseWeapon },
["exercise bow"] = { id = 28555, count = 1, value = 700, charges = 1500, type = OfferType.ExerciseWeapon },
["exercise rod"] = { id = 28556, count = 1, value = 700, charges = 1500, type = OfferType.ExerciseWeapon },
["exercise wand"] = { id = 28557, count = 1, value = 700, charges = 1500, type = OfferType.ExerciseWeapon },

["baby brain squid"] = { id = 32909, count = 1, value = 800, wrap = true, type = OfferType.House },
["baby vulcongra"] = { id = 32908, count = 1, value = 800, wrap = true, type = OfferType.House },
["cerberus champion puppy"] = { id = 31464, count = 1, value = 800, wrap = true, type = OfferType.House },
["guzzlemaw grub"] = { id = 32907, count = 1, value = 800, wrap = true, type = OfferType.House },
["jousting eagle baby"] = { id = 31462, count = 1, value = 800, wrap = true, type = OfferType.House },
["demon doll"] = { id = 32918, count = 1, value = 400, wrap = true, type = OfferType.House },
["ogre rowdy doll"] = { id = 32944, count = 1, value = 400, wrap = true, type = OfferType.House },
["retching horror doll"] = { id = 32945, count = 1, value = 400, wrap = true, type = OfferType.House },
["vexclaw doll"] = { id = 32943, count = 1, value = 400, wrap = true, type = OfferType.House },
["draken doll"] = { id = 12044, count = 1, value = 150, wrap = true, type = OfferType.House },
["bear doll"] = { id = 3001, count = 1, value = 150, wrap = true, type = OfferType.House },

["gilded blessed shield"] = { id = 37165, count = 1, value = 1500, wrap = true, type = OfferType.House },
["gilded crown"] = { id = 34332, count = 1, value = 1500, wrap = true, type = OfferType.House },
["gilded horned helmet"] = { id = 38640, count = 1, value = 1500, wrap = true, type = OfferType.House },
["gilded magic longsword"] = { id = 36995, count = 1, value = 1500, wrap = true, type = OfferType.House },
["gilded warlord sword"] = { id = 39767, count = 1, value = 1500, wrap = true, type = OfferType.House },

["sublime tournament accolade"] = { id = 31472, count = 1, value = 500, wrap = true, type = OfferType.House },
["tournament accolade"] = { id = 31470, count = 1, value = 500, wrap = true, type = OfferType.House },

["sublime tournament carpet"] = { id = 31467, count = 1, value = 100, wrap = true, type = OfferType.House },
["tournament carpet"] = { id = 31466, count = 1, value = 100, wrap = true, type = OfferType.House },

["carved table"] = { id = 32972, count = 1, value = 100, wrap = true, type = OfferType.House },
["carved table centre"] = { id = 32974, count = 1, value = 100, wrap = true, type = OfferType.House },
["carved table corner"] = { id = 32969, count = 1, value = 100, wrap = true, type = OfferType.House },

["cozy couch"] = { id = 32948, count = 1, value = 100, wrap = true, type = OfferType.House },
["cozy couch left end"] = { id = 32948, count = 1, value = 100, wrap = true, type = OfferType.House },
["cozy couch right end"] = { id = 32956, count = 1, value = 100, wrap = true, type = OfferType.House },
["cozy couch corner"] = { id = 32964, count = 1, value = 100, wrap = true, type = OfferType.House },

["zaoan chess box"] = { id = 18339, count = 1, value = 200, type = OfferType.Utils },
["pannier backpack"] = { id = 19159, count = 1, value = 150, type = OfferType.Utils },
["green light"] = { id = 21217, count = 1, value = 80, type = OfferType.Utils },
["blood herb"] = { id = 3734, count = 3, value = 30, type = OfferType.Utils },

["full dragon slayer"] = { id = { female = 1289, male = 1288 }, value = 5000, type = OfferType.Outfit },
["full lion of war"] = { id = { female = 1207, male = 1206 }, value = 2000, type = OfferType.Outfit },
["full veteran paladin"] = { id = { female = 1205, male = 1204 }, value = 2000, type = OfferType.Outfit },
["full void master"] = { id = { female = 1203, male = 1202 }, value = 2000, type = OfferType.Outfit },

["cerberus champion"] = { id = 146, value = 4000, type = OfferType.Mount },
["jousting eagle"] = { id = 145, value = 1500, type = OfferType.Mount },
}

local offersByCategories = {
["exercise weapons"] = "{exercise sword} (700), {exercise axe} (700), {exercise club} (700), {exercise bow} (700), {exercise rod} (700), {exercise wand} (700). Each one with 1500 charges.",
["dolls"] = "{baby brain squid} (800), {baby vulcongra} (800), {cerberus champion puppy} (800), {guzzlemaw grub} (800), {jousting eagle baby} (800), {demon doll} (400), {ogre rowdy doll} (400), {retching horror doll} (400), {vexclaw doll} (400), {draken doll} (150), {bear doll} (150).",
["house decorations"] = "\nGilded: {gilded blessed shield} (1500), {gilded crown} (1500), {gilded horned helmet} (1500), {gilded magic longsword} (1500), {gilded warlord sword} (1500).\n"
.. "Accolade: {sublime tournament accolade} (500), {tournament accolade} (500).\n"
.. "Carpet: {sublime tournament carpet} (100), {tournament carpet} (100).\n"
.. "Table: {carved table} (100), {carved table centre} (100), {carved table corner} (100).\n"
.. "Cozy: {cozy couch} (100), {cozy couch left end} (100), {cozy couch right end} (100), {cozy couch corner} (100).",
["utils"] = "{zaoan chess box} (200), {pannier backpack} (150), {green light} (80), {blood herb} (30).",
["outfits"] = "{full lion of war} (2000), {full veteran paladin} (2000), {full void master} (2000), {full dragon slayer} (5000).",
["mounts"] = "{jousting eagle} (1500), {cerberus champion} (4000).",
}

local function creatureSayCallback(npc, creature, type, message)
Expand All @@ -121,7 +147,7 @@ local function creatureSayCallback(npc, creature, type, message)
return false
end

local amountTournamentCoins = player:getTournamentCoins()
local amountTournamentCoins = player:getTournamentCoins() or 0
message = string.lower(message)
if message == "help" or message == tournamentCoinName:lower() then
npcHandler:say("In our game store -> Tournament Shop", npc, creature)
Expand All @@ -135,63 +161,51 @@ local function creatureSayCallback(npc, creature, type, message)
return true
end

if (npcHandler:getTopic(playerId) == 2 or npcHandler:getTopic(playerId) == 0) and eventShopItems[message] == nil then
if (npcHandler:getTopic(playerId) == 2 or npcHandler:getTopic(playerId) == 0) and listShopItems[message] == nil then
npcHandler:setTopic(playerId, 0)
npcHandler:say("We can't find the item that you want, try again or access https://thorfinn.com.br/?thorfinncoins", npc, creature)
npcHandler:say("We can't find the item that you want, try again or access our game store to see the offers!", npc, creature)
return true
end

if npcHandler:getTopic(playerId) == 1 then
npcHandler:setTopic(playerId, 2)
local text = "We can't find the {category} that you want, try again or access https://thorfinn.com.br/?thorfinncoins"
if message == "exercise weapons" then
text = "{exercise sword} (25), {exercise axe} (25), {exercise club} (25), {exercise bow} (25), {exercise rod} (25), {exercise wand} (25). Each one with 500 charges"
elseif message == "dolls" then
text = "{baby brain squid} (800), {baby vulcongra} (800), {cerberus champion puppy} (800), {guzzlemaw grub} (800), {jousting eagle baby} (800), {demon doll} (400), {ogre rowdy doll} (400), {retching horror doll} (400), {vexclaw doll} (400)."
elseif message == "house decorations" then
text = "\nGilded: {gilded blessed shield} (1500), {gilded crown} (1500), {gilded horned helmet} (1500), {gilded magic longsword} (1500), {gilded warlord sword} (1500).\n"
.. "Accolade: {sublime tournament accolade} (500), {tournament accolade} (500).\n"
.. "Carpet: {sublime tournament carpet} (100), {tournament carpet} (100).\n"
.. "Table: {carved table} (100), {carved table centre} (100), {carved table corner} (100).\n"
.. "Cozy: {cozy couch} (100), {cozy couch left end} (100), {cozy couch right end} (100), {cozy couch corner} (100)."
elseif message == "utils" then
text = "{stamina extension} (300), {zaoan chess box} (200), {pannier backpack} (150), {green light} (80), {blood herb} (30)."
elseif message == "mounts" then
text = "{jousting eagle} (1500), {foxmouse} (2500), {doom skull} (4000), {corpsefire skull} (4000), {cerberus champion} (4000), {spirit of purity} (4000)."
elseif message == "outfits" then
text = "{full lion of war} (2000), {full veteran paladin} (2000), {full void master} (2000), {full dragon slayer} (5000)."
local text = offersByCategories[message]
if text == nil then
text = "We can't find the {category} that you want, try again or access our game store to see the offers!"
npcHandler:setTopic(playerId, 0)
end
npcHandler:say(text, npc, creature)
return true
end

if (npcHandler:getTopic(playerId) == 2 or npcHandler:getTopic(playerId) == 0) and eventShopItems[message] ~= nil then
local selected = eventShopItems[message]
local itemCount, itemPrice, itemCharge = selected[2], selected[3], selected[5] or 0
local descCharge = ""
if itemCharge > 0 and (itemCharge ~= 9999999 and itemCharge ~= 8888888) then
descCharge = " with " .. itemCharge .. " charges"
end

if amountTournamentCoins > 0 and amountTournamentCoins >= itemPrice then
if itemCharge == 9999999 then
npcHandler:say(string.format("You want buy %s mount for %i %s? {yes} or {no}", message, itemPrice, tournamentCoinName:lower()), npc, creature)
npcHandler:setTopic("mount", message)
elseif itemCharge == 8888888 then
npcHandler:say(string.format("You want buy %s outfit for %i %s? {yes} or {no}", message, itemPrice, tournamentCoinName:lower()), npc, creature)
npcHandler:setTopic("outfit", message)
else
npcHandler:say(string.format("You want buy %ix %s%s for %i %s? {yes} or {no}", itemCount, message, descCharge, itemPrice, tournamentCoinName:lower()), npc, creature)
end
npcHandler:setTopic(playerId, 3)
npcHandler:setTopic("selected", selected)
else
npcHandler:say(string.format("You don't have %i {%s}!", itemPrice, tournamentCoinName), npc, creature)
if (npcHandler:getTopic(playerId) == 2 or npcHandler:getTopic(playerId) == 0) and listShopItems[message] ~= nil then
local selected = listShopItems[message]
if amountTournamentCoins < selected.value then
npcHandler:say(string.format("You don't have %i {%s}!", selected.value, tournamentCoinName), npc, creature)
npcHandler:setTopic(playerId, 0)
npcHandler:setTopic("selected", {})
npcHandler:setTopic("outfit", {})
npcHandler:setTopic("mount", {})
end

local descCharge = ""
if selected.type == OfferType.ExerciseWeapon and selected.charges ~= nil then
descCharge = " with " .. selected.charges .. " charges"
end

if selected.type == OfferType.Outfit then
npcHandler:say(string.format("You want buy %s outfit for %i %s? {yes} or {no}", message, selected.value, tournamentCoinName:lower()), npc, creature)
npcHandler:setTopic("outfit", message)
elseif selected.type == OfferType.Mount then
npcHandler:say(string.format("You want buy %s mount for %i %s? {yes} or {no}", message, selected.value, tournamentCoinName:lower()), npc, creature)
npcHandler:setTopic("mount", message)
else
npcHandler:say(string.format("You want buy %ix %s%s for %i %s? {yes} or {no}", selected.count, message, descCharge, selected.value, tournamentCoinName:lower()), npc, creature)
end

npcHandler:setTopic(playerId, 3)
npcHandler:setTopic("selected", selected)

return true
end

Expand All @@ -210,63 +224,61 @@ local function creatureSayCallback(npc, creature, type, message)
return true
end

local itemId, itemCount, itemPrice, isWrappable, itemCharge = selected[1], selected[2], selected[3], selected[4] or false, selected[5] or 0

if itemCharge == 9999999 then
if player:hasMount(itemId) then
if selected.type == OfferType.Mount then
if player:hasMount(selected.id) then
npcHandler:say("You already own this mount.", npc, creature)
return true
end
player:updateTournamentCoins(itemPrice, "remove")
player:addMount(itemId)
player:updateTournamentCoins(selected.value, "remove")
player:addMount(selected.id)
local mountName = npcHandler:getTopic("mount")
local msg = string.format("You bought %s mount for %i {%s}!", mountName, itemPrice, tournamentCoinName)
local msg = string.format("You bought %s mount for %i {%s}!", mountName, selected.value, tournamentCoinName)
player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE)
npcHandler:say(msg, npc, creature)
npcHandler:setTopic(playerId, 0)
npcHandler:setTopic("selected", {})
npcHandler:setTopic("mount", {})
elseif itemCharge == 8888888 then
local female, male = itemCount, itemId
elseif selected.type == OfferType.Outfit then
local female, male = selected.id.female, selected.id.male
if player:hasOutfit(female) or player:hasOutfit(male) then
npcHandler:say("You already own this outfit.", npc, creature)
return true
end
player:updateTournamentCoins(itemPrice, "remove")
player:updateTournamentCoins(selected.value, "remove")
player:addOutfitAddon(female, 3)
player:addOutfitAddon(male, 3)
local outfitName = npcHandler:getTopic("outfit")
local msg = string.format("You bought %s outfit for %i {%s}!", outfitName, itemPrice, tournamentCoinName)
local msg = string.format("You bought %s outfit for %i %s!", outfitName, selected.value, tournamentCoinName:lower())
player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE)
npcHandler:say(msg, npc, creature)
npcHandler:setTopic(playerId, 0)
npcHandler:setTopic("selected", {})
npcHandler:setTopic("outfit", {})
else
local inbox = player:getSlotItem(CONST_SLOT_STORE_INBOX)
local itemT = ItemType(itemId)
if amountTournamentCoins >= itemPrice then
local itemT = ItemType(selected.id)
if amountTournamentCoins >= selected.value then
if inbox and inbox:getEmptySlots() > 0 and player:getFreeCapacity() >= itemT:getCapacity() then
player:updateTournamentCoins(itemPrice, "remove")
player:updateTournamentCoins(selected.value, "remove")

if itemCharge > 0 then
local addedItem = player:addItem(itemId, itemCount, true)
addedItem:setAttribute("charges", itemCharge)
if selected.charges > 0 then
local addedItem = player:addItem(selected.id, selected.count, true)
addedItem:setAttribute("charges", selected.charges)
else
if isWrappable then
if selected.wrap then
local decoKit = inbox:addItem(ITEM_DECORATION_KIT, 1)
if decoKit then
decoKit:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Unwrap it in your own house to create a <" .. itemT:getName() .. ">.")
decoKit:setCustomAttribute("unWrapId", itemId)
decoKit:setCustomAttribute("unWrapId", selected.id)
decoKit:setAttribute(ITEM_ATTRIBUTE_STORE, systemTime())
player:sendUpdateContainer(inbox)
end
else
player:addItem(itemId, itemCount)
player:addItem(selected.id, selected.count)
end
end
local descCharge = itemCharge > 0 and " with " .. itemCharge .. " charges" or ""
local msg = string.format("You bought %ix %s%s for %i {%s} and received in your store inbox!", itemCount, itemT:getName(), descCharge, itemPrice, tournamentCoinName)
local descCharge = selected.charges > 0 and " with " .. selected.charges .. " charges" or ""
local msg = string.format("You bought %ix %s%s for %i {%s} and received in your store inbox!", selected.count, itemT:getName(), descCharge, selected.value, tournamentCoinName)
player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE)
npcHandler:say(msg, npc, creature)
npcHandler:setTopic(playerId, 0)
Expand Down
Loading

0 comments on commit 35bebfd

Please sign in to comment.