diff options
author | nea <romangraef@gmail.com> | 2022-03-12 21:02:08 +0100 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-03-12 21:02:08 +0100 |
commit | 7a9d8290fdd73169e9a91034acaab367f35a0c4e (patch) | |
tree | fa3ceb44fa121fe602a4b404392c5e9e806e3ad5 /sbdata/tasks.py | |
parent | c30ac933566c66ec359931a0f9a68415fb36789e (diff) | |
download | sbdata-7a9d8290fdd73169e9a91034acaab367f35a0c4e.tar.gz sbdata-7a9d8290fdd73169e9a91034acaab367f35a0c4e.tar.bz2 sbdata-7a9d8290fdd73169e9a91034acaab367f35a0c4e.zip |
explore
Diffstat (limited to 'sbdata/tasks.py')
-rw-r--r-- | sbdata/tasks.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/sbdata/tasks.py b/sbdata/tasks.py index 8ac1f8c..ede5bac 100644 --- a/sbdata/tasks.py +++ b/sbdata/tasks.py @@ -15,6 +15,7 @@ class DungeonDrop: item: Item floor: int chest: str + cost: int drop_chances: dict[str, str] def get_drop_chance(self, has_s_plus: bool, talisman_level: int, boss_luck: int): @@ -22,6 +23,16 @@ class DungeonDrop: return self.drop_chances.get(drop_identifier) +default_chest_costs: dict[str, dict[int, int]] = dict( + Wood={7: 0}, + Gold={1: 25_000, 2: 50_000, 7: 100_000}, + Diamond={1: 50_000, 2: 100_000, 7: 250_000}, + Emerald={1: 100_000, 2: 250_000, 7: 500_000}, + Obsidian={1: 250_000, 2: 500_000, 7: 1_000_000}, + Bedrock={4: 4, 7: 2_000_000} +) + + @register_task("Fetch Dungeon Loot") def fetch_dungeon_loot(args: Arguments): items = [] @@ -31,6 +42,7 @@ def fetch_dungeon_loot(args: Arguments): item = None ifloor = None chest = None + cost = None drop_chances = {} for param in template.params: @@ -42,14 +54,19 @@ def fetch_dungeon_loot(args: Arguments): elif attr_name == 'customlink': if item is None: item = find_item_by_name(attr_value.split('#')[-1]) + elif attr_name == 'cost': + cost = int(attr_value.replace(',', '')) elif attr_name == 'chest': chest = attr_value elif attr_name == 'floor': ifloor = int(attr_value) elif attr_name.startswith("S"): drop_chances[attr_name] = attr_value - if item is None or ifloor is None or chest is None: + if item is None or ifloor is None or chest is None or cost is None: print('WARNING: Missing data for item: ' + str(template)) else: - items.append(DungeonDrop(item, ifloor, chest, drop_chances)) - return items + if cost == 0: + defaults = default_chest_costs[chest] + cost = defaults[min(f for f in defaults.keys() if f >= ifloor)] + items.append(DungeonDrop(item, ifloor, chest, cost, drop_chances)) + return items |