Skip to content

Commit

Permalink
Example Item Creation
Browse files Browse the repository at this point in the history
  • Loading branch information
PoryGone committed Nov 7, 2023
1 parent 0465a7b commit d09b4ba
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions worlds/dk64/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from worlds.AutoWorld import World

from randomizer.Lists import Item as DK64RItem
from randomizer.Enums.Items import Items as DK64RItems

BASE_ID = 0xD64000

Expand Down Expand Up @@ -35,15 +36,25 @@ class DK64Item(Item):
# Complete item table
full_item_table = { item.name: ItemData(int(BASE_ID + index), item.playthrough) for index, item in DK64RItem.ItemList.items() }

lookup_id_to_name: typing.Dict[int, str] = {data.code: item_name for item_name, data in full_item_table.items()}

full_item_table.update(event_table) # Temp for generating goal item


def setup_items(world: World) -> typing.Dict[str, DK64Item]:
item_table = {}
def setup_items(world: World) -> typing.List[DK64Item]:
item_table = []

# DK64_TODO: Pull Active Items from DK64R

# Example
# Example item creation
donkey_item = DK64RItem.ItemList[DK64RItems.Donkey]
item_table.append(DK64Item(donkey_item.name, ItemClassification.progression, full_item_table[donkey_item.name], world.player))

gb_item = DK64RItem.ItemList[DK64RItems.GoldenBanana]
for i in range(201):
item_table.append(DK64Item(gb_item.name, ItemClassification.progression, full_item_table[gb_item.name], world.player))

# Example of accessing Option result
if world.options.goal == "krool":
pass

Expand All @@ -52,5 +63,3 @@ def setup_items(world: World) -> typing.Dict[str, DK64Item]:
# print(k + ": " + hex(v.code) + " | " + str(v.progression))

return item_table

lookup_id_to_name: typing.Dict[int, str] = {data.code: item_name for item_name, data in full_item_table.items()}

0 comments on commit d09b4ba

Please sign in to comment.