The Plague the Pets Carried — JavaScript Bug Hunt

Modelled on World of Warcraft's Corrupted Blood incident (September 2005): a debuff cast by the boss Hakkar in the new Zul'Gurub raid was meant to stay…

  • Language: JavaScript
  • Layer: Backend
  • Difficulty: Easy
  • Concepts: State
  • Modelled on: World of Warcraft · 2005
  • Visible tests: the player leaves clean and keeps ordinary debuffs; a dismissed pet is cleaned too
  • Reward: 50 XP for a complete fix

Briefing

Modelled on World of Warcraft's Corrupted Blood incident (September 2005): a debuff cast by the boss Hakkar in the new Zul'Gurub raid was meant to stay inside that zone. But a hunter's pet that was dismissed while infected kept the debuff, and when it was summoned again in a capital city the plague spread from player to player across the world. Blizzard had to fix the mechanic and reset the servers.

This project is a reconstruction. zone.js strips zone-bound debuffs when a player leaves the instance — from the player, and from their pet only if the pet is currently summoned.

Fix leaveInstance so nothing the player owns leaves the zone still carrying a zone-bound debuff.

Bug report

BUG-ZG-HAKKAR · Priority: P0 · Reported by: every city on the realm

leaveInstance(world, playerId):

  • removes every debuff with zoneBound: true from the player
  • removes every zoneBound debuff from the player's pet (player.petId), whether the pet is summoned or dismissed; a player may have no pet (petId null)
  • keeps every debuff that is not zone-bound, in its original order
  • sets the player's zone to "world"

Observed: a pet dismissed inside Zul'Gurub still carries Corrupted Blood when summoned in Ironforge.

Logs

[zone] rexxar left zulgurub, debuffs cleared
[ironforge] misha summoned with Corrupted Blood
[ironforge] 214 players infected in 3 minutes

The code as shipped

src/raid/zone.js (editable)

function stripZoneBound(entity) {
  entity.debuffs = entity.debuffs.filter(function (d) { return !d.zoneBound; });
}

exports.leaveInstance = function (world, playerId) {
  var player = world.entities[playerId];
  stripZoneBound(player);
  if (player.petId && world.entities[player.petId].summoned) {
    stripZoneBound(world.entities[player.petId]);
  }
  player.zone = "world";
};

Read-only context: src/raid/world.js.

Open the hunt to edit the files, run the visible tests and submit against the hidden ones. More JavaScript bug hunts.