Skip to content

Commit

Permalink
Merge branch 'ArchipelagoMW:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Electro1512 authored Dec 6, 2023
2 parents 2aa4c29 + 87252c1 commit 14f14e0
Show file tree
Hide file tree
Showing 18 changed files with 400 additions and 159 deletions.
6 changes: 6 additions & 0 deletions WebHostLib/customserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ async def main():
ctx.auto_shutdown = Room.get(id=room_id).timeout
ctx.shutdown_task = asyncio.create_task(auto_shutdown(ctx, []))
await ctx.shutdown_task

# ensure auto launch is on the same page in regard to room activity.
with db_session:
room: Room = Room.get(id=ctx.room_id)
room.last_activity = datetime.datetime.utcnow() - datetime.timedelta(seconds=room.timeout + 60)

logging.info("Shutting down")

with Locker(room_id):
Expand Down
6 changes: 3 additions & 3 deletions ZillionClient.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
import base64
import platform
from typing import Any, ClassVar, Coroutine, Dict, List, Optional, Protocol, Tuple, Type, cast
from typing import Any, ClassVar, Coroutine, Dict, List, Optional, Protocol, Tuple, cast

# CommonClient import first to trigger ModuleUpdater
from CommonClient import CommonContext, server_loop, gui_enabled, \
Expand All @@ -10,7 +10,7 @@
import Utils
from Utils import async_start

import colorama # type: ignore
import colorama

from zilliandomizer.zri.memory import Memory
from zilliandomizer.zri import events
Expand Down Expand Up @@ -45,7 +45,7 @@ def __call__(self, rooms: List[List[int]]) -> None: ...

class ZillionContext(CommonContext):
game = "Zillion"
command_processor: Type[ClientCommandProcessor] = ZillionCommandProcessor
command_processor = ZillionCommandProcessor
items_handling = 1 # receive items from other players

known_name: Optional[str]
Expand Down
1 change: 1 addition & 0 deletions worlds/ffmq/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def __init__(self, item_id, classification, groups=(), data_name=None):
"Pazuzu 5F": ItemData(None, ItemClassification.progression),
"Pazuzu 6F": ItemData(None, ItemClassification.progression),
"Dark King": ItemData(None, ItemClassification.progression),
"Tristam Bone Item Given": ItemData(None, ItemClassification.progression),
#"Barred": ItemData(None, ItemClassification.progression),

}
Expand Down
102 changes: 100 additions & 2 deletions worlds/ffmq/Options.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from Options import Choice, FreeText, Toggle
from Options import Choice, FreeText, Toggle, Range


class Logic(Choice):
Expand Down Expand Up @@ -131,6 +131,21 @@ class EnemizerAttacks(Choice):
default = 0


class EnemizerGroups(Choice):
"""Set which enemy groups will be affected by Enemizer."""
display_name = "Enemizer Groups"
option_mobs_only = 0
option_mobs_and_bosses = 1
option_mobs_bosses_and_dark_king = 2
default = 1


class ShuffleResWeakType(Toggle):
"""Resistance and Weakness types are shuffled for all enemies."""
display_name = "Shuffle Resistance/Weakness Types"
default = 0


class ShuffleEnemiesPositions(Toggle):
"""Instead of their original position in a given map, enemies are randomly placed."""
display_name = "Shuffle Enemies' Positions"
Expand Down Expand Up @@ -231,19 +246,103 @@ class BattlefieldsBattlesQuantities(Choice):
option_random_one_through_ten = 6


class CompanionLevelingType(Choice):
"""Set how companions gain levels.
Quests: Complete each companion's individual quest for them to promote to their second version.
Quests Extended: Each companion has four exclusive quests, leveling each time a quest is completed.
Save the Crystals (All): Each time a Crystal is saved, all companions gain levels.
Save the Crystals (Individual): Each companion will level to their second version when a specific Crystal is saved.
Benjamin Level: Companions' level tracks Benjamin's."""
option_quests = 0
option_quests_extended = 1
option_save_crystals_individual = 2
option_save_crystals_all = 3
option_benjamin_level = 4
option_benjamin_level_plus_5 = 5
option_benjamin_level_plus_10 = 6
default = 0
display_name = "Companion Leveling Type"


class CompanionSpellbookType(Choice):
"""Update companions' spellbook.
Standard: Original game spellbooks.
Standard Extended: Add some extra spells. Tristam gains Exit and Quake and Reuben gets Blizzard.
Random Balanced: Randomize the spellbooks with an appropriate mix of spells.
Random Chaos: Randomize the spellbooks in total free-for-all."""
option_standard = 0
option_standard_extended = 1
option_random_balanced = 2
option_random_chaos = 3
default = 0
display_name = "Companion Spellbook Type"


class StartingCompanion(Choice):
"""Set a companion to start with.
Random Companion: Randomly select one companion.
Random Plus None: Randomly select a companion, with the possibility of none selected."""
display_name = "Starting Companion"
default = 0
option_none = 0
option_kaeli = 1
option_tristam = 2
option_phoebe = 3
option_reuben = 4
option_random_companion = 5
option_random_plus_none = 6


class AvailableCompanions(Range):
"""Select randomly which companions will join your party. Unavailable companions can still be reached to get their items and complete their quests if needed.
Note: If a Starting Companion is selected, it will always be available, regardless of this setting."""
display_name = "Available Companions"
default = 4
range_start = 0
range_end = 4


class CompanionsLocations(Choice):
"""Set the primary location of companions. Their secondary location is always the same.
Standard: Companions will be at the same locations as in the original game.
Shuffled: Companions' locations are shuffled amongst themselves.
Shuffled Extended: Add all the Temples, as well as Phoebe's House and the Rope Bridge as possible locations."""
display_name = "Companions' Locations"
default = 0
option_standard = 0
option_shuffled = 1
option_shuffled_extended = 2


class KaelisMomFightsMinotaur(Toggle):
"""Transfer Kaeli's requirements (Tree Wither, Elixir) and the two items she's giving to her mom.
Kaeli will be available to join the party right away without the Tree Wither."""
display_name = "Kaeli's Mom Fights Minotaur"
default = 0


option_definitions = {
"logic": Logic,
"brown_boxes": BrownBoxes,
"sky_coin_mode": SkyCoinMode,
"shattered_sky_coin_quantity": ShatteredSkyCoinQuantity,
"starting_weapon": StartingWeapon,
"progressive_gear": ProgressiveGear,
"leveling_curve": LevelingCurve,
"starting_companion": StartingCompanion,
"available_companions": AvailableCompanions,
"companions_locations": CompanionsLocations,
"kaelis_mom_fight_minotaur": KaelisMomFightsMinotaur,
"companion_leveling_type": CompanionLevelingType,
"companion_spellbook_type": CompanionSpellbookType,
"enemies_density": EnemiesDensity,
"enemies_scaling_lower": EnemiesScalingLower,
"enemies_scaling_upper": EnemiesScalingUpper,
"bosses_scaling_lower": BossesScalingLower,
"bosses_scaling_upper": BossesScalingUpper,
"enemizer_attacks": EnemizerAttacks,
"enemizer_groups": EnemizerGroups,
"shuffle_res_weak_types": ShuffleResWeakType,
"shuffle_enemies_position": ShuffleEnemiesPositions,
"progressive_formations": ProgressiveFormations,
"doom_castle_mode": DoomCastle,
Expand All @@ -253,6 +352,5 @@ class BattlefieldsBattlesQuantities(Choice):
"crest_shuffle": CrestShuffle,
"shuffle_battlefield_rewards": ShuffleBattlefieldRewards,
"map_shuffle_seed": MapShuffleSeed,
"leveling_curve": LevelingCurve,
"battlefields_battles_quantities": BattlefieldsBattlesQuantities,
}
80 changes: 46 additions & 34 deletions worlds/ffmq/Output.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,46 +35,58 @@ def output_item_name(item):
"item_name": location.item.name})

def cc(option):
return option.current_key.title().replace("_", "").replace("OverworldAndDungeons", "OverworldDungeons")
return option.current_key.title().replace("_", "").replace("OverworldAndDungeons",
"OverworldDungeons").replace("MobsAndBosses", "MobsBosses").replace("MobsBossesAndDarkKing",
"MobsBossesDK").replace("BenjaminLevelPlus", "BenPlus").replace("BenjaminLevel", "BenPlus0").replace(
"RandomCompanion", "Random")

def tf(option):
return True if option else False

options = deepcopy(settings_template)
options["name"] = self.multiworld.player_name[self.player]

option_writes = {
"enemies_density": cc(self.multiworld.enemies_density[self.player]),
"chests_shuffle": "Include",
"shuffle_boxes_content": self.multiworld.brown_boxes[self.player] == "shuffle",
"npcs_shuffle": "Include",
"battlefields_shuffle": "Include",
"logic_options": cc(self.multiworld.logic[self.player]),
"shuffle_enemies_position": tf(self.multiworld.shuffle_enemies_position[self.player]),
"enemies_scaling_lower": cc(self.multiworld.enemies_scaling_lower[self.player]),
"enemies_scaling_upper": cc(self.multiworld.enemies_scaling_upper[self.player]),
"bosses_scaling_lower": cc(self.multiworld.bosses_scaling_lower[self.player]),
"bosses_scaling_upper": cc(self.multiworld.bosses_scaling_upper[self.player]),
"enemizer_attacks": cc(self.multiworld.enemizer_attacks[self.player]),
"leveling_curve": cc(self.multiworld.leveling_curve[self.player]),
"battles_quantity": cc(self.multiworld.battlefields_battles_quantities[self.player]) if
self.multiworld.battlefields_battles_quantities[self.player].value < 5 else
"RandomLow" if
self.multiworld.battlefields_battles_quantities[self.player].value == 5 else
"RandomHigh",
"shuffle_battlefield_rewards": tf(self.multiworld.shuffle_battlefield_rewards[self.player]),
"random_starting_weapon": True,
"progressive_gear": tf(self.multiworld.progressive_gear[self.player]),
"tweaked_dungeons": tf(self.multiworld.tweak_frustrating_dungeons[self.player]),
"doom_castle_mode": cc(self.multiworld.doom_castle_mode[self.player]),
"doom_castle_shortcut": tf(self.multiworld.doom_castle_shortcut[self.player]),
"sky_coin_mode": cc(self.multiworld.sky_coin_mode[self.player]),
"sky_coin_fragments_qty": cc(self.multiworld.shattered_sky_coin_quantity[self.player]),
"enable_spoilers": False,
"progressive_formations": cc(self.multiworld.progressive_formations[self.player]),
"map_shuffling": cc(self.multiworld.map_shuffle[self.player]),
"crest_shuffle": tf(self.multiworld.crest_shuffle[self.player]),
}
"enemies_density": cc(self.multiworld.enemies_density[self.player]),
"chests_shuffle": "Include",
"shuffle_boxes_content": self.multiworld.brown_boxes[self.player] == "shuffle",
"npcs_shuffle": "Include",
"battlefields_shuffle": "Include",
"logic_options": cc(self.multiworld.logic[self.player]),
"shuffle_enemies_position": tf(self.multiworld.shuffle_enemies_position[self.player]),
"enemies_scaling_lower": cc(self.multiworld.enemies_scaling_lower[self.player]),
"enemies_scaling_upper": cc(self.multiworld.enemies_scaling_upper[self.player]),
"bosses_scaling_lower": cc(self.multiworld.bosses_scaling_lower[self.player]),
"bosses_scaling_upper": cc(self.multiworld.bosses_scaling_upper[self.player]),
"enemizer_attacks": cc(self.multiworld.enemizer_attacks[self.player]),
"leveling_curve": cc(self.multiworld.leveling_curve[self.player]),
"battles_quantity": cc(self.multiworld.battlefields_battles_quantities[self.player]) if
self.multiworld.battlefields_battles_quantities[self.player].value < 5 else
"RandomLow" if
self.multiworld.battlefields_battles_quantities[self.player].value == 5 else
"RandomHigh",
"shuffle_battlefield_rewards": tf(self.multiworld.shuffle_battlefield_rewards[self.player]),
"random_starting_weapon": True,
"progressive_gear": tf(self.multiworld.progressive_gear[self.player]),
"tweaked_dungeons": tf(self.multiworld.tweak_frustrating_dungeons[self.player]),
"doom_castle_mode": cc(self.multiworld.doom_castle_mode[self.player]),
"doom_castle_shortcut": tf(self.multiworld.doom_castle_shortcut[self.player]),
"sky_coin_mode": cc(self.multiworld.sky_coin_mode[self.player]),
"sky_coin_fragments_qty": cc(self.multiworld.shattered_sky_coin_quantity[self.player]),
"enable_spoilers": False,
"progressive_formations": cc(self.multiworld.progressive_formations[self.player]),
"map_shuffling": cc(self.multiworld.map_shuffle[self.player]),
"crest_shuffle": tf(self.multiworld.crest_shuffle[self.player]),
"enemizer_groups": cc(self.multiworld.enemizer_groups[self.player]),
"shuffle_res_weak_type": tf(self.multiworld.shuffle_res_weak_types[self.player]),
"companion_leveling_type": cc(self.multiworld.companion_leveling_type[self.player]),
"companion_spellbook_type": cc(self.multiworld.companion_spellbook_type[self.player]),
"starting_companion": cc(self.multiworld.starting_companion[self.player]),
"available_companions": ["Zero", "One", "Two",
"Three", "Four"][self.multiworld.available_companions[self.player].value],
"companions_locations": cc(self.multiworld.companions_locations[self.player]),
"kaelis_mom_fight_minotaur": tf(self.multiworld.kaelis_mom_fight_minotaur[self.player]),
}

for option, data in option_writes.items():
options["Final Fantasy Mystic Quest"][option][data] = 1

Expand All @@ -83,7 +95,7 @@ def tf(option):
'utf8')
self.rom_name_available_event.set()

setup = {"version": "1.4", "name": self.multiworld.player_name[self.player], "romname": rom_name, "seed":
setup = {"version": "1.5", "name": self.multiworld.player_name[self.player], "romname": rom_name, "seed":
hex(self.multiworld.per_slot_randoms[self.player].randint(0, 0xFFFFFFFF)).split("0x")[1].upper()}

starting_items = [output_item_name(item) for item in self.multiworld.precollected_items[self.player]]
Expand Down
4 changes: 3 additions & 1 deletion worlds/ffmq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ def stage_generate_early(cls, multiworld):
map_shuffle = multiworld.map_shuffle[world.player].value
crest_shuffle = multiworld.crest_shuffle[world.player].current_key
battlefield_shuffle = multiworld.shuffle_battlefield_rewards[world.player].current_key
companion_shuffle = multiworld.companions_locations[world.player].value
kaeli_mom = multiworld.kaelis_mom_fight_minotaur[world.player].current_key

query = f"s={seed}&m={map_shuffle}&c={crest_shuffle}&b={battlefield_shuffle}"
query = f"s={seed}&m={map_shuffle}&c={crest_shuffle}&b={battlefield_shuffle}&cs={companion_shuffle}&km={kaeli_mom}"

if query in rooms_data:
world.rooms = rooms_data[query]
Expand Down
35 changes: 30 additions & 5 deletions worlds/ffmq/data/entrances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -827,12 +827,12 @@
id: 164
area: 47
coordinates: [14, 6]
teleporter: [16, 2]
teleporter: [98, 8] # Script for reuben, original value [16, 2]
- name: Fireburg - Hotel
id: 165
area: 47
coordinates: [20, 8]
teleporter: [17, 2]
teleporter: [96, 8] # It's a script now for tristam, original value [17, 2]
- name: Fireburg - GrenadeMan House Script
id: 166
area: 47
Expand Down Expand Up @@ -1178,6 +1178,16 @@
area: 60
coordinates: [2, 7]
teleporter: [123, 0]
- name: Lava Dome Pointless Room - Visit Quest Script 1
id: 490
area: 60
coordinates: [4, 4]
teleporter: [99, 8]
- name: Lava Dome Pointless Room - Visit Quest Script 2
id: 491
area: 60
coordinates: [4, 5]
teleporter: [99, 8]
- name: Lava Dome Lower Moon Helm Room - Left Entrance
id: 235
area: 60
Expand Down Expand Up @@ -1568,6 +1578,11 @@
area: 79
coordinates: [2, 45]
teleporter: [174, 0]
- name: Mount Gale - Visit Quest
id: 494
area: 79
coordinates: [44, 7]
teleporter: [101, 8]
- name: Windia - Main Entrance 1
id: 312
area: 80
Expand Down Expand Up @@ -1613,11 +1628,11 @@
area: 80
coordinates: [21, 39]
teleporter: [30, 5]
- name: Windia - INN's Script # Change to teleporter
- name: Windia - INN's Script # Change to teleporter / Change back to script!
id: 321
area: 80
coordinates: [18, 34]
teleporter: [31, 2] # Original value [79, 8]
teleporter: [97, 8] # Original value [79, 8] > [31, 2]
- name: Windia - Vendor House
id: 322
area: 80
Expand Down Expand Up @@ -1697,7 +1712,7 @@
id: 337
area: 82
coordinates: [45, 24]
teleporter: [215, 0]
teleporter: [102, 8] # Changed to script, original value [215, 0]
- name: Windia Inn Lobby - Exit
id: 338
area: 82
Expand Down Expand Up @@ -1998,6 +2013,16 @@
area: 95
coordinates: [29, 37]
teleporter: [70, 8]
- name: Light Temple - Visit Quest Script 1
id: 492
area: 95
coordinates: [34, 39]
teleporter: [100, 8]
- name: Light Temple - Visit Quest Script 2
id: 493
area: 95
coordinates: [35, 39]
teleporter: [100, 8]
- name: Ship Dock - Mobius Teleporter Script
id: 397
area: 96
Expand Down
Loading

0 comments on commit 14f14e0

Please sign in to comment.