Skip to content

Commit

Permalink
Remove mixed pools build
Browse files Browse the repository at this point in the history
  • Loading branch information
tanjo3 committed Jul 16, 2024
1 parent fddcb16 commit 5aa037f
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 138 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
exclude = wwrando, wwrando-s7, wwrando-random-settings, wwrando-mixed-pools
exclude = wwrando, wwrando-s7, wwrando-random-settings
max-line-length = 120
extend-ignore = E203, W503
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ jobs:
git clone --recursive https://github.com/wooferzfg/tww-rando-bot.git
echo "${{ secrets.WWRANDO_SEED_KEY }}" > tww-rando-bot/wwrando/keys/seed_key.py
echo "${{ secrets.WWRANDO_DEV_TANJO3_SEED_KEY }}" > tww-rando-bot/wwrando-s7/keys/seed_key.py
echo "${{ secrets.WWRANDO_MP_SEED_KEY }}" > tww-rando-bot/wwrando-mixed-pools/keys/seed_key.py
echo "${{ secrets.WWRANDO_RS_SEED_KEY }}" > tww-rando-bot/wwrando-random-settings/keys/seed_key.py
cd tww-rando-bot
export GITHUB_TOKEN=${{ secrets.BOT_GITHUB_TOKEN }}
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@
path = wwrando-random-settings
url = https://github.com/Aelire/wwrando.git
branch = randobot-support-keep-gclib
[submodule "wwrando-mixed-pools"]
path = wwrando-mixed-pools
url = https://github.com/wooferzfg/wwrando.git
branch = mixed-pools
18 changes: 4 additions & 14 deletions randobot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ class SeedType(Enum):

S7_PERMALINKS = OrderedDict([
("s7", "eJwz1DM00DOIt7RITrQwM2VwZLhrVMTF0czAwMDCAAUcIEKAgYGJg3GlykMQAyoRwuLAsmajv8G85QwMk/iB6jUB5s8MHw=="),
("miniblins", "eJwz1DM00DOIt7RITrQwM2VwZPA1cGAgEvgwOLAIXfS3uMvOwDJJfwlDgxIAVbMJPQ=="),
("mixed-pools", "eJwz1DM00DOIt7RITrQwM2VwZLi/IYGBSPDmgT/LkYv+BnPYGRgm8QMFFAG7egse"),
])
S7_DEFAULT = ["s7"]

S7_SL_PERMALINKS = OrderedDict([
("s7-sl", "eJwz1DM00DOIt7RITrQwM2VwZLhrVMTF0czAwMDCAAUcIEKAgYGJg3GlykMQAyoRwuLAsmajv8G85QwMk/iB6jkB5q8L/w=="),
("miniblins-sl", "eJwz1DM00DOIt7RITrQwM2VwZPA1cGAgEvgwOLAIXfS3uMvOwDJJfwlDAxMAVZMJHQ=="),
("mixed-pools-sl", "eJwz1DM00DOIt7RITrQwM2VwZLi/IYGBSPDmgT/LkYv+BnPYGRgm8QMFGAG7Wgr+"),
])
S7_SL_DEFAULT = ["s7-sl"]

Expand All @@ -72,20 +76,6 @@ class SeedType(Enum):
S7_DOWNLOAD = "https://github.com/tanjo3/wwrando/releases/tag/s7-v1"
S7_TRACKER = "https://wooferzfg.me/tww-rando-tracker/s7-tournament"

MP_PERMALINKS = OrderedDict([
("miniblins", "MS4xMC4wXzVmMWJhZTYAQQBNMEBMAEAEEvETzn8AEEh+SAEAIw=="),
("mixed-pools", "MS4xMC4wXzVmMWJhZTYAQQDfsGDs4E8ExPETjHsAAEg+AAAAIA=="),
])
MP_DEFAULT = ["mixed-pools"]

MP_SL_PERMALINKS = OrderedDict([
("mixed-pools-sl", "MS4xMC4wXzVmMWJhZTYAQQDfsGDs4E8ExPETjHsAAEg+AAAAAA=="),
])
MP_SL_DEFAULT = ["mixed-pools-sl"]

MP_PATH = "wwrando-mixed-pools"
MP_DOWNLOAD = "https://github.com/wooferzfg/wwrando/releases/tag/mixed-pools-build"

RS_PATH = "wwrando-random-settings"
RS_VERSION = "RS1.4.0-dev3"
RS_DOWNLOAD = "https://github.com/Aelire/wwrando/releases/tag/RS1.4.0-dev3"
Expand Down
57 changes: 17 additions & 40 deletions randobot/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,9 @@ async def ex_s7(self, args, message):
await self.send_message("Rolling seed...")

settings_permalink, modifiers = await self.choose_s7_permalink(
constants.S7_DEFAULT, constants.S7_PERMALINKS, args
constants.S7_DEFAULT,
constants.S7_PERMALINKS,
args
)

username = message.get("user", {}).get("name")
Expand All @@ -343,35 +345,10 @@ async def ex_s7(self, args, message):
args_format=ArgFormat.VS7,
)
await self.update_race_room_with_generated_seed(settings_permalink, generated_seed, SeedType.STANDARD)
await self.send_message("Please note that this seed uses the S7 Tournament build of the randomizer.")
await self.send_message(f"Download: {constants.S7_DOWNLOAD}")
await self.send_message(f"Tracker: {constants.S7_TRACKER}")

async def ex_rollmpseed(self, args, message):
if not await self.can_roll_standard_seed(message):
return

await self.send_message("Rolling seed...")

settings_permalink = await self.choose_permalink(
constants.MP_DEFAULT,
constants.MP_PERMALINKS,
args
)

username = message.get('user', {}).get('name')
generated_seed = await self._generate_seed(
constants.MP_PATH,
settings_permalink,
username,
generate_spoiler_log=False,
args_format=ArgFormat.V111,
)
await self.update_race_room_with_generated_seed(settings_permalink, generated_seed, SeedType.STANDARD)
await self.print_mixed_pools_build()
await self.print_s7_build()

async def ex_miniblins(self, args, message):
await self.ex_rollmpseed(['miniblins'], message)
await self.ex_s7(['miniblins'], message)

async def ex_randomsettings(self, args, message):
if not await self.can_roll_standard_seed(message):
Expand Down Expand Up @@ -502,27 +479,28 @@ async def ex_startspoilerlograce(self, args, message):

self.loop.create_task(self.start_spoiler_log_race())

async def ex_startmpspoilerlograce(self, args, message):
async def ex_starts7spoilerlograce(self, args, message):
if not await self.can_start_spoiler_log_race(message):
return

settings_permalink = await self.choose_permalink(
constants.MP_SL_DEFAULT,
constants.MP_SL_PERMALINKS,
settings_permalink, modifiers = await self.choose_s7_permalink(
constants.S7_SL_DEFAULT,
constants.S7_SL_PERMALINKS,
args
)
username = message.get('user', {}).get('name')

await self.send_message("Rolling seed...")
generated_seed = await self._generate_seed(
constants.MP_PATH,
constants.S7_PATH,
settings_permalink,
username,
generate_spoiler_log=True,
args_format=ArgFormat.V111,
modifiers=modifiers,
args_format=ArgFormat.VS7,
)
await self.update_race_room_with_generated_seed(settings_permalink, generated_seed, SeedType.SPOILER_LOG)
await self.print_mixed_pools_build()
await self.print_s7_build()

self.loop.create_task(self.start_spoiler_log_race())

Expand Down Expand Up @@ -722,11 +700,10 @@ async def print_banned_presets(self):
def seconds_remaining(self):
return (self.state.get("race_start_time") - datetime.now()).total_seconds()

async def print_mixed_pools_build(self):
await self.send_message(
f"Please note that this seed has been rolled on the Mixed Pools version of the randomizer. "
f"You can download it here: {constants.MP_DOWNLOAD}"
)
async def print_s7_build(self):
await self.send_message("Please note that this seed uses the S7 Tournament build of the randomizer.")
await self.send_message(f"Download: {constants.S7_DOWNLOAD}")
await self.send_message(f"Tracker: {constants.S7_TRACKER}")

async def print_example_permalink(self):
example_permalink = self.state.get("example_permalink")
Expand Down
103 changes: 27 additions & 76 deletions randobot/tests/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ async def test_rollseed_s7(self, mock_send_message, mock_set_raceinfo, mock_gene
call(f"Permalink: PERMA_{permalink}"),
call("Seed Hash: SEED HASH"),
call('Please note that this seed uses the S7 Tournament build of the randomizer.'),
call('Download: https://github.com/tanjo3/wwrando/releases/tag/s7-v1'),
call('Tracker: https://wooferzfg.me/tww-rando-tracker/s7-tournament'),
call("Download: https://github.com/tanjo3/wwrando/releases/tag/s7-v1"),
call("Tracker: https://wooferzfg.me/tww-rando-tracker/s7-tournament"),
])

self.assertEqual(mock_set_raceinfo.call_count, 1)
Expand Down Expand Up @@ -132,8 +132,8 @@ async def test_rollseed_s7_with_ra(self, mock_send_message, mock_set_raceinfo, m
call(f"Permalink: PERMA_{permalink}"),
call("Seed Hash: SEED HASH"),
call('Please note that this seed uses the S7 Tournament build of the randomizer.'),
call('Download: https://github.com/tanjo3/wwrando/releases/tag/s7-v1'),
call('Tracker: https://wooferzfg.me/tww-rando-tracker/s7-tournament'),
call("Download: https://github.com/tanjo3/wwrando/releases/tag/s7-v1"),
call("Tracker: https://wooferzfg.me/tww-rando-tracker/s7-tournament"),
])

self.assertEqual(mock_set_raceinfo.call_count, 2)
Expand Down Expand Up @@ -286,8 +286,8 @@ async def test_presets_and_permalinks_with_ra(
call(f"Permalink: PERMA_{permalink}"),
call("Seed Hash: SEED HASH"),
call('Please note that this seed uses the S7 Tournament build of the randomizer.'),
call('Download: https://github.com/tanjo3/wwrando/releases/tag/s7-v1'),
call('Tracker: https://wooferzfg.me/tww-rando-tracker/s7-tournament'),
call("Download: https://github.com/tanjo3/wwrando/releases/tag/s7-v1"),
call("Tracker: https://wooferzfg.me/tww-rando-tracker/s7-tournament"),
])

self.assertEqual(mock_set_raceinfo.call_count, 2)
Expand Down Expand Up @@ -375,43 +375,6 @@ async def test_invalid_ra(
call("Invalid preset: \"s7+garbage\" - Invalid runners' agreement modifier!"),
])

@patch.object(MockGenerator, "generate_seed", side_effect=mock_generate_seed_standard)
@patch.object(RandoHandler, "set_raceinfo", return_value=async_return(None))
@patch.object(RandoHandler, "send_message", return_value=async_return(None))
async def test_rollmpseed(self, mock_send_message, mock_set_raceinfo, mock_generate_seed):
generator = MockGenerator()
state = {}
handler = create_rando_handler(generator, state)
await handler.ex_rollmpseed([], get_mock_message_data())

self.assertEqual(mock_send_message.call_count, 4)
mock_send_message.assert_has_calls([
call("Rolling seed..."),
call("Permalink: PERMA_MS4xMC4wXzVmMWJhZTYAQQDfsGDs4E8ExPETjHsAAEg+AAAAIA=="),
call("Seed Hash: SEED HASH"),
call(
"Please note that this seed has been rolled on the Mixed Pools "
"version of the randomizer. You can download it here: "
"https://github.com/wooferzfg/wwrando/releases/tag/mixed-pools-build"
),
])

self.assertEqual(mock_set_raceinfo.call_count, 1)
mock_set_raceinfo.assert_has_calls([
call("PERMA_MS4xMC4wXzVmMWJhZTYAQQDfsGDs4E8ExPETjHsAAEg+AAAAIA== | Seed Hash: SEED HASH", False, False),
])

self.assertEqual(mock_generate_seed.call_count, 1)
mock_generate_seed.assert_has_calls([
call(
"wwrando-mixed-pools",
"MS4xMC4wXzVmMWJhZTYAQQDfsGDs4E8ExPETjHsAAEg+AAAAIA==",
"test_user",
generate_spoiler_log=False,
args_format=ArgFormat.V111,
),
])

@patch.object(MockGenerator, "generate_seed", side_effect=mock_generate_seed_standard)
@patch.object(RandoHandler, "set_raceinfo", return_value=async_return(None))
@patch.object(RandoHandler, "send_message", return_value=async_return(None))
Expand All @@ -421,32 +384,26 @@ async def test_miniblins(self, mock_send_message, mock_set_raceinfo, mock_genera
handler = create_rando_handler(generator, state)
await handler.ex_miniblins([], get_mock_message_data())

self.assertEqual(mock_send_message.call_count, 4)
self.assertEqual(mock_send_message.call_count, 6)
permalink = "eJwz1DM00DOIt7RITrQwM2VwZPA1cGAgEvgwOLAIXfS3uMvOwDJJfwlDgxIAVbMJPQ=="
mock_send_message.assert_has_calls([
call("Rolling seed..."),
call("Permalink: PERMA_MS4xMC4wXzVmMWJhZTYAQQBNMEBMAEAEEvETzn8AEEh+SAEAIw=="),
call(f"Permalink: PERMA_{permalink}"),
call("Seed Hash: SEED HASH"),
call(
"Please note that this seed has been rolled on the Mixed Pools "
"version of the randomizer. You can download it here: "
"https://github.com/wooferzfg/wwrando/releases/tag/mixed-pools-build"
),
call('Please note that this seed uses the S7 Tournament build of the randomizer.'),
call("Download: https://github.com/tanjo3/wwrando/releases/tag/s7-v1"),
call("Tracker: https://wooferzfg.me/tww-rando-tracker/s7-tournament"),
])

self.assertEqual(mock_set_raceinfo.call_count, 1)
mock_set_raceinfo.assert_has_calls([
call("PERMA_MS4xMC4wXzVmMWJhZTYAQQBNMEBMAEAEEvETzn8AEEh+SAEAIw== | Seed Hash: SEED HASH", False, False),
call(f"PERMA_{permalink} | Seed Hash: SEED HASH", False, False),
])

self.assertEqual(mock_generate_seed.call_count, 1)
mock_generate_seed.assert_has_calls([
call(
"wwrando-mixed-pools",
"MS4xMC4wXzVmMWJhZTYAQQBNMEBMAEAEEvETzn8AEEh+SAEAIw==",
"test_user",
generate_spoiler_log=False,
args_format=ArgFormat.V111,
),
call("wwrando-s7", permalink, "test_user", generate_spoiler_log=False,
modifiers="", args_format=ArgFormat.VS7),
])

@patch("asyncio.sleep", return_value=async_return(None))
Expand Down Expand Up @@ -540,23 +497,22 @@ async def test_startspoilerlogtimer(self, mock_send_message, mock_set_raceinfo,
@patch.object(MockGenerator, "generate_seed", side_effect=mock_generate_seed_spoiler_log)
@patch.object(RandoHandler, "set_raceinfo", return_value=async_return(None))
@patch.object(RandoHandler, "send_message", return_value=async_return(None))
async def test_startmpspoilerlograce(self, mock_send_message, mock_set_raceinfo, mock_generate_seed, mock_sleep):
async def test_starts7spoilerlograce(self, mock_send_message, mock_set_raceinfo, mock_generate_seed, mock_sleep):
generator = MockGenerator()
state = {}
handler = create_rando_handler(generator, state)
await handler.ex_startmpspoilerlograce([], get_mock_message_data())
await handler.ex_starts7spoilerlograce([], get_mock_message_data())

await wait_for_all_async_tasks()

self.assertEqual(mock_send_message.call_count, 13)
self.assertEqual(mock_send_message.call_count, 15)
permalink = "eJwz1DM00DOIt7RITrQwM2VwZLhrVMTF0czAwMDCAAUcIEKAgYGJg3GlykMQAyoRwuLAsmajv8G85QwMk/iB6jkB5q8L/w=="
mock_send_message.assert_has_calls([
call("Rolling seed..."),
call("Seed rolled!"),
call(
"Please note that this seed has been rolled on the Mixed Pools "
"version of the randomizer. You can download it here: "
"https://github.com/wooferzfg/wwrando/releases/tag/mixed-pools-build"
),
call('Please note that this seed uses the S7 Tournament build of the randomizer.'),
call("Download: https://github.com/tanjo3/wwrando/releases/tag/s7-v1"),
call("Tracker: https://wooferzfg.me/tww-rando-tracker/s7-tournament"),
call("Preparation stage starts in 15 seconds..."),
call("5..."),
call("4..."),
Expand All @@ -565,26 +521,21 @@ async def test_startmpspoilerlograce(self, mock_send_message, mock_set_raceinfo,
call("1..."),
call("You have 60 minutes to prepare your route!"),
call("Spoiler Log: SPOILER_LOG_URL"),
call("Example Permalink: MS4xMC4wXzVmMWJhZTYAQQDfsGDs4E8ExPETjHsAAEg+AAAAAA=="),
call(f"Example Permalink: {permalink}"),
call("Warning: The seed from this permalink does not match the actual permalink!")
])

mock_set_raceinfo.assert_not_called()

self.assertEqual(mock_generate_seed.call_count, 1)
mock_generate_seed.assert_has_calls([
call(
"wwrando-mixed-pools",
"MS4xMC4wXzVmMWJhZTYAQQDfsGDs4E8ExPETjHsAAEg+AAAAAA==",
"test_user",
generate_spoiler_log=True,
args_format=ArgFormat.V111,
),
call("wwrando-s7", permalink, "test_user", generate_spoiler_log=True,
modifiers="", args_format=ArgFormat.VS7),
])

self.assertEqual(state["spoiler_log_seed_rolled"], True)
self.assertEqual(state["example_permalink"], "MS4xMC4wXzVmMWJhZTYAQQDfsGDs4E8ExPETjHsAAEg+AAAAAA==")
self.assertEqual(state["permalink"], "PERMA_MS4xMC4wXzVmMWJhZTYAQQDfsGDs4E8ExPETjHsAAEg+AAAAAA==")
self.assertEqual(state["example_permalink"], permalink)
self.assertEqual(state["permalink"], f"PERMA_{permalink}")
self.assertEqual(state["spoiler_log_url"], "SPOILER_LOG_URL")
self.assertEqual(state["seed_hash"], "SEED HASH")
self.assertEqual(state["file_name"], "FILENAME")
Expand Down
2 changes: 1 addition & 1 deletion setup-wwrando.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ for rando in wwrando; do
python3.10 -m venv /venv/$rando --upgrade-deps &&
/venv/$rando/bin/pip install --no-cache-dir -r requirements.txt)
done
for rando in wwrando-s7 wwrando-mixed-pools wwrando-random-settings; do
for rando in wwrando-s7 wwrando-random-settings; do
(cd $rando &&
python3.12 -m venv /venv/$rando --upgrade-deps &&
/venv/$rando/bin/pip install --no-cache-dir -r requirements.txt)
Expand Down
1 change: 0 additions & 1 deletion wwrando-mixed-pools
Submodule wwrando-mixed-pools deleted from 670ed9

0 comments on commit 5aa037f

Please sign in to comment.