diff --git a/src/GUI/UI/Houses/TownHall.cpp b/src/GUI/UI/Houses/TownHall.cpp index fbed5f963861..5f606ac7ddd8 100644 --- a/src/GUI/UI/Houses/TownHall.cpp +++ b/src/GUI/UI/Houses/TownHall.cpp @@ -145,106 +145,9 @@ std::vector GUIWindow_TownHall::listDialogueOptions() { MonsterId GUIWindow_TownHall::randomMonsterForHunting(HouseId townhall) { while (true) { - // TODO(captainurist): I got lazy here. Use actual enum values. - int result = grng->random(258) + 1; - switch (townhall) { - case HOUSE_TOWN_HALL_HARMONDALE: - if ((result < 115 || result > 132) && - (result < 235 || result > 252) && - (result < 133 || result > 150) && - (result < 0x97u || result > 0xBAu) && - (result < 0xBEu || result > 0xC0u) && - (result < 0xC4u || result > 0xC6u) && - (result < 0x2Bu || result > 0x2Du) && - (result < 0xCDu || result > 0xCFu) && - (result < 0x5Eu || result > 0x60u) && - (result < 0xFDu || result > 0xFFu) && - (result < 0x6Du || result > 0x6Fu) && - (result < 0x61u || result > 0x63u)) - return static_cast(result); - break; - - case HOUSE_TOWN_HALL_ERATHIA: - if ((result < 115 || result > 132) && - (result < 0xE8u || result > 0xF9u) && - (result < 0x85u || result > 0x96u) && - (result < 0x97u || result > 0xBAu) && - (result < 0xBEu || result > 0xC0u) && - (result < 0xC4u || result > 0xC6u) && - (result < 0x2Bu || result > 0x2Du) && - (result < 0x52u || result > 0x54u) && - (result < 4 || result > 6) && - (result < 0x37u || result > 0x39u) && - (result < 0x3Au || result > 0x3Cu) && - (result < 0x3Du || result > 0x3Fu) && - (result < 0xFDu || result > 0xFFu) && - (result < 0x61u || result > 0x63u) && - (result < 0xCDu || result > 0xCFu)) - return static_cast(result); - break; - - case HOUSE_TOWN_HALL_TULAREAN_FOREST: - if ((result < 0x73u || result > 0x84u) && - (result < 0xE8u || result > 0xF9u) && - (result < 0x85u || result > 0x96u) && - (result < 0x97u || result > 0xBAu) && - (result < 0xBEu || result > 0xC0u) && - (result < 0xC4u || result > 0xC6u) && - (result < 0x2Bu || result > 0x2Du) && - (result < 0x31u || result > 0x33u) && - (result < 0x34u || result > 0x36u) && - (result < 0xFDu || result > 0xFFu) && - (result < 0x61u || result > 0x63u) && - (result < 0x1Cu || result > 0x1Eu)) - return static_cast(result); - break; - - case HOUSE_TOWN_HALL_CELESTE: - if ((result < 0x73u || result > 0x84u) && - (result < 0xE8u || result > 0xF9u) && - (result < 0x85u || result > 0x96u) && - (result < 0x97u || result > 0xBAu) && - (result < 0xBEu || result > 0xC0u) && - (result < 0xC4u || result > 0xC6u) && - (result < 0x2Bu || result > 0x2Du) && - (result < 0x5Eu || result > 0x60u) && - (result < 0x43u || result > 0x45u) && - (result < 0x4Fu || result > 0x51u) && - (result < 0xC1u || result > 0xC3u) && - (result < 0x13u || result > 0x15u) && - (result < 0xFDu || result > 0xFFu) && - (result < 0x61u || result > 0x63u) && - (result < 0x6Au || result > 0x6Cu)) - return static_cast(result); - break; - - case HOUSE_TOWN_HALL_PIT: - if ((result < 0x73u || result > 0x84u) && - (result < 0xE8u || result > 0xF9u) && - (result < 0x85u || result > 0x96u) && - (result < 0x97u || result > 0xBAu) && - (result < 0xBEu || result > 0xC0u) && - (result < 0xC4u || result > 0xC6u) && - (result < 0x2Bu || result > 0x2Du) && - (result < 0x6Du || result > 0x6Fu) && - (result < 0x46u || result > 0x48u) && - (result < 0x100u || result > 0x102u) && - (result < 0xD9u || result > 0xDBu) && - (result < 0xC7u || result > 0xC9u) && - (result < 0xE5u || result > 0xE7u) && - (result < 0xDFu || result > 0xE1u) && - (result < 0x5Bu || result > 0x5Du) && - (result < 0x49u || result > 0x4Bu) && - (result < 0xFDu || result > 0xFFu) && - (result < 0x61u || result > 0x63u) && - (result < 0x10u || result > 0x12u)) - return static_cast(result); - break; - - default: - assert(false); - return MONSTER_INVALID; - } + MonsterId result = grng->randomSample(allMonsters()); + if (isBountyHuntable(monsterTypeForMonsterId(result), townhall)) + return result; } }