Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: teleport effect from "onUse" actions #3109

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data-canary/scripts/actions/other/ladder_up.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function ladder.onUse(player, item, fromPosition, target, toPosition, isHotkey)
return true
end

player:teleportTo(fromPosition, false)
player:teleportTo(fromPosition, true)
return true
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local dwarvenLadder = Action()
function dwarvenLadder.onUse(player, item, fromPosition, itemEx, toPosition)
if player:getStorageValue(Storage.DwarvenLegs) < 1 then
player:teleportTo({ x = 32681, y = 31507, z = 10 })
player:teleportTo({ x = 32681, y = 31507, z = 10 }, true)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return true
else
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/combat/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ bool Combat::doCombatChain(const std::shared_ptr<Creature> &caster, const std::s
auto delay = i * std::max<int32_t>(50, g_configManager().getNumber(COMBAT_CHAIN_DELAY));
++i;
for (const auto &to : toVector) {
auto nextTarget = g_game().getCreatureByID(to);
const auto &nextTarget = g_game().getCreatureByID(to);
if (!nextTarget) {
continue;
}
Expand Down
8 changes: 4 additions & 4 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ void Game::playerMoveCreatureByID(uint32_t playerId, uint32_t movingCreatureId,
return;
}

std::shared_ptr<Creature> movingCreature = getCreatureByID(movingCreatureId);
const auto &movingCreature = getCreatureByID(movingCreatureId);
if (!movingCreature) {
return;
}
Expand Down Expand Up @@ -5451,7 +5451,7 @@ void Game::playerLookInBattleList(uint32_t playerId, uint32_t creatureId) {
return;
}

std::shared_ptr<Creature> creature = getCreatureByID(creatureId);
const auto &creature = getCreatureByID(creatureId);
if (!creature) {
return;
}
Expand Down Expand Up @@ -5863,7 +5863,7 @@ void Game::playerSetAttackedCreature(uint32_t playerId, uint32_t creatureId) {
return;
}

std::shared_ptr<Creature> attackCreature = getCreatureByID(creatureId);
const auto &attackCreature = getCreatureByID(creatureId);
if (!attackCreature) {
player->setAttackedCreature(nullptr);
player->sendCancelTarget();
Expand Down Expand Up @@ -9424,7 +9424,7 @@ void Game::parsePlayerExtendedOpcode(uint32_t playerId, uint8_t opcode, const st
}

void Game::forceRemoveCondition(uint32_t creatureId, ConditionType_t conditionType, ConditionId_t conditionId) {
std::shared_ptr<Creature> creature = getCreatureByID(creatureId);
const auto &creature = getCreatureByID(creatureId);
if (!creature) {
return;
}
Expand Down
6 changes: 3 additions & 3 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1522,9 +1522,9 @@ void ProtocolGame::checkCreatureAsKnown(uint32_t id, bool &known, uint32_t &remo
continue;
}
// We need to protect party players from removing
std::shared_ptr<Creature> creature = g_game().getCreatureByID(*it);
if (std::shared_ptr<Player> checkPlayer;
creature && (checkPlayer = creature->getPlayer()) != nullptr) {
const auto &creature = g_game().getCreatureByID(*it);
const auto &checkPlayer = creature ? creature->getPlayer() : nullptr;
if (checkPlayer) {
if (player->getParty() != checkPlayer->getParty() && !canSee(creature)) {
removedKnown = *it;
knownCreatureSet.erase(it);
Expand Down
Loading