Files
Grinch-AP/worlds/saving_princess/Items.py
LeonarthCG c9625e1b35 Saving Princess: implement new game (#3238)
* Saving Princess: initial commit

* settings -> options

Co-authored-by: Scipio Wright <scipiowright@gmail.com>

* settings -> options

Co-authored-by: Scipio Wright <scipiowright@gmail.com>

* replace RegionData class with List[str]

RegionData was only wrapping a List[str], so we can directly use List[str]

* world: MultiWorld -> multiworld: MultiWorld

* use world's random instead of multiworld's

* use state's has_any and has_all where applicable

* remove unused StartInventory import

* reorder PerGameCommonOptions

* fix relative AutoWorld import

Co-authored-by: Scipio Wright <scipiowright@gmail.com>

* clean up double spaces

* local commands -> Local Commands

Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com>

* remove redundant which items section

Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com>

* game info rework

* clean up item count redundancy

* add game to readme and codeowners

* fix get_region_entrance return type

* world.multiworld.get -> world.get

* add more events

added events for the boss kills that open the gate, as well as for system power being restored

these only apply if expanded pool is not selected

* add client/autoupdater to launcher

* reorder commands in game info

* update docs with automated installation info

* add quick links to doc

* Update setup_en.md

* remove standalone saving princess client

* doc fixes

* code improvements and redundant default removal

as suggested by @Exempt-Medic
this includes the removal of events from the item/location name to id, as well as checking for the player name being ASCII

* add option to change launch coammnd

the LaunchCommand option is filled to either the executable or wine with the necessary arguments based on Utils.is_windows

* simplify valid install check

* mod installer improvements

now deletes possible existing files before installing the mod

* add option groups and presets

* add required client version

* update docs about cheat items pop-ups

items sent directly by the server (such as with starting inventory) now have pop-ups just like any other item

* add Steam Input issue to faq

* Saving Princess: BRAINOS requires all weapons

* Saving Princess: Download dll and patch together

Previously, gm-apclientpp.dll was downloaded from its own repo
With this update, the dll is instead extracted from the same zip as the game's patch

* Saving Princess: Add URI launch support

* Saving Princess: goal also requires all weapons

given it's past brainos

* Saving Princess: update docs

automatic connection support was added, docs now reflect this

* Saving Princess: extend([item]) -> append(item)

* Saving Princess: automatic connection validation

also parses the slot, password and host:port into parameters for the game

* Saving Princess: change subprocess .run to .Popen

This keeps the game from freezing the launcher while it is running

---------

Co-authored-by: Scipio Wright <scipiowright@gmail.com>
Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com>
Co-authored-by: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com>
2024-12-07 11:29:27 +01:00

99 lines
3.2 KiB
Python

from typing import Optional, Dict, Tuple
from BaseClasses import Item, ItemClassification as ItemClass
from .Constants import *
class SavingPrincessItem(Item):
game: str = GAME_NAME
class ItemData:
item_class: ItemClass
code: Optional[int]
count: int # Number of copies for the item that will be made of class item_class
count_extra: int # Number of extra copies for the item that will be made as useful
def __init__(self, item_class: ItemClass, code: Optional[int] = None, count: int = 1, count_extra: int = 0):
self.item_class = item_class
self.code = code
if code is not None:
self.code += BASE_ID
# if this is filler, a trap or an event, ignore the count
if self.item_class == ItemClass.filler or self.item_class == ItemClass.trap or code is None:
self.count = 0
self.count_extra = 0
else:
self.count = count
self.count_extra = count_extra
def create_item(self, player: int):
return SavingPrincessItem(item_data_names[self], self.item_class, self.code, player)
item_dict_weapons: Dict[str, ItemData] = {
ITEM_WEAPON_CHARGE: ItemData(ItemClass.progression, 0),
ITEM_WEAPON_FIRE: ItemData(ItemClass.progression, 1),
ITEM_WEAPON_ICE: ItemData(ItemClass.progression, 2),
ITEM_WEAPON_VOLT: ItemData(ItemClass.progression, 3),
}
item_dict_upgrades: Dict[str, ItemData] = {
ITEM_MAX_HEALTH: ItemData(ItemClass.progression, 4, 2, 4),
ITEM_MAX_AMMO: ItemData(ItemClass.progression, 5, 2, 4),
ITEM_RELOAD_SPEED: ItemData(ItemClass.progression, 6, 4, 2),
ITEM_SPECIAL_AMMO: ItemData(ItemClass.useful, 7),
}
item_dict_base: Dict[str, ItemData] = {
**item_dict_weapons,
**item_dict_upgrades,
ITEM_JACKET: ItemData(ItemClass.useful, 8),
}
item_dict_keys: Dict[str, ItemData] = {
EP_ITEM_GUARD_GONE: ItemData(ItemClass.progression, 9),
EP_ITEM_CLIFF_GONE: ItemData(ItemClass.progression, 10),
EP_ITEM_ACE_GONE: ItemData(ItemClass.progression, 11),
EP_ITEM_SNAKE_GONE: ItemData(ItemClass.progression, 12),
}
item_dict_expanded: Dict[str, ItemData] = {
**item_dict_base,
**item_dict_keys,
EP_ITEM_POWER_ON: ItemData(ItemClass.progression, 13),
}
item_dict_filler: Dict[str, ItemData] = {
FILLER_ITEM_HEAL: ItemData(ItemClass.filler, 14),
FILLER_ITEM_QUICK_FIRE: ItemData(ItemClass.filler, 15),
FILLER_ITEM_ACTIVE_CAMO: ItemData(ItemClass.filler, 16),
}
item_dict_traps: Dict[str, ItemData] = {
TRAP_ITEM_ICE: ItemData(ItemClass.trap, 17),
TRAP_ITEM_SHAKES: ItemData(ItemClass.trap, 18),
TRAP_ITEM_NINJA: ItemData(ItemClass.trap, 19),
}
item_dict_events: Dict[str, ItemData] = {
EVENT_ITEM_GUARD_GONE: ItemData(ItemClass.progression),
EVENT_ITEM_CLIFF_GONE: ItemData(ItemClass.progression),
EVENT_ITEM_ACE_GONE: ItemData(ItemClass.progression),
EVENT_ITEM_SNAKE_GONE: ItemData(ItemClass.progression),
EVENT_ITEM_POWER_ON: ItemData(ItemClass.progression),
EVENT_ITEM_VICTORY: ItemData(ItemClass.progression),
}
item_dict: Dict[str, ItemData] = {
**item_dict_expanded,
**item_dict_filler,
**item_dict_traps,
**item_dict_events,
}
item_data_names: Dict[ItemData, str] = {value: key for key, value in item_dict.items()}