Skip to content

Commit

Permalink
Merge branch 'main' into improve_unrealized_dream
Browse files Browse the repository at this point in the history
  • Loading branch information
luan authored Dec 9, 2023
2 parents 0329a0f + 0e16b1c commit ae99477
Show file tree
Hide file tree
Showing 93 changed files with 3,659 additions and 2,062 deletions.
2 changes: 2 additions & 0 deletions cmake/modules/BaseConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ find_package(asio CONFIG REQUIRED)
find_package(eventpp CONFIG REQUIRED)
find_package(jsoncpp CONFIG REQUIRED)
find_package(magic_enum CONFIG REQUIRED)
find_package(opentelemetry-cpp CONFIG REQUIRED)
find_package(prometheus-cpp CONFIG REQUIRED)
find_package(mio REQUIRED)
find_package(pugixml CONFIG REQUIRED)
find_package(spdlog REQUIRED)
Expand Down
8 changes: 8 additions & 0 deletions cmake/modules/CanaryLib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ target_link_libraries(${PROJECT_NAME}_lib
unofficial::argon2::libargon2
unofficial::libmariadb
unofficial::mariadbclient
opentelemetry-cpp::common
opentelemetry-cpp::metrics
opentelemetry-cpp::api
opentelemetry-cpp::ext
opentelemetry-cpp::sdk
opentelemetry-cpp::logs
opentelemetry-cpp::ostream_metrics_exporter
opentelemetry-cpp::prometheus_exporter
)

if(CMAKE_BUILD_TYPE MATCHES Debug)
Expand Down
9 changes: 9 additions & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,12 @@ vipKeepHouse = false
-- NOTE set rewardChestMaxCollectItems max items per collect action
rewardChestCollectEnabled = true
rewardChestMaxCollectItems = 200

-- Metrics
--- Prometheus
metricsEnablePrometheus = false
metricsPrometheusAddress = "0.0.0.0:9464"

--- OStream
metricsEnableOstream = false
metricsOstreamInterval = 1000
22 changes: 11 additions & 11 deletions data-otservbr-global/monster/quests/forgotten_knowledge/icicle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,20 @@ monster.defenses = {
defense = 199,
armor = 199,
mitigation = 0.50,
{ name = "icicle heal", interval = 2000, chance = 25, target = false },
{ name = "icicle heal", interval = 2000, chance = 60, target = false },
}

monster.elements = {
{ type = COMBAT_PHYSICALDAMAGE, percent = 0 },
{ type = COMBAT_ENERGYDAMAGE, percent = 0 },
{ type = COMBAT_EARTHDAMAGE, percent = 0 },
{ type = COMBAT_FIREDAMAGE, percent = 0 },
{ type = COMBAT_LIFEDRAIN, percent = 0 },
{ type = COMBAT_MANADRAIN, percent = 0 },
{ type = COMBAT_DROWNDAMAGE, percent = 0 },
{ type = COMBAT_ICEDAMAGE, percent = 0 },
{ type = COMBAT_HOLYDAMAGE, percent = 0 },
{ type = COMBAT_DEATHDAMAGE, percent = 0 },
{ type = COMBAT_PHYSICALDAMAGE, percent = 100 },
{ type = COMBAT_ENERGYDAMAGE, percent = 100 },
{ type = COMBAT_EARTHDAMAGE, percent = 100 },
{ type = COMBAT_FIREDAMAGE, percent = 100 },
{ type = COMBAT_LIFEDRAIN, percent = 100 },
{ type = COMBAT_MANADRAIN, percent = 100 },
{ type = COMBAT_DROWNDAMAGE, percent = 100 },
{ type = COMBAT_ICEDAMAGE, percent = 100 },
{ type = COMBAT_HOLYDAMAGE, percent = 100 },
{ type = COMBAT_DEATHDAMAGE, percent = 100 },
}

monster.immunities = {
Expand Down
98 changes: 66 additions & 32 deletions data-otservbr-global/npc/alaistar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,50 @@ npcConfig.flags = {
floorchange = false,
}

npcConfig.shop = {
{ itemName = "cowbell", clientId = 21204, sell = 210 },
{ itemName = "empty potion flask", clientId = 283, sell = 5 },
{ itemName = "empty potion flask", clientId = 284, sell = 5 },
{ itemName = "empty potion flask", clientId = 285, sell = 5 },
{ itemName = "execowtioner mask", clientId = 21201, sell = 240 },
{ itemName = "giant pacifier", clientId = 21199, sell = 170 },
{ itemName = "glob of glooth", clientId = 21182, sell = 125 },
{ itemName = "glooth injection tube", clientId = 21103, sell = 350 },
{ itemName = "great health potion", clientId = 239, buy = 225 },
{ itemName = "great mana potion", clientId = 238, buy = 144 },
{ itemName = "great spirit potion", clientId = 7642, buy = 228 },
{ itemName = "health potion", clientId = 266, buy = 50 },
{ itemName = "mana potion", clientId = 268, buy = 56 },
{ itemName = "metal jaw", clientId = 21193, sell = 260 },
{ itemName = "metal toe", clientId = 21198, sell = 430 },
{ itemName = "mooh'tah shell", clientId = 21202, sell = 110 },
{ itemName = "moohtant horn", clientId = 21200, sell = 140 },
{ itemName = "necromantic rust", clientId = 21196, sell = 390 },
{ itemName = "poisoned fang", clientId = 21195, sell = 130 },
{ itemName = "seacrest hair", clientId = 21801, sell = 260 },
{ itemName = "seacrest pearl", clientId = 21747, sell = 400 },
{ itemName = "seacrest scale", clientId = 21800, sell = 150 },
{ itemName = "slime heart", clientId = 21194, sell = 160 },
{ itemName = "slimy leaf tentacle", clientId = 21197, sell = 320 },
{ itemName = "strong health potion", clientId = 236, buy = 115 },
{ itemName = "strong mana potion", clientId = 237, buy = 93 },
{ itemName = "supreme health potion", clientId = 23375, buy = 625 },
{ itemName = "ultimate health potion", clientId = 7643, buy = 438 },
{ itemName = "ultimate mana potion", clientId = 23373, buy = 379 },
{ itemName = "ultimate spirit potion", clientId = 23374, buy = 438 },
{ itemName = "vial", clientId = 2874, sell = 5 },
local itemsTable = {
["potions"] = {
{ itemName = "empty potion flask", clientId = 283, sell = 5 },
{ itemName = "empty potion flask", clientId = 284, sell = 5 },
{ itemName = "empty potion flask", clientId = 285, sell = 5 },
{ itemName = "great health potion", clientId = 239, buy = 225 },
{ itemName = "great mana potion", clientId = 238, buy = 144 },
{ itemName = "great spirit potion", clientId = 7642, buy = 228 },
{ itemName = "health potion", clientId = 266, buy = 50 },
{ itemName = "mana potion", clientId = 268, buy = 56 },
{ itemName = "strong health potion", clientId = 236, buy = 115 },
{ itemName = "strong mana potion", clientId = 237, buy = 93 },
{ itemName = "supreme health potion", clientId = 23375, buy = 625 },
{ itemName = "ultimate health potion", clientId = 7643, buy = 438 },
{ itemName = "ultimate mana potion", clientId = 23373, buy = 379 },
{ itemName = "ultimate spirit potion", clientId = 23374, buy = 438 },
{ itemName = "vial", clientId = 2874, sell = 5 },
},
["creature products"] = {
{ itemName = "cowbell", clientId = 21204, sell = 210 },
{ itemName = "giant pacifier", clientId = 21199, sell = 170 },
{ itemName = "glob of glooth", clientId = 21182, sell = 125 },
{ itemName = "glooth injection tube", clientId = 21103, sell = 350 },
{ itemName = "metal jaw", clientId = 21193, sell = 260 },
{ itemName = "metal toe", clientId = 21198, sell = 430 },
{ itemName = "mooh'tah shell", clientId = 21202, sell = 110 },
{ itemName = "moohtant horn", clientId = 21200, sell = 140 },
{ itemName = "necromantic rust", clientId = 21196, sell = 390 },
{ itemName = "poisoned fang", clientId = 21195, sell = 130 },
{ itemName = "seacrest hair", clientId = 21801, sell = 260 },
{ itemName = "seacrest pearl", clientId = 21747, sell = 400 },
{ itemName = "seacrest scale", clientId = 21800, sell = 150 },
{ itemName = "slime heart", clientId = 21194, sell = 160 },
{ itemName = "slimy leaf tentacle", clientId = 21197, sell = 320 },
},
}

npcConfig.shop = {}
for _, categoryTable in pairs(itemsTable) do
for _, itemTable in ipairs(categoryTable) do
table.insert(npcConfig.shop, itemTable)
end
end

-- On buy npc shop message
npcType.onBuyItem = function(npc, player, itemId, subType, amount, ignore, inBackpacks, totalCost)
npc:sellItem(player, itemId, amount, subType, 0, ignore, inBackpacks)
Expand Down Expand Up @@ -95,6 +105,30 @@ npcType.onCloseChannel = function(npc, creature)
npcHandler:onCloseChannel(npc, creature)
end

local function creatureSayCallback(npc, creature, type, message)
local player = Player(creature)
local playerId = player:getId()

if not npcHandler:checkInteraction(npc, creature) then
return false
end

local formattedCategoryNames = {}
for categoryName, _ in pairs(itemsTable) do
table.insert(formattedCategoryNames, "{" .. categoryName .. "}")
end

local categoryTable = itemsTable[message:lower()]

if categoryTable then
npcHandler:say("Of course, just browse through my wares.", npc, player)
npc:openShopWindowTable(player, categoryTable)
end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

npcType:register(npcConfig)
99 changes: 52 additions & 47 deletions data-otservbr-global/npc/alexander.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,49 @@ npcConfig.voices = {
{ text = "Selling all sorts of magic equipment. Come and have a look" },
}

local itemsTable = {
["runes"] = {
{ itemName = "animate dead rune", clientId = 3203, buy = 375 },
{ itemName = "blank rune", clientId = 3147, buy = 10 },
{ itemName = "desintegrate rune", clientId = 3197, buy = 26 },
{ itemName = "energy bomb rune", clientId = 3149, buy = 203 },
{ itemName = "fireball rune", clientId = 3189, buy = 30 },
{ itemName = "holy missile rune", clientId = 3182, buy = 16 },
{ itemName = "icicle rune", clientId = 3158, buy = 30 },
{ itemName = "magic wall rune", clientId = 3180, buy = 116 },
{ itemName = "paralyze rune", clientId = 3165, buy = 700 },
{ itemName = "poison bomb rune", clientId = 3173, buy = 85 },
{ itemName = "soulfire rune", clientId = 3195, buy = 46 },
{ itemName = "stone shower rune", clientId = 3175, buy = 37 },
{ itemName = "thunderstorm rune", clientId = 3202, buy = 47 },
{ itemName = "wild growth rune", clientId = 3156, buy = 160 },
},
["wands"] = {
{ itemName = "hailstorm rod", clientId = 3067, buy = 15000 },
{ itemName = "moonlight rod", clientId = 3070, buy = 1000 },
{ itemName = "necrotic rod", clientId = 3069, buy = 5000 },
{ itemName = "northwind rod", clientId = 8083, buy = 7500 },
{ itemName = "springsprout rod", clientId = 8084, buy = 18000 },
{ itemName = "terra rod", clientId = 3065, buy = 10000 },
{ itemName = "underworld rod", clientId = 8082, buy = 22000 },
{ itemName = "wand of cosmic energy", clientId = 3073, buy = 10000 },
{ itemName = "wand of decay", clientId = 3072, buy = 5000 },
{ itemName = "wand of draconia", clientId = 8093, buy = 7500 },
{ itemName = "wand of dragonbreath", clientId = 3075, buy = 1000 },
{ itemName = "wand of inferno", clientId = 3071, buy = 15000 },
{ itemName = "wand of starstorm", clientId = 8092, buy = 18000 },
{ itemName = "wand of voodoo", clientId = 8094, buy = 22000 },
{ itemName = "wand of vortex", clientId = 3074, buy = 500 },
},
}

npcConfig.shop = {}
for _, categoryTable in pairs(itemsTable) do
for _, itemTable in ipairs(categoryTable) do
table.insert(npcConfig.shop, itemTable)
end
end

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)

Expand Down Expand Up @@ -69,6 +112,12 @@ local function creatureSayCallback(npc, creature, type, message)
return false
end

local formattedCategoryNames = {}
for categoryName, _ in pairs(itemsTable) do
table.insert(formattedCategoryNames, "{" .. categoryName .. "}")
end

local categoryTable = itemsTable[message:lower()]
local itemId = items[player:getVocation():getBaseId()]
if MsgContains(message, "first rod") or MsgContains(message, "first wand") then
if player:isMage() then
Expand All @@ -91,6 +140,9 @@ local function creatureSayCallback(npc, creature, type, message)
elseif MsgContains(message, "no") and npcHandler:getTopic(playerId) == 1 then
npcHandler:say("Ok then.", npc, creature)
npcHandler:setTopic(playerId, 0)
elseif categoryTable then
npcHandler:say("Of course, just browse through my wares.", npc, player)
npc:openShopWindowTable(player, categoryTable)
end
return true
end
Expand All @@ -104,53 +156,6 @@ npcHandler:setMessage(MESSAGE_WALKAWAY, "See you, |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Of course, just browse through my wares. Or do you want to look only at {runes} or {wands}?")
npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

npcConfig.shop = {
{ itemName = "animate dead rune", clientId = 3203, buy = 375 },
{ itemName = "blank rune", clientId = 3147, buy = 10 },
{ itemName = "crystal ball", clientId = 3076, buy = 530, sell = 190 },
{ itemName = "desintegrate rune", clientId = 3197, buy = 26 },
{ itemName = "durable exercise rod", clientId = 35283, buy = 945000, count = 1800 },
{ itemName = "durable exercise wand", clientId = 35284, buy = 945000, count = 1800 },
{ itemName = "energy bomb rune", clientId = 3149, buy = 203 },
{ itemName = "exercise rod", clientId = 28556, buy = 262500, count = 500 },
{ itemName = "exercise wand", clientId = 28557, buy = 262500, count = 500 },
{ itemName = "fireball rune", clientId = 3189, buy = 30 },
{ itemName = "hailstorm rod", clientId = 3067, buy = 15000 },
{ itemName = "holy missile rune", clientId = 3182, buy = 16 },
{ itemName = "icicle rune", clientId = 3158, buy = 30 },
{ itemName = "lasting exercise rod", clientId = 35289, buy = 7560000, count = 14400 },
{ itemName = "lasting exercise wand", clientId = 35290, buy = 7560000, count = 14400 },
{ itemName = "life crystal", clientId = 3061, sell = 85 },
{ itemName = "life ring", clientId = 3052, buy = 900 },
{ itemName = "magic wall rune", clientId = 3180, buy = 116 },
{ itemName = "mind stone", clientId = 3062, sell = 170 },
{ itemName = "moonlight rod", clientId = 3070, buy = 1000 },
{ itemName = "necrotic rod", clientId = 3069, buy = 5000 },
{ itemName = "northwind rod", clientId = 8083, buy = 7500 },
{ itemName = "paralyze rune", clientId = 3165, buy = 700 },
{ itemName = "poison bomb rune", clientId = 3173, buy = 85 },
{ itemName = "snakebite rod", clientId = 3066, buy = 500 },
{ itemName = "soulfire rune", clientId = 3195, buy = 46 },
{ itemName = "spellbook of enlightenment", clientId = 8072, sell = 4000 },
{ itemName = "spellbook of lost souls", clientId = 8075, sell = 19000 },
{ itemName = "spellbook of mind control", clientId = 8074, sell = 13000 },
{ itemName = "spellbook of warding", clientId = 8073, sell = 8000 },
{ itemName = "spellwand", clientId = 651, sell = 299 },
{ itemName = "springsprout rod", clientId = 8084, buy = 18000 },
{ itemName = "stone shower rune", clientId = 3175, buy = 37 },
{ itemName = "terra rod", clientId = 3065, buy = 10000 },
{ itemName = "thunderstorm rune", clientId = 3202, buy = 47 },
{ itemName = "underworld rod", clientId = 8082, buy = 22000 },
{ itemName = "wand of cosmic energy", clientId = 3073, buy = 10000 },
{ itemName = "wand of decay", clientId = 3072, buy = 5000 },
{ itemName = "wand of draconia", clientId = 8093, buy = 7500 },
{ itemName = "wand of dragonbreath", clientId = 3075, buy = 1000 },
{ itemName = "wand of inferno", clientId = 3071, buy = 15000 },
{ itemName = "wand of starstorm", clientId = 8092, buy = 18000 },
{ itemName = "wand of voodoo", clientId = 8094, buy = 22000 },
{ itemName = "wand of vortex", clientId = 3074, buy = 500 },
{ itemName = "wild growth rune", clientId = 3156, buy = 160 },
}
-- On buy npc shop message
npcType.onBuyItem = function(npc, player, itemId, subType, amount, ignore, inBackpacks, totalCost)
npc:sellItem(player, itemId, amount, subType, 0, ignore, inBackpacks)
Expand Down
Loading

0 comments on commit ae99477

Please sign in to comment.