Files
dockipelago/worlds/papermario/data/node.py
Jonathan Tinney 7971961166
Some checks failed
Analyze modified files / flake8 (push) Failing after 2m28s
Build / build-win (push) Has been cancelled
Build / build-ubuntu2204 (push) Has been cancelled
ctest / Test C++ ubuntu-latest (push) Has been cancelled
ctest / Test C++ windows-latest (push) Has been cancelled
Analyze modified files / mypy (push) Has been cancelled
Build and Publish Docker Images / Push Docker image to Docker Hub (push) Successful in 5m4s
Native Code Static Analysis / scan-build (push) Failing after 5m2s
type check / pyright (push) Successful in 1m7s
unittests / Test Python 3.11.2 ubuntu-latest (push) Failing after 16m23s
unittests / Test Python 3.12 ubuntu-latest (push) Failing after 28m19s
unittests / Test Python 3.13 ubuntu-latest (push) Failing after 14m49s
unittests / Test hosting with 3.13 on ubuntu-latest (push) Successful in 5m0s
unittests / Test Python 3.13 macos-latest (push) Has been cancelled
unittests / Test Python 3.11 windows-latest (push) Has been cancelled
unittests / Test Python 3.13 windows-latest (push) Has been cancelled
add schedule I, sonic 1/frontiers/heroes, spirit island
2026-04-02 23:46:36 -07:00

64 lines
2.1 KiB
Python

from ..items import PMItem
# A table that represents all areas of interactivity
class Node:
# MapArea this node is found in
map_id: int = -1
area_id: int = -1
# Entrance data of the Map if this note represents an entrance
entrance_id: int = None
entrance_type: str = None # like walk, pipe, door etc.
entrance_name: str = None # verbose name of entrance
# Human-readable name of item location (eg ItemA) or item price (eg ShopPriceA)
key_name_item: str = None
key_name_price: str = None
item_source_type: int = None
# reference to item placed here in the unmodified game
vanilla_item: int = None
# reference to item placed here during randomization
current_item: PMItem = None
# vanilla item price if shop
vanilla_price: int = None
# index bytes of the DBKey
item_index: int = None
price_index: int = None
identifier: str = None
# used for in game strings like shop descriptions
shop_string_location: int = -1
shop_string: list[int] = None
def __str__(self):
"""Return string representation of current node"""
entrance = ("[" + format(self.entrance_id) + "] ") if self.entrance_id else ''
itemkey = ("[" + format(self.key_name_item) + "] ") if self.key_name_item else ''
item = self.current_item.name if self.current_item else ''
price = (" (" + format(self.current_item.base_price) + ")") if self.current_item and self.key_name_price else ''
return f"[{self.identifier}]{entrance}{itemkey}{item}{price}"
def get_item_key(self):
"""Return convention key for item location"""
if self.current_item is None:
return None
return (0xA1 << 24) | (self.area_id << 16) | (self.map_id << 8) | self.item_index
def get_price_key(self):
"""Return convention key for item location"""
if self.current_item is None:
return None
return (0xA1 << 24) | (self.area_id << 16) | (self.map_id << 8) | self.price_index
def is_shop(self):
"""Return whether this location is a shop or not."""
return self.key_name_price is not None