Skip to content

Commit

Permalink
Merge branch 'main' into improve_targetlist_iddlestatus
Browse files Browse the repository at this point in the history
  • Loading branch information
mehah committed Dec 6, 2024
2 parents 14b08c2 + b54a712 commit 5d31d33
Show file tree
Hide file tree
Showing 22 changed files with 156 additions and 125 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ jobs:
with:
install: true

- name: Cache Docker layers
uses: actions/cache@main
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-x86-${{ github.sha }}
restore-keys: |
${{ runner.os }}-x86-
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
Expand Down Expand Up @@ -109,14 +101,6 @@ jobs:
with:
install: true

- name: Cache Docker layers
uses: actions/cache@main
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-arm-${{ github.sha }}
restore-keys: |
${{ runner.os }}-arm-
- name: Build
uses: docker/[email protected]
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ monster.loot = {
{ id = 6558, chance = 10000 }, -- flask of demonic blood
{ id = 6558, chance = 10000 }, -- flask of demonic blood
{ id = 6558, chance = 10000 }, -- flask of demonic blood
{ id = 17838, chance = 1800 }, -- unknown item
{ id = 3019, chance = 1000 }, -- demonbone amulet
{ id = 3026, chance = 12000, maxCount = 8 }, -- white pearl
{ id = 3029, chance = 12000, maxCount = 9 }, -- small sapphire
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ monster.loot = {
{ name = "butcher's axe", chance = 1000 },
{ name = "dreaded cleaver", chance = 1000 },
{ name = "mercenary sword", chance = 1000 },
{ id = 28341, chance = 1000 }, -- tessellated wall
{ name = "slightly rusted shield", chance = 5880 },
{ name = "slightly rusted helmet", chance = 35290 },
{ name = "epaulette", chance = 500 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ monster.loot = {
{ name = "dreaded cleaver", chance = 30000 },
{ name = "slightly rusted shield", chance = 26670 },
{ name = "wand of inferno", chance = 30000 },
{ id = 28341, chance = 1000 }, -- tessellated wall
{ name = "sturdy book", chance = 1000 },
}

Expand Down
4 changes: 2 additions & 2 deletions data-otservbr-global/scripts/lib/monster_functions.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function Monster:handleCobraOnSpawn()
if Game.getStorageValue(Global.Storage.CobraFlask) >= os.time() then
monster:setHealth(monster:getMaxHealth() * 0.75)
monster:getPosition():sendMagicEffect(CONST_ME_GREEN_RINGS)
self:setHealth(self:getMaxHealth() * 0.75)
self:getPosition():sendMagicEffect(CONST_ME_GREEN_RINGS)
else
Game.setStorageValue(Global.Storage.CobraFlask, -1)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,3 @@ end

rewardSoulWar:position({ x = 33620, y = 31400, z = 10 })
rewardSoulWar:register()

local phantasmalJadeMount = Action()

function phantasmalJadeMount.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local soulWarQuest = player:soulWarQuestKV()
if soulWarQuest:get("panthasmal-jade-mount") then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You already have Phantasmal Jade mount!")
return true
end

if table.contains({ 34072, 34073, 34074 }, item.itemid) then
if player:getItemCount(34072) >= 4 and player:getItemCount(34073) == 1 and player:getItemCount(34074) == 1 then
player:removeItem(34072, 4)
player:removeItem(34073, 1)
player:removeItem(34074, 1)
player:addMount(167)
player:addAchievement("You got Horse Power")
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations! You won Phantasmal Jade mount.")
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations! You won You got Horse Power achievement.")
player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE)
soulWarQuest:set("panthasmal-jade-mount", true)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You don't have the necessary items!")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
end

return true
end

phantasmalJadeMount:id(34072, 34073, 34074)
phantasmalJadeMount:register()
2 changes: 1 addition & 1 deletion data/libs/functions/boss_lever.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function BossLever:onUse(player)
return true
end

local isAccountNormal = creature:getAccountType() == ACCOUNT_TYPE_NORMAL
local isAccountNormal = creature:getAccountType() < ACCOUNT_TYPE_GAMEMASTER
if isAccountNormal and creature:getLevel() < self.requiredLevel then
local message = "All players need to be level " .. self.requiredLevel .. " or higher."
creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, message)
Expand Down
15 changes: 8 additions & 7 deletions data/libs/systems/blessing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ Blessings.BuyAllBlesses = function(player)
local hasToF = Blessings.Config.HasToF and player:hasBlessing(1) or true
local missingBless = player:getBlessings(nil, donthavefilter)
local missingBlessAmt = #missingBless + (hasToF and 0 or 1)
local totalCost
for i, bless in ipairs(missingBless) do
local totalCost = 0

for _, bless in ipairs(missingBless) do
totalCost = totalCost + Blessings.getBlessingCost(player:getLevel(), true, bless.id >= 7)
end

Expand All @@ -274,19 +275,19 @@ Blessings.BuyAllBlesses = function(player)
end

if player:removeMoneyBank(totalCost) then
metrics.addCounter("balance_decrease", remainsPrice, {
metrics.addCounter("balance_decrease", totalCost, {
player = player:getName(),
context = "blessings",
})

for i, v in ipairs(missingBless) do
player:addBlessing(v.id, 1)
for _, bless in ipairs(missingBless) do
player:addBlessing(bless.id, 1)
end

player:sendCancelMessage("You received the remaining " .. missingBlessAmt .. " blesses for a total of " .. totalCost .. " gold.")
player:sendCancelMessage(string.format("You received the remaining %d blesses for a total of %d gold.", missingBlessAmt, totalCost))
player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
else
player:sendCancelMessage("You don't have enough money. You need " .. totalCost .. " to buy all blesses.", cid)
player:sendCancelMessage(string.format("You don't have enough money. You need %d to buy all blesses.", totalCost))
player:getPosition():sendMagicEffect(CONST_ME_POFF)
end

Expand Down
45 changes: 45 additions & 0 deletions data/scripts/actions/items/usable_phantasmal_jade_items.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
local config = {
requiredItems = {
[34072] = { key = "spectral-horseshoes", count = 4 },
[34073] = { key = "spectral-saddle", count = 1 },
[34074] = { key = "spectral-horse-tac", count = 1 },
},

mountId = 167,
}

local usablePhantasmalJadeItems = Action()

function usablePhantasmalJadeItems.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local itemInfo = config.requiredItems[item:getId()]
if not itemInfo then
return true
end

if player:hasMount(config.mountId) then
return true
end

local currentCount = (player:kv():get(itemInfo.key) or 0) + 1
player:kv():set(itemInfo.key, currentCount)
player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE)
item:remove(1)

for _, info in pairs(config.requiredItems) do
if (player:kv():get(info.key) or 0) < info.count then
return true
end
end

player:addMount(config.mountId)
player:addAchievement("Natural Born Cowboy")
player:addAchievement("You got Horse Power")
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Phantasmal jade is now yours!")
return true
end

for itemId, _ in pairs(config.requiredItems) do
usablePhantasmalJadeItems:id(itemId)
end

usablePhantasmalJadeItems:register()
4 changes: 2 additions & 2 deletions docker/Dockerfile.arm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Stage 1: Download all dependencies
FROM ubuntu:23.04 AS dependencies
FROM ubuntu:24.04 AS dependencies

RUN apt-get update && apt-get install -y --no-install-recommends cmake git \
unzip build-essential ca-certificates curl zip unzip tar \
Expand Down Expand Up @@ -30,7 +30,7 @@ WORKDIR /srv
RUN export VCPKG_ROOT=/opt/vcpkg/ && VCPKG_FORCE_SYSTEM_BINARIES=1 cmake --preset linux-release && cmake --build --preset linux-release

# Stage 3: load data and execute
FROM ubuntu:23.04
FROM ubuntu:24.04

VOLUME [ "/data" ]

Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile.x86
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Stage 1: Download all dependencies
FROM ubuntu:23.04 AS dependencies
FROM ubuntu:24.04 AS dependencies

RUN apt-get update && apt-get install -y --no-install-recommends cmake git \
unzip build-essential ca-certificates curl zip unzip tar \
Expand Down Expand Up @@ -30,7 +30,7 @@ WORKDIR /srv
RUN export VCPKG_ROOT=/opt/vcpkg/ && cmake --preset linux-release && cmake --build --preset linux-release

# Stage 3: load data and execute
FROM ubuntu:23.04
FROM ubuntu:24.04
VOLUME [ "/data" ]

COPY --from=build /srv/build/linux-release/bin/canary /bin/canary
Expand Down
8 changes: 6 additions & 2 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5039,10 +5039,14 @@ ItemsTierCountList Player::getDepotInboxItemsId() const {
ItemsTierCountList itemMap;

const auto &inboxPtr = getInbox();
const auto &container = inboxPtr->getContainer();
const auto &container = inboxPtr ? inboxPtr->getContainer() : nullptr;
if (container) {
for (ContainerIterator it = container->iterator(); it.hasNext(); it.advance()) {
const auto &item = *it;
if (!item) {
continue;
}

(itemMap[item->getID()])[item->getTier()] += Item::countByType(item, -1);
}
}
Expand Down Expand Up @@ -9073,7 +9077,7 @@ void Player::forgeFuseItems(ForgeAction_t actionType, uint16_t firstItemId, uint

returnValue = g_game().internalAddItem(static_self_cast<Player>(), exaltationContainer, INDEX_WHEREEVER);
if (returnValue != RETURNVALUE_NOERROR) {
g_logger().error("Failed to add exaltation chest to player with name {}", fmt::underlying(ITEM_EXALTATION_CHEST), getName());
g_logger().error("Failed to add exaltation chest to player with name {}", getName());
sendCancelMessage(getReturnMessage(returnValue));
sendForgeError(RETURNVALUE_CONTACTADMINISTRATOR);
return;
Expand Down
11 changes: 8 additions & 3 deletions src/creatures/players/wheel/player_wheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1448,8 +1448,13 @@ void PlayerWheel::improveGemGrade(WheelFragmentType_t fragmentType, uint8_t pos)
return;
}

if (value == 0 && quantity == 0) {
g_logger().error("[{}] Player {} trying to upgrade gem to grade greater than 3", std::source_location::current().function_name(), m_player.getName());
return;
}

if (!m_player.hasItemCountById(fragmentId, quantity, true)) {
g_logger().error("[{}] Player {} does not have the required {} fragments with id {}", __FUNCTION__, m_player.getName(), quantity, fragmentId);
g_logger().error("[{}] Player {} does not have the required {} fragments with id {}", std::source_location::current().function_name(), m_player.getName(), quantity, fragmentId);
return;
}

Expand Down Expand Up @@ -1477,7 +1482,7 @@ std::tuple<int, int> PlayerWheel::getLesserGradeCost(uint8_t grade) const {
case 3:
return std::make_tuple(30000000, 30);
default:
throw std::invalid_argument("Invalid level for Lesser Fragment.");
return {};
}
}

Expand All @@ -1490,7 +1495,7 @@ std::tuple<int, int> PlayerWheel::getGreaterGradeCost(uint8_t grade) const {
case 3:
return std::make_tuple(75000000, 30);
default:
throw std::invalid_argument("Invalid level for Greater Fragment.");
return {};
}
}

Expand Down
Loading

0 comments on commit 5d31d33

Please sign in to comment.