Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ enum Say
SAY_SOULS_LICH_KING_RAND_WHISPER = 5
};

// How long the Lady Deathwhisper elevator stays motionless at each end of its cycle before departing again.
constexpr uint32 DARKWHISPER_ELEVATOR_DWELL_TIME = 7 * IN_MILLISECONDS;

BossBoundaryData const boundaries =
{
{ DATA_LORD_MARROWGAR, new CircleBoundary(Position(-428.0f,2211.0f), 95.0) },
Expand Down Expand Up @@ -212,7 +215,7 @@ class instance_icecrown_citadel : public InstanceMapScript
PutricideEventProgress = 0;
LichKingHeroicAvailable = true;
LichKingRandomWhisperTimer = 120 * IN_MILLISECONDS;
DarkwhisperElevatorTimer = 3000;
DarkwhisperElevatorTimer = DARKWHISPER_ELEVATOR_DWELL_TIME;

SetHeaders(DataHeader);
SetBossNumber(MAX_ENCOUNTERS);
Expand Down Expand Up @@ -1664,21 +1667,28 @@ class instance_icecrown_citadel : public InstanceMapScript
else
LichKingRandomWhisperTimer -= diff;

if (DarkwhisperElevatorTimer <= diff)
{
DarkwhisperElevatorTimer = 3000;
if (GetBossState(DATA_LADY_DEATHWHISPER) == DONE)
if (GameObject* elevator = instance->GetGameObject(LadyDeathwisperElevatorGUID))
if (StaticTransport* trans = elevator->ToStaticTransport())
if (GetBossState(DATA_LADY_DEATHWHISPER) == DONE)
if (GameObject* elevator = instance->GetGameObject(LadyDeathwisperElevatorGUID))
if (StaticTransport* trans = elevator->ToStaticTransport())
{
// StaticTransport::Update clamps PathProgress to exactly 0 / GetPauseTime() and then freezes
// there while GOState matches, so these two comparisons detect "parked at a stop" exactly.
bool const atBottom = trans->GetGoState() == GO_STATE_READY && trans->GetPathProgress() == 0;
bool const atTop = trans->GetGoState() == GO_STATE_ACTIVE &&
trans->GetPathProgress() == trans->GetPauseTime();

// Count the dwell down only while parked, so it always starts on arrival instead of on the
// phase of a free-running tick. Flipping GOState sends the transport towards the other end.
if (!atBottom && !atTop)
DarkwhisperElevatorTimer = DARKWHISPER_ELEVATOR_DWELL_TIME;
else if (DarkwhisperElevatorTimer <= diff)
{
if (trans->GetGoState() == GO_STATE_READY && trans->GetPathProgress() == 0)
trans->SetGoState(GO_STATE_ACTIVE);
else if (trans->GetGoState() == GO_STATE_ACTIVE && trans->GetPathProgress() == trans->GetPauseTime())
trans->SetGoState(GO_STATE_READY);
DarkwhisperElevatorTimer = DARKWHISPER_ELEVATOR_DWELL_TIME;
trans->SetGoState(atBottom ? GO_STATE_ACTIVE : GO_STATE_READY);
}
}
else
DarkwhisperElevatorTimer -= diff;
else
DarkwhisperElevatorTimer -= diff;
Comment on lines +1684 to +1690

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

fd -t f '^(Map|Transport)\.(cpp|h)$' . \
  -x rg -n -C 6 \
  'InstanceMap::Update|instance_data->Update|StaticTransport::Update|GetPathProgress|GetPauseTime' {}

Repository: azerothcore/azerothcore-wotlk

Length of output: 6406


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- review guidance files ---'
for f in .agents/docs/code-review.md .agents/docs/self-review-rules.md .agents/docs/cpp-guidelines.md .agents/docs/cpp-scripts.md; do
    if [ -f "$f" ]; then
        printf '\n--- %s ---\n' "$f"
        sed -n '1,240p' "$f"
    else
        printf '\n--- missing: %s ---\n' "$f"
    fi
done

printf '\n--- candidate files ---\n'
fd -t f -i 'map|transport' src/server/game src/server/scripts 2>/dev/null | head -80

printf '\n--- target source ---\n'
sed -n '1610,1710p' src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp

printf '\n--- target diff ---\n'
git diff -- src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp

printf '\n--- update implementations ---\n'
rg -n -C 18 'void (Map|InstanceMap|StaticTransport)::Update|instance_data->Update|Map::Update' src/server/game

Repository: azerothcore/azerothcore-wotlk

Length of output: 50387


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- review guidance files ---'
for f in .agents/docs/code-review.md .agents/docs/self-review-rules.md .agents/docs/cpp-guidelines.md .agents/docs/cpp-scripts.md; do
    if [ -f "$f" ]; then
        printf '\n--- %s ---\n' "$f"
        sed -n '1,240p' "$f"
    else
        printf '\n--- missing: %s ---\n' "$f"
    fi
done

printf '\n--- target source ---\n'
sed -n '1610,1710p' src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp

printf '\n--- target diff ---\n'
git diff -- src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp

printf '\n--- update implementations ---\n'
rg -n -C 18 'void (Map|InstanceMap|StaticTransport)::Update|instance_data->Update|Map::Update' src/server/game

Repository: azerothcore/azerothcore-wotlk

Length of output: 50387


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- map update ordering ---'
sed -n '436,565p' src/server/game/Maps/Map.cpp
sed -n '968,1025p' src/server/game/Entities/Transport/Transport.cpp

printf '\n--- elevator declarations and initialization ---\n'
rg -n -C 8 'DARKWHISPER_ELEVATOR|DarkwhisperElevatorTimer|LadyDeathwisperElevatorGUID|GO_LADY_DEATHWHISPER_ELEVATOR' \
  src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp

printf '\n--- repository state ---\n'
git status --short
git diff --stat
git diff --unified=30 -- src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp

printf '\n--- relevant current-master history summary ---\n'
git log -8 --oneline -- src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp

Repository: azerothcore/azerothcore-wotlk

Length of output: 12080


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- change under review ---'
git show --format=fuller --stat --oneline 786a2c20
git show --format= --unified=25 786a2c20 -- src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp

printf '\n--- parent implementation ---\n'
git show 786a2c20^:src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp |
    sed -n '55,85p;195,225p;1635,1685p;1895,1925p'

printf '\n--- update-diff bounds ---\n'
rg -n -C 5 't_diff|diff.*MAX|MAX.*diff|Update\([^)]*diff|World::Update' \
  src/server/game/World src/server/game/Maps src/server/game/Server | head -240

printf '\n--- deterministic timer model ---\n'
python3 - <<'PY'
DWELL = 7000

def tick(timer, progress, diff, pause):
    # StaticTransport::Update runs before InstanceMap::Update.
    arrived = progress < pause and progress + diff >= pause
    progress = pause if arrived else min(progress + diff, pause)
    parked = progress == pause
    if not parked:
        timer = DWELL
        action = "moving"
    elif timer <= diff:
        timer = DWELL
        action = "depart"
    else:
        timer -= diff
        action = "parked"
    return timer, progress, action, arrived

for diff in (1000, 8000):
    result = tick(DWELL, 6500, diff, 7000)
    print({"diff": diff, "result": result})
PY

Repository: azerothcore/azerothcore-wotlk

Length of output: 33187


Reset the dwell timer when the transport reaches an endpoint.

StaticTransport::Update runs before this code, so subtracting the full diff can shorten the stop or depart immediately when diff >= 7 seconds. Track endpoint arrival and decrement DarkwhisperElevatorTimer only on later updates.

Source: MCP tools

}

if (Events.Empty())
return;
Expand Down
Loading